mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Issue #217: copy result metadata (like EAN extension) even when return EAN-13 as UPC-A
This commit is contained in:
parent
c99e635482
commit
2c2c395afa
|
@ -77,7 +77,11 @@ public final class UPCAReader extends UPCEANReader {
|
||||||
private static Result maybeReturnResult(Result result) throws FormatException {
|
private static Result maybeReturnResult(Result result) throws FormatException {
|
||||||
String text = result.getText();
|
String text = result.getText();
|
||||||
if (text.charAt(0) == '0') {
|
if (text.charAt(0) == '0') {
|
||||||
return new Result(text.substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A);
|
Result upcaResult = new Result(text.substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A);
|
||||||
|
if (result.getResultMetadata() != null) {
|
||||||
|
upcaResult.putAllMetadata(result.getResultMetadata());
|
||||||
|
}
|
||||||
|
return upcaResult;
|
||||||
} else {
|
} else {
|
||||||
throw FormatException.getFormatInstance();
|
throw FormatException.getFormatInstance();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue