Hello,
I've just started trying out restlets. Looks cool so far.
I ran into a snag and wanted to ask if this is a bug or I'm missing
something.

I defined some variants like so:
myVariants  = new ArrayList<Representation>();
myVariants.add(new StringTemplateRepresentation("First: ${first} Last: 
${last}", model, MediaType.TEXT_PLAIN));
myVariants.add(new StringTemplateRepresentation("<xml><name first=\"${first}\" 
last=\"${last}\"></></xml>", model, MediaType.TEXT_XML));

The variants are used correctly but I get a NPE in the
StringTemplateRepresentation because the character set is null.

java.lang.NullPointerException
        at 
org.restlet.resource.StringTemplateRepresentation.write(StringTemplateRepresentation.java:161)
        at 
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:226)
        at 
com.noelios.restlet.ext.simple.SimpleCall.sendResponse(SimpleCall.java:169)
        at 
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:86)
        at 
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:88)
        at 
com.noelios.restlet.ext.simple.SimpleServerHelper.handle(SimpleServerHelper.java:131)
        at simple.http.Dispatcher.run(Dispatcher.java:83)
        at simple.util.process.Daemon.execute(Daemon.java:121)
        at simple.util.process.Daemon.run(Daemon.java:106)


This is the problem line:
OutputStreamWriter osw = new OutputStreamWriter(outputStream, 
getCharacterSet().getName());

Seems like there should be a null check?

Thanks,
Chris
-- 
Chris Grindstaff | http://gstaff.org

Reply via email to