public void run() { logger = MaryUtils.getLogger("server"); try { OutputStreamWriter clientUTFOutput = new OutputStreamWriter(client.getOutputStream(), "UTF-8"); clientOut = new PrintWriter(clientUTFOutput, true); handle(); } catch (UnsupportedEncodingException ex) { throw new AssertionError("UTF-8 is always a supported encoding."); } catch (Exception e) { logger.info("Error parsing request:", e); if (clientOut == null) { logger.info("Cannot write to client."); } else { clientOut.println("Error parsing request:"); clientOut.println(e.getMessage()); } } finally { // info Sockets must not be closed before the corresponding data socket is here and the request parsed: // FileUtils.close(client, clientOut); } }
public void run() { logger = MaryUtils.getLogger("server"); try { OutputStreamWriter clientUTFOutput = new OutputStreamWriter(client.getOutputStream(), "UTF-8"); clientOut = new PrintWriter(clientUTFOutput, true); handle(); } catch (UnsupportedEncodingException ex) { throw new AssertionError("UTF-8 is always a supported encoding."); } catch (Exception e) { logger.info("Error parsing request:", e); if (clientOut == null) { logger.info("Cannot write to client."); } else { clientOut.println("Error parsing request:"); clientOut.println(e.getMessage()); } } finally { // info Sockets must not be closed before the corresponding data socket is here and the request parsed: // FileUtils.close(client, clientOut); } }
public void run() { logger = MaryUtils.getLogger("server"); try { OutputStreamWriter clientUTFOutput = new OutputStreamWriter(client.getOutputStream(), "UTF-8"); clientOut = new PrintWriter(clientUTFOutput, true); handle(); } catch (UnsupportedEncodingException ex) { throw new AssertionError("UTF-8 is always a supported encoding."); } catch (Exception e) { logger.info("Error parsing request:", e); if (clientOut == null) { logger.info("Cannot write to client."); } else { clientOut.println("Error parsing request:"); clientOut.println(e.getMessage()); } } finally { // info Sockets must not be closed before the corresponding data socket is here and the request parsed: // FileUtils.close(client, clientOut); } }