FindBugs Report

Produced using FindBugs3.0.1.

Project:

Metrics

188 lines of code analyzed, in 5 classes, in 1 packages.

Metric Total Density*
High Priority Warnings NaN
Medium Priority Warnings NaN
Low Priority Warnings 2 10.64
Total Warnings 2 10.64

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



Summary

Warning Type Number
Performance Warnings 1
Dodgy code Warnings 1
Total 2



Warnings

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

Performance Warnings

Warning Priority Details
Could be refactored into a static inner class Low

The class groovyx.net.http.OkHttpBuilder$OkHttpFromServer could be refactored into a _static_ inner class


In file OkHttpBuilder.java, lines 249 to 312
In class groovyx.net.http.OkHttpBuilder$OkHttpFromServer
At OkHttpBuilder.java:[lines 249-312]



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.OkHttpBuilder.execute(Function, ChainedHttpConfig)


In file OkHttpBuilder.java, line 244
In class groovyx.net.http.OkHttpBuilder
In method groovyx.net.http.OkHttpBuilder.execute(Function, ChainedHttpConfig)
At OkHttpBuilder.java:[line 244]





Warning Types

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.