mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -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 {
|
||||
String text = result.getText();
|
||||
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 {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue