W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2010

unicorn commit: ~ call disconnect() on HTTPURLConnection to observers, and close input stream after parsing!

From: Mercurial notifier <nobody@w3.org>
Date: Mon, 27 Sep 2010 16:35:54 +0000
To: Unicorn Updates <www-validator-cvs@w3.org>
Message-Id: <E1P0GgE-0000Q7-N2@blinky.w3.org>
changeset:   1523:285d3d950283
tag:         tip
user:        Thomas Gambet <tgambet@w3.org>
date:        Mon Sep 27 12:35:46 2010 -0400
files:       src/org/w3c/unicorn/request/URIRequest.java src/org/w3c/unicorn/response/impl/DefaultResponseXBeans.java
description:
~ call disconnect() on HTTPURLConnection to observers, and close input stream after parsing!


diff -r 96b36644f59b -r 285d3d950283 src/org/w3c/unicorn/request/URIRequest.java
--- a/src/org/w3c/unicorn/request/URIRequest.java	Mon Sep 27 10:11:33 2010 -0400
+++ b/src/org/w3c/unicorn/request/URIRequest.java	Mon Sep 27 12:35:46 2010 -0400
@@ -138,7 +138,9 @@
 						aURL.toString().replaceAll("&?" + Framework.mapOfObserver.get(observerId).getParamOutputName() + "=[^&]*", ""));
 			}
 			
-			return ResponseFactory.getResponse(aURLConnection.getInputStream(), responseType, aURL.toString(), aURLConnection.getContentEncoding(), observerId);
+			Response res = ResponseFactory.getResponse(aURLConnection.getInputStream(), responseType, aURL.toString(), aURLConnection.getContentEncoding(), observerId);
+			aURLConnection.disconnect();
+			return res;
 		
 		} catch (MalformedURLException e) {
 			throw new UnicornException(new Message(e));
diff -r 96b36644f59b -r 285d3d950283 src/org/w3c/unicorn/response/impl/DefaultResponseXBeans.java
--- a/src/org/w3c/unicorn/response/impl/DefaultResponseXBeans.java	Mon Sep 27 10:11:33 2010 -0400
+++ b/src/org/w3c/unicorn/response/impl/DefaultResponseXBeans.java	Mon Sep 27 12:35:46 2010 -0400
@@ -58,6 +58,7 @@
 			XmlOptions xo = new XmlOptions();
 			xo.setErrorListener(errorList);
 			ord = ObservationresponseDocument.Factory.parse(is, new XmlOptions().setCharacterEncoding(charset));
+			is.close();
 			or = ord.getObservationresponse();
 			if (!or.validate(xo)) {
 				String content = "";
Received on Monday, 27 September 2010 16:35:56 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:44 UTC