Apache Lucene open-source search software
SOLR-7664: Throw correct exception (RemoteSolrException) on receiving a HTTP 413
Ramkumar Aiyengarac84d8abf43f
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 0af7fdb958e..467304972ef 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -181,6 +181,9 @@ Bug Fixes* SOLR-7679: Schema API doesn't take similarity attribute into account when addingfield 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)diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.javaindex 04fb70eee16..1e775243da4 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java@@ -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);