SpotBugs Report

Produced using SpotBugs3.1.0-RC6.

Project:

Metrics

281 lines of code analyzed, in 7 classes, in 1 packages.

Metric Total Density*
High Priority Warnings NaN
Medium Priority Warnings 2 7.12
Low Priority Warnings 4 14.23
Total Warnings 6 21.35

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



Summary

Warning Type Number
Internationalization Warnings 1
Performance Warnings 3
Dodgy code Warnings 2
Total 6



Warnings

Click on each warning link to see a full description of the issue, and details of how to resolve it.

Internationalization Warnings

Warning Priority Details
Consider using Locale parameterized version of invoked method Low

Use of non-localized String.toUpperCase() or String.toLowerCase() in groovyx.net.http.ApacheHttpBuilder.addHeaders(ChainedHttpConfig$ChainedRequest, HttpUriRequest)


In file ApacheHttpBuilder.java, line 485
In class groovyx.net.http.ApacheHttpBuilder
In method groovyx.net.http.ApacheHttpBuilder.addHeaders(ChainedHttpConfig$ChainedRequest, HttpUriRequest)
At ApacheHttpBuilder.java:[line 485]



Performance Warnings

Warning Priority Details
Should be a static inner class Medium

Should groovyx.net.http.ApacheHttpBuilder$SocksHttp be a _static_ inner class?


In file ApacheHttpBuilder.java, lines 141 to 147
In class groovyx.net.http.ApacheHttpBuilder$SocksHttp
At ApacheHttpBuilder.java:[lines 141-147]

Should be a static inner class Medium

Should groovyx.net.http.ApacheHttpBuilder$SocksHttps be a _static_ inner class?


In file ApacheHttpBuilder.java, lines 154 to 161
In class groovyx.net.http.ApacheHttpBuilder$SocksHttps
At ApacheHttpBuilder.java:[lines 154-161]

Could be refactored into a static inner class Low

The class groovyx.net.http.ApacheHttpBuilder$ApacheFromServer could be refactored into a _static_ inner class


In file ApacheHttpBuilder.java, lines 202 to 251
In class groovyx.net.http.ApacheHttpBuilder$ApacheFromServer
At ApacheHttpBuilder.java:[lines 202-251]



Dodgy code Warnings

Warning Priority Details
Exception is caught when Exception is not thrown Low

Exception is caught when Exception is not thrown in groovyx.net.http.ApacheHttpBuilder.exec(ChainedHttpConfig, Function)


In file ApacheHttpBuilder.java, line 464
In class groovyx.net.http.ApacheHttpBuilder
In method groovyx.net.http.ApacheHttpBuilder.exec(ChainedHttpConfig, Function)
At ApacheHttpBuilder.java:[line 464]

Field not initialized in constructor but dereferenced without null check Low

ApacheHttpBuilder$ApacheToServer.bytes not initialized in constructor and dereferenced in groovyx.net.http.ApacheHttpBuilder$ApacheToServer.getContentLength()


In file ApacheHttpBuilder.java, line 280
In class groovyx.net.http.ApacheHttpBuilder$ApacheToServer
Field groovyx.net.http.ApacheHttpBuilder$ApacheToServer.bytes
In method groovyx.net.http.ApacheHttpBuilder$ApacheToServer.getContentLength()
At ApacheHttpBuilder.java:[line 280]





Warning Types

Consider using Locale parameterized version of invoked method

A String is being converted to upper or lowercase, using the platform's default encoding. This may result in improper conversions when used with international characters. Use the

versions instead.



Exception is caught when Exception is not thrown

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 ...
}



Could be refactored into a static inner class

This class is an inner class, but does not use its embedded reference to the object which created it except during construction of the inner object.  This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary.  If possible, the class should be made into a static inner class. Since the reference to the outer object is required during construction of the inner instance, the inner class will need to be refactored so as to pass a reference to the outer instance to the constructor for the inner class.



Should be a static inner class

This class is an inner class, but does not use its embedded reference to the object which created it.  This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary.  If possible, the class should be made static.



Field not initialized in constructor but dereferenced without null check

This field is never initialized within any constructor, and is therefore could be null after the object is constructed. Elsewhere, it is loaded and dereferenced without a null check. This could be a either an error or a questionable design, since it means a null pointer exception will be generated if that field is dereferenced before being initialized.