directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1712847 - /directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java
Date Thu, 05 Nov 2015 19:00:16 GMT
Author: elecharny
Date: Thu Nov  5 19:00:16 2015
New Revision: 1712847

URL: http://svn.apache.org/viewvc?rev=1712847&view=rev
Log:
o Fixed the DbIndex parsing (some index types weren't even read, the default index's type
was ignored)

Modified:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java?rev=1712847&r1=1712846&r2=1712847&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java
Thu Nov  5 19:00:16 2015
@@ -96,6 +96,7 @@ public class DbIndexWrapper implements C
                 if ( "default".equalsIgnoreCase( attrStr ) )
                 {
                     isDefault = true;
+                    startPos = pos + 1;
                     break;
                 }
                 
@@ -113,7 +114,7 @@ public class DbIndexWrapper implements C
             }
         }
         
-        // If the 'default' special attribute si presetn, we can discard all the other attributes
+        // If the 'default' special attribute is present, we can discard all the other attributes
         if ( isDefault )
         {
             attributes.clear();
@@ -136,11 +137,7 @@ public class DbIndexWrapper implements C
                     // Check if we have this indexType
                     DbIndexTypeEnum indexType = DbIndexTypeEnum.getIndexType( indexTypeName
);
                     
-                    if ( indexType == DbIndexTypeEnum.NONE )
-                    {
-                        // This is an error, ignore it.
-                    }
-                    else
+                    if ( indexType != DbIndexTypeEnum.NONE )
                     {
                         indexTypes.add( indexType );
                     }
@@ -148,6 +145,20 @@ public class DbIndexWrapper implements C
                     startPos = pos + 1;
                 }
             }
+            
+            if ( pos != startPos )
+            {
+                // Search for the index type
+                String indexTypeName = indexStr.substring( startPos, pos );
+                
+                // Check if we have this indexType
+                DbIndexTypeEnum indexType = DbIndexTypeEnum.getIndexType( indexTypeName );
+                
+                if ( indexType != DbIndexTypeEnum.NONE )
+                {
+                    indexTypes.add( indexType );
+                }
+            }
         }
     }
     
@@ -296,12 +307,12 @@ public class DbIndexWrapper implements C
     {
         StringBuilder sb = new StringBuilder();
         
-        // first, the Attribute, if it's not dafault
+        // first, the Attribute, if it's not default
         if ( isDefault )
         {
             if ( indexTypes.size() == 0 )
             {
-                // No types either ? retrun a blank String
+                // No types either ? return a blank String
                 return "";
             }
             



Mime
View raw message