Simple changes from code inspection

git-svn-id: https://zxing.googlecode.com/svn/trunk@2899 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-10-13 22:15:01 +00:00
parent 21500405d5
commit ad24a551aa
4 changed files with 6 additions and 33 deletions

View file

@ -47,12 +47,7 @@ public final class ExpandedProductResultParser extends ResultParser {
// ExtendedProductParsedResult NOT created. Not a RSS Expanded barcode
return null;
}
// Really neither of these should happen:
String rawText = getMassagedText(result);
if (rawText == null) {
// ExtendedProductParsedResult NOT created. Input text is NULL
return null;
}
String productID = null;
String sscc = null;

View file

@ -20,6 +20,7 @@ import com.google.zxing.Result;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -245,13 +246,12 @@ public final class VCardResultParser extends ResultParser {
byte[] fragmentBytes = fragmentBuffer.toByteArray();
String fragment;
if (charset == null) {
fragment = new String(fragmentBytes);
fragment = new String(fragmentBytes, Charset.forName("UTF-8"));
} else {
try {
fragment = new String(fragmentBytes, charset);
} catch (UnsupportedEncodingException e) {
// Yikes, well try anyway:
fragment = new String(fragmentBytes);
fragment = new String(fragmentBytes, Charset.forName("UTF-8"));
}
}
fragmentBuffer.reset();

View file

@ -88,9 +88,6 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
for (ResultPoint[] points : detectorResult.getPoints()) {
DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
if (decoderResult == null) {
throw NotFoundException.getNotFoundInstance();
}
Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();

View file

@ -100,17 +100,13 @@ final class DecodedBitStreamParser {
codeIndex = textCompaction(codewords, codeIndex, result);
break;
case BYTE_COMPACTION_MODE_LATCH:
case BYTE_COMPACTION_MODE_LATCH_6:
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
codeIndex = byteCompaction(code, codewords, codeIndex, result);
break;
case NUMERIC_COMPACTION_MODE_LATCH:
codeIndex = numericCompaction(codewords, codeIndex, result);
break;
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
codeIndex = byteCompaction(code, codewords, codeIndex, result);
break;
case BYTE_COMPACTION_MODE_LATCH_6:
codeIndex = byteCompaction(code, codewords, codeIndex, result);
break;
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata);
break;
@ -220,21 +216,10 @@ final class DecodedBitStreamParser {
textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH;
break;
case BYTE_COMPACTION_MODE_LATCH:
codeIndex--;
end = true;
break;
case BYTE_COMPACTION_MODE_LATCH_6:
case NUMERIC_COMPACTION_MODE_LATCH:
codeIndex--;
end = true;
break;
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
codeIndex--;
end = true;
break;
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
codeIndex--;
end = true;
break;
case MACRO_PDF417_TERMINATOR:
codeIndex--;
end = true;
@ -251,10 +236,6 @@ final class DecodedBitStreamParser {
byteCompactionData[index] = code;
index++;
break;
case BYTE_COMPACTION_MODE_LATCH_6:
codeIndex--;
end = true;
break;
}
}
}