SpotBugs Report

Project Information

Project:

SpotBugs version: 3.1.1

Code analyzed:



Metrics

1174 lines of code analyzed, in 32 classes, in 10 packages.

Metric Total Density*
High Priority Warnings 1 0.85
Medium Priority Warnings 14 11.93
Low Priority Warnings 4 3.41
Total Warnings 19 16.18

(* Defects per Thousand lines of non-commenting source statements)



Contents

Summary

Warning Type Number
Bad practice Warnings 4
Malicious code vulnerability Warnings 1
Dodgy code Warnings 14
Total 19

Warnings

Click on a warning row to see full context information.

Bad practice Warnings

Code Warning
OS org.openstreetmap.josm.plugins.streetside.oauth.OAuthPortListenerTest.responseTest() may fail to close stream
UI Usage of GetResource in org.openstreetmap.josm.plugins.streetside.utils.api.JsonImageDetectionDecoderTest.testDecodeImageDetections() may be unsafe if class is extended
UI Usage of GetResource in org.openstreetmap.josm.plugins.streetside.utils.api.JsonMapObjectDecoderTest.testDecodeMapObjects() may be unsafe if class is extended
UI Usage of GetResource in org.openstreetmap.josm.plugins.streetside.utils.api.JsonSequencesDecoderTest.testDecodeSequences() may be unsafe if class is extended

Malicious code vulnerability Warnings

Code Warning
DP Invocation of reflect.Field.setAccessible(boolean), which should be invoked from within a doPrivileged block, in org.openstreetmap.josm.plugins.streetside.utils.TestUtil.getAccessibleField(Class, String)

Dodgy code Warnings

Code Warning
DLS Dead store to keyField in org.openstreetmap.josm.plugins.streetside.model.MapObjectTest.setUp()
ST Write to static field org.openstreetmap.josm.plugins.streetside.model.MapObjectTest.iconUrlGen from instance method org.openstreetmap.josm.plugins.streetside.model.MapObjectTest.setUp()
ST Write to static field org.openstreetmap.josm.plugins.streetside.model.MapObjectTest.iconUrlGenValue from instance method org.openstreetmap.josm.plugins.streetside.model.MapObjectTest.setUp()
ST Write to static field org.openstreetmap.josm.Main.main from instance method org.openstreetmap.josm.plugins.streetside.utils.PluginStateTest.uploadTest()
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.cache.StreetsideCacheTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.gui.ImageDisplayTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.gui.StreetsidePreferenceSettingTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.history.StreetsideRecordTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.model.MapObjectTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImageTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.StreetsideDataTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.StreetsideLayerTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.utils.api.JsonMapObjectDecoderTest.rules
UrF Unread public/protected field: org.openstreetmap.josm.plugins.streetside.utils.StreetsidePropertiesTest.rules

Details

DLS_DEAD_LOCAL_STORE: Dead store to local variable

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.

DP_DO_INSIDE_DO_PRIVILEGED: Method invoked that should be only be invoked inside a doPrivileged block

This code invokes a method that requires a security permission check. If this code will be granted security permissions, but might be invoked by code that does not have security permissions, then the invocation needs to occur inside a doPrivileged block.

OS_OPEN_STREAM: Method may fail to close stream

The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method.  This may result in a file descriptor leak.  It is generally a good idea to use a finally block to ensure that streams are closed.

ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD: Write to static field from instance method

This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.

UI_INHERITANCE_UNSAFE_GETRESOURCE: Usage of GetResource may be unsafe if class is extended

Calling this.getClass().getResource(...) could give results other than expected if this class is extended by a class in another package.

URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD: Unread public/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.