Skip to content

Commit

Permalink
Some more lgtm.com fixes/work-arounds
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 7, 2021
1 parent 78d096a commit 95b7620
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ protected final void _loadToHaveAtLeast(int minAvailable) throws IOException
// No input stream, no leading (either we are closed, or have non-stream input source)
if (_inputStream == null) {
_reportError("Needed to read %d bytes, reached end-of-input", minAvailable);
return; // never gets here, but sec tools complain without
}
while (_inputEnd < minAvailable) {
int count = _inputStream.read(_inputBuffer, _inputEnd, _inputBuffer.length - _inputEnd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ public static Schema simpleSchema(JsonFormatTypes type, JavaType hint)
return Schema.create(Schema.Type.NULL);
case NUMBER:
// 16-Feb-2017, tatu: Fixed as suggested by `baharclerode@github`
if (hint.hasRawClass(float.class)) {
return Schema.create(Schema.Type.FLOAT);
}
if (hint.hasRawClass(long.class)) {
return Schema.create(Schema.Type.LONG);
if (hint != null) {
if (hint.hasRawClass(float.class)) {
return Schema.create(Schema.Type.FLOAT);
}
if (hint.hasRawClass(long.class)) {
return Schema.create(Schema.Type.LONG);
}
}
return Schema.create(Schema.Type.DOUBLE);
case STRING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ public final void writeStartArray() throws IOException
}
if (_currField == null) { // just a sanity check
_reportError("Can not write START_ARRAY without field (message type "+_currMessage.getName()+")");
return; // never gets here but code analyzers can't see that
}
if (!_currField.isArray()) {
_reportError("Can not write START_ARRAY: field '"+_currField.name+"' not declared as 'repeated'");
Expand Down Expand Up @@ -568,6 +569,7 @@ private void _verifyArrayWrite(Object array) throws IOException
}
if (_currField == null) { // inlined _verifyValueWrite
_reportError("Can not write START_ARRAY without field (message type "+_currMessage.getName()+")");
return; // never gets here but need to help code analyzers
}
if (!_currField.isArray()) {
_reportError("Can not write START_ARRAY: field '"+_currField.name+"' not declared as 'repeated'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ public JsonToken nextToken() throws IOException
case STATE_INITIAL:
if (_schema == null) {
_reportError("No Schema has been assigned: can not decode content");
return null; // never gets here but needed for code analyzers benefit
}
_currentMessage = _schema.getRootType();
_currentField = _currentMessage.firstField();
Expand Down

0 comments on commit 95b7620

Please sign in to comment.