From 66bdbd51d0ceecedbc9c1f1f0a77b8118e2553c4 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Tue, 26 Dec 2023 00:00:38 -0500 Subject: [PATCH] [site] Fix missing parts of site after upgrade --- README.md | 2 +- src/site/resources/examples/spotbugs.xml | 2 + src/site/resources/examples/spotbugsXml.xml | 316 ++++++++++++++++++++ 3 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 src/site/resources/examples/spotbugs.xml create mode 100644 src/site/resources/examples/spotbugsXml.xml diff --git a/README.md b/README.md index bf0531a6..db635a45 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ mvn com.github.spotbugs:spotbugs-maven-plugin:4.8.2.0:gui ``` mvn -DtestSrc=remote -Prun-its clean install -D"invoker.parallelThreads=4" -Then replace current src/site/resources entirely with any working example 'site' folder from there (Currently uses basic-1). +Then replace current src/site/resources entirely with any working example 'site' folder from there (Currently uses basic-1). Also top files top level of the basic site folder 'spotbugs.xml' and 'spotbugsXml.xml'. ``` ## Contributing ## diff --git a/src/site/resources/examples/spotbugs.xml b/src/site/resources/examples/spotbugs.xml new file mode 100644 index 00000000..5d0264d4 --- /dev/null +++ b/src/site/resources/examples/spotbugs.xml @@ -0,0 +1,2 @@ + +C:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it-src-spotbugs\spotbugsTestCases\src\javaC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\target\generated-sources\annotationsC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\src\it-src\test\javaC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\target\generated-test-sources\test-annotations \ No newline at end of file diff --git a/src/site/resources/examples/spotbugsXml.xml b/src/site/resources/examples/spotbugsXml.xml new file mode 100644 index 00000000..1a543c5d --- /dev/null +++ b/src/site/resources/examples/spotbugsXml.xml @@ -0,0 +1,316 @@ + +C:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\target\classesC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\target\test-classesC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\target\test-classesC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\com\github\spotbugs\spotbugs\4.8.3\spotbugs-4.8.3.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\ow2\asm\asm\9.6\asm-9.6.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\ow2\asm\asm-analysis\9.6\asm-analysis-9.6.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\ow2\asm\asm-commons\9.6\asm-commons-9.6.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\ow2\asm\asm-tree\9.6\asm-tree-9.6.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\ow2\asm\asm-util\9.6\asm-util-9.6.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\bcel\bcel\6.8.0\bcel-6.8.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\com\github\stephenc\jcip\jcip-annotations\1.0-1\jcip-annotations-1.0-1.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\dom4j\dom4j\2.1.4\dom4j-2.1.4.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\commons\commons-lang3\3.13.0\commons-lang3-3.13.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\commons\commons-text\1.10.0\commons-text-1.10.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\slf4j\slf4j-api\2.0.9\slf4j-api-2.0.9.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\com\github\spotbugs\spotbugs-annotations\4.8.3\spotbugs-annotations-4.8.3.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\com\google\code\gson\gson\2.10.1\gson-2.10.1.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\jaxen\jaxen\2.0.0\jaxen-2.0.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\net\sf\saxon\Saxon-HE\12.4\Saxon-HE-12.4.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\xmlresolver\xmlresolver\5.2.2\xmlresolver-5.2.2.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\httpcomponents\client5\httpclient5\5.1.3\httpclient5-5.1.3.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\httpcomponents\core5\httpcore5-h2\5.1.3\httpcore5-h2-5.1.3.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\commons-codec\commons-codec\1.15\commons-codec-1.15.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\httpcomponents\core5\httpcore5\5.1.3\httpcore5-5.1.3.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\xmlresolver\xmlresolver\5.2.2\xmlresolver-5.2.2-data.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\logging\log4j\log4j-core\2.22.0\log4j-core-2.22.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apache\logging\log4j\log4j-api\2.22.0\log4j-api-2.22.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\junit\jupiter\junit-jupiter-engine\5.10.1\junit-jupiter-engine-5.10.1.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\junit\platform\junit-platform-engine\1.10.1\junit-platform-engine-1.10.1.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\opentest4j\opentest4j\1.3.0\opentest4j-1.3.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\junit\platform\junit-platform-commons\1.10.1\junit-platform-commons-1.10.1.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\junit\jupiter\junit-jupiter-api\5.10.1\junit-jupiter-api-5.10.1.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\local-repo\jakarta\servlet\jakarta.servlet-api\5.0.0\jakarta.servlet-api-5.0.0.jarC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it-src-spotbugs\spotbugsTestCases\src\javaC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\target\generated-sources\annotationsC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\src\it-src\test\javaC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\target\generated-test-sources\test-annotationsC:\Users\Jeremy\GitHub\spotbugs-maven-plugin\target\it\basic-1\targetUnusual equals methodAbstractMissingHashCode$Concrete.equals(Object) is unusualAt AbstractMissingHashCode.java:[lines 20-36]In class AbstractMissingHashCode$ConcreteIn method AbstractMissingHashCode$Concrete.equals(Object)At AbstractMissingHashCode.java:[lines 33-36]Unused public or protected fieldUnused public or protected field: AbstractMissingHashCode$Concrete.zAt AbstractMissingHashCode.java:[lines 20-36]In class AbstractMissingHashCode$ConcreteIn AbstractMissingHashCode.javaField AbstractMissingHashCode$Concrete.zIn AbstractMissingHashCode.javaClass doesn't override equals in superclassAbstractMissingHashCode$ConcreteMissingEquals doesn't override AbstractMissingHashCode$Concrete.equals(Object)At AbstractMissingHashCode.java:[line 41]In class AbstractMissingHashCode$ConcreteMissingEqualsAt AbstractMissingHashCode.java:[line 1]Did you intend to override AbstractMissingHashCode$Concrete.equals(Object)Unused fieldUnused field: AbstractMissingHashCode$ConcreteMissingEquals.zAt AbstractMissingHashCode.java:[line 41]In class AbstractMissingHashCode$ConcreteMissingEqualsIn AbstractMissingHashCode.javaField AbstractMissingHashCode$ConcreteMissingEquals.zIn AbstractMissingHashCode.javaClass inherits equals() and uses Object.hashCode()AbstractMissingHashCode$StillMissingHashCode inherits equals and uses Object.hashCode()At AbstractMissingHashCode.java:[line 16]In class AbstractMissingHashCode$StillMissingHashCodeAt AbstractMissingHashCode.java:[line 16]Unused fieldUnused field: AbstractMissingHashCode$StillMissingHashCode.yAt AbstractMissingHashCode.java:[line 16]In class AbstractMissingHashCode$StillMissingHashCodeIn AbstractMissingHashCode.javaField AbstractMissingHashCode$StillMissingHashCode.yIn AbstractMissingHashCode.javaShould be a static inner classShould AccidentalNonConstructorInInnerClass$DoNotReport be a _static_ inner class?At AccidentalNonConstructorInInnerClass.java:[lines 21-24]In class AccidentalNonConstructorInInnerClass$DoNotReportAt AccidentalNonConstructorInInnerClass.java:[lines 21-24]Should be a static inner classShould AccidentalNonConstructorInInnerClass$Report be a _static_ inner class?At AccidentalNonConstructorInInnerClass.java:[lines 3-5]In class AccidentalNonConstructorInInnerClass$ReportAt AccidentalNonConstructorInInnerClass.java:[lines 3-5]Doomed attempt to append to an object output streamDoomed attempt to append to an object output stream in AppendingToAnObjectOutputStream.appendObject1(File, Object)At AppendingToAnObjectOutputStream.java:[lines 10-38]In class AppendingToAnObjectOutputStreamIn method AppendingToAnObjectOutputStream.appendObject1(File, Object)At AppendingToAnObjectOutputStream.java:[line 14]Doomed attempt to append to an object output streamDoomed attempt to append to an object output stream in AppendingToAnObjectOutputStream.appendObject2(File, Object)At AppendingToAnObjectOutputStream.java:[lines 10-38]In class AppendingToAnObjectOutputStreamIn method AppendingToAnObjectOutputStream.appendObject2(File, Object)At AppendingToAnObjectOutputStream.java:[line 21]Doomed attempt to append to an object output streamDoomed attempt to append to an object output stream in AppendingToAnObjectOutputStream.appendObject3(String, Object)At AppendingToAnObjectOutputStream.java:[lines 10-38]In class AppendingToAnObjectOutputStreamIn method AppendingToAnObjectOutputStream.appendObject3(String, Object)At AppendingToAnObjectOutputStream.java:[line 28]Doomed attempt to append to an object output streamDoomed attempt to append to an object output stream in AppendingToAnObjectOutputStream.appendObject4(String, Object)At AppendingToAnObjectOutputStream.java:[lines 10-38]In class AppendingToAnObjectOutputStreamIn method AppendingToAnObjectOutputStream.appendObject4(String, Object)At AppendingToAnObjectOutputStream.java:[line 35]Invocation of toString on an unnamed arrayInvocation of toString on an unnamed array in ArrayToString.print2()At ArrayToString.java:[lines 3-34]In class ArrayToStringIn method ArrayToString.print2()At ArrayToString.java:[line 28]Invocation of toString on an arrayInvocation of toString on ? in ArrayToString.print0(String[])At ArrayToString.java:[lines 3-34]In class ArrayToStringIn method ArrayToString.print0(String[])Local variable stored in JVM register 1At ArrayToString.java:[line 17]Invocation of toString on an arrayInvocation of toString on ? in ArrayToString.print1()At ArrayToString.java:[lines 3-34]In class ArrayToStringIn method ArrayToString.print1()Local variable stored in JVM register 1At ArrayToString.java:[line 23]Invocation of toString on an arrayInvocation of toString on gargs in ArrayToString.print3()At ArrayToString.java:[lines 3-34]In class ArrayToStringIn method ArrayToString.print3()In ArrayToString.javaValue loaded from field ArrayToString.gargsAt ArrayToString.java:[line 33]Bad comparison of signed byteBad comparison of signed byte with 200 in AssumeUnsignedBytes.find200(byte[])At AssumeUnsignedBytes.java:[lines 3-10]In class AssumeUnsignedBytesIn method AssumeUnsignedBytes.find200(byte[])Value 200At AssumeUnsignedBytes.java:[line 8]Unusual equals methodUseOfNonHashableClassInHashDataStructure.equals(Object) is unusualAt UseOfNonHashableClassInHashDataStructure.java:[lines 3-24]In class UseOfNonHashableClassInHashDataStructureIn method UseOfNonHashableClassInHashDataStructure.equals(Object)At UseOfNonHashableClassInHashDataStructure.java:[line 16]Class defines equals() and uses Object.hashCode()UseOfNonHashableClassInHashDataStructure defines equals and uses Object.hashCode()At UseOfNonHashableClassInHashDataStructure.java:[lines 3-24]In class UseOfNonHashableClassInHashDataStructureIn method UseOfNonHashableClassInHashDataStructure.equals(Object)At UseOfNonHashableClassInHashDataStructure.java:[line 16]Use of class without a hashCode() method in a hashed data structureUseOfNonHashableClassInHashDataStructure doesn't define a hashCode() method but is used in a hashed data structure in UseOfNonHashableClassInHashDataStructure.get(UseOfNonHashableClassInHashDataStructure)At UseOfNonHashableClassInHashDataStructure.java:[lines 3-24]In class UseOfNonHashableClassInHashDataStructureIn method UseOfNonHashableClassInHashDataStructure.get(UseOfNonHashableClassInHashDataStructure)At UseOfNonHashableClassInHashDataStructure.java:[lines 3-24]Unhashable class UseOfNonHashableClassInHashDataStructure Called method java.util.HashMap.get(Object)At UseOfNonHashableClassInHashDataStructure.java:[line 24]equals() method does not check for null argumentUseOfNonHashableClassInHashDataStructure.equals(Object) does not check for null argumentAt UseOfNonHashableClassInHashDataStructure.java:[lines 3-24]In class UseOfNonHashableClassInHashDataStructureIn method UseOfNonHashableClassInHashDataStructure.equals(Object)Parameter $L1At UseOfNonHashableClassInHashDataStructure.java:[line 16]Signature declares use of unhashable class in hashed constructUseOfNonHashableClassInHashDataStructure doesn't define a hashCode() method but it is used in a hashed context in UseOfNonHashableClassInHashDataStructure$UMapAt UseOfNonHashableClassInHashDataStructure.java:[line 5]In class UseOfNonHashableClassInHashDataStructure$UMapAt UseOfNonHashableClassInHashDataStructure.java:[line 5]In class UseOfNonHashableClassInHashDataStructure$UMapAt UseOfNonHashableClassInHashDataStructure.java:[lines 3-24]Unhashable class UseOfNonHashableClassInHashDataStructure At UseOfNonHashableClassInHashDataStructure.java:[line 5]Dead store to local variableDead store to $L2 in new UselessAssignments(int, int)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method new UselessAssignments(int, int)Local variable stored in JVM register 2At UselessAssignments.java:[line 17]Another occurrence at UselessAssignments.java:[line 19]Overwritten incrementOverwritten increment in UselessAssignments.oops()At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method UselessAssignments.oops()At UselessAssignments.java:[line 30]Double assignment of fieldDouble assignment of field g1 in new UselessAssignments(int, int)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method new UselessAssignments(int, int)In UselessAssignments.javaField UselessAssignments.g1In UselessAssignments.javaDid you mean to refer to the field UselessAssignments.g2?At UselessAssignments.java:[line 18]Double assignment of fieldDouble assignment of field foo in UselessAssignments.oops()At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method UselessAssignments.oops()In UselessAssignments.javaField UselessAssignments.fooAt UselessAssignments.java:[line 31]Another occurrence at UselessAssignments.java:[line 32]Double assignment of fieldDouble assignment of field foo in UselessAssignments.report(UselessAssignments, UselessAssignments)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method UselessAssignments.report(UselessAssignments, UselessAssignments)In UselessAssignments.javaField UselessAssignments.fooAt UselessAssignments.java:[line 37]Double assignment of fieldDouble assignment of field bar in UselessAssignments.setFoo(UselessAssignments, UselessAssignments)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method UselessAssignments.setFoo(UselessAssignments, UselessAssignments)In UselessAssignments.javaField UselessAssignments.barAt UselessAssignments.java:[line 24]Self assignment of fieldSelf assignment of field foo in new UselessAssignments(int, int)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method new UselessAssignments(int, int)In UselessAssignments.javaField UselessAssignments.fooDid you mean to refer to the local variable ?At UselessAssignments.java:[line 16]Self assignment of fieldSelf assignment of field foo in UselessAssignments.oops()At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method UselessAssignments.oops()In UselessAssignments.javaField UselessAssignments.fooAt UselessAssignments.java:[line 31]Double assignment of local variableDouble assignment of $L3 in new UselessAssignments(int, int)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method new UselessAssignments(int, int)Local variable stored in JVM register 3At UselessAssignments.java:[line 19]Self assignment of local variableSelf assignment of $L2 in new UselessAssignments(int, int)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method new UselessAssignments(int, int)Local variable stored in JVM register 2At UselessAssignments.java:[line 17]Unread fieldUnread field: UselessAssignments.barAt UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn UselessAssignments.javaField UselessAssignments.barAt UselessAssignments.java:[line 24]Unread fieldUnread field: UselessAssignments.g1At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn UselessAssignments.javaField UselessAssignments.g1At UselessAssignments.java:[line 18]Uninitialized read of field in constructorUninitialized read of foo in new UselessAssignments(int, int)At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn method new UselessAssignments(int, int)In UselessAssignments.javaField UselessAssignments.fooDid you mean to refer to the local variable ?At UselessAssignments.java:[line 16]Unused fieldUnused field: UselessAssignments.g2At UselessAssignments.java:[lines 14-42]In class UselessAssignmentsIn UselessAssignments.javaField UselessAssignments.g2In UselessAssignments.javaUseless control flowUseless control flow in UselessControlFlow.report0(Object, Object)At UselessControlFlow.java:[lines 1-48]In class UselessControlFlowIn method UselessControlFlow.report0(Object, Object)At UselessControlFlow.java:[line 14]Useless control flowUseless control flow in UselessControlFlow.report1(Object, Object)At UselessControlFlow.java:[lines 1-48]In class UselessControlFlowIn method UselessControlFlow.report1(Object, Object)At UselessControlFlow.java:[line 21]Useless non-empty void methodMethod UselessControlFlow.report4(Object[], Object) seems to be uselessAt UselessControlFlow.java:[lines 1-48]In class UselessControlFlowIn method UselessControlFlow.report4(Object[], Object)At UselessControlFlow.java:[line 48]Dead store to local variableDead store to $L1 in UselessCurrentThread.test4()At UselessCurrentThread.java:[lines 11-70]In class UselessCurrentThreadIn method UselessCurrentThread.test4()Local variable stored in JVM register 1At UselessCurrentThread.java:[line 42]May expose internal representation by incorporating reference to mutable objectnew UselessCurrentThread(Thread) may expose internal representation by storing an externally mutable object into unknownThreadAt UselessCurrentThread.java:[lines 11-70]In class UselessCurrentThreadIn method new UselessCurrentThread(Thread)In UselessCurrentThread.javaField UselessCurrentThread.unknownThreadLocal variable stored in JVM register 1At UselessCurrentThread.java:[line 12]Static Thread.interrupted() method invoked on thread instanceUselessCurrentThread.test4() invokes static Thread.interrupted() method on thread instanceAt UselessCurrentThread.java:[lines 11-70]In class UselessCurrentThreadIn method UselessCurrentThread.test4()At UselessCurrentThread.java:[line 43]Static Thread.interrupted() method invoked on thread instanceUselessCurrentThread.test5() invokes static Thread.interrupted() method on thread instanceAt UselessCurrentThread.java:[lines 11-70]In class UselessCurrentThreadIn method UselessCurrentThread.test5()At UselessCurrentThread.java:[line 52]Finalizer does nothing but call superclass finalizerUselessFinalize.finalize() does nothing except call super.finalize(); delete itAt UselessFinalize.java:[lines 1-5]In class UselessFinalizeIn method UselessFinalize.finalize()At UselessFinalize.java:[lines 4-5]Dead store to local variableDead store to $L3 in UserMistakes.main(String[])At UserMistakes.java:[lines 10-43]In class UserMistakesIn method UserMistakes.main(String[])Local variable stored in JVM register 3At UserMistakes.java:[line 28]Code contains a hard coded reference to an absolute pathnameHard coded reference to an absolute pathname in UserMistakes.main(String[])At UserMistakes.java:[lines 10-43]In class UserMistakesIn method UserMistakes.main(String[])File name /mainList.txtAt UserMistakes.java:[line 26]Another occurrence at UserMistakes.java:[line 37]Reliance on default encodingFound reliance on default encoding in UserMistakes.main(String[]): new java.io.FileReader(String)At UserMistakes.java:[lines 10-43]In class UserMistakesIn method UserMistakes.main(String[])Called method new java.io.FileReader(String)At UserMistakes.java:[line 26]Another occurrence at UserMistakes.java:[line 37]"." or "|" used for regular expression"." or "|" used for regular expression in UserMistakes.main(String[])At UserMistakes.java:[lines 10-43]In class UserMistakesIn method UserMistakes.main(String[])Called method String.replaceAll(String, String)At UserMistakes.java:[line 14]Method discards result of readLine after checking if it is non-nullUserMistakes.main(String[]) discards result of readLine after checking if it is non-nullAt UserMistakes.java:[lines 10-43]In class UserMistakesIn method UserMistakes.main(String[])At UserMistakes.java:[line 27]clone method does not call super.clone()org.codehaus.mojo.spotbugsmavenplugin.it.App.clone() does not call super.clone()At App.java:[lines 22-29]In class org.codehaus.mojo.spotbugsmavenplugin.it.AppIn method org.codehaus.mojo.spotbugsmavenplugin.it.App.clone()At App.java:[line 29]Clone method may return nullorg.codehaus.mojo.spotbugsmavenplugin.it.App.clone() may return nullAt App.java:[lines 22-29]In class org.codehaus.mojo.spotbugsmavenplugin.it.AppIn method org.codehaus.mojo.spotbugsmavenplugin.it.App.clone()At App.java:[line 29]Bad practiceMalicious code vulnerabilityPerformanceCorrectnessDodgy codeInternationalizationDead store to local variable
+ +<p> +This instruction assigns a value to a local variable, +but the value is not read or used in any subsequent instruction. +Often, this indicates an error, because the value computed is never +used. +</p> +<p> +Note that Sun's javac compiler often generates dead stores for +final local variables. Because SpotBugs is a bytecode-based tool, +there is no easy way to eliminate these false positives. +</p> + +
clone method does not call super.clone()
+ +<p> This non-final class defines a clone() method that does not call super.clone(). +If this class ("<i>A</i>") is extended by a subclass ("<i>B</i>"), +and the subclass <i>B</i> calls super.clone(), then it is likely that +<i>B</i>'s clone() method will return an object of type <i>A</i>, +which violates the standard contract for clone().</p> + +<p> If all clone() methods call super.clone(), then they are guaranteed +to use Object.clone(), which always returns an object of the correct type.</p> + +
May expose internal representation by incorporating reference to mutable object
+ + <p> This code stores a reference to an externally mutable object into the + internal representation of the object.&nbsp; + If instances + are accessed by untrusted code, and unchecked changes to + the mutable object would compromise security or other + important properties, you will need to do something different. + Storing a copy of the object is better approach in many situations.</p> + +
Should be a static inner class
+ + <p> This class is an inner class, but does not use its embedded reference + to the object which created it.&nbsp; This reference makes the instances + of the class larger, and may keep the reference to the creator object + alive longer than necessary.&nbsp; If possible, the class should be + made static. +</p> + +
Unread field
+ + <p> This field is never read.&nbsp; Consider removing it from the class.</p> + +
Self assignment of field
+ +<p> This method contains a self assignment of a field; e.g. +</p> +<pre><code>int x; +public void foo() { + x = x; +} +</code></pre> +<p>Such assignments are useless, and may indicate a logic error or typo.</p> + +
equals() method does not check for null argument
+ + <p> + This implementation of equals(Object) violates the contract defined + by java.lang.Object.equals() because it does not check for null + being passed as the argument. All equals() methods should return + false if passed a null value. + </p> + +
"." or "|" used for regular expression
+ +<p> +A String function is being invoked and "." or "|" is being passed +to a parameter that takes a regular expression as an argument. Is this what you intended? +For example +</p> +<ul> +<li>s.replaceAll(".", "/") will return a String in which <em>every</em> character has been replaced by a '/' character</li> +<li>s.split(".") <em>always</em> returns a zero length array of String</li> +<li>"ab|cd".replaceAll("|", "/") will return "/a/b/|/c/d/"</li> +<li>"ab|cd".split("|") will return array with six (!) elements: [, a, b, |, c, d]</li> +</ul> +<p> +Consider using <code>s.replace(".", "/")</code> or <code>s.split("\\.")</code> instead. +</p> + +
Unused field
+ + <p> This field is never used.&nbsp; Consider removing it from the class.</p> + +
Class doesn't override equals in superclass
+ + <p> This class extends a class that defines an equals method and adds fields, but doesn't +define an equals method itself. Thus, equality on instances of this class will +ignore the identity of the subclass and the added fields. Be sure this is what is intended, +and that you don't need to override the equals method. Even if you don't need to override +the equals method, consider overriding it anyway to document the fact +that the equals method for the subclass just return the result of +invoking super.equals(o). + </p> + +
Reliance on default encoding
+ +<p> Found a call to a method which will perform a byte to String (or String to byte) conversion, +and will assume that the default platform encoding is suitable. This will cause the application +behavior to vary between platforms. Use an alternative API and specify a charset name or Charset +object explicitly.</p> + +
Uninitialized read of field in constructor
+ + <p> This constructor reads a field which has not yet been assigned a value.&nbsp; + This is often caused when the programmer mistakenly uses the field instead + of one of the constructor's parameters.</p> + +
Useless control flow
+ +<p> This method contains a useless control flow statement, where +control flow continues onto the same place regardless of whether or not +the branch is taken. For example, +this is caused by having an empty statement +block for an <code>if</code> statement:</p> +<pre><code>if (argv.length == 0) { + // TODO: handle this case +} +</code></pre> + +
Double assignment of local variable
+ +<p> This method contains a double assignment of a local variable; e.g. +</p> +<pre><code>public void foo() { + int x,y; + x = x = 17; +} +</code></pre> +<p>Assigning the same value to a variable twice is useless, and may indicate a logic error or typo.</p> + +
Clone method may return null
+ + <p> + This clone method seems to return null in some circumstances, but clone is never + allowed to return a null value. If you are convinced this path is unreachable, throw an AssertionError + instead. + </p> + +
Class inherits equals() and uses Object.hashCode()
+ + <p> This class inherits <code>equals(Object)</code> from an abstract + superclass, and <code>hashCode()</code> from +<code>java.lang.Object</code> (which returns + the identity hash code, an arbitrary value assigned to the object + by the VM).&nbsp; Therefore, the class is very likely to violate the + invariant that equal objects must have equal hashcodes.</p> + + <p>If you don't want to define a hashCode method, and/or don't + believe the object will ever be put into a HashMap/Hashtable, + define the <code>hashCode()</code> method + to throw <code>UnsupportedOperationException</code>.</p> + +
Invocation of toString on an unnamed array
+ +<p> +The code invokes toString on an (anonymous) array. Calling toString on an array generates a fairly useless result +such as [C@16f0472. Consider using Arrays.toString to convert the array into a readable +String that gives the contents of the array. See Programming Puzzlers, chapter 3, puzzle 12. +</p> + +
Self assignment of local variable
+ +<p> This method contains a self assignment of a local variable; e.g.</p> +<pre><code>public void foo() { + int x = 3; + x = x; +} +</code></pre> +<p> +Such assignments are useless, and may indicate a logic error or typo. +</p> + +
Unused public or protected field
+ + <p> This field is never used.&nbsp; +The field is public or protected, so perhaps + it is intended to be used with classes not seen as part of the analysis. If not, +consider removing it from the class.</p> + +
Doomed attempt to append to an object output stream
+ + <p> + This code opens a file in append mode and then wraps the result in an object output stream like as follows: + </p> + <pre><code>OutputStream out = new FileOutputStream(anyFile, true); + new ObjectOutputStream(out);</code></pre> + <p> + This won't allow you to append to an existing object output stream stored in a file. If you want to be + able to append to an object output stream, you need to keep the object output stream open. + </p> + <p>The only situation in which opening a file in append mode and the writing an object output stream + could work is if on reading the file you plan to open it in random access mode and seek to the byte offset + where the append started. + </p> + +
Finalizer does nothing but call superclass finalizer
+ + <p> The only thing this <code>finalize()</code> method does is call + the superclass's <code>finalize()</code> method, making it + redundant.&nbsp; Delete it.</p> + +
Signature declares use of unhashable class in hashed construct
+ + <p> A method, field or class declares a generic signature where a non-hashable class +is used in context where a hashable class is required. +A class that declares an equals method but inherits a hashCode() method +from Object is unhashable, since it doesn't fulfill the requirement that +equal objects have equal hashCodes. +</p> + +
Method discards result of readLine after checking if it is non-null
+ + <p> The value returned by readLine is discarded after checking to see if the return +value is non-null. In almost all situations, if the result is non-null, you will want +to use that non-null value. Calling readLine again will give you a different line.</p> + +
Invocation of toString on an array
+ +<p> +The code invokes toString on an array, which will generate a fairly useless result +such as [C@16f0472. Consider using Arrays.toString to convert the array into a readable +String that gives the contents of the array. See Programming Puzzlers, chapter 3, puzzle 12. +</p> + +
Overwritten increment
+ +<p> +The code performs an increment/decrement operation (e.g., <code>i++</code> / <code>i--</code>) and then +immediately overwrites it. For example, <code>i = i++</code> / <code>i = i--</code> immediately +overwrites the incremented/decremented value with the original value. +</p> + +
Unusual equals method
+ + <p> This class doesn't do any of the patterns we recognize for checking that the type of the argument +is compatible with the type of the <code>this</code> object. There might not be anything wrong with +this code, but it is worth reviewing. +</p> + +
Code contains a hard coded reference to an absolute pathname
+ +<p>This code constructs a File object using a hard coded to an absolute pathname +(e.g., <code>new File("/home/dannyc/workspace/j2ee/src/share/com/sun/enterprise/deployment");</code> +</p> + +
Double assignment of field
+ +<p> This method contains a double assignment of a field; e.g. +</p> +<pre><code>int x,y; +public void foo() { + x = x = 17; +} +</code></pre> +<p>Assigning to a field twice is useless, and may indicate a logic error or typo.</p> + +
Static Thread.interrupted() method invoked on thread instance
+ +<p> +This method invokes the Thread.interrupted() method on a Thread object that appears to be a Thread object that is +not the current thread. As the interrupted() method is static, the interrupted method will be called on a different +object than the one the author intended. +</p> + +
Use of class without a hashCode() method in a hashed data structure
+ + <p> A class defines an equals(Object) method but not a hashCode() method, +and thus doesn't fulfill the requirement that equal objects have equal hashCodes. +An instance of this class is used in a hash data structure, making the need to +fix this problem of highest importance. + +
Class defines equals() and uses Object.hashCode()
+ + <p> This class overrides <code>equals(Object)</code>, but does not + override <code>hashCode()</code>, and inherits the implementation of + <code>hashCode()</code> from <code>java.lang.Object</code> (which returns + the identity hash code, an arbitrary value assigned to the object + by the VM).&nbsp; Therefore, the class is very likely to violate the + invariant that equal objects must have equal hashcodes.</p> + +<p>If you don't think instances of this class will ever be inserted into a HashMap/HashTable, +the recommended <code>hashCode</code> implementation to use is:</p> +<pre><code>public int hashCode() { + assert false : "hashCode not designed"; + return 42; // any arbitrary constant will do +} +</code></pre> + +
Bad comparison of signed byte
+ +<p> Signed bytes can only have a value in the range -128 to 127. Comparing +a signed byte with a value outside that range is vacuous and likely to be incorrect. +To convert a signed byte <code>b</code> to an unsigned value in the range 0..255, +use <code>0xff &amp; b</code>. +</p> + +
Useless non-empty void method
+ +<p>Our analysis shows that this non-empty void method does not actually perform any useful work. +Please check it: probably there's a mistake in its code or its body can be fully removed. +</p> +<p>We are trying to reduce the false positives as much as possible, but in some cases this warning might be wrong. +Common false-positive cases include:</p> +<ul> +<li>The method is intended to trigger loading of some class which may have a side effect.</li> +<li>The method is intended to implicitly throw some obscure exception.</li> +</ul> + +
Dubious method invocationNull pointer dereferenceIncorrect use of finalizersBad use of return value from methodInput/Output problemUnused fieldUnread fieldSuspicious Thread InterruptedDubious method usedDead local storeUseless/non-informative string generatedBad implementation of cloneable idiomProblems with implementation of equals()Inner class could be made staticSuspicious integer expressionUseless self-operationUseless codeStoring reference to mutable objectRegular expressionsUseless control flowEqual objects must have equal hashcodesUninitialized read of field in constructor
\ No newline at end of file