Author: tomekr
Date: Thu Sep 22 11:00:52 2016
New Revision: 1761892

URL: http://svn.apache.org/viewvc?rev=1761892&view=rev
Log:
OAK-4842: Upgrade breaks if there's no SearchManager configured in 
repository.xml

Modified:
    
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/core/IndexAccessor.java
    
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
    
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/OptionParserFactory.java

Modified: 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/core/IndexAccessor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/core/IndexAccessor.java?rev=1761892&r1=1761891&r2=1761892&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/core/IndexAccessor.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/core/IndexAccessor.java
 Thu Sep 22 11:00:52 2016
@@ -31,6 +31,9 @@ public final class IndexAccessor {
     public static IndexReader getReader(RepositoryContext ctx) throws 
RepositoryException, IOException {
         RepositoryImpl repo = ctx.getRepository();
         SearchManager searchMgr = 
repo.getSearchManager(ctx.getRepositoryConfig().getDefaultWorkspaceName());
+        if (searchMgr == null) {
+            return null;
+        }
         QueryHandler handler = searchMgr.getQueryHandler();
         SearchIndex index = (SearchIndex) handler;
         return index.getIndexReader();

Modified: 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java?rev=1761892&r1=1761891&r2=1761892&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
 Thu Sep 22 11:00:52 2016
@@ -975,6 +975,9 @@ public class RepositoryUpgrade {
         boolean longNameFound = false;
         try {
             IndexReader reader = IndexAccessor.getReader(source);
+            if (reader == null) {
+                return;
+            }
             TermEnum terms = reader.terms(new Term(FieldNames.LOCAL_NAME));
             while (terms.next()) {
                 Term t = terms.term();

Modified: 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/OptionParserFactory.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/OptionParserFactory.java?rev=1761892&r1=1761891&r2=1761892&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/OptionParserFactory.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/OptionParserFactory.java
 Thu Sep 22 11:00:52 2016
@@ -143,5 +143,6 @@ public class OptionParserFactory {
                 "Shutdown the source repository after nodes are copied and 
before the commit hooks are applied");
         op.accepts(CACHE_SIZE, "Cache size in 
MB").withRequiredArg().ofType(Integer.class).defaultsTo(256);
         op.accepts(SKIP_INIT, "Skip the repository initialization; only copy 
data");
+        op.accepts(SKIP_NAME_CHECK, "Skip the initial phase of testing node 
name lengths");
     }
 }


Reply via email to