Hi Gabriel,

 

I have just fixed your original issue causing the object conversion to fail.
It wasn’t due to the internal HTTP connector, but to the logic converting an
OutputStream into an InputStream located in the BioUtils class.

 

Thanks for the report, this was a subtle yet potentially nasty bug impacting
all OutputRepresentation subclasses such as :

·         EmfRepresentation

·         FormDataSet

·         JaxRsOutputRepresentation

·         ObjectRepresentation

 

This is now fixed in 2.0/2.1/master, including a non-regression test. 

 

Best regards,

Jerome

--

 <http://www.restlet.com/> http://www.restlet.com

 <http://twitter.com/#!/jlouvel> http://twitter.com/#!/jlouvel

 

 

 

De : Thierry Boileau [mailto:[email protected]] 
Envoyé : mercredi 8 février 2012 12:22
À : [email protected]
Objet : Re: ObjectRepresentation with int negative returns null

 

Hello Gabriel,

I think that this error is due to the internal HTTP server connector.  This
connector is not completly stabilized, and I suggest you to add a proofed
one such as jetty or simple.
Just complete the classpath with the extension jar
(org.restlet.ext.jetty.jar or org.restlet.ext.simple.jar) and its
dependencies (org.eclipse.jetty.jar or org.simpleframework.jar).
I've entered an issue for that
(http://restlet.tigris.org/issues/show_bug.cgi?id=1371).

Best regards,
Thierry Boileau

 

Hi Gabriel,

I've found a problem with the default converter. If you add the jackson
extension, you will notice that this client code works:
ContactResource resource = cr.wrap(ContactResource.class);
Contact contact = resource.retrieve();

In this case, the client and the server exchange a json representation of
the contact which is automatically deserialized on client side.
Regarding the default converter that supports the exchange of serialized
Java objects, it is based on the java.io.ObjectInputStream class. It seems
that it goes to a premature end of stream exception.

Best regards,
THierry Boileau





 

Hi Gabriel,

I've also tested using NetBeans 7.1 and JDK 1.6. I've just opened your test
project and added jars from the "jse"edition, release2.0.11. It works nicely
for me. I don't know what to think about it...

Best regards,
Thierry Boileau

 

 

Hello Gabriel,

that's really weird, I've tried your sample code, and it simply works for
me. I've just created an Eclipse project with your source code and added
the org.restlet.jar taken from 2.0.11 version.
I will try in a servlet container, then in Netbeans.
Once added the jackson extension, your client test code is also able to
retrieve a json representation of the Contact, with correct values.

Best regards,
Thierry Boileau

 

 

Hello,

I've attached a file with a very simple example based in the restlet example
from the restlet web.

In this example a very simple server is run that exposes the Contact
resource as a Java Object representation.
If the Contact resource that is retrieved by the client has any int field
with a negative value (in the example attached I've changed the age field on
the ContactServerResorce to be a "-1" ) then when the client tries to
retrieve the Contact, it is always null.
If the age field is positive the contact is retrieved without problem.
I've test this in windows and linux, JDK 1.6 and JDK1.7, with
restletjse2.1RC2 and the nightshot. Also with the 2.0.10, and it always is
null if any integer is negative in the POJO.

Also if I change the int for a double, it works.
This is making me crazy.
Can anybody help me please?
Thank you in advance
Gabriel
PD: the attached file is a netbeans project, however it is not need to
compile the source.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447
<http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2918
603> &dsMessageId=2918603

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2951163

Reply via email to