Apache Solr open-source search software
SOLR-16363: DirectUpdateHandler2 remove String.format from error logging (#1124)
Kevin Risden57719fedef71
diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.javaindex dd15bfcad39..1d5339f26d7 100644--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java@@ -22,7 +22,6 @@ import java.lang.invoke.MethodHandles;import java.lang.reflect.Array;import java.util.ArrayList;import java.util.List;-import java.util.Locale;import java.util.concurrent.ExecutionException;import java.util.concurrent.Future;import java.util.concurrent.atomic.LongAdder;@@ -301,33 +300,27 @@ public class DirectUpdateHandler2 extends UpdateHandler} catch (SolrException e) {throw e;} catch (AlreadyClosedException e) {- throw new SolrException(- SolrException.ErrorCode.SERVER_ERROR,- String.format(- Locale.ROOT,- "Server error writing document id %s to the index",- cmd.getPrintableId()),- e);+ String errorMsg =+ "Server error writing document id " + cmd.getPrintableId() + " to the index.";+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, errorMsg, e);} catch (IllegalArgumentException iae) {- throw new SolrException(- SolrException.ErrorCode.BAD_REQUEST,- String.format(- Locale.ROOT,- "Exception writing document id %s to the index; possible analysis error: %s%s",- cmd.getPrintableId(),- iae.getMessage(),- (iae.getCause() instanceof BytesRefHash.MaxBytesLengthExceededException- ? ". Perhaps the document has an indexed string field (solr.StrField) which is too large"- : "")),- iae);+ String errorDetails =+ (iae.getCause() instanceof BytesRefHash.MaxBytesLengthExceededException+ ? ". Perhaps the document has an indexed string field (solr.StrField) which is too large"+ : "");+ String errorMsg =+ "Exception writing document id "+ + cmd.getPrintableId()+ + " to the index; possible analysis error: "+ + iae.getMessage()+ + errorDetails;+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, errorMsg, iae);} catch (RuntimeException t) {- throw new SolrException(- SolrException.ErrorCode.BAD_REQUEST,- String.format(- Locale.ROOT,- "Exception writing document id %s to the index; possible analysis error.",- cmd.getPrintableId()),- t);+ String errorMsg =+ "Exception writing document id "+ + cmd.getPrintableId()+ + " to the index; possible analysis error.";+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, errorMsg, t);}}