Hi all;

we have some errors since upgrading from restlet svn6565 to 2.0.0.
We managed to fix most of them (by making sure we 'exhaust' 
representations if not fully read, see the question Marc asked previous 
week).
But  there is one remaining issue.

Once in a while (cannot predict when), we get IO exceptions that prevent 
a resource from getting loaded. The stacktrace is this one:

java.io.IOException: Closed
         at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:138)
         at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:86)
         at org.restlet.engine.io.BioUtils.copy(BioUtils.java:74)
         at 
org.kauriproject.runtime.module.restservice.ModuleResourceRepresentation.write(ModuleResourceRepresentation.java:27)
         at 
org.restlet.engine.http.ServerCall.writeResponseBody(ServerCall.java:513)
         at 
org.restlet.engine.http.ServerCall.sendResponse(ServerCall.java:450)
         at 
org.restlet.ext.jetty.internal.JettyCall.sendResponse(JettyCall.java:327)
         at 
org.restlet.engine.http.adapter.ServerAdapter.commit(ServerAdapter.java:197)
         at 
org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:151)
         at 
org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:167)

Our representation is a simple extension of a StreamRepresentation:

public class ModuleResourceRepresentation extends StreamRepresentation {
     private ModuleSource.Resource resource;

     public ModuleResourceRepresentation(ModuleSource.Resource resource, 
MediaType mediaType) {
         super(mediaType);
         this.resource = resource;

     }

     public InputStream getStream() throws IOException {
         return resource.getInputStream();
     }

     public void write(OutputStream outputStream) throws IOException {
         BioUtils.copy(getStream(), outputStream);
     }


}

And this representation is handled in get:

                ModuleResourceRepresentation entity = new 
ModuleResourceRepresentation(resource, type);
                 response.setEntity(entity);
                 response.setStatus(Status.SUCCESS_OK);

I cannot find any way this stream is getting closed or released in our 
code. Does anyone have an idea how this comes?

freya

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

Reply via email to