Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.97 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. BufferedWriter - Stream closed prematurely during program execution
  2. public class RestHandler  {
  3. public static BufferedWriter rest_logger;
  4.  
  5. public RestHandler(parsedXMLConfigData _config, BufferedWriter writer) {
  6.     rest_logger = writer;
  7.     try {
  8.         rest_logger.write("RestHandler instance finished init and ready to receive calls!" + "n");
  9.     } catch (IOException e) {
  10.         // TODO Auto-generated catch block
  11.         e.printStackTrace();
  12.     }
  13. }
  14.        
  15. @POST
  16. @Path("{subResources: [a-zA-Z0-9_/]+}")
  17. public void postHandler
  18. (
  19.         @Context final UriInfo uriInfo,
  20.         @PathParam("subResources") String subResources) {
  21.  
  22.     try {
  23.         rest_logger.write("TEXT...");
  24.     } catch (IOException e) {
  25.         // TODO Auto-generated catch block
  26.         e.printStackTrace();
  27.     }
  28.     }
  29.        
  30. protected void finalize() throws Throwable {
  31.     rest_logger.close();
  32. }
  33.        
  34. rest_logger = new BufferedWriter(new FileWriter("rest_logger.txt"));
  35. rest_logger = writer;
  36.        
  37. rest_logger = writer;