[infinispan-issues] [JBoss JIRA] (ISPN-4159) DefaultTwoWayKey2StringMapper encodes objects to strings in a manner that is incompatible with string handling of some databases

Tristan Tarrant (JIRA) issues at jboss.org
Tue May 17 08:22:14 EDT 2016


     [ https://issues.jboss.org/browse/ISPN-4159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tristan Tarrant updated ISPN-4159:
----------------------------------
    Fix Version/s: 9.0.0.Alpha3
                       (was: 9.0.0.Alpha2)


> DefaultTwoWayKey2StringMapper encodes objects to strings in a manner that is incompatible with string handling of some databases
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ISPN-4159
>                 URL: https://issues.jboss.org/browse/ISPN-4159
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Loaders and Stores
>    Affects Versions: 6.0.0.Final
>            Reporter: Adrian Nistor
>            Assignee: Adrian Nistor
>             Fix For: 9.0.0.Alpha3
>
>
> DefaultTwoWayKey2StringMapper uses two neat tricks. 
> 1. it does not encode all supported types, it only encodes non-Strings. Strings are kept unmodified.
> 2. it uses a special prefix (unicode char 0xfeff) to mark which strings were encoded and which are plain.
> Unfortunately some databases, notably MySql, interpret the endianness mark (0xfeff, 0xfffe), convert to native byte order and then drop it. 
> This leaves us with no clue the string is not an actual String but an encoded representation of another type. This misinterpretation leads later to ClassCastExceptions in various places in core and user code.
> Proposed fix: get rid of #1 and #2 optimisations. Encode all objects, including Strings and always use the ?n prefix (where n stands for the original type). Drop the 0xFEFF marker prefix.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the infinispan-issues mailing list