Java

Java

Made by DeepSource
Attempt to close a null value detected JAVA-S0250
Bug risk
Critical

close() is being invoked on a value that is always null. If this statement is executed, a null pointer exception will occur. Another serious issue is the fact that the resource that is meant to be closed is not closed.

Value is always null JAVA-S0249
Bug risk
Critical

A null pointer is dereferenced here. This will lead to a NullPointerException when the code is executed.

Impossible downcast of toArray() result detected JAVA-S0386
Bug risk
Critical

This code is casting the result of calling toArray() on a collection to a subtype of Object[], as in:

BigDecimal constructed from double may be imprecise JAVA-S0008
Bug risk
Major

BigDecimals constructed from a double may not be represented correctly.

System.exit() should only be invoked within application entry points JAVA-S0060
Bug risk
Major

This method invokes System.exit(), and is called by other code. This can prevent proper error handling and debugging.

equals method does not handle null valued operands JAVA-S0110
Bug risk
Critical

This implementation of equals violates the contract defined by java.lang.Object.equals because it does not check for null being passed as the argument.

Database resource may not be closed on return JAVA-S0326
Bug risk
Critical

The method creates a database resource (such as a database connection or row) but does not appear to do any of the following: * Assign the resource to any fields

readLine() result is read without a null check JAVA-S0220
Bug risk
Critical

The result of invoking readLine() is read without checking to see if it is null.

Possibly null fields should not be synchronized on JAVA-E1060
Bug risk
Critical

There is a null check for a field which is being synchronized on. Since the field is synchronized on, it is unlikely that it will be null. If it is null and then synchronized on, a NullPointerException will be thrown on synchronization and the check would be pointless.

Incorrect combination of Math.max and Math.min JAVA-S0080
Bug risk
Critical

This code tries to limit the value bounds using a construct such as:

Increment of volatile field is not atomic JAVA-S0028
Bug risk
Major

An increment to a volatile field isn't atomic.

Adding elements of an entry set may fail due to reuse of Entry objects JS0425
Bug risk
Major

The entrySet() method is allowed to return a view of the underlying Map in which a single Entry object is reused and returned during the iteration. As of Java 1.6, commonly used map structures may return the same entry object while iterating over their entrySet. When iterating through such a Map, the Entry value is only valid until you advance to the next iteration.

Repeated conditional test on the same variable detected JAVA-S0034
Bug risk
Major

The code contains a conditional test that is performed twice, one right after the other.

Elements accessed from volatile reference to an array are not volatile JAVA-S0027
Bug risk
Major

A volatile reference to an array doesn't treat the array elements as volatile.

Invocation of equals() on an array, which is equivalent to == JAVA-S0348
Bug risk
Major

This method invokes the .equals(Object o) method on an array. Since arrays do not override the equals method of Object, calling equals on an array is the same as comparing their addresses. To compare the contents of the arrays, use java.util.Arrays.equals(Object[], Object[]). To compare the addresses of the arrays, it would be less confusing to explicitly check pointer equality using ==.

For loop appears to check one variable and increment another JAVA-S0214
Bug risk
Major

There is a complicated, subtle or wrong increment in this for loop. Are you sure this for loop is incrementing the correct variable? It appears that another variable is being initialized and checked by the for loop.

Use of member identifier that is a keyword in later Java versions JAVA-S0050
Bug risk
Major

This identifier is reserved as a keyword in later versions of Java. If/when this code is migrated to a newer Java version, it will not compile unless the identifier is renamed.

Clone method does not invoke super method JAVA-S0048
Bug risk
Critical

Non-final class defines a clone method that does not call super.clone.

Static initializer creates instance before all static final fields are assigned JAVA-S0267
Bug risk
Critical

The class's static initializer creates an instance of the class before all of the static final fields are assigned. This may easily lead to a scenario where the static instance of this class may be used while in a partially constructed state.

Value is guaranteed to be accessed while null after an exception is thrown JAVA-S0266
Bug risk
Critical

There is a statement or branch within a catch block which, if executed, guarantees that the variable accessed at this point will be null, unless a runtime exception is thrown (for any reason) before the access.