You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2022/10/26 02:44:04 UTC
[solr] 02/02: SOLR-16363: DirectUpdateHandler2 remove String.format from error logging (#1124)
This is an automated email from the ASF dual-hosted git repository.
krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit fd55c602a85ba259e58b25a3068e41ce40b9a79e
Author: Kevin Risden <ri...@users.noreply.github.com>
AuthorDate: Tue Oct 25 22:35:06 2022 -0400
SOLR-16363: DirectUpdateHandler2 remove String.format from error logging (#1124)
---
.../apache/solr/update/DirectUpdateHandler2.java | 45 +++++++++-------------
1 file changed, 19 insertions(+), 26 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
index b511461b2fb..bc94e1227bf 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);
}
}