SpotBugs (3.1.3)
Analysis for
SpotBugs Analysis generated at: Sun, 19 Aug 2018 23:03:48 +0200
Package |
Code Size |
Bugs |
High Prio Bugs |
Medium Prio Bugs |
Low Prio Bugs |
Exp. Bugs |
Overall
(34 packages),
(146 classes)
|
4107 |
20 |
3 |
17 |
|
|
org.pidome.server.entities.users |
121 |
1 |
|
1 |
|
|
org.pidome.server.env |
192 |
3 |
1 |
2 |
|
|
org.pidome.server.services |
184 |
1 |
1 |
|
|
|
org.pidome.server.services.cluster |
132 |
2 |
|
2 |
|
|
org.pidome.server.services.http.api.controllers |
243 |
1 |
|
1 |
|
|
org.pidome.server.services.http.api.response |
76 |
1 |
|
1 |
|
|
org.pidome.server.system.hardware |
196 |
2 |
|
2 |
|
|
org.pidome.server.system.hardware.serial |
157 |
3 |
|
3 |
|
|
org.pidome.server.system.hardware.usb |
149 |
1 |
|
1 |
|
|
org.pidome.server.system.hardware.usb.linux |
271 |
4 |
|
4 |
|
|
org.pidome.server.system.logging |
75 |
1 |
1 |
|
|
|
High Prio
Medium Prio
Low Prio
Exp.
High Prio
Medium Prio
Low Prio
Exp.
UrF / URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD
This field is never read.
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.
Nm / NM_CLASS_NAMING_CONVENTION
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
WMI / WMI_WRONG_MAP_ITERATOR
This method accesses the value of a Map entry, using a key that was retrieved from
a keySet iterator. It is more efficient to use an iterator on the entrySet of the map, to avoid the
Map.get(key) lookup.
NP / NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
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.
Nm / NM_METHOD_NAMING_CONVENTION
Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.
REC / REC_CATCH_EXCEPTION
This method uses a try-catch block that catches Exception objects, but Exception is not
thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to
say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception
each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well,
masking potential bugs.
A better approach is to either explicitly catch the specific exceptions that are thrown,
or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below:
try {
...
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
... deal with all non-runtime exceptions ...
}
RCN / RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
This method contains a redundant check of a known non-null value against
the constant null.
EI / EI_EXPOSE_REP
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.
DMI / DMI_HARDCODED_ABSOLUTE_FILENAME
This code constructs a File object using a hard coded to an absolute pathname
(e.g., new File("/home/dannyc/workspace/j2ee/src/share/com/sun/enterprise/deployment");
UuF / UUF_UNUSED_FIELD
This field is never used. Consider removing it from the class.
Nm / NM_CLASS_NOT_EXCEPTION
This class is not derived from another exception, but ends with 'Exception'. This will
be confusing to users of this class.
Dm / DM_DEFAULT_ENCODING
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.
SF / SF_SWITCH_NO_DEFAULT
This method contains a switch statement where default case is missing.
Usually you need to provide a default case.
Because the analysis only looks at the generated bytecode, this warning can be incorrect triggered if
the default case is at the end of the switch statement and the switch statement doesn't contain break statements for other
cases.
RV / RV_RETURN_VALUE_IGNORED_BAD_PRACTICE
This method returns a value that is not checked. The return value should be checked
since it can indicate an unusual or unexpected function execution. For
example, the File.delete()
method returns false
if the file could not be successfully deleted (rather than
throwing an Exception).
If you don't check the result, you won't notice if the method invocation
signals unexpected behavior by returning an atypical return value.
In class org.pidome.server.entities.users.UserLogin
In method org.pidome.server.entities.users.UserLogin.getModified()
Field org.pidome.server.entities.users.UserLogin.modified
At UserLogin.java:[line 269]
org.pidome.server.entities.users.UserLogin.getModified() may expose internal representation by returning UserLogin.modified
In class org.pidome.server.env.Platform
In method org.pidome.server.env.Platform.setPlatform()
File name /etc
At Platform.java:[line 167]
Hard coded reference to an absolute pathname in org.pidome.server.env.Platform.setPlatform()
In class org.pidome.server.env.Platform
In method org.pidome.server.env.Platform.setPlatform()
Called method new java.io.InputStreamReader(InputStream)
At Platform.java:[line 169]
Found reliance on default encoding in org.pidome.server.env.Platform.setPlatform(): new java.io.InputStreamReader(InputStream)
In class org.pidome.server.env.Platform
In method org.pidome.server.env.Platform.setPlatform()
At Platform.java:[line 177]
Exception is caught when Exception is not thrown in org.pidome.server.env.Platform.setPlatform()
In class org.pidome.server.services.ServiceHandler
In method org.pidome.server.services.ServiceHandler.stopService(PiDomeService)
Actual type org.pidome.server.services.PiDomeService
Expected org.pidome.server.services.AbstractService
Called method java.util.concurrent.ConcurrentHashMap.contains(Object)
Invoked on org.pidome.server.services.ServiceHandler.services
service passed as argument
Enum.equals(Object) used to determine equality
At ServiceHandler.java:[line 224]
PiDomeService is incompatible with expected argument type AbstractService in org.pidome.server.services.ServiceHandler.stopService(PiDomeService)
In class org.pidome.server.services.cluster.HostInformation
Field org.pidome.server.services.cluster.HostInformation.clusterMaster
In HostInformation.java
Unused field: org.pidome.server.services.cluster.HostInformation.clusterMaster
In class org.pidome.server.services.cluster.HostInformation
Field org.pidome.server.services.cluster.HostInformation.nodeId
In HostInformation.java
Unused field: org.pidome.server.services.cluster.HostInformation.nodeId
In class org.pidome.server.services.http.api.controllers.AuthApiController
In method org.pidome.server.services.http.api.controllers.AuthApiController.authenticate(LoginObject, HttpServerResponse, RoutingContext)
Value loaded from login
Return value of com.j256.ormlite.stmt.Where.queryForFirst() of type Object
Redundant null check at AuthApiController.java:[line 126]
Redundant nullcheck of login, which is known to be non-null in org.pidome.server.services.http.api.controllers.AuthApiController.authenticate(LoginObject, HttpServerResponse, RoutingContext)
In class org.pidome.server.services.http.api.response.DefaultRestException
At DefaultRestException.java:[lines 29-49]
Class org.pidome.server.services.http.api.response.DefaultRestException is not derived from an Exception, even though it is named as such
In class org.pidome.server.system.hardware.HardwareRoot
In method org.pidome.server.system.hardware.HardwareRoot.HardwareMutation(Peripheral, HardwareRoot$Mutation)
At HardwareRoot.java:[lines 141-149]
The method name org.pidome.server.system.hardware.HardwareRoot.HardwareMutation(Peripheral, HardwareRoot$Mutation) doesn't start with a lower case letter
In class org.pidome.server.system.hardware.HardwareRoot
In method org.pidome.server.system.hardware.HardwareRoot.HardwareMutation(Peripheral, HardwareRoot$Mutation)
At HardwareRoot.java:[lines 141-146]
Switch statement found in org.pidome.server.system.hardware.HardwareRoot.HardwareMutation(Peripheral, HardwareRoot$Mutation) where default case is missing
In class org.pidome.server.system.hardware.serial.CustomSerialDevices
In method org.pidome.server.system.hardware.serial.CustomSerialDevices.lambda$discover$3(File)
Called method java.io.File.delete()
At CustomSerialDevices.java:[line 87]
Another occurrence at CustomSerialDevices.java:[line 92]
Exceptional return value of java.io.File.delete() ignored in org.pidome.server.system.hardware.serial.CustomSerialDevices.lambda$discover$3(File)
In class org.pidome.server.system.hardware.serial.CustomSerialDevices
In method org.pidome.server.system.hardware.serial.CustomSerialDevices.stop()
Field org.pidome.server.system.hardware.serial.CustomSerialDevices.deviceCollection
At CustomSerialDevices.java:[line 141]
org.pidome.server.system.hardware.serial.CustomSerialDevices.stop() makes inefficient use of keySet iterator instead of entrySet iterator
In class org.pidome.server.system.hardware.serial.SerialUtils
In method org.pidome.server.system.hardware.serial.SerialUtils.discoverPorts()
Value loaded from listOfFiles
Dereferenced at SerialUtils.java:[line 54]
Known null at SerialUtils.java:[line 52]
Possible null pointer dereference in org.pidome.server.system.hardware.serial.SerialUtils.discoverPorts() due to return value of called method
In class org.pidome.server.system.hardware.usb.USBDevices
In method org.pidome.server.system.hardware.usb.USBDevices.deviceMutation(HardwareRoot$Mutation, Transport$SubSystem, String, String, String, String, String, String)
At USBDevices.java:[lines 94-138]
Switch statement found in org.pidome.server.system.hardware.usb.USBDevices.deviceMutation(HardwareRoot$Mutation, Transport$SubSystem, String, String, String, String, String, String) where default case is missing
In class org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval
At LinuxUsbCFuncsImpl.java:[lines 82-91]
The class name org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval doesn't start with an upper case letter
In class org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval
Field org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval.tv_sec
At LinuxUsbCFuncsImpl.java:[line 89]
Unread public/protected field: org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval.tv_sec
In class org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval
Field org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval.tv_usec
At LinuxUsbCFuncsImpl.java:[line 90]
Unread public/protected field: org.pidome.server.system.hardware.usb.linux.LinuxUsbCFuncsImpl$LinuxCLib$timeval.tv_usec
In class org.pidome.server.system.hardware.usb.linux.LinuxUsbUdevLib$udev
At LinuxUsbUdevLib.java:[lines 232-237]
The class name org.pidome.server.system.hardware.usb.linux.LinuxUsbUdevLib$udev doesn't start with an upper case letter
In class org.pidome.server.system.logging.ColoredConsoleLogger
In method org.pidome.server.system.logging.ColoredConsoleLogger.append(LogEvent)
Called method new String(byte[])
At ColoredConsoleLogger.java:[line 122]
Another occurrence at ColoredConsoleLogger.java:[line 124]
Another occurrence at ColoredConsoleLogger.java:[line 126]
Another occurrence at ColoredConsoleLogger.java:[line 128]
Another occurrence at ColoredConsoleLogger.java:[line 130]
Another occurrence at ColoredConsoleLogger.java:[line 134]
Another occurrence at ColoredConsoleLogger.java:[line 136]
Found reliance on default encoding in org.pidome.server.system.logging.ColoredConsoleLogger.append(LogEvent): new String(byte[])