Hi! I am using JCR-OCM and have to store binaries in Jackrabbit. Therefore I have a class BinaryDocument which has a property "byte[] data". The class is being mapped to a node with node type "nt:resource" and the data property is mapped to its field "jcr:property". Furthermore I have properties encoding, lastModified and mimeType mapped to their counterparts in nt:resource.
Ok, I am accessing Jackrabbit via RMI which is the reason why I used byte[] as data type for the actual binary data. What I do in my client is reading a file (let's say a PDF) into a byte array, put that byte array into my BinaryDocument object, send it over RMI to my stateless session bean, which then persists it via Jackrabbit-OCM. Now if I load this data again from my session bean and write it back into a file I can't open it anymore. I assume there is some encoding / charset mismatch somewhere on the way. As I only read and write byte arrays I thought there's no operation in my client that actually changes the binary stream in any way. Looking at the OCM sources I saw that ByteArrayTypeConverterImpl creates the JCR value as follows: String value = new String(byte[]) propValue); valueFactory.createValue(value); Is it possible that this operation is being done using the wrong charset for my file? Well, that's just a wild guess, I could honestly be totally wrong. I would be thankful for any pointers. Are there people doing the same, like storing binaries with OCM using byte[] for the jcr:data? Am I missing something? Thanks in advance Hendrik
