See my mail to the list. This URL also contains the current SVN revision.

The test retrieves it twice and compares contents. If someone makes an
svn commit in the meantime, the contents will be different.

Thats my theory at least

On Thu, Aug 16, 2012 at 3:53 PM,  <[email protected]> wrote:
> Author: uschindler
> Date: Thu Aug 16 19:53:45 2012
> New Revision: 1374022
>
> URL: http://svn.apache.org/viewvc?rev=1374022&view=rev
> Log:
> 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/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
>
> Modified: 
> lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
> URL: 
> http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java?rev=1374022&r1=1374021&r2=1374022&view=diff
> ==============================================================================
> --- 
> lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
>  (original)
> +++ 
> lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
>  Thu Aug 16 19:53:45 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());
>    }
>  }
>
>



-- 
lucidworks.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to