Revision: 8004 http://languagetool.svn.sourceforge.net/languagetool/?rev=8004&view=rev Author: dnaber Date: 2012-09-08 23:46:43 +0000 (Sat, 08 Sep 2012) Log Message: ----------- tiny code cleanup: close http exchange in finally block
Modified Paths: -------------- trunk/JLanguageTool/src/main/java/org/languagetool/server/LanguageToolHttpHandler.java Modified: trunk/JLanguageTool/src/main/java/org/languagetool/server/LanguageToolHttpHandler.java =================================================================== --- trunk/JLanguageTool/src/main/java/org/languagetool/server/LanguageToolHttpHandler.java 2012-09-08 23:43:51 UTC (rev 8003) +++ trunk/JLanguageTool/src/main/java/org/languagetool/server/LanguageToolHttpHandler.java 2012-09-08 23:46:43 UTC (rev 8004) @@ -1,9 +1,6 @@ package org.languagetool.server; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; +import java.io.*; import java.net.HttpURLConnection; import java.net.URI; import java.net.URLDecoder; @@ -85,6 +82,7 @@ e.printStackTrace(); final String response = "Error: " + StringTools.escapeXML(Tools.getFullStackTrace(e)); sendError(httpExchange, HttpURLConnection.HTTP_INTERNAL_ERROR, response); + } finally { httpExchange.close(); } print("Check done in " + (System.currentTimeMillis() - timeStart) + "ms"); @@ -123,7 +121,6 @@ final String response = getSupportedLanguagesAsXML(); httpExchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, response.getBytes(ENCODING).length); httpExchange.getResponseBody().write(response.getBytes(ENCODING)); - httpExchange.close(); } private void checkText(String text, HttpExchange httpExchange, Map<String, String> parameters) throws Exception { @@ -179,7 +176,6 @@ CONTEXT_SIZE, StringTools.XmlPrintMode.NORMAL_XML); httpExchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, response.getBytes(ENCODING).length); httpExchange.getResponseBody().write(response.getBytes(ENCODING)); - httpExchange.close(); } private Map<String, String> parseQuery(String query) throws UnsupportedEncodingException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Languagetool-cvs mailing list Languagetool-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-cvs