...
diff --git a/release-notes/VERSION b/release-notes/VERSION index ae666fe..dffd5d3 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION
@@ -18,6 +18,7 @@ class loader and Class.forName, as necessary * [JACKSON-803]: Problems with Smile, parsing of long names (reported by D Lam) + * [JACKSON-804]: Allow byte range up to 255, for interoperability with unsigned bytes ------------------------------------------------------------------------ === History: ===
diff --git a/src/java/org/codehaus/jackson/JsonParser.java b/src/java/org/codehaus/jackson/JsonParser.java index a48f236..b8e221c 100644 --- a/src/java/org/codehaus/jackson/JsonParser.java +++ b/src/java/org/codehaus/jackson/JsonParser.java
@@ -33,7 +33,8 @@ implements Closeable, Versioned { private final static int MIN_BYTE_I = (int) Byte.MIN_VALUE; - private final static int MAX_BYTE_I = (int) Byte.MAX_VALUE; + // [JACKSON-804]: allow range up to 255 (instead of Java's 127) for better interoperability + private final static int MAX_BYTE_I = 255; private final static int MIN_SHORT_I = (int) Short.MIN_VALUE; private final static int MAX_SHORT_I = (int) Short.MAX_VALUE;
diff --git a/src/mapper/java/org/codehaus/jackson/map/deser/std/StdDeserializer.java b/src/mapper/java/org/codehaus/jackson/map/deser/std/StdDeserializer.java index 40dce9b..fa0aacf 100644 --- a/src/mapper/java/org/codehaus/jackson/map/deser/std/StdDeserializer.java +++ b/src/mapper/java/org/codehaus/jackson/map/deser/std/StdDeserializer.java
@@ -202,7 +202,8 @@ throw ctxt.weirdStringException(_valueClass, "not a valid Byte value"); } // So far so good: but does it fit? - if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { + // as per [JACKSON-804], allow range up to 255, inclusive + if (value < Byte.MIN_VALUE || value > 255) { throw ctxt.weirdStringException(_valueClass, "overflow, value can not be represented as 8-bit value"); } return Byte.valueOf((byte) value);
diff --git a/src/mapper/java/org/codehaus/jackson/map/deser/std/StdKeyDeserializer.java b/src/mapper/java/org/codehaus/jackson/map/deser/std/StdKeyDeserializer.java index 524a3f2..7639b7c 100644 --- a/src/mapper/java/org/codehaus/jackson/map/deser/std/StdKeyDeserializer.java +++ b/src/mapper/java/org/codehaus/jackson/map/deser/std/StdKeyDeserializer.java
@@ -128,7 +128,8 @@ public Byte _parse(String key, DeserializationContext ctxt) throws JsonMappingException { int value = _parseInt(key); - if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { + // as per [JACKSON-804], allow range up to 255, inclusive + if (value < Byte.MIN_VALUE || value > 255) { throw ctxt.weirdKeyException(_keyClass, key, "overflow, value can not be represented as 8-bit value"); } return Byte.valueOf((byte) value);