wyona / yanel

http://www.yanel.org
Apache License 2.0
10 stars 5 forks source link

Resources which write directly into the response need to make sure to close the InputStream in case there should be an error while writing #56

Open michaelwechner opened 11 years ago

michaelwechner commented 11 years ago

If a resource like for example

src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResourceV101.java

writes directly into the response (view.setResponse(false);)

and an error occurs while writing (for example because the client hangs up too early), then we need to make sure to close a possible InputStream.

Yanel itself cannot do this, because it does not have access to the InputStream, which is hidden by the resource.

Make sure the following resources are closing the InputStream

grep -rl "setResponse(false)" src/resources/* src/resources/davcollection/src/java/org/wyona/yanel/impl/resources/XmlViewResource.java src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResourceV101.java src/resources/pdf/src/java/org/wyona/yanel/impl/resources/PDFResource.java src/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResource.java src/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResourceV101.java src/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java

michaelwechner commented 10 years ago

The redirect resource are not using any InputStream

src/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResource.java src/resources/redirect/src/java/org/wyona/yanel/impl/resources/redirect/RedirectResourceV101.java