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

unicorn commit: + fix of function getContent

From: Mercurial notifier <nobody@w3.org>
Date: Tue, 23 Nov 2010 18:47:10 +0000
Message-Id: <E1PKxtW-0003gG-MW@mcbain.w3.org>
To: Unicorn Updates <www-validator-cvs@w3.org>
changeset:   1568:d8be99f9906c
tag:         tip
user:        Thomas Gambet <tgambet@w3.org>
date:        Tue Nov 23 13:47:04 2010 -0500
files:       src/org/w3c/unicorn/input/URIInputModule.java
description:
+ fix of function getContent


diff -r 15ab38bfb84e -r d8be99f9906c src/org/w3c/unicorn/input/URIInputModule.java
--- a/src/org/w3c/unicorn/input/URIInputModule.java	Fri Nov 19 12:07:12 2010 -0500
+++ b/src/org/w3c/unicorn/input/URIInputModule.java	Tue Nov 23 13:47:04 2010 -0500
@@ -5,6 +5,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.PrintWriter;
 import java.net.URL;
 import java.util.Date;
@@ -111,9 +112,13 @@
 	public String getStringContent() throws IOException {
 		logger.trace("getString.");
 		final URL aURL = new URL(this.sURI);
-		final String sResult = (String) aURL.openConnection().getContent();
-		logger.debug("sResult : " + sResult + ".");
-		return sResult;
+		InputStream in = aURL.openConnection().getInputStream();
+	    StringBuffer out = new StringBuffer();
+	    byte[] b = new byte[4096];
+	    for (int n; (n = in.read(b)) != -1;) {
+	        out.append(new String(b, 0, n));
+	    }
+	    return out.toString();
 	}
 
 	public String getURI() {
Received on Tuesday, 23 November 2010 18:47:12 UTC

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