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

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