PMD Results

The following document contains the results of PMD 7.17.0.

Violations By Priority

Priority 1

civitas.externalcrypto - civitas/crypto/messagedigest/tests/TestUtil.java

Rule Violation Line
AvoidThrowingRawExceptionTypes Avoid throwing raw exception type Error. 11

Priority 3

civitas.externalcrypto - civitas/crypto/CryptoBase.java

Rule Violation Line
ServiceClassField Services have only @Autowired fields 24
ServiceClassField Services have only @Autowired fields 25
ServiceClassField Services have only @Autowired fields 26
AvoidFieldNameMatchingMethodName Field getPublicKeyGenerator has the same name as a method 29
AvoidFieldNameMatchingMethodName Field getSharedKeyGenerator has the same name as a method 32
AvoidCatchingGenericException Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block 41
ServiceClassMethods Services have only public apply method 46
ServiceClassMethods Services have only public apply method 50
ServiceClassMethods Services have only public apply method 58
ServiceClassMethods Services have only public apply method 62
AvoidCatchingGenericException Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block 69
ServiceClassMethods Services have only public apply method 74
ServiceClassMethods Services have only public apply method 78
ServiceClassMethods Services have only public apply method 82

civitas.externalcrypto - civitas/crypto/GetPublicKeyGeneratorService.java

Rule Violation Line
UseConcurrentHashMap If you run in Java5 or newer and have concurrent access, you should use the ConcurrentHashMap implementation 11
ServiceClassField Services have only @Autowired fields 11
AvoidCatchingGenericException Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block 24

civitas.externalcrypto - civitas/crypto/GetSharedKeyGeneratorService.java

Rule Violation Line
UseConcurrentHashMap If you run in Java5 or newer and have concurrent access, you should use the ConcurrentHashMap implementation 14
ServiceClassField Services have only @Autowired fields 14

civitas.externalcrypto - civitas/crypto/messagedigest/CryptoHash.java

Rule Violation Line
AvoidMessageDigestField You shouldnt declare field of MessageDigest type, because unsynchronized access could cause problems 21
ServiceClassField Services have only @Autowired fields 21

civitas.externalcrypto - civitas/common/ballotdesign/tests/BallotDesignTestData.java

Rule Violation Line
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 14
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 36

civitas.externalcrypto - civitas/crypto/messagedigest/tests/MessageDigestTestData.java

Rule Violation Line
AvoidMessageDigestField You shouldnt declare field of MessageDigest type, because unsynchronized access could cause problems 6

civitas.externalcrypto - civitas/crypto/messagedigest/tests/TestUtil.java

Rule Violation Line
PreserveStackTrace Thrown exception does not preserve the stack trace of exception 'e' on all code paths 11

civitas.externalcrypto - civitas/crypto/tests/CryptoBaseTest.java

Rule Violation Line
TooManyMethods This class has too many methods, consider refactoring it. 34167
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 85
UnitTestShouldIncludeAssert This unit test should include assert() or fail() 116
UnitTestShouldIncludeAssert This unit test should include assert() or fail() 126
UnitTestContainsTooManyAsserts Unit tests should not contain more than 1 assert(s). 136
UnitTestShouldIncludeAssert This unit test should include assert() or fail() 144
LinguisticNaming Linguistics Antipattern - The variable 'isOne' indicates linguistically it is a boolean, but it is 'int' 155

civitas.externalcrypto - civitas/crypto/tests/CryptoHashFunctionalTest.java

Rule Violation Line
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 66

Files

civitas.externalcrypto - civitas/crypto/CryptoBase.java

Rule Violation Priority Line
ServiceClassField Services have only @Autowired fields 3 24
ServiceClassField Services have only @Autowired fields 3 25
ServiceClassField Services have only @Autowired fields 3 26
AvoidFieldNameMatchingMethodName Field getPublicKeyGenerator has the same name as a method 3 29
AvoidFieldNameMatchingMethodName Field getSharedKeyGenerator has the same name as a method 3 32
AvoidCatchingGenericException Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block 3 41
ServiceClassMethods Services have only public apply method 3 46
ServiceClassMethods Services have only public apply method 3 50
ServiceClassMethods Services have only public apply method 3 58
ServiceClassMethods Services have only public apply method 3 62
AvoidCatchingGenericException Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block 3 69
ServiceClassMethods Services have only public apply method 3 74
ServiceClassMethods Services have only public apply method 3 78
ServiceClassMethods Services have only public apply method 3 82

civitas.externalcrypto - civitas/crypto/GetPublicKeyGeneratorService.java

Rule Violation Priority Line
UseConcurrentHashMap If you run in Java5 or newer and have concurrent access, you should use the ConcurrentHashMap implementation 3 11
ServiceClassField Services have only @Autowired fields 3 11
AvoidCatchingGenericException Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block 3 24

civitas.externalcrypto - civitas/crypto/GetSharedKeyGeneratorService.java

Rule Violation Priority Line
UseConcurrentHashMap If you run in Java5 or newer and have concurrent access, you should use the ConcurrentHashMap implementation 3 14
ServiceClassField Services have only @Autowired fields 3 14

civitas.externalcrypto - civitas/crypto/messagedigest/CryptoHash.java

Rule Violation Priority Line
AvoidMessageDigestField You shouldnt declare field of MessageDigest type, because unsynchronized access could cause problems 3 21
ServiceClassField Services have only @Autowired fields 3 21

civitas.externalcrypto - civitas/common/ballotdesign/tests/BallotDesignTestData.java

Rule Violation Priority Line
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 3 14
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 3 36

civitas.externalcrypto - civitas/crypto/messagedigest/tests/MessageDigestTestData.java

Rule Violation Priority Line
AvoidMessageDigestField You shouldnt declare field of MessageDigest type, because unsynchronized access could cause problems 3 6

civitas.externalcrypto - civitas/crypto/messagedigest/tests/TestUtil.java

Rule Violation Priority Line
PreserveStackTrace Thrown exception does not preserve the stack trace of exception 'e' on all code paths 3 11
AvoidThrowingRawExceptionTypes Avoid throwing raw exception type Error. 1 11

civitas.externalcrypto - civitas/crypto/tests/CryptoBaseTest.java

Rule Violation Priority Line
TooManyMethods This class has too many methods, consider refactoring it. 3 34167
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 3 85
UnitTestShouldIncludeAssert This unit test should include assert() or fail() 3 116
UnitTestShouldIncludeAssert This unit test should include assert() or fail() 3 126
UnitTestContainsTooManyAsserts Unit tests should not contain more than 1 assert(s). 3 136
UnitTestShouldIncludeAssert This unit test should include assert() or fail() 3 144
LinguisticNaming Linguistics Antipattern - The variable 'isOne' indicates linguistically it is a boolean, but it is 'int' 3 155

civitas.externalcrypto - civitas/crypto/tests/CryptoHashFunctionalTest.java

Rule Violation Priority Line
RelianceOnDefaultCharset Specify a character set instead of relying on the default charset 3 66

Processing Errors

Filename Problem
civitas.externalcrypto - civitas/crypto/tests/CryptoBaseTest.java ContextedRuntimeException: java.lang.NullPointerException: Cannot invoke "net.sourceforge.pmd.lang.java.ast.ASTVariableId.getInitializer()" because "varDecl" is null Exception Context: [1:Rule applied on node=!debug only! [ConstructorCall:85:18]new SecretKeySpec(SOMESTRING.getBytes(), SHARED_KEY_ALG)] ---------------------------------
org.apache.commons.lang3.exception.ContextedRuntimeException: java.lang.NullPointerException: Cannot invoke "net.sourceforge.pmd.lang.java.ast.ASTVariableId.getInitializer()" because "varDecl" is null
Exception Context:
	[1:Rule applied on node=!debug only! [ConstructorCall:85:18]new SecretKeySpec(SOMESTRING.getBytes(), SHARED_KEY_ALG)]
---------------------------------
	at net.sourceforge.pmd.util.AssertionUtil.contexted(AssertionUtil.java:257)
	at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.applyOnIndex(RuleApplicator.java:79)
	at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.apply(RuleApplicator.java:57)
	at net.sourceforge.pmd.lang.rule.internal.RuleSets.apply(RuleSets.java:183)
	at net.sourceforge.pmd.lang.impl.PmdRunnable.processSource(PmdRunnable.java:140)
	at net.sourceforge.pmd.lang.impl.PmdRunnable.run(PmdRunnable.java:80)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NullPointerException: Cannot invoke "net.sourceforge.pmd.lang.java.ast.ASTVariableId.getInitializer()" because "varDecl" is null
	at net.sourceforge.pmd.lang.java.rule.security.AbstractHardCodedConstructorArgsVisitor.validateProperKeyArgument(AbstractHardCodedConstructorArgsVisitor.java:68)
	at net.sourceforge.pmd.lang.java.rule.security.AbstractHardCodedConstructorArgsVisitor.visit(AbstractHardCodedConstructorArgsVisitor.java:35)
	at net.sourceforge.pmd.lang.java.rule.security.HardCodedCryptoKeyRule.visit(HardCodedCryptoKeyRule.java:14)
	at net.sourceforge.pmd.lang.java.ast.ASTConstructorCall.acceptVisitor(ASTConstructorCall.java:34)
	at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.acceptVisitor(AbstractJavaNode.java:38)
	at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.apply(AbstractJavaRule.java:30)
	at net.sourceforge.pmd.lang.rule.RuleReference.apply(RuleReference.java:413)
	at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.applyOnIndex(RuleApplicator.java:77)
	... 9 more