Hi
To get a file from disk I wrote this code below. It works perfectly in
version 5.0.18 but it generates a null pointer in v5.1.0.5. I checked
the release notes to no avail. What's going on here?
Object onActionFromGetParticipantsFile() {
String method = "get";
try {
FileInputStream fInput = new FileInputStream(fileName);
byte[] bytes = new byte[fInput.available()];
fInput.read(bytes, 0, fInput.available());
if (bytes != null) {
ServletOutputStream stream =
response.getHTTPServletResponse().getOutputStream();
response.getHTTPServletResponse().setContentType("text/plain");
response.getHTTPServletResponse().setContentLength(bytes.length);
response.getHTTPServletResponse().setHeader("Content-Disposition",
method + ";filename=" +fileName;
stream.write(bytes);
**** Here it comes up with a null pointer, although the streanm object
exists as I checked that !
stream.flush();
stream.close();
return response;
}
} catch (Exception e) {
System.out.println("onActionFromGetFile; " + e);
}
return new TextStreamResponse("text/plain", String.format("file
" + fileName+ " not found"));
Marinus
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org