-
Notifications
You must be signed in to change notification settings - Fork 19.9k
Bugs from FindBugs #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @MengqiLin, thanks for comming to report the bugs in branch I'll try to fix the bugs |
* Made Matrix equality comparison deep. Solution to the issue TheAlgorithms#719 * Comparing Matrix size before content size. * Update DoublyLinkedList.java * fix: fix link in README * Efficiency Just two small things that in case the number was very big could be helpful. * update readme.md: Fixed & added links * Update LevenshteinDistance.java * Now it's OK! * Update README.md * docs: update the whole repository * fix some bugs * delete duplicate files * format code * docs: update .gitignore * Delete .gitignore___jb_tmp___ * docs: delete duplicate files * docs: update AnyBaseToAnyBase and GenericTree * docs: rename files * Update README.md * Update HexaDecimalToDecimal.java * fix bugs in AES.java(TheAlgorithms#765) * fix bugs in ReverseString(TheAlgorithms#765) * fix bugs in MinimizingLateness(TheAlgorithms#765) * Update GenericArrayListQueue.java Documentations added * Fix for Issue TheAlgorithms#771. position=size causes NPE * Fix for Issue TheAlgorithms#773. Deleting an element that doesn't exist causes NPE * Revert "Fix for Issue TheAlgorithms#773. Deleting an element that doesn't exist causes NPE" This reverts commit 7eb0785. * Fix for Issue TheAlgorithms#773. Deleting an element that doesn't exist causes NPE * Integer To Roman * Rename GenericTree.Java to GenericTree.java * Update IntegerToRoman.java * Create FUNDING.yml * Using randomize partition to avoid the basically ordered sequences * Update QuickSort.java * Update BinaryToDecimal.java Updated some of the variable names for the ease of understanding the process. * Update BinaryToDecimal.java Changed bin_num and bin_copy to binNum and binCopy respectively. * Fix binary to octal conversion * Updated Dynamic Programming Links in Readme.md Links in the dynamic programming column were not pointing to the right files so I fixed it in the Readme file. * Updated Miscellaneous Links in README.md * Added Maths Folder & Absolute Value Program * Update AbsoluteValue.java * Added gitpod.io badge to the README * Updates README.md * Update README.md * Update README.md * Updates README.md * docs: remove FUNDING.yml and use default file See https://github.com/TheAlgorithms/.github * ignore non-alphanumeric * secondaryWordCount method added * Fix StackArray.java resize() * reduce code * code readable * fix memory leak * fix EmptyStackException * optimization * Update Knapsack.java Added check if the arrays are null * make code more readable * make code less * optimization * add more * Find max and min value by recursion * Update Queues.java * init with DEFAULT_CAPACITY * Correct the prime check algorithm There are no prime numbers smaller than 2 and numbers greater than and divisible by 2 are not prime. * The code was very verbose. Now it is simplified without sacrificing accuracy. * optimization * Improved grammar and whitespace for prompts * update * mergeSortedArrayList * Updated Readme * AbsoluteMax and AbsoluteMin * Update README.md * update gcd * toString * optimization and fix bug * Update Queues.java * Correction of iteration limit of fibOptimized * PalindromeNumber * perfect number * Result print * Size * update BalancedBrackets * clear list * update SinglyLinkedList * update StackOfLinkedList * DecimalToAnyUsingStack * parseInteger * LinkedQueue * add pow * Update FindMin.java Re-word the comments * Update CountWords.java Cleaning the code * using recursion * update LinkedQueue * fix: update Fibonacci and close TheAlgorithms#1008 * close TheAlgorithms#1008 * upate SinglyLinkedList * added license to the repository. * update AnyBaseToDecimal * make code readable * statistics optimization * qwe * add jump search algorithm * FibonacciNumber * Create CONTRIBUTING.md to avoid 404 for community guidelines. * fix: update FindMin and fix TheAlgorithms#1170 * Update BubbleSort.java Output from print(integers) returns [78, 231, 54, 23, 12, 9, 6, 4, 1] Correct output should be: [231, 78, 54, 23, 12, 9, 6, 4, 1] * Update README.md * Comment revisions * fix: removed warning for Sorts 'C-style array declaration of parameter 'array'' * optimization * Create update_directory_md.yml * updating DIRECTORY.md * optimization * Fix bug * Added Best/First/Worst Fit algorithm implementation * Change Done * Update update_directory_md.yml * updating DIRECTORY.md * Fixing packages. * Closing scanners. * Simple Substitution Cipher Algorithm added. * Update SimpleSubstitutionCipher.java * updating DIRECTORY.md * Delete Dijkshtra.java Duplicate and wrongly named. * updating DIRECTORY.md * bytesToHex function is changed beecause of required library is depracated on OpenJdk 11 * Using Try/catch and recursion Adding try/catch and recursion to optimize the code * Update DecimalToBinary.java Close ressource leak Scanner input * Update Cycles.java closing Scanner in * Update PrimMST.java removing unused import java.lang.* * Update Cycles.java removing unused member variable finalCycles * Update Main.java fixing bug Program is causing a NoSuchElementException * Update RedBlackBST.java closing Scanner scan * Update RomanToInteger.java declaring serialVersionUID * added type parameter * remove deprecated use of Character * remove unused variable * remove unused method * remove unused variable * remove unnecessary SuppressWarning * close Reader * close Reader * dynamic array data structure * Update LICENSE * change Sorts/ShellSort.java * Update ShellSort.java * added removeDuplicates function * updating DIRECTORY.md * Add a new sort algorithm, Sort/BitonicSort * updating DIRECTORY.md * Create PrimeFactorization.java * Finish both AmicableNumbers and VampireNumbers * Finish both AmicableNumbers and VampireNumbers * implement search with search helper * updating DIRECTORY.md * added scanner in factorail program * added comment in front of main method * Added indentation in the "main" function statement block * updating DIRECTORY.md * Update AVLTree.java * Update VampireNumber.java * Fixed Error:(6, 8) java: class algorithm is public, should be declared in a file named algorithm.java. Inside file PrimeFactorization, the name of public class was wrong. Co-authored-by: Egoscio <[email protected]> Co-authored-by: Libin Yang <[email protected]> Co-authored-by: Bartosz Dąbek <[email protected]> Co-authored-by: Marcos <[email protected]> Co-authored-by: Ashmi Chheda <[email protected]> Co-authored-by: bogdandv <[email protected]> Co-authored-by: Anup Kumar Panwar <[email protected]> Co-authored-by: yanglbme <[email protected]> Co-authored-by: ibahadiraltun <[email protected]> Co-authored-by: Daher Daher <[email protected]> Co-authored-by: Abhijay Kumar <[email protected]> Co-authored-by: Abhijay Kumar <[email protected]> Co-authored-by: xemjas <[email protected]> Co-authored-by: CN-GuoZiyang <[email protected]> Co-authored-by: Priyansh-Kedia <[email protected]> Co-authored-by: obelisk0114 <[email protected]> Co-authored-by: Nikit Singh <[email protected]> Co-authored-by: obelisk0114 <[email protected]> Co-authored-by: PatOnTheBack <[email protected]> Co-authored-by: nisarhassan12 <[email protected]> Co-authored-by: Nisar Hassan Naqvi <[email protected]> Co-authored-by: Furaha Damién <[email protected]> Co-authored-by: yeongmo-j <[email protected]> Co-authored-by: shellhub <[email protected]> Co-authored-by: qwerty50000a <[email protected]> Co-authored-by: Lucas <[email protected]> Co-authored-by: Ayush Varshney <[email protected]> Co-authored-by: Jas <[email protected]> Co-authored-by: Matheus Muriel <[email protected]> Co-authored-by: salonilakhotia <[email protected]> Co-authored-by: UntouchedOdin0 <[email protected]> Co-authored-by: walter-ind <[email protected]> Co-authored-by: Nikita Naumov <[email protected]> Co-authored-by: Hemant Kumar <[email protected]> Co-authored-by: Chase Ganey <[email protected]> Co-authored-by: BryanChan777 <[email protected]> Co-authored-by: Arogon1 <[email protected]> Co-authored-by: valery noname <[email protected]> Co-authored-by: Christian Clauss <[email protected]> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Caesar <[email protected]> Co-authored-by: Dekas Dimitrios <[email protected]> Co-authored-by: Hassan <[email protected]> Co-authored-by: nikhil kala <[email protected]> Co-authored-by: Hakan Arslan <[email protected]> Co-authored-by: Wendell Lucas <[email protected]> Co-authored-by: Alexandra Englert <[email protected]> Co-authored-by: Wesllhey Holanda <[email protected]> Co-authored-by: markaster <[email protected]> Co-authored-by: LittleFoot <[email protected]> Co-authored-by: littleFoot1 <[email protected]> Co-authored-by: Moetez Skouri <[email protected]> Co-authored-by: Alaa El Bouhdidi <[email protected]> Co-authored-by: VTolas <[email protected]> Co-authored-by: ben <[email protected]> Co-authored-by: Vikrant Khedkar <[email protected]> Co-authored-by: Maria Lungeanu <[email protected]>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions! |
These are the bugs that detected by FindBugs in eclipse
1.1 High confidence(1):
Location: Line 32 in Matrix.java
System.out.println("m3=="MATRIX": " + m2.equals("MATRIX")); //false
Reason: Call to equals() comparing different types
Bug: Call to DataStructures.Matrix.Matrix.equals(String) in DataStructures.Matrix.Matrix.main(String[])
This method calls equals(Object) on two references of different class types and analysis suggests they will be to objects of different classes at runtime. Further, examination of the equals methods that would be invoked suggest that either this call will always return false, or else the equals method is not be symmetric (which is a property required by the contract for equals in class Object).
Rank: Scariest (1), confidence: High
Pattern: EC_UNRELATED_TYPES
Type: EC, Category: CORRECTNESS (Correctness)
1.2 Normal confidence(2):
1), Location: Line 35 in Matrix.java
System.out.println("m2==m2: " + m2.equals(m2)); //true
Reason: Self comparison of value with itself
Bug: Self comparison of DataStructures.Matrix.Matrix.equals(Matrix) with itself DataStructures.Matrix.Matrix.main(String[])
This method compares a local variable with itself, and may indicate a typo or a logic error. Make sure that you are comparing the right things.
Rank: Scariest (3), confidence: Normal
Pattern: SA_LOCAL_SELF_COMPARISON
Type: SA, Category: CORRECTNESS (Correctness)
2), Location: Line 19 in CirclLinkedList.java
head = new Node(null,head);
Reason: Uninitialized read of field constructor
Bug: Uninitialized read of head in new DataStructures.Lists.CircleLinkedList()
This constructor reads a field which has not yet been assigned a value. This is often caused when the programmer mistakenly uses the field instead of one of the constructor's parameters.
Rank: Scariest (3), confidence: Normal
Pattern: UR_UNINIT_READ
Type: UR, Category: CORRECTNESS (Correctness)
2.1 High confidence(7):
Location: Line 337 in AES.java
int cellBitsLength = cellBits.length();
while (cellBitsLength < 8) {
cellBits = '0' + cellBits;
}
Reason: An apparent infinite loop
Bug: There is an apparent infinite loop in ciphers.AES.mergeCellsIntoBlock(int[])
This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).
Rank: Scary (8), confidence: High
Pattern: IL_INFINITE_LOOP
Type: IL, Category: CORRECTNESS (Correctness)
Location: Line 223 in AES.java
int currentByteBitsLength = currentByteBits.length();
while (currentByteBitsLength < 2) {
currentByteBits = '0' + currentByteBits;
}
Reason: An apparent infinite loop
Bug: There is an apparent infinite loop in ciphers.AES.scheduleCore(BigInteger, int)
This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).
Rank: Scary (8), confidence: High
Pattern: IL_INFINITE_LOOP
Type: IL, Category: CORRECTNESS (Correctness)
Location: Line 206 in AES.java
int rBytesLength = rBytes.length();
while (rBytesLength < 8) {
rBytes = "0" + rBytes;
}
Reason: An apparent infinite loop
Bug: There is an apparent infinite loop in ciphers.AES.scheduleCore(BigInteger, int)
This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).
Rank: Scary (8), confidence: High
Pattern: IL_INFINITE_LOOP
Type: IL, Category: CORRECTNESS (Correctness)
Location: Line 308 AES.java
int blockBitsLength = blockBits.length();
while (rBytesLength < 8) {
rBytes = "0" + rBytes;
}
Reason: An apparent infinite loop
Bug: There is an apparent infinite loop in ciphers.AES. splitBlockIntoCells(BigInteger)
This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).
Rank: Scary (8), confidence: High
Pattern: IL_INFINITE_LOOP
Type: IL, Category: CORRECTNESS (Correctness)
Location: Line 70 StackOfLinkedList.java
Node temp = head;
head = head.next;
Reason: Possible null pointer dereference
Bug: Possible null pointer dereference of temp in DataStructures.Stacks.LinkedListStack.pop()
There is a branch of statement that, if executed, guarantees that a null value will be dereferenced, which would generate a NullPointerException when the code is executed. Of course, the problem might be that the branch or statement is infeasible and that the null pointer exception can't ever be executed; deciding that is beyond the ability of FindBugs.
Rank: Scary (6), confidence: High
Pattern: NP_NULL_ON_SOME_PATH
Type: NP, Category: CORRECTNESS (Correctness)
Location: Line 90 DoublyLinkedList.java
head = head.next; // oldHead <--> 2ndElement(head)
head.previous = null; // oldHead --> 2ndElement(head) nothing pointing at old head so will be removed
Reason: Nullcheck of value pervious dereferenced
Bug: Nullcheck of DoublyLinkedList.head at line 91 of value previously dereferenced in DataStructures.Lists.DoublyLinkedList.deleteHead()
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.
Rank: Scary (9), confidence: High
Pattern: RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
Type: RCN, Category: CORRECTNESS (Correctness)
Location: Line 104 DoublyLinkedList.java
Link temp = tail;
tail = tail.previous; // 2ndLast(tail) <--> oldTail --> null
tail.next = null; // 2ndLast(tail) --> null
Reason: Nullcheck of value pervious dereferenced
Bug: Nullcheck of DoublyLinkedList.head at line 91 of value previously dereferenced in DataStructures.Lists.DoublyLinkedList.deleteHead()
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.
Rank: Scary (9), confidence: High
Pattern: RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
Type: RCN, Category: CORRECTNESS (Correctness)
2.2 Normal confidence(3):
if (this.getRows() != other.getRows() || this.getColumns() != other.getColumns())
return false;
Reason: Covariant equals() method defined , Object equals(Object) inherited
Bug: DataStructures.Matrix.Matrix defines equals(Matrix) method and uses Object.equals(Object)
This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class. The class should probably define a boolean equals(Object) method.
Rank: Scary (8), confidence: Normal
Pattern: EQ_SELF_USE_OBJECT
Type: Eq, Category: CORRECTNESS (Correctness)
return (this.key == otherHeapElement.key) && (this.additionalInfo.equals(otherHeapElement.additionalInfo));
Reason: Covariant equals() method defined , Object equals(Object) inherited
Bug: DataStructures.Heaps.HeapElement defines equals(HeapElement) method and uses Object.equals(Object)
This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class. The class should probably define a boolean equals(Object) method.
Rank: Scary (8), confidence: Normal
Pattern: EQ_SELF_USE_OBJECT
Type: Eq, Category: CORRECTNESS (Correctness)
System.out.println("m2==null: " + m2.equals(null)); //false
Reason: Method call passes null for non-null parameter
Bug: Null passed for non-null parameter of equals(Matrix) in DataStructures.Matrix.Matrix.main(String[])
A possibly-null value is passed at a call site where all known target methods require the parameter to be non-null. Either the parameter is annotated as a parameter that should always be non-null, or analysis has shown that it will always be dereferenced.
Rank: Scary (8), confidence: Normal
Pattern: NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS
Type: NP, Category: CORRECTNESS (Correctness)
3.1 High confidence(1)
Double[] decimalArray = {8.2, 1.5, 3.14159265, 9.3, 5.1, 4.8, 2.6};
Reason: Rough value of known constant found
Bug: Rough value of Math.PI found: 3.14159265
It's recommended to use the predefined library constant for code clarity and better precision.
Rank: Troubling (14), confidence: High
Pattern: CNT_ROUGH_CONSTANT_VALUE
Type: CNT, Category: BAD_PRACTICE (Bad practice)
3.2 Normal confidence(4):
Location: Line 19 Foo.java
if (Integer.toString(50) == Byte.toString(b[i]))
Reason: Comparison of String objects using == or ! =
Bug: Comparison of String objects using == or != in test.Foo.bar()
This code compares java.lang.String objects for reference equality using the == or != operators. Unless both strings are either constants in a source file, or have been interned using the String.intern() method, the same string value may be represented by two different String objects. Consider using the equals(Object) method instead.
Rank: Troubling (11), confidence: Normal
Pattern: ES_COMPARING_STRINGS_WITH_EQ
Type: ES, Category: BAD_PRACTICE (Bad practice)
Location: Line 53 TopKWords.java
fis.close();
Reason: Value is null and guaranteed to be dereferenced on exception path
Bug: fis is null guaranteed to be dereferenced in Others.TopKWords$CountWords.getDictionary() on exception path
There is a statement or branch on an exception path that if executed guarantees that a value is null at this point, and that value that is guaranteed to be dereferenced (except on forward paths involving runtime exceptions).
Rank: Troubling (11), confidence: Normal
Pattern: NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH
Type: NP, Category: CORRECTNESS (Correctness)
Location: Line 32 removeDuplicateFromString.java
if(s.isEmpty() || s == null) {
return s;
}
Reason: Nullcheck of value previously dereferenced
Bug: Nullcheck of s at line 32 of value previously dereferenced in Others.removeDuplicateFromString.removeDuplicate(String)
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.
Rank: Troubling (11), confidence: Normal
Pattern: RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
Type: RCN, Category: CORRECTNESS (Correctness)
Location: Line 32 removeDuplicateFromString.java
if(str.isEmpty() || str == null) return str;
Reason: Nullcheck of value previously dereferenced
Bug: Nullcheck of str at line 22 of value previously dereferenced in Others.ReverseString.reverse(String)
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.
Rank: Troubling (11), confidence: Normal
Pattern: RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
Type: RCN, Category: CORRECTNESS (Correctness)
4.1 High confidence(7):
Location: Line 118 CSVFile.java
ArrayList colums = new ArrayList();
Reason: Dead store to local variable
Bug: Dead store to colums in new DataStructures.CSVFile.src.CSVFile(File, char)
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 FindBugs is a bytecode-based tool, there is no easy way to eliminate these false positives.
Rank: Of Concern (15), confidence: High
Pattern: DLS_DEAD_LOCAL_STORE
Type: DLS, Category: STYLE (Dodgy code)
Location: Line 146 TestCSVFile.java
CSVFile testObj = new CSVFile("testData4.csv",',');
Reason: Dead store to local variable
Bug: Dead store to testObj in DataStructures.CSVFile.src.TestCSVFile.testRemoving()
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 FindBugs is a bytecode-based tool, there is no easy way to eliminate these false positives.
Rank: Of Concern (15), confidence: High
Pattern: DLS_DEAD_LOCAL_STORE
Type: DLS, Category: STYLE (Dodgy code)
Location: Line 93 NodeStack.java
NodeStack.head = NodeStack.head.getPrevious();
Reason: Write to static field from instance method
Bug: Write to static field DataStructures.Stacks.NodeStack.head from instance method DataStructures.Stacks.NodeStack.pop()
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.
Rank: Of Concern (15), confidence: High
Pattern: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
Type: ST, Category: STYLE (Dodgy code)
Location: Line 78 NodeStack.java
NodeStack.head = newNs;
Reason: Write to static field from instance method
Bug: Write to static field DataStructures.Stacks.NodeStack.head from instance method DataStructures.Stacks.NodeStack.push(Object)
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.
Rank: Of Concern (15), confidence: High
Pattern: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
Type: ST, Category: STYLE (Dodgy code)
Location: Line 269 ClosesPair.java
minNum = length;
Reason: Write to static field from instance method
Bug: Write to static field divideconquer.ClosestPair.minNum from instance method divideconquer.ClosestPair.bruteForce(ClosestPair$Location[])
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.
Rank: Of Concern (15), confidence: High
Pattern: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
Type: ST, Category: STYLE (Dodgy code)
Location: Line 232 ClosesPair.java
minNum = length;
Reason: Write to static field from instance method
Bug: Write to static field divideconquer.ClosestPair.minNum from instance method divideconquer.ClosestPair.closestPair(ClosestPair$Location[], int)
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.
Rank: Of Concern (15), confidence: High
Pattern: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
Type: ST, Category: STYLE (Dodgy code)
Location: Line 195 NodeStack.java
if (xGap < minValue) {
secondCount++; // size of the array
}
Reason: Write to static field from instance method
Bug: Write to static field divideconquer.ClosestPair.secondCount from instance method divideconquer.ClosestPair.closestPair(ClosestPair$Location[], int)
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.
Rank: Of Concern (15), confidence: High
Pattern: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
Type: ST, Category: STYLE (Dodgy code)
4.2 Normal confidence(4):
Location: Line 21 AnyBaseToDecimal.java
System.out.println("Decimal value of " + inp + " is: " + convertToDecimal(inp, base));
Reason: Dereference of result of readLine() without nullcheck
Bug: Dereference of the result of readLine() without nullcheck in Conversions.AnyBaseToDecimal.main(String[])
The result of invoking readLine() is dereferenced without checking to see if the result is null. If there are no more lines of text to read, readLine() will return null and dereferencing that will generate a null pointer exception.
Rank: Of Concern (15), confidence: Normal
Pattern: NP_DEREFERENCE_OF_READLINE_VALUE
Type: NP, Category: STYLE (Dodgy code)
Location: Line 28 MinimizingLateness.java
indexCount = Integer.parseInt(ch); // The first line specifies the size of the operation (= the size of the array)
Reason: Dereference of result of readLine() without nullcheck
Bug: Dereference of the result of readLine() without nullcheck in MinimizingLateness.MinimizingLateness.main(String[])
The result of invoking readLine() is dereferenced without checking to see if the result is null. If there are no more lines of text to read, readLine() will return null and dereferencing that will generate a null pointer exception.
Rank: Of Concern (15), confidence: Normal
Pattern: NP_DEREFERENCE_OF_READLINE_VALUE
Type: NP, Category: STYLE (Dodgy code)
Location: Line 18 removeDuplicateFromString.java
System.out.println("String after removing duplicates: " + removeDuplicate(inp_str));
Reason: Dereference of result of readLine() without nullcheck
Bug: Dereference of the result of readLine() without nullcheck in Others.removeDuplicateFromString.main(String[])
The result of invoking readLine() is dereferenced without checking to see if the result is null. If there are no more lines of text to read, readLine() will return null and dereferencing that will generate a null pointer exception.
Rank: Of Concern (15), confidence: Normal
Pattern: NP_DEREFERENCE_OF_READLINE_VALUE
Type: NP, Category: STYLE (Dodgy code)
Location: Line 44 ReverseString.java
System.out.println("Reverse="+reverse(srr));
Reason: Dereference of result of readLine() without nullcheck
Bug: Dereference of the result of readLine() without nullcheck in Others.ReverseString.main(String[])
The result of invoking readLine() is dereferenced without checking to see if the result is null. If there are no more lines of text to read, readLine() will return null and dereferencing that will generate a null pointer exception.
Rank: Of Concern (15), confidence: Normal
Pattern: NP_DEREFERENCE_OF_READLINE_VALUE
Type: NP, Category: STYLE (Dodgy code)
The text was updated successfully, but these errors were encountered: