Fix some warnings from new inspection tool

This commit is contained in:
Sean Owen 2016-08-26 16:21:05 +01:00
parent 33fd85e0c2
commit 7b1e1ccadb
7 changed files with 17 additions and 23 deletions

View file

@ -39,10 +39,8 @@ public abstract class ReaderException extends Exception {
}
// Prevent stack traces from being taken
// srowen says: huh, my IDE is saying this is not an override. native methods can't be overridden?
// This, at least, does not hurt. Because we use a singleton pattern here, it doesn't matter anyhow.
@Override
public final Throwable fillInStackTrace() {
public final synchronized Throwable fillInStackTrace() {
return null;
}

View file

@ -470,7 +470,8 @@ public final class Detector {
boolean colorModel = image.get(p1.getX(), p1.getY());
for (int i = 0; i < d; i++) {
int iMax = (int) Math.ceil(d);
for (int i = 0; i < iMax; i++) {
px += dx;
py += dy;
if (image.get(MathUtils.round(px), MathUtils.round(py)) != colorModel) {

View file

@ -307,14 +307,11 @@ public final class BitMatrix implements Cloneable {
}
}
int width = right - left;
int height = bottom - top;
if (width < 0 || height < 0) {
if (right < left || bottom < top) {
return null;
}
return new int[] {left, top, width, height};
return new int[] {left, top, right - left, bottom - top};
}
/**

View file

@ -47,7 +47,7 @@ final class Base256Encoder implements Encoder {
if (context.hasMoreCharacters() || mustPad) {
if (dataCount <= 249) {
buffer.setCharAt(0, (char) dataCount);
} else if (dataCount > 249 && dataCount <= 1555) {
} else if (dataCount <= 1555) {
buffer.setCharAt(0, (char) ((dataCount / 250) + 249));
buffer.insert(1, (char) (dataCount % 250));
} else {

View file

@ -251,12 +251,12 @@ public final class HighLevelEncoder {
//step L
if (isDigit(c)) {
charCounts[ASCII_ENCODATION] += 0.5;
charCounts[ASCII_ENCODATION] += 0.5f;
} else if (isExtendedASCII(c)) {
charCounts[ASCII_ENCODATION] = (int) Math.ceil(charCounts[ASCII_ENCODATION]);
charCounts[ASCII_ENCODATION] += 2;
charCounts[ASCII_ENCODATION] = (float) Math.ceil(charCounts[ASCII_ENCODATION]);
charCounts[ASCII_ENCODATION] += 2.0f;
} else {
charCounts[ASCII_ENCODATION] = (int) Math.ceil(charCounts[ASCII_ENCODATION]);
charCounts[ASCII_ENCODATION] = (float) Math.ceil(charCounts[ASCII_ENCODATION]);
charCounts[ASCII_ENCODATION]++;
}
@ -298,7 +298,7 @@ public final class HighLevelEncoder {
// step Q
if (isSpecialB256(c)) {
charCounts[BASE256_ENCODATION] += 4;
charCounts[BASE256_ENCODATION] += 4.0f;
} else {
charCounts[BASE256_ENCODATION]++;
}

View file

@ -127,16 +127,14 @@ public final class RSSExpandedReader extends AbstractRSSReader {
this.pairs.clear();
this.startFromEven = false;
try {
List<ExpandedPair> pairs = decodeRow2pairs(rowNumber, row);
return constructResult(pairs);
return constructResult(decodeRow2pairs(rowNumber, row));
} catch (NotFoundException e) {
// OK
}
this.pairs.clear();
this.startFromEven = true;
List<ExpandedPair> pairs = decodeRow2pairs(rowNumber, row);
return constructResult(pairs);
return constructResult(decodeRow2pairs(rowNumber, row));
}
@Override

View file

@ -134,17 +134,17 @@ final class PDF417HighLevelEncoder {
static {
//Construct inverse lookups
Arrays.fill(MIXED, (byte) -1);
for (byte i = 0; i < TEXT_MIXED_RAW.length; i++) {
for (int i = 0; i < TEXT_MIXED_RAW.length; i++) {
byte b = TEXT_MIXED_RAW[i];
if (b > 0) {
MIXED[b] = i;
MIXED[b] = (byte) i;
}
}
Arrays.fill(PUNCTUATION, (byte) -1);
for (byte i = 0; i < TEXT_PUNCTUATION_RAW.length; i++) {
for (int i = 0; i < TEXT_PUNCTUATION_RAW.length; i++) {
byte b = TEXT_PUNCTUATION_RAW[i];
if (b > 0) {
PUNCTUATION[b] = i;
PUNCTUATION[b] = (byte) i;
}
}
}