Skip to content

Commit 8398635

Browse files
committed
cosmetic: cleanup code warnings
1 parent 60516e1 commit 8398635

File tree

13 files changed

+14
-23
lines changed

13 files changed

+14
-23
lines changed

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/crypto/impl/AesCryptoSupport.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import javax.crypto.spec.IvParameterSpec;
3232
import javax.crypto.spec.SecretKeySpec;
3333

34-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3534
import io.wcm.devops.conga.plugins.aem.crypto.CryptoSupport;
3635

3736
/**
@@ -96,7 +95,6 @@ private Cipher getCipher(int cipherMode, byte[] iv, Key key) throws GeneralSecur
9695
return cipher;
9796
}
9897

99-
@SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE")
10098
private byte[] generateIV() {
10199
byte[] iv = new byte[IV_SIZE];
102100
RANDOM.nextBytes(iv);

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AbstractFilterHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
abstract class AbstractFilterHelper implements HelperPlugin<Object> {
3434

3535
@Override
36-
@SuppressWarnings("PMD.PreserveStackTrace")
36+
@SuppressWarnings({ "PMD.PreserveStackTrace", "PMD.AvoidThrowingNewInstanceOfSameException" })
3737
public final Object apply(Object context, Options options, HelperContext pluginContext) throws IOException {
3838
if (!(context instanceof Map)) {
3939
throw new IllegalArgumentException("Excpected map object for filter rule.");

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemCryptoEncryptHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public String getName() {
6363
}
6464

6565
@Override
66-
@SuppressWarnings({ "java:S3776", "java:S5411" }) // ignore complexity
66+
@SuppressWarnings({ "java:S3776", "java:S5411", "PMD.ExceptionAsFlowControl" }) // ignore complexity
6767
public Object apply(Object context, Options options, HelperContext pluginContext) throws IOException {
6868
if (context == null) {
6969
return null;

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackageOsgiConfigPostProcessor.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.apache.sling.provisioning.model.Model;
4141
import org.slf4j.Logger;
4242

43-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4443
import io.wcm.devops.conga.generator.GeneratorException;
4544
import io.wcm.devops.conga.generator.plugins.postprocessor.AbstractPostProcessor;
4645
import io.wcm.devops.conga.generator.spi.context.FileContext;
@@ -78,7 +77,6 @@ public boolean accepts(FileContext file, PostProcessorContext context) {
7877
}
7978

8079
@Override
81-
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
8280
public List<FileContext> apply(FileContext fileContext, PostProcessorContext context) {
8381
File file = fileContext.getFile();
8482
Logger logger = context.getLogger();
@@ -152,7 +150,6 @@ private boolean generateOsgiConfigurations(Model model, ContentPackage contentPa
152150
String rootPath, FileHeaderContext fileHeader, PostProcessorContext context) throws IOException {
153151
List<Void> result = ProvisioningUtil.visitOsgiConfigurations(model, new ConfigConsumer<Void>() {
154152
@Override
155-
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
156153
@SuppressWarnings("java:S3457") // log placeholders
157154
public Void accept(String path, Dictionary<String, Object> properties) throws IOException {
158155
String contentPath = rootPath + (StringUtils.contains(path, "/") ? "." : "/") + path;

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackagePostProcessor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.apache.commons.io.FilenameUtils;
3333
import org.slf4j.Logger;
3434

35-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3635
import io.wcm.devops.conga.generator.GeneratorException;
3736
import io.wcm.devops.conga.generator.plugins.postprocessor.AbstractPostProcessor;
3837
import io.wcm.devops.conga.generator.spi.context.FileContext;
@@ -72,7 +71,6 @@ public boolean accepts(FileContext file, PostProcessorContext context) {
7271
}
7372

7473
@Override
75-
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
7674
public List<FileContext> apply(FileContext fileContext, PostProcessorContext context) {
7775
File file = fileContext.getFile();
7876
Logger logger = context.getLogger();

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/util/ContentPackageBinaryFile.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
import org.apache.commons.lang3.StringUtils;
3030

31-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3231
import io.wcm.devops.conga.generator.UrlFileManager;
3332

3433
/**
@@ -93,7 +92,6 @@ public String getPath() {
9392
* @param targetDir Target directory for configuration
9493
* @throws IOException I/O exception
9594
*/
96-
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
9795
public void deleteIfRequired(UrlFileManager urlFileManager, File targetDir) throws IOException {
9896
if (delete) {
9997
if (StringUtils.isNotBlank(url)) {

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/crypto/CryptoStringTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,28 @@ void testConversion() {
5353

5454

5555
@Test
56-
void testToByteArrayNull() throws Exception {
56+
void testToByteArrayNull() {
5757
assertThrows(IllegalArgumentException.class, () -> {
5858
CryptoString.toByteArray(null);
5959
});
6060
}
6161

6262
@Test
63-
void testToByteArrayIllegalString() throws Exception {
63+
void testToByteArrayIllegalString() {
6464
assertThrows(IllegalArgumentException.class, () -> {
6565
CryptoString.toByteArray("abc");
6666
});
6767
}
6868

6969
@Test
70-
void testToStringNull() throws Exception {
70+
void testToStringNull() {
7171
assertThrows(IllegalArgumentException.class, () -> {
7272
CryptoString.toString(null);
7373
});
7474
}
7575

7676
@Test
77-
void testToStringEmptyArray() throws Exception {
77+
void testToStringEmptyArray() {
7878
assertThrows(IllegalArgumentException.class, () -> {
7979
CryptoString.toString(new byte[0]);
8080
});

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemCryptoEncryptHelperTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void testNull() throws Exception {
7272
}
7373

7474
@Test
75-
void testWithoutKey() throws Exception {
75+
void testWithoutKey() {
7676
assertThrows(IOException.class, () -> {
7777
executeHelper(helper, INPUT, new MockOptions(), pluginContext);
7878
});

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/WebConsolePasswordHashHelperTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ void testCustomAlgorithm() throws Exception {
7373
}
7474

7575
@Test
76-
void testInvalidHashAlgorithm() throws Exception {
76+
void testInvalidHashAlgorithm() {
7777
assertThrows(IOException.class, () -> {
7878
Object passwordHash = executeHelper(helper, PASSWORD_PLAIN, new MockOptions().withHash(WebConsolePasswordHashHelper.HASH_OPTION_ALGORITHM, "invalid"));
7979
assertEquals(PASSWORD_HASH_SHA256, passwordHash);
8080
});
8181
}
8282

8383
@Test
84-
void testInvalidEncoding() throws Exception {
84+
void testInvalidEncoding() {
8585
assertThrows(IOException.class, () -> {
8686
Object passwordHash = executeHelper(helper, PASSWORD_PLAIN, new MockOptions().withHash(WebConsolePasswordHashHelper.HASH_OPTION_ENCODING, "invalid"));
8787
assertEquals(PASSWORD_HASH_SHA256, passwordHash);

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackagePropertiesPostProcessorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void setUp() {
4848

4949
@SuppressWarnings("unchecked")
5050
@Test
51-
void testContentPackage() throws Exception {
51+
void testContentPackage() {
5252

5353
FileContext fileContext = new FileContext()
5454
.file(new File("src/test/resources/package/example.zip"));
@@ -80,7 +80,7 @@ void testContentPackageOverridePackageType() throws Exception {
8080
}
8181

8282
@Test
83-
void testNonContentPackage() throws Exception {
83+
void testNonContentPackage() {
8484

8585
FileContext fileContext = new FileContext()
8686
.file(new File("src/test/resources/package/no-content-package.zip"));

0 commit comments

Comments
 (0)