Project Information
Project:
DupDetector (spotbugsMain)
SpotBugs version: 4.4.2
Code analyzed:
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/RecursiveSearch.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Input.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Output.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/LexerAnalyzer.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Recommender.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Token.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Interfaces/RefactoringInterface.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Interfaces/RecommenderInterface.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Interfaces/InputInterface.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Interfaces/TokenInterface.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Interfaces/OutputInterface.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/TokenType.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/TokenAnalyzer.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/Refactoring.class
- /home/runner/work/DupDetector/DupDetector/build/classes/java/main/edu/odu/cs/cs350/DupDetector.class
Metrics
1249 lines of code analyzed,
in 15 classes,
in 2 packages.
| High Priority Warnings |
4 |
3.20 |
| Medium Priority Warnings |
39 |
31.22 |
|
Total Warnings
|
43
|
34.43
|
(* Defects per Thousand lines of non-commenting source statements)
Contents
Summary
Warnings
Click on a warning row to see full context information.
|
Dm
|
new edu.odu.cs.cs350.Input(String[]) invokes System.exit(...), which shuts down the entire virtual machine |
|
Bug type DM_EXIT (click for details)
In class edu.odu.cs.cs350.Input In method new edu.odu.cs.cs350.Input(String[]) At Input.java:[line 43]
|
|
Eq
|
edu.odu.cs.cs350.Refactoring defines compareTo(Refactoring) and uses Object.equals() |
|
Bug type EQ_COMPARETO_USE_OBJECT_EQUALS (click for details)
In class edu.odu.cs.cs350.Refactoring In method edu.odu.cs.cs350.Refactoring.compareTo(Refactoring) At Refactoring.java:[line 67]
|
|
RCN
|
Nullcheck of Recommender.refactorings at line 106 of value previously dereferenced in edu.odu.cs.cs350.Recommender.getRefactorings() |
|
Bug type RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE (click for details)
In class edu.odu.cs.cs350.Recommender In method edu.odu.cs.cs350.Recommender.getRefactorings() Value loaded from field edu.odu.cs.cs350.Recommender.refactorings At Recommender.java:[line 104] Redundant null check at Recommender.java:[line 106]
|
|
RCN
|
Nullcheck of input at line 117 of value previously dereferenced in edu.odu.cs.cs350.Recommender.setRefactorings(List) |
|
Bug type RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE (click for details)
In class edu.odu.cs.cs350.Recommender In method edu.odu.cs.cs350.Recommender.setRefactorings(List) Value loaded from input At Recommender.java:[line 117] Redundant null check at Recommender.java:[line 117]
|
|
Dm
|
Found reliance on default encoding in edu.odu.cs.cs350.Input.setFileExtensions(File): new java.io.FileReader(File) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class edu.odu.cs.cs350.Input In method edu.odu.cs.cs350.Input.setFileExtensions(File) Called method new java.io.FileReader(File) At Input.java:[line 185]
|
|
Dm
|
Found reliance on default encoding in edu.odu.cs.cs350.Input.setMinSequenceMaxSubs(File): new java.io.FileReader(File) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class edu.odu.cs.cs350.Input In method edu.odu.cs.cs350.Input.setMinSequenceMaxSubs(File) Called method new java.io.FileReader(File) At Input.java:[line 207]
|
|
Dm
|
Found reliance on default encoding in new edu.odu.cs.cs350.TokenAnalyzer(File): new java.util.Scanner(File) |
|
Bug type DM_DEFAULT_ENCODING (click for details)
In class edu.odu.cs.cs350.TokenAnalyzer In method new edu.odu.cs.cs350.TokenAnalyzer(File) Called method new java.util.Scanner(File) At TokenAnalyzer.java:[line 56]
|
|
EI
|
edu.odu.cs.cs350.Input.getFiles() may expose internal representation by returning Input.files |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Input In method edu.odu.cs.cs350.Input.getFiles() Field edu.odu.cs.cs350.Input.files At Input.java:[line 104]
|
|
EI
|
edu.odu.cs.cs350.Input.getTokenCountForFiles() may expose internal representation by returning Input.tokenCountForFiles |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Input In method edu.odu.cs.cs350.Input.getTokenCountForFiles() Field edu.odu.cs.cs350.Input.tokenCountForFiles At Input.java:[line 133]
|
|
EI
|
edu.odu.cs.cs350.Input.getTokens() may expose internal representation by returning Input.tokens |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Input In method edu.odu.cs.cs350.Input.getTokens() Field edu.odu.cs.cs350.Input.tokens At Input.java:[line 112]
|
|
EI
|
edu.odu.cs.cs350.Input.getfileExtensions() may expose internal representation by returning Input.fileExtensions |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Input In method edu.odu.cs.cs350.Input.getfileExtensions() Field edu.odu.cs.cs350.Input.fileExtensions At Input.java:[line 151]
|
|
EI
|
edu.odu.cs.cs350.Output.getFiles() may expose internal representation by returning Output.files |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Output In method edu.odu.cs.cs350.Output.getFiles() Field edu.odu.cs.cs350.Output.files At Output.java:[line 75]
|
|
EI
|
edu.odu.cs.cs350.Output.getRefactorings() may expose internal representation by returning Output.refactorings |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Output In method edu.odu.cs.cs350.Output.getRefactorings() Field edu.odu.cs.cs350.Output.refactorings At Output.java:[line 95]
|
|
EI
|
edu.odu.cs.cs350.Recommender.getRefactorings() may expose internal representation by returning Recommender.refactorings |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Recommender In method edu.odu.cs.cs350.Recommender.getRefactorings() Field edu.odu.cs.cs350.Recommender.refactorings At Recommender.java:[line 104] Another occurrence at Recommender.java:[line 107]
|
|
EI
|
edu.odu.cs.cs350.Recommender.getTokens() may expose internal representation by returning Recommender.tokens |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.Recommender In method edu.odu.cs.cs350.Recommender.getTokens() Field edu.odu.cs.cs350.Recommender.tokens At Recommender.java:[line 80]
|
|
EI
|
edu.odu.cs.cs350.RecursiveSearch.findFiles(String) may expose internal representation by returning RecursiveSearch.listofFiles |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.RecursiveSearch In method edu.odu.cs.cs350.RecursiveSearch.findFiles(String) Field edu.odu.cs.cs350.RecursiveSearch.listofFiles At RecursiveSearch.java:[line 83]
|
|
EI
|
edu.odu.cs.cs350.RecursiveSearch.findFiles(String, List) may expose internal representation by returning RecursiveSearch.listofFiles |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.RecursiveSearch In method edu.odu.cs.cs350.RecursiveSearch.findFiles(String, List) Field edu.odu.cs.cs350.RecursiveSearch.listofFiles At RecursiveSearch.java:[line 47]
|
|
EI
|
edu.odu.cs.cs350.RecursiveSearch.searchDirectory(String) may expose internal representation by returning RecursiveSearch.listofFiles |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.RecursiveSearch In method edu.odu.cs.cs350.RecursiveSearch.searchDirectory(String) Field edu.odu.cs.cs350.RecursiveSearch.listofFiles At RecursiveSearch.java:[line 115]
|
|
EI
|
edu.odu.cs.cs350.TokenAnalyzer.getTokens() may expose internal representation by returning TokenAnalyzer.tokensContainer |
|
Bug type EI_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.TokenAnalyzer In method edu.odu.cs.cs350.TokenAnalyzer.getTokens() Field edu.odu.cs.cs350.TokenAnalyzer.tokensContainer At TokenAnalyzer.java:[line 120]
|
|
EI2
|
new edu.odu.cs.cs350.Output(InputInterface, RecommenderInterface) may expose internal representation by storing an externally mutable object into Output.input |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class edu.odu.cs.cs350.Output In method new edu.odu.cs.cs350.Output(InputInterface, RecommenderInterface) Field edu.odu.cs.cs350.Output.input Local variable named input At Output.java:[line 39]
|
|
EI2
|
new edu.odu.cs.cs350.Output(InputInterface, RecommenderInterface) may expose internal representation by storing an externally mutable object into Output.recommender |
|
Bug type EI_EXPOSE_REP2 (click for details)
In class edu.odu.cs.cs350.Output In method new edu.odu.cs.cs350.Output(InputInterface, RecommenderInterface) Field edu.odu.cs.cs350.Output.recommender Local variable named recommender At Output.java:[line 40]
|
|
MS
|
edu.odu.cs.cs350.DupDetector.setInput(Input) may expose internal static state by storing a mutable object into a static field edu.odu.cs.cs350.DupDetector.input |
|
Bug type EI_EXPOSE_STATIC_REP2 (click for details)
In class edu.odu.cs.cs350.DupDetector In method edu.odu.cs.cs350.DupDetector.setInput(Input) Field edu.odu.cs.cs350.DupDetector.input Local variable named i At DupDetector.java:[line 46]
|
|
MS
|
edu.odu.cs.cs350.DupDetector.setOutput(Output) may expose internal static state by storing a mutable object into a static field edu.odu.cs.cs350.DupDetector.output |
|
Bug type EI_EXPOSE_STATIC_REP2 (click for details)
In class edu.odu.cs.cs350.DupDetector In method edu.odu.cs.cs350.DupDetector.setOutput(Output) Field edu.odu.cs.cs350.DupDetector.output Local variable named o At DupDetector.java:[line 85]
|
|
MS
|
edu.odu.cs.cs350.DupDetector.setRecommender(Recommender) may expose internal static state by storing a mutable object into a static field edu.odu.cs.cs350.DupDetector.recommender |
|
Bug type EI_EXPOSE_STATIC_REP2 (click for details)
In class edu.odu.cs.cs350.DupDetector In method edu.odu.cs.cs350.DupDetector.setRecommender(Recommender) Field edu.odu.cs.cs350.DupDetector.recommender Local variable named r At DupDetector.java:[line 70]
|
|
MS
|
Public static edu.odu.cs.cs350.DupDetector.getInput() may expose internal representation by returning DupDetector.input |
|
Bug type MS_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.DupDetector In method edu.odu.cs.cs350.DupDetector.getInput() Field edu.odu.cs.cs350.DupDetector.input At DupDetector.java:[line 38]
|
|
MS
|
Public static edu.odu.cs.cs350.DupDetector.getOutput() may expose internal representation by returning DupDetector.output |
|
Bug type MS_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.DupDetector In method edu.odu.cs.cs350.DupDetector.getOutput() Field edu.odu.cs.cs350.DupDetector.output At DupDetector.java:[line 77]
|
|
MS
|
Public static edu.odu.cs.cs350.DupDetector.getRecommender() may expose internal representation by returning DupDetector.recommender |
|
Bug type MS_EXPOSE_REP (click for details)
In class edu.odu.cs.cs350.DupDetector In method edu.odu.cs.cs350.DupDetector.getRecommender() Field edu.odu.cs.cs350.DupDetector.recommender At DupDetector.java:[line 62]
|
|
Bx
|
Boxing/unboxing to parse a primitive edu.odu.cs.cs350.Input.setMinSequenceMaxSubs(File) |
|
Bug type DM_BOXED_PRIMITIVE_FOR_PARSING (click for details)
In class edu.odu.cs.cs350.Input In method edu.odu.cs.cs350.Input.setMinSequenceMaxSubs(File) Called method Integer.intValue() Should call Integer.parseInt(String) instead At Input.java:[line 210] Another occurrence at Input.java:[line 211]
|
|
Dm
|
edu.odu.cs.cs350.Output.getCompleteOutput() invokes inefficient new String() constructor |
|
Bug type DM_STRING_VOID_CTOR (click for details)
In class edu.odu.cs.cs350.Output In method edu.odu.cs.cs350.Output.getCompleteOutput() At Output.java:[line 169]
|
|
Dm
|
edu.odu.cs.cs350.Output.getSectionOne() invokes inefficient new String() constructor |
|
Bug type DM_STRING_VOID_CTOR (click for details)
In class edu.odu.cs.cs350.Output In method edu.odu.cs.cs350.Output.getSectionOne() At Output.java:[line 113] Another occurrence at Output.java:[line 114] Another occurrence at Output.java:[line 116]
|
|
Dm
|
edu.odu.cs.cs350.Output.getSectionTwo() invokes inefficient new String() constructor |
|
Bug type DM_STRING_VOID_CTOR (click for details)
In class edu.odu.cs.cs350.Output In method edu.odu.cs.cs350.Output.getSectionTwo() At Output.java:[line 141]
|
|
UrF
|
Unread field: edu.odu.cs.cs350.LexerAnalyzer.yychar |
|
Bug type URF_UNREAD_FIELD (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer Field edu.odu.cs.cs350.LexerAnalyzer.yychar At LexerAnalyzer.java:[line 903]
|
|
UrF
|
Unread field: edu.odu.cs.cs350.LexerAnalyzer.zzAtBOL |
|
Bug type URF_UNREAD_FIELD (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer Field edu.odu.cs.cs350.LexerAnalyzer.zzAtBOL At LexerAnalyzer.java:[line 750]
|
|
UrF
|
Unread field: edu.odu.cs.cs350.LexerAnalyzer.zzEOFDone |
|
Bug type URF_UNREAD_FIELD (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer Field edu.odu.cs.cs350.LexerAnalyzer.zzEOFDone At LexerAnalyzer.java:[line 882]
|
|
DLS
|
Dead store to offset in edu.odu.cs.cs350.LexerAnalyzer.zzUnpackAction() |
|
Bug type DLS_DEAD_LOCAL_STORE (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer In method edu.odu.cs.cs350.LexerAnalyzer.zzUnpackAction() Local variable named offset At LexerAnalyzer.java:[line 355]
|
|
DLS
|
Dead store to offset in edu.odu.cs.cs350.LexerAnalyzer.zzUnpackAttribute() |
|
Bug type DLS_DEAD_LOCAL_STORE (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer In method edu.odu.cs.cs350.LexerAnalyzer.zzUnpackAttribute() Local variable named offset At LexerAnalyzer.java:[line 682]
|
|
DLS
|
Dead store to offset in edu.odu.cs.cs350.LexerAnalyzer.zzUnpackRowMap() |
|
Bug type DLS_DEAD_LOCAL_STORE (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer In method edu.odu.cs.cs350.LexerAnalyzer.zzUnpackRowMap() Local variable named offset At LexerAnalyzer.java:[line 412]
|
|
DLS
|
Dead store to offset in edu.odu.cs.cs350.LexerAnalyzer.zzUnpackTrans() |
|
Bug type DLS_DEAD_LOCAL_STORE (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer In method edu.odu.cs.cs350.LexerAnalyzer.zzUnpackTrans() Local variable named offset At LexerAnalyzer.java:[line 631]
|
|
DLS
|
Dead store to offset in edu.odu.cs.cs350.LexerAnalyzer.zzUnpackcmap_blocks() |
|
Bug type DLS_DEAD_LOCAL_STORE (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer In method edu.odu.cs.cs350.LexerAnalyzer.zzUnpackcmap_blocks() Local variable named offset At LexerAnalyzer.java:[line 312]
|
|
DLS
|
Dead store to offset in edu.odu.cs.cs350.LexerAnalyzer.zzUnpackcmap_top() |
|
Bug type DLS_DEAD_LOCAL_STORE (click for details)
In class edu.odu.cs.cs350.LexerAnalyzer In method edu.odu.cs.cs350.LexerAnalyzer.zzUnpackcmap_top() Local variable named offset At LexerAnalyzer.java:[line 71]
|
|
NP
|
Possible null pointer dereference in edu.odu.cs.cs350.RecursiveSearch.findFiles(String) due to return value of called method |
|
Bug type NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE (click for details)
In class edu.odu.cs.cs350.RecursiveSearch In method edu.odu.cs.cs350.RecursiveSearch.findFiles(String) Value loaded from ? Dereferenced at RecursiveSearch.java:[line 66] Known null at RecursiveSearch.java:[line 66]
|
|
NP
|
Possible null pointer dereference in edu.odu.cs.cs350.RecursiveSearch.findFiles(String, List) due to return value of called method |
|
Bug type NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE (click for details)
In class edu.odu.cs.cs350.RecursiveSearch In method edu.odu.cs.cs350.RecursiveSearch.findFiles(String, List) Value loaded from ? Dereferenced at RecursiveSearch.java:[line 30] Known null at RecursiveSearch.java:[line 30]
|
|
NP
|
Possible null pointer dereference in edu.odu.cs.cs350.RecursiveSearch.searchDirectory(String) due to return value of called method |
|
Bug type NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE (click for details)
In class edu.odu.cs.cs350.RecursiveSearch In method edu.odu.cs.cs350.RecursiveSearch.searchDirectory(String) Value loaded from ? Dereferenced at RecursiveSearch.java:[line 98] Known null at RecursiveSearch.java:[line 98]
|
A boxed primitive is created from a String, just to extract the unboxed primitive value.
It is more efficient to just call the static parseXXX method.
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.
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.
Invoking System.exit shuts down the entire Java virtual machine. This
should only been done when it is appropriate. Such calls make it
hard or impossible for your code to be invoked by other code.
Consider throwing a RuntimeException instead.
Creating a new java.lang.String object using the
no-argument constructor wastes memory because the object so created will
be functionally indistinguishable from the empty string constant
"". Java guarantees that identical string constants
will be represented by the same String object. Therefore,
you should just use the empty string constant directly.
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 behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.
Returning a reference to a mutable object value stored in one of the object's fields
exposes the internal representation of the object.
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.
Returning a new copy of the object is better approach in many situations.
This code stores a reference to an externally mutable object into the
internal representation of the object.
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.
This class defines a compareTo(...) method but inherits its
equals() method from java.lang.Object.
Generally, the value of compareTo should return zero if and only if
equals returns true. If this is violated, weird and unpredictable
failures will occur in classes such as PriorityQueue.
In Java 5 the PriorityQueue.remove method uses the compareTo method,
while in Java 6 it uses the equals method.
From the JavaDoc for the compareTo method in the Comparable interface:
It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)).
Generally speaking, any class that implements the Comparable interface and violates this condition
should clearly indicate this fact. The recommended language
is "Note: this class has a natural ordering that is inconsistent with equals."
This code stores a reference to an externally mutable object into a static
field.
If 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.
A public static method returns a reference to
an array that is part of the static state of the class.
Any code that calls this method can freely modify
the underlying array.
One fix is to return a copy of the array.
The return value from a method is dereferenced without a null check,
and the return value of that method is one that should generally be checked
for null. This may lead to a NullPointerException when the code is executed.
A value is checked here to see whether it is null, but this value can't
be null because it was previously dereferenced and if it were null a null pointer
exception would have occurred at the earlier dereference.
Essentially, this code and the previous dereference
disagree as to whether this value is allowed to be null. Either the check is redundant
or the previous dereference is erroneous.
This field is never read. Consider removing it from the class.