Project Information
Project:
FindBugs version: 3.0.1
Code analyzed:
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\connector\Connector.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\connector\ConnectorContext.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\connector\ConnectRecord.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\connector\Task.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\ConnectSchema$1.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\ConnectSchema.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Date.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Decimal.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Field.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Schema$1.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Schema$Type.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Schema.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\SchemaAndValue.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\SchemaBuilder.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\SchemaProjector$1.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\SchemaProjector.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Struct.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Time.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\data\Timestamp.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\AlreadyExistsException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\ConnectException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\DataException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\IllegalWorkerStateException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\NotFoundException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\RetriableException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\SchemaBuilderException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\errors\SchemaProjectorException.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\sink\SinkConnector.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\sink\SinkRecord.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\sink\SinkTask.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\sink\SinkTaskContext.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\source\SourceConnector.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\source\SourceRecord.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\source\SourceTask.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\source\SourceTaskContext.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\storage\Converter.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\storage\OffsetStorageReader.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\storage\StringConverter.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\transforms\Transformation.class
- C:\Users\daanr\Desktop\kafka-trunk\connect\api\build\classes\main\org\apache\kafka\connect\util\ConnectorUtils.class
Metrics
1149 lines of code analyzed,
in 40 classes,
in 8 packages.
| High Priority Warnings |
1 |
0.87 |
| Medium Priority Warnings |
5 |
4.35 |
|
Total Warnings
|
6
|
5.22
|
(* Defects per Thousand lines of non-commenting source statements)
Contents
Summary
Warnings
Click on a warning row to see full context information.
|
IC
|
Initialization of org.apache.kafka.connect.data.Schema accesses class org.apache.kafka.connect.data.SchemaBuilder, which isn't initialized yet |
|
Bug type IC_SUPERCLASS_USES_SUBCLASS_DURING_INITIALIZATION (click for details)
In class org.apache.kafka.connect.data.Schema In method org.apache.kafka.connect.data.Schema.<static initializer for Schema>() In class org.apache.kafka.connect.data.SchemaBuilder At Schema.java:[line 135] Another occurrence at Schema.java:[line 136] Another occurrence at Schema.java:[line 137] Another occurrence at Schema.java:[line 138] Another occurrence at Schema.java:[line 139] Another occurrence at Schema.java:[line 140] Another occurrence at Schema.java:[line 141] Another occurrence at Schema.java:[line 142] Another occurrence at Schema.java:[line 143] Another occurrence at Schema.java:[line 145] Another occurrence at Schema.java:[line 146] Another occurrence at Schema.java:[line 147] Another occurrence at Schema.java:[line 148] Another occurrence at Schema.java:[line 149] Another occurrence at Schema.java:[line 150] Another occurrence at Schema.java:[line 151] Another occurrence at Schema.java:[line 152] Another occurrence at Schema.java:[line 153]
|
|
ICAST
|
int converted to long and passed as absolute time to new java.util.Date(long) in org.apache.kafka.connect.data.Time.toLogical(Schema, int) |
|
Bug type ICAST_INT_2_LONG_AS_INSTANT (click for details)
In class org.apache.kafka.connect.data.Time In method org.apache.kafka.connect.data.Time.toLogical(Schema, int) Called method new java.util.Date(long) Local variable named value At Time.java:[line 74]
|
|
Bx
|
Primitive boxed just to call toString in org.apache.kafka.connect.data.Decimal.builder(int) |
|
Bug type DM_BOXED_PRIMITIVE_TOSTRING (click for details)
In class org.apache.kafka.connect.data.Decimal In method org.apache.kafka.connect.data.Decimal.builder(int) Called method Integer.toString() Should call Integer.toString(int) instead At Decimal.java:[line 53]
|
A boxed primitive is allocated just to call toString(). It is more effective to just use the static
form of toString which takes the primitive value. So,
| Replace... | With this... |
| new Integer(1).toString() | Integer.toString(1) |
| new Long(1).toString() | Long.toString(1) |
| new Float(1.0).toString() | Float.toString(1.0) |
| new Double(1.0).toString() | Double.toString(1.0) |
| new Byte(1).toString() | Byte.toString(1) |
| new Short(1).toString() | Short.toString(1) |
| new Boolean(true).toString() | Boolean.toString(true) |
During the initialization of a class, the class makes an active use of a subclass.
That subclass will not yet be initialized at the time of this use.
For example, in the following code, foo will be null.
public class CircularClassInitialization {
static class InnerClassSingleton extends CircularClassInitialization {
static InnerClassSingleton singleton = new InnerClassSingleton();
}
static CircularClassInitialization foo = InnerClassSingleton.singleton;
}
This code converts a 32-bit int value to a 64-bit long value, and then
passes that value for a method parameter that requires an absolute time value.
An absolute time value is the number
of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
For example, the following method, intended to convert seconds since the epoch into a Date, is badly
broken:
Date getDate(int seconds) { return new Date(seconds * 1000); }
The multiplication is done using 32-bit arithmetic, and then converted to a 64-bit value.
When a 32-bit value is converted to 64-bits and used to express an absolute time
value, only dates in December 1969 and January 1970 can be represented.
Correct implementations for the above method are:
// Fails for dates after 2037
Date getDate(int seconds) { return new Date(seconds * 1000L); }
// better, works for all dates
Date getDate(long seconds) { return new Date(seconds * 1000); }
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.