From e7ee2b99afc449044d0bea81842531c07a025af3 Mon Sep 17 00:00:00 2001
From: Mohit Kataria <tihom88@gmail.com>
Date: Fri, 24 May 2019 15:19:23 +0530
Subject: [PATCH] OAK-8261:(Formatting changes) Indexing lane failing but the
 index is not marked corrupt

---
 .../oak/plugins/blob/BlobStoreBlob.java       | 13 ++++----
 .../index/lucene/LuceneIndexEditor.java       | 32 +++++++++++--------
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/BlobStoreBlob.java b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/BlobStoreBlob.java
index 2fcec3f53a..20b78579b3 100644
--- a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/BlobStoreBlob.java
+++ b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/BlobStoreBlob.java
@@ -30,10 +30,10 @@ import org.jetbrains.annotations.Nullable;
  * A blob implementation.
  */
 public class BlobStoreBlob implements Blob {
-    
+
     private final BlobStore blobStore;
     private final String blobId;
-    
+
     public BlobStoreBlob(BlobStore blobStore, String blobId) {
         this.blobStore = blobStore;
         this.blobId = blobId;
@@ -46,7 +46,7 @@ public class BlobStoreBlob implements Blob {
             return blobStore.getInputStream(blobId);
         } catch (IOException e) {
             throw new RuntimeException("Error occurred while obtaining " +
-                    "InputStream for blobId ["+ blobId +"]",e);
+                    "InputStream for blobId [" + blobId + "]", e);
         }
     }
 
@@ -59,7 +59,8 @@ public class BlobStoreBlob implements Blob {
         }
     }
 
-    @Override @Nullable
+    @Override
+    @Nullable
     public String getReference() {
         return blobStore.getReference(blobId);
     }
@@ -83,7 +84,7 @@ public class BlobStoreBlob implements Blob {
     public String toString() {
         return blobId;
     }
-    
+
     @Override
     public int hashCode() {
         return blobId.hashCode();
@@ -93,7 +94,7 @@ public class BlobStoreBlob implements Blob {
     public boolean equals(Object other) {
         if (this == other) {
             return true;
-        } 
+        }
         if (other instanceof BlobStoreBlob) {
             BlobStoreBlob b = (BlobStoreBlob) other;
             // theoretically, the data could be the same  
diff --git a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
index 14481af7fa..b9405d32d0 100644
--- a/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
+++ b/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
@@ -57,13 +57,19 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
 
     private final LuceneIndexEditorContext context;
 
-    /** Name of this node, or {@code null} for the root node. */
+    /**
+     * Name of this node, or {@code null} for the root node.
+     */
     private final String name;
 
-    /** Parent editor or {@code null} if this is the root editor. */
+    /**
+     * Parent editor or {@code null} if this is the root editor.
+     */
     private final LuceneIndexEditor parent;
 
-    /** Path of this editor, built lazily in {@link #getPath()}. */
+    /**
+     * Path of this editor, built lazily in {@link #getPath()}.
+     */
     private String path;
 
     private boolean propertiesChanged = false;
@@ -96,7 +102,7 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
     private LuceneIndexEditor(LuceneIndexEditor parent, String name,
                               MatcherState matcherState,
                               PathFilter.Result pathFilterResult,
-            boolean isDeleted) {
+                              boolean isDeleted) {
         this.parent = parent;
         this.name = name;
         this.path = null;
@@ -116,7 +122,7 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
     @Override
     public void enter(NodeState before, NodeState after)
             throws CommitFailedException {
-        if (EmptyNodeState.MISSING_NODE == before && parent == null){
+        if (EmptyNodeState.MISSING_NODE == before && parent == null) {
             context.enableReindexMode();
         }
 
@@ -147,7 +153,7 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
             }
         }
 
-        for (Matcher m : matcherState.affectedMatchers){
+        for (Matcher m : matcherState.affectedMatchers) {
             m.markRootDirty();
         }
 
@@ -231,14 +237,14 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
                 this.context.indexUpdate();
             } catch (IOException e) {
                 CommitFailedException ce = new CommitFailedException("Lucene", 5, "Failed to remove the index entries of"
-                                + " the removed subtree " + path + "for index " + context.getIndexingContext().getIndexPath(), e);
+                        + " the removed subtree " + path + "for index " + context.getIndexingContext().getIndexPath(), e);
                 context.getIndexingContext().indexUpdateFailed(ce);
                 throw ce;
             }
         }
 
         MatcherState ms = getMatcherState(name, before);
-        if (!ms.isEmpty()){
+        if (!ms.isEmpty()) {
             return new LuceneIndexEditor(this, name, ms, filterResult, true);
         }
         return null; // no need to recurse down the removed subtree
@@ -291,11 +297,11 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
         List<Matcher> inherited = Lists.newArrayList();
         for (Matcher m : Iterables.concat(matcherState.inherited, currentMatchers)) {
             Matcher result = m.match(name, after);
-            if (result.getStatus() == Matcher.Status.MATCH_FOUND){
+            if (result.getStatus() == Matcher.Status.MATCH_FOUND) {
                 matched.add(result);
             }
 
-            if (result.getStatus() != Matcher.Status.FAIL){
+            if (result.getStatus() != Matcher.Status.FAIL) {
                 inherited.addAll(result.nextSet());
             }
         }
@@ -330,13 +336,13 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
         final Set<Matcher> affectedMatchers;
 
         public MatcherState(List<Matcher> matched,
-                            List<Matcher> inherited){
+                            List<Matcher> inherited) {
             this.matched = matched;
             this.inherited = inherited;
 
             //Affected matches would only be used when there are
             //some matched matchers
-            if (matched.isEmpty()){
+            if (matched.isEmpty()) {
                 affectedMatchers = Collections.emptySet();
             } else {
                 affectedMatchers = Sets.newIdentityHashSet();
@@ -390,7 +396,7 @@ public class LuceneIndexEditor implements IndexEditor, Aggregate.AggregateRoot {
         return context.getDefinition();
     }
 
-    private boolean isIndexable(){
+    private boolean isIndexable() {
         return indexingRule != null;
     }
 
-- 
2.17.1

