NullPointerException from converter when passing empty form in 2.0 RC3

2010-05-06 Thread Jean-Baptiste Dusseaut
Hi, 

Since Restlet 2.0RC3, ConverterService throws a nullPointerException when 
attempting to resolve an empty form. 

Here is a short code exemple : 

ClientResource resource = new ClientResource("uri");
resource.post(new Form()); 


>From the server side, the post handle looks like this : 

@Post create(Form form) {
 // do stuff
}


And finally, the stack trace we got : 

java.lang.NullPointerException
at 
org.restlet.engine.util.FormReader.readNextParameter(FormReader.java:221)
at org.restlet.engine.util.FormReader.addParameters(FormReader.java:132)
at org.restlet.engine.util.FormUtils.parse(FormUtils.java:266)
at org.restlet.data.Form.(Form.java:82)
at 
org.restlet.engine.converter.DefaultConverter.toObject(DefaultConverter.java:253)
at 
org.restlet.service.ConverterService.toObject(ConverterService.java:156)
at org.restlet.resource.ServerResource.doHandle(ServerResource.java:402)
at org.restlet.resource.ServerResource.post(ServerResource.java:1047)


The question is, okay we really want a well formed form here, but it seems to 
us that throwing a nullpointer when receiving en empty form is a bit to 
excessive :)

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


RE: NullPointerException from converter when passing empty form in 2.0 RC3

2010-05-12 Thread Jean-Baptiste Dusseaut
ok thanks.

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


Form and null pointer, again

2010-06-02 Thread Jean-Baptiste Dusseaut
This bug from RC 3 is now fixed 
(http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2604056),
 good job. 

Still, I have a question. There is no longer a NullPointerException coming from 
the depth of restlet, but the form passes to the @put method is null. Of 
course, we can check if the form is null, but a form is a collection of 
parameter. It seems more natural to have an empty form rather than a null form. 
It's a rule I think described in Effective Java, and i'm quite agree with it.

Anyway, RC4 is a great release, we found no additional bug in it :)

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