nfsantos commented on code in PR #881:
URL: https://github.com/apache/jackrabbit-oak/pull/881#discussion_r1151951619


##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticBulkProcessorHandler.java:
##########
@@ -156,12 +154,21 @@ private BulkProcessor initBulkProcessor() {
                 .build();
     }
 
+    private void checkFailures() throws IOException {
+        if (ioException.getSuppressed().length > 0) {
+            throw ioException;

Review Comment:
   The stack trace of this instance was captured when the exception was 
created, so at the initialization of the `ElasticBulkProcessor` instance. 
Therefore, it does not match the stack trace in the location where it was 
thrown, which will cause confusing when reading the logs and will make it 
harder to pinpoint the problem.
   
   Possible fixes:
   - call `fillInStackTrace` here just before throwing the exception
   - Store the suppressed exceptions in an array and create the IOException 
here. I prefer this solution, as it is cleaner, no need to call 
`fillInStackTrace` and to understand the need of calling this method here.



##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexDefinition.java:
##########
@@ -138,6 +148,10 @@ public ElasticIndexDefinition(NodeState root, NodeState 
defn, String indexPath,
         this.queryFetchSizes = Arrays.stream(getOptionalValues(defn, 
QUERY_FETCH_SIZES, Type.LONGS, Long.class, QUERY_FETCH_SIZES_DEFAULT))
                 .mapToInt(Long::intValue).toArray();
         this.trackTotalHits = getOptionalValue(defn, TRACK_TOTAL_HITS, 
TRACK_TOTAL_HITS_DEFAULT);
+        this.dynamicMapping = getOptionalValue(defn, DYNAMIC_MAPPING, 
DYNAMIC_MAPPING_DEFAULT);
+        this.failOnError = getOptionalValue(defn, FAIL_ON_ERROR,
+                Boolean.parseBoolean(System.getProperty(TYPE_ELASTICSEARCH + 
"." + FAIL_ON_ERROR, ""+ FAIL_ON_ERROR_DEFAULT))

Review Comment:
   ```suggestion
                   Boolean.parseBoolean(System.getProperty(TYPE_ELASTICSEARCH + 
"." + FAIL_ON_ERROR, Boolean.toString(FAIL_ON_ERROR_DEFAULT)))
   ```
   I find this nicer and easier to understand/read than using `"" + b` to 
convert a boolean value to a string. Probably it's also safer. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to