GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Mismatch between MessagePack str and Java String · Issue #890 · msgpack/msgpack-java Open DescriptionOverviewThe msgpack specification defines the
But in Java:
The difference here is a msgpack str value can carry any arbitrary array of bytes while Java enforces a character set encoding on its String objects. This means that a msgpack str allows byte arrays that cannot be properly decoded to Java Strings. Why does this matter?As the popularity of Redis grows beyond mere caching, Redis functions become an important feature for performing multiple operations in a single atomic unit of work. The definition of the FCALL/FCALL_RO commands have a list of keys and arguments that are order-based and consequently strongly couple the function code to the calling code. This can be alleviated greatly by using msgpack to send complex objects to a Redis function as its argument(s). Redis functions bring together the Lua programming language for server-side functions with the cmsgpack library for encoding and decoding data. Java enters the picture with multiple libraries including Spring Data Redis, Jedis, and Lettuce. But when Jackson deserializes this str value it decodes it into a String. At this point we lose fidelity because the byte array behind the Lua string and msgpack str does not match the byte array behind the Java String-- Java has converted the byte[] into a String using a character encoding that has character substitution logic to shoehorn the invalid data into the String. So how can this be fixed?It seems easy-- the MessagePackParser should read every string object just like a binary object-- into a byte[]. Then when Jackson matches this to a data type, for any String objects it can proceed using the same conversion logic as it currently employs by default; but when the target of deserialization has a byte[] data type, the raw bytes can be supplied directly. This would allow what is currently not possible using Jackson deserialization of msgpack objects -- reading in data from Redis values that do not correspond to valid Java Strings. Our current use case looks like the following:
ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |