SOLR-7664: Throw correct exception (RemoteSolrException) on receiving a HTTP 413

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1687135 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ramkumar Aiyengar 2015-06-23 21:40:21 +00:00
parent 6624bfc982
commit ac84d8abf4
2 changed files with 8 additions and 5 deletions

View File

@ -181,6 +181,9 @@ Bug Fixes
* SOLR-7679: Schema API doesn't take similarity attribute into account when adding
field types. (Marius Grama, Steve Rowe)
* SOLR-7664: Throw correct exception (RemoteSolrException) on receiving a HTTP 413.
(Ramkumar Aiyengar, Eirik Lygre)
Optimizations
----------------------
* SOLR-7660: Avoid redundant 'exists' calls made to ZK while fetching cluster state updates. (shalin)

View File

@ -73,7 +73,6 @@ import java.util.Locale;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
@ -490,7 +489,7 @@ public class HttpSolrClient extends SolrClient {
}
break;
default:
if (processor == null) {
if (processor == null || "".equals(contentType)) {
throw new RemoteSolrException(baseUrl, httpStatus, "non ok status: " + httpStatus
+ ", message:" + response.getStatusLine().getReasonPhrase(),
null);
@ -552,9 +551,10 @@ public class HttpSolrClient extends SolrClient {
} catch (Exception ex) {}
if (reason == null) {
StringBuilder msg = new StringBuilder();
msg.append(response.getStatusLine().getReasonPhrase());
msg.append("\n\n");
msg.append("request: " + method.getURI());
msg.append(response.getStatusLine().getReasonPhrase())
.append("\n\n")
.append("request: ")
.append(method.getURI());
reason = java.net.URLDecoder.decode(msg.toString(), UTF_8);
}
RemoteSolrException rss = new RemoteSolrException(baseUrl, httpStatus, reason, null);