A small tip for upgrading your XPages apps from 8.5.1 to 8.5.2

If you have been using Stephan Wissel's "Web Agents, XPages Style" technique for outputting non-HTML content from your XPages, you may run into a problem when you upgrade your server to 8.5.2.

In the original afterRenderResponse sample code, you would use something like...

try{
    var exCon = facesContext.getExternalContext(); 
    var writer = facesContext.getResponseWriter();
    var response = exCon.getResponse();
    response.setContentType("text/plain");
    writer.write("Hello World");
    writer.close();
}catch(e){
    _dump(e);
}

What you may find is running that code on your lovely new 8.5.2 server will result in an Error 500 with no detail of the error itself. To fix the problem, simple remove the

writer.close();

line from the source code and you should be good to go.