SOLR-5673: HttpSolrServer doesn't set own property correctly in setFollowRedirects

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1562898 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-01-30 17:16:00 +00:00
parent 968d6f98cc
commit fa2423a2ec
3 changed files with 12 additions and 1 deletions

View File

@ -241,6 +241,9 @@ Bug Fixes
* SOLR-5679: Shard splitting fails with ClassCastException on collections * SOLR-5679: Shard splitting fails with ClassCastException on collections
upgraded from 4.5 and earlier versions. (Brett Hoerner, shalin) upgraded from 4.5 and earlier versions. (Brett Hoerner, shalin)
* SOLR-5673: HTTPSolrServer doesn't set own property correctly in
setFollowRedirects. (Frank Wesemann via shalin)
Optimizations Optimizations
---------------------- ----------------------

View File

@ -595,7 +595,7 @@ public class HttpSolrServer extends SolrServer {
* </p> * </p>
*/ */
public void setFollowRedirects(boolean followRedirects) { public void setFollowRedirects(boolean followRedirects) {
this.followRedirects = true; this.followRedirects = followRedirects;
HttpClientUtil.setFollowRedirects(httpClient, followRedirects); HttpClientUtil.setFollowRedirects(httpClient, followRedirects);
} }

View File

@ -412,6 +412,14 @@ public class BasicHttpSolrServerTest extends SolrJettyTestBase {
} catch (Throwable t) { } catch (Throwable t) {
fail("Exception was thrown:" + t); fail("Exception was thrown:" + t);
} }
//And back again:
server.setFollowRedirects(false);
try {
QueryResponse response = server.query(q);
fail("Should have thrown an exception.");
} catch (SolrServerException e) {
assertTrue(e.getMessage().contains("redirect"));
}
server.shutdown(); server.shutdown();
} }