lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1374024 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/solrj/ solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
Date Thu, 16 Aug 2012 19:56:09 GMT
Author: uschindler
Date: Thu Aug 16 19:56:09 2012
New Revision: 1374024

URL: http://svn.apache.org/viewvc?rev=1374024&view=rev
Log:
Merged revision(s) 1374022 from lucene/dev/trunk:
Better verbosity, also fix bug in while loop with char==0.
I have one explanation for this: Maybe Apaches SVN server returns something (like error message)
that's not UTF8?

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java?rev=1374024&r1=1374023&r2=1374024&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
(original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
Thu Aug 16 19:56:09 2012
@@ -25,12 +25,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
-import java.io.StringReader;
-import java.net.ConnectException;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.net.URLConnection;
-
 import org.apache.commons.io.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.common.util.ContentStreamBase;
@@ -111,12 +107,12 @@ public class ContentStreamTest extends L
       charset = ContentStreamBase.DEFAULT_CHARSET;
     // Re-open the stream and this time use a reader
     stream = new ContentStreamBase.URLStream( url );
-    StringBuilder sb = new StringBuilder();
     Reader reader = stream.getReader();
-    int ch;
-    while ((ch = reader.read()) > 0) {
-      sb.append((char)ch);
+    try {
+      String streamContent = IOUtils.toString(reader);
+      assertEquals(new String(content, charset), streamContent);
+    } finally {
+      IOUtils.closeQuietly(reader);
     }
-    assertEquals(new String(content, charset), sb.toString());
   }
 }



Mime
View raw message