SpotBugs Report

Project Information

Project: ActiveMQ :: Openwire Generator

SpotBugs version: 4.8.3

Code analyzed:



Metrics

3074 lines of code analyzed, in 22 classes, in 1 packages.

Metric Total Density*
High Priority Warnings 5 1.63
Medium Priority Warnings 13 4.23
Total Warnings 18 5.86

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



Contents

Summary

Warning Type Number
Bad practice Warnings 3
Correctness Warnings 5
Internationalization Warnings 3
Malicious code vulnerability Warnings 6
Dodgy code Warnings 1
Total 18

Warnings

Click on a warning row to see full context information.

Bad practice Warnings

Code Warning
ES Comparison of String objects using == or != in org.apache.activemq.openwire.tool.JavaTestsGenerator.generateFile(PrintWriter)
RV Exceptional return value of java.io.File.mkdirs() ignored in org.apache.activemq.openwire.tool.MultiSourceGenerator.run()
RV Exceptional return value of java.io.File.mkdirs() ignored in org.apache.activemq.openwire.tool.SingleSourceGenerator.run()

Correctness Warnings

Code Warning
MF Field CGeneratorTask.target masks field in superclass org.apache.tools.ant.Task
MF Field CSharpGeneratorTask.target masks field in superclass org.apache.tools.ant.Task
MF Field CSharpMarshallingGenerator.targetDir masks field in superclass org.apache.activemq.openwire.tool.JavaMarshallingGenerator
MF Field CppGeneratorTask.target masks field in superclass org.apache.tools.ant.Task
MF Field CppMarshallingHeadersGenerator.targetDir masks field in superclass org.apache.activemq.openwire.tool.JavaMarshallingGenerator

Internationalization Warnings

Code Warning
Dm Found reliance on default encoding in org.apache.activemq.openwire.tool.JavaMarshallingGenerator.processFactory(): new java.io.FileWriter(File)
Dm Found reliance on default encoding in org.apache.activemq.openwire.tool.MultiSourceGenerator.processClass(JClass): new java.io.FileWriter(File)
Dm Found reliance on default encoding in org.apache.activemq.openwire.tool.SingleSourceGenerator.run(): new java.io.FileWriter(File)

Malicious code vulnerability Warnings

Code Warning
EI org.apache.activemq.openwire.tool.JavaMarshallingGenerator.getConcreteClasses() may expose internal representation by returning JavaMarshallingGenerator.concreteClasses
EI org.apache.activemq.openwire.tool.MultiSourceGenerator.getManuallyMaintainedClasses() may expose internal representation by returning MultiSourceGenerator.manuallyMaintainedClasses
EI org.apache.activemq.openwire.tool.SingleSourceGenerator.getManuallyMaintainedClasses() may expose internal representation by returning SingleSourceGenerator.manuallyMaintainedClasses
EI2 org.apache.activemq.openwire.tool.JavaMarshallingGenerator.setConcreteClasses(List) may expose internal representation by storing an externally mutable object into JavaMarshallingGenerator.concreteClasses
EI2 org.apache.activemq.openwire.tool.MultiSourceGenerator.setManuallyMaintainedClasses(Set) may expose internal representation by storing an externally mutable object into MultiSourceGenerator.manuallyMaintainedClasses
EI2 org.apache.activemq.openwire.tool.SingleSourceGenerator.setManuallyMaintainedClasses(Set) may expose internal representation by storing an externally mutable object into SingleSourceGenerator.manuallyMaintainedClasses

Dodgy code Warnings

Code Warning
UrF Unread public/protected field: org.apache.activemq.openwire.tool.MultiSourceGenerator.buffer

Details

DM_DEFAULT_ENCODING: Reliance on 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 behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.

EI_EXPOSE_REP: May expose internal representation by returning reference to mutable object

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.

EI_EXPOSE_REP2: May expose internal representation by incorporating reference to mutable object

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.

ES_COMPARING_STRINGS_WITH_EQ: Comparison of String objects using == or !=

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.

MF_CLASS_MASKS_FIELD: Class defines field that masks a superclass field

This class defines a field with the same name as a visible instance field in a superclass. This is confusing, and may indicate an error if methods update or access one of the fields when they wanted the other.

RV_RETURN_VALUE_IGNORED_BAD_PRACTICE: Method ignores exceptional return value

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.

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.