lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: svn commit: r1374022 - /lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
Date Thu, 16 Aug 2012 19:56:01 GMT
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,  <uschindler@apache.org> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message