19 KiB
19 KiB
代码审查报告
文件: data\demo-pmd\src\com\demo\mtps\MultiPerfSecurity.java
语言: java
耗时: 301.2s
分析工具: pmd
⚠️ 部分 AI 功能不可用,报告已降级
错误
- AI 审查请求失败: AbortError: This operation was aborted
总计: 190 | 错误: 7 | 警告: 175 | 建议: 8
静态分析 · 190 个问题
- 🔴
pmd:DoubleCheckedLockingL58 Double checked locking is not thread safe in Java. - 🔴
pmd:FieldNamingConventionsL111 The constant name 'sdf' doesn't match '[A-Z][A-Z_0-9]*' - 🔴
pmd:AvoidFileStreamL157 Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter - 🔴
pmd:StringInstantiationL232 Avoid instantiating String objects; this is usually unnecessary. - 🔴
pmd:AvoidReassigningParametersL268 Avoid reassigning parameters such as 's' - 🔴
pmd:SystemPrintlnL300 Usage of System.out/err - 🔴
pmd:SystemPrintlnL382 Usage of System.out/err - 🟡
pmd:AtLeastOneConstructorL31 Each class should declare at least one constructor - 🟡
pmd:UnusedPrivateFieldL32 Avoid unused private fields such as 'count'. - 🟡
pmd:PublicMemberInNonPublicTypeL33 Public member 'incr' declared in a non-public type - 🟡
pmd:AvoidSynchronizedAtMethodLevelL33 Use block level locking rather than method level synchronization - 🟡
pmd:AtLeastOneConstructorL39 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL40 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL41 Local variable 'g' could be declared final - 🟡
pmd:AvoidThreadGroupL41 Avoid using java.lang.ThreadGroup; it is not thread safe - 🟡
pmd:UnusedLocalVariableL42 Avoid unused local variables such as 't'. - 🟡
pmd:AtLeastOneConstructorL47 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL48 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL49 Local variable 't' could be declared final - 🟡
pmd:UseUtilityClassL55 All members are static. Consider adding a private no-args constructor to prevent instantiation. - 🟡
pmd:CommentDefaultAccessModifierL58 Missing commented default access modifier on method 'get()' - 🟡
pmd:UseUtilityClassL71 All members are static. Consider adding a private no-args constructor to prevent instantiation. - 🟡
pmd:CommentDefaultAccessModifierL74 Missing commented default access modifier on method 'get()' - 🟡
pmd:NonThreadSafeSingletonL75 Singleton is not thread safe - 🟡
pmd:AtLeastOneConstructorL83 Each class should declare at least one constructor - 🟡
pmd:OverridingThreadRunL85 Don't override Thread.run() method, use Runnable instead - 🟡
pmd:UnusedPrivateFieldL91 Avoid unused private fields such as 'SDF'. - 🟡
pmd:SimpleDateFormatNeedsLocaleL91 When instantiating a SimpleDateFormat object, specify a Locale - 🟡
pmd:AtLeastOneConstructorL95 Each class should declare at least one constructor - 🟡
pmd:UseConcurrentHashMapL96 If you run in Java5 or newer and have concurrent access, you should use the ConcurrentHashMap implementation - 🟡
pmd:CommentDefaultAccessModifierL96 Missing commented default access modifier on field 'map' - 🟡
pmd:AtLeastOneConstructorL100 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL101 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL102 Local variable 'lock' could be declared final - 🟡
pmd:UseNotifyAllInsteadOfNotifyL104 Call Thread.notifyAll() rather than Thread.notify() - 🟡
pmd:AtLeastOneConstructorL110 Each class should declare at least one constructor - 🟡
pmd:SimpleDateFormatNeedsLocaleL111 When instantiating a SimpleDateFormat object, specify a Locale - 🟡
pmd:CommentDefaultAccessModifierL113 Missing commented default access modifier on method 'bar()' - 🟡
pmd:UnsynchronizedStaticFormatterL114 Static Formatter objects should be accessed in a synchronized manner - 🟡
pmd:ReplaceJavaUtilDateL114 Usage of java.util.Date should be replaced with classes from java.time - 🟡
pmd:AtLeastOneConstructorL123 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL124 Missing commented default access modifier on method 'bad(int)' - 🟡
pmd:MethodArgumentCouldBeFinalL124 Parameter 'x' is not assigned and could be declared final - 🟡
pmd:AddEmptyStringL125 Do not add empty strings - 🟡
pmd:AtLeastOneConstructorL130 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL131 Missing commented default access modifier on method 'bad(StringBuffer)' - 🟡
pmd:MethodArgumentCouldBeFinalL131 Parameter 'sb' is not assigned and could be declared final - 🟡
pmd:AppendCharacterWithCharL132 Avoid appending characters as strings in StringBuffer.append. - 🟡
pmd:AtLeastOneConstructorL137 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL138 Missing commented default access modifier on method 'bad(int[], int[])' - 🟡
pmd:MethodArgumentCouldBeFinalL138 Parameter 'src' is not assigned and could be declared final - 🟡
pmd:MethodArgumentCouldBeFinalL138 Parameter 'dst' is not assigned and could be declared final - 🟡
pmd:AvoidArrayLoopsL139 Arrays.copyOf or System.arraycopy are more efficient - 🟡
pmd:AtLeastOneConstructorL146 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL147 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL148 Local variable 'c' could be declared final - 🟡
pmd:ReplaceJavaUtilCalendarL148 Usage of java.util.Calendar should be replaced with classes from java.time - 🟡
pmd:UselessPureMethodCallL150 Do not call pure method getTime if the result is not used. - 🟡
pmd:AtLeastOneConstructorL155 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL156 Missing commented default access modifier on method 'bad()' - 🟡
pmd:CloseResourceL157 Ensure that resources like this FileInputStream object are closed after use - 🟡
pmd:LocalVariableCouldBeFinalL157 Local variable 'fis' could be declared final - 🟡
pmd:AtLeastOneConstructorL164 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL165 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UnusedLocalVariableL167 Avoid unused local variables such as 'o'. - 🟡
pmd:AvoidInstantiatingObjectsInLoopsL167 Avoid instantiating new objects inside loops - 🟡
pmd:AtLeastOneConstructorL173 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL174 Missing commented default access modifier on field 'b' - 🟡
pmd:BigIntegerInstantiationL174 Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN) - 🟡
pmd:AtLeastOneConstructorL178 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL179 Missing commented default access modifier on method 'bad(StringBuilder)' - 🟡
pmd:MethodArgumentCouldBeFinalL179 Parameter 'sb' is not assigned and could be declared final - 🟡
pmd:ConsecutiveAppendsShouldReuseL180 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable. - 🟡
pmd:ConsecutiveLiteralAppendsL180 StringBuffer (or StringBuilder).append is called 3 consecutive times with literals. Use a single append with a single combined String. - 🟡
pmd:ConsecutiveAppendsShouldReuseL181 StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable. - 🟡
pmd:AppendCharacterWithCharL181 Avoid appending characters as strings in StringBuffer.append. - 🟡
pmd:AtLeastOneConstructorL187 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL188 Missing commented default access modifier on method 'bad(StringBuilder)' - 🟡
pmd:MethodArgumentCouldBeFinalL188 Parameter 'sb' is not assigned and could be declared final - 🟡
pmd:AtLeastOneConstructorL194 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL195 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL195 Parameter 's' is not assigned and could be declared final - 🟡
pmd:LiteralsFirstInComparisonsL196 Position literals first in String comparisons - 🟡
pmd:AtLeastOneConstructorL201 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL202 Missing commented default access modifier on method 'bad(int, int)' - 🟡
pmd:MethodArgumentCouldBeFinalL202 Parameter 'a' is not assigned and could be declared final - 🟡
pmd:MethodArgumentCouldBeFinalL202 Parameter 'b' is not assigned and could be declared final - 🟡
pmd:VariableCanBeInlinedL203 Consider simply using the value vs. storing it in local variable 's'. - 🟡
pmd:LocalVariableCouldBeFinalL203 Local variable 's' could be declared final - 🟡
pmd:AtLeastOneConstructorL209 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL210 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL210 Parameter 's' is not assigned and could be declared final - 🟡
pmd:LocalVariableCouldBeFinalL211 Local variable 'sb' could be declared final - 🟡
pmd:AtLeastOneConstructorL217 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL218 Missing commented default access modifier on method 'bad(List)' - 🟡
pmd:MethodArgumentCouldBeFinalL218 Parameter 'l' is not assigned and could be declared final - 🟡
pmd:UnusedLocalVariableL219 Avoid unused local variables such as 'arr'. - 🟡
pmd:OptimizableToArrayCallL219 This call to Collection.toArray() may be optimizable - 🟡
pmd:AtLeastOneConstructorL224 Each class should declare at least one constructor - 🟡
pmd:RedundantFieldInitializerL225 Avoid using redundant field initializer for 'x' - 🟡
pmd:CommentDefaultAccessModifierL225 Missing commented default access modifier on field 'x' - 🟡
pmd:RedundantFieldInitializerL226 Avoid using redundant field initializer for 'b' - 🟡
pmd:CommentDefaultAccessModifierL226 Missing commented default access modifier on field 'b' - 🟡
pmd:AtLeastOneConstructorL230 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL231 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL231 Parameter 's' is not assigned and could be declared final - 🟡
pmd:UnusedLocalVariableL232 Avoid unused local variables such as 't'. - 🟡
pmd:AtLeastOneConstructorL237 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL238 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL238 Parameter 's' is not assigned and could be declared final - 🟡
pmd:UnusedLocalVariableL239 Avoid unused local variables such as 't'. - 🟡
pmd:StringToStringL239 Avoid calling toString() on String objects; this is unnecessary. - 🟡
pmd:AtLeastOneConstructorL244 Each class should declare at least one constructor - 🟡
pmd:LooseCouplingL245 Avoid using implementation types like 'Vector'; use the interface instead - 🟡
pmd:ReplaceVectorWithListL245 Consider replacing this Vector with the newer java.util.List - 🟡
pmd:CommentDefaultAccessModifierL245 Missing commented default access modifier on field 'v' - 🟡
pmd:ReplaceVectorWithListL245 Consider replacing this Vector with the newer java.util.List - 🟡
pmd:UseArrayListInsteadOfVectorL245 Use ArrayList instead of Vector - 🟡
pmd:AtLeastOneConstructorL249 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL250 Missing commented default access modifier on method 'bad(String[])' - 🟡
pmd:MethodArgumentCouldBeFinalL250 Parameter 'arr' is not assigned and could be declared final - 🟡
pmd:LocalVariableCouldBeFinalL251 Local variable 'l' could be declared final - 🟡
pmd:LocalVariableCouldBeFinalL252 Local variable 's' could be declared final - 🟡
pmd:UseArraysAsListL253 Use asList instead of tight loops - 🟡
pmd:AtLeastOneConstructorL259 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL260 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL260 Parameter 's' is not assigned and could be declared final - 🟡
pmd:UseIndexOfCharL261 String.indexOf(char) is faster than String.indexOf(String). - 🟡
pmd:AtLeastOneConstructorL266 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL267 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:UnusedAssignmentL268 The value assigned to variable 's' is never used - 🟡
pmd:AtLeastOneConstructorL273 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL274 Missing commented default access modifier on method 'bad(StringBuffer)' - 🟡
pmd:MethodArgumentCouldBeFinalL274 Parameter 'sb' is not assigned and could be declared final - 🟡
pmd:UseStringBufferLengthL275 This is an inefficient use of CharSequence.toString; call CharSequence.length instead. - 🟡
pmd:AtLeastOneConstructorL280 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL281 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL281 Parameter 's' is not assigned and could be declared final - 🟡
pmd:AtLeastOneConstructorL287 Each class should declare at least one constructor - 🟡
pmd:UnusedPrivateMethodL288 Avoid unused private methods such as 'bad1()'. - 🟡
pmd:AvoidCalendarDateCreationL289 A Calendar is used to get the current time, this is expensive. - 🟡
pmd:UnusedPrivateMethodL291 Avoid unused private methods such as 'bad2()'. - 🟡
pmd:AvoidCalendarDateCreationL292 A Calendar is used to get the current time, this is expensive. - 🟡
pmd:AtLeastOneConstructorL297 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL298 Missing commented default access modifier on method 'bar(String)' - 🟡
pmd:MethodArgumentCouldBeFinalL298 Parameter 'string' is not assigned and could be declared final - 🟡
pmd:InefficientEmptyStringCheckL299 String.trim().length() == 0 / String.trim().isEmpty() is an inefficient way to validate a blank String. - 🟡
pmd:AtLeastOneConstructorL306 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL307 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL308 Local variable 'sb' could be declared final - 🟡
pmd:InefficientStringBufferingL308 Avoid concatenating nonliterals in a StringBuffer/StringBuilder constructor or append(). - 🟡
pmd:AtLeastOneConstructorL314 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL315 Missing commented default access modifier on method 'bad(String)' - 🟡
pmd:LocalVariableCouldBeFinalL316 Local variable 'sb' could be declared final - 🟡
pmd:InsufficientStringBufferDeclarationL316 StringBuilder has been initialized with size 16, but has at least 64 characters appended. - 🟡
pmd:AtLeastOneConstructorL323 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL324 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UseStringBufferForStringAppendsL327 Prefer StringBuilder (non-synchronized) or StringBuffer (synchronized) over += for concatenating strings - 🟡
pmd:CommentDefaultAccessModifierL331 Missing commented default access modifier on method 'getString(int)' - 🟡
pmd:MethodArgumentCouldBeFinalL331 Parameter 'i' is not assigned and could be declared final - 🟡
pmd:AtLeastOneConstructorL337 Each class should declare at least one constructor - 🟡
pmd:PublicMemberInNonPublicTypeL338 Public member 'convert' declared in a non-public type - 🟡
pmd:MethodArgumentCouldBeFinalL338 Parameter 'i' is not assigned and could be declared final - 🟡
pmd:LocalVariableCouldBeFinalL339 Local variable 's' could be declared final - 🟡
pmd:UselessStringValueOfL340 No need to call String.valueOf to append to a string. - 🟡
pmd:AtLeastOneConstructorL350 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL351 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL352 Local variable 'key' could be declared final - 🟡
pmd:HardCodedCryptoKeyL352 Do not use hard coded encryption keys - 🟡
pmd:RelianceOnDefaultCharsetL352 Specify a character set instead of relying on the default charset - 🟡
pmd:AtLeastOneConstructorL358 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL359 Missing commented default access modifier on method 'bad()' - 🟡
pmd:LocalVariableCouldBeFinalL360 Local variable 'iv' could be declared final - 🟡
pmd:AtLeastOneConstructorL366 Each class should declare at least one constructor - 🟡
pmd:CommentDefaultAccessModifierL367 Missing commented default access modifier on method 'bad()' - 🟡
pmd:UseShortArrayInitializerL368 Array initialization can be written shorter - 🟡
pmd:LocalVariableCouldBeFinalL368 Local variable 'iv' could be declared final - 🟡
pmd:InsecureCryptoIvL368 Do not use hard coded initialization vector in crypto operations - 🟡
pmd:CommentDefaultAccessModifierL371 Missing commented default access modifier on method 'alsoBad()' - 🟡
pmd:LocalVariableCouldBeFinalL372 Local variable 'iv' could be declared final - 🟡
pmd:InsecureCryptoIvL372 Do not use hard coded initialization vector in crypto operations - 🟡
pmd:RelianceOnDefaultCharsetL372 Specify a character set instead of relying on the default charset - 🔵
pmd:UnnecessaryImportL12 Unused import 'java.util.Hashtable' - 🔵
pmd:UnnecessaryImportL13 Unused import 'java.io.File' - 🔵
pmd:UnnecessaryImportL15 Unused import 'java.io.FileOutputStream' - 🔵
pmd:UnnecessaryImportL19 Unused import 'java.util.Arrays' - 🔵
pmd:DontCallThreadRunL50 Dont call Thread.run() explicitly, use Thread.start() - 🔵
pmd:UnnecessaryFullyQualifiedNameL114 Unnecessary qualifier 'java.util': 'Date' is already in scope because it is imported in this file - 🔵
pmd:UseVarargsL138 Consider using varargs for methods or constructors which take an array the last parameter. - 🔵
pmd:UseVarargsL250 Consider using varargs for methods or constructors which take an array the last parameter.