|
|
@ -1925,10 +1925,10 @@ public class JsonFormat { |
|
|
|
// Try to interpret the value as a number.
|
|
|
|
// Try to interpret the value as a number.
|
|
|
|
try { |
|
|
|
try { |
|
|
|
int numericValue = parseInt32(json); |
|
|
|
int numericValue = parseInt32(json); |
|
|
|
if (enumDescriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO3) { |
|
|
|
if (enumDescriptor.isClosed()) { |
|
|
|
result = enumDescriptor.findValueByNumberCreatingIfUnknown(numericValue); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
result = enumDescriptor.findValueByNumber(numericValue); |
|
|
|
result = enumDescriptor.findValueByNumber(numericValue); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
result = enumDescriptor.findValueByNumberCreatingIfUnknown(numericValue); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (InvalidProtocolBufferException e) { |
|
|
|
} catch (InvalidProtocolBufferException e) { |
|
|
|
// Fall through. This exception is about invalid int32 value we get from parseInt32() but
|
|
|
|
// Fall through. This exception is about invalid int32 value we get from parseInt32() but
|
|
|
|