Bug 745842 (EDG-59) - byte array storage problem via rest server module
Summary: byte array storage problem via rest server module
Keywords:
Status: CLOSED NEXTRELEASE
Alias: EDG-59
Product: JBoss Data Grid 5
Classification: JBoss
Component: Infinispan
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: EAP 5.1.0 EDG TP
Assignee: Default User
QA Contact:
URL: http://jira.jboss.org/jira/browse/EDG-59
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-10 14:12 UTC by Michal Linhard
Modified: 2014-03-17 04:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-14 17:08:08 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker EDG-59 0 Major Closed byte array storage problem via rest server module 2014-05-14 13:11:07 UTC

Description Michal Linhard 2011-01-10 14:12:11 UTC
project_key: EDG

infinispan 4.2.0.FINAL issue:

when I want to store byte array in the serialized form (mimetype: application/x-java-serialized-object) I can't get it back, because rest server returns it in raw form instead of serialized form. 

see https://github.com/infinispan/infinispan/blob/4.2.0.FINAL/server/rest/src/main/scala/org/infinispan/rest/Server.scala, line 44-50.

the process is like this:
1. PUT bytearray in serialized form
2. rest server deserializes the bytearray and stores it in deserialized (raw) form
3. GET byte array (expecting serialized form)
4. rest server retrieves the byte array in raw form but doesn't serialize it, instead streams it in raw form - because of the above mentioned code.

Comment 2 Galder Zamarreño 2011-01-11 17:21:25 UTC
Link: Added: This issue depends ISPN-872


Comment 3 Galder Zamarreño 2011-01-12 15:06:38 UTC
Michal, fyi, you can do comparison of contents of arrays via this static method:

java.util.Arrays.equals(serializedData, serializedDataBack);

This is much better than looping through the byte array yourself comparing each byte.

Comment 4 Michal Linhard 2011-01-12 15:19:51 UTC
cool, thx :-) I knew there must be a nicer way!

Comment 5 Galder Zamarreño 2011-01-12 16:15:46 UTC
Michal, just something I wanted to verify about your test. 

When you execute it and you trace it through, the get() op, in line 39 of Server.scala, it returns an application/xml variant in your case as well?

Comment 6 Galder Zamarreño 2011-01-12 16:20:23 UTC
Can you try your test making sure that you add this header in the get request?

get.setRequestHeader("Accept", "application/x-java-serialized-object")

Comment 7 Galder Zamarreño 2011-01-12 16:26:52 UTC
Something else is needed on top of that.

Comment 8 Michal Linhard 2011-01-12 17:44:56 UTC
updated the test, still the same result ...


Note You need to log in before you can comment on or make changes to this bug.