directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r689645 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/
Date Wed, 27 Aug 2008 22:47:07 GMT
Author: seelmann
Date: Wed Aug 27 15:47:07 2008
New Revision: 689645

URL: http://svn.apache.org/viewvc?rev=689645&view=rev
Log:
Fix for DIRSTUDIO-378 (underscore _ in returning attributes)

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java?rev=689645&r1=689644&r2=689645&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidget.java
Wed Aug 27 15:47:07 2008
@@ -21,6 +21,9 @@
 package org.apache.directory.studio.ldapbrowser.common.widgets.search;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BrowserWidget;
@@ -113,7 +116,7 @@
         String[] history = HistoryUtils.load( BrowserCommonConstants.DIALOGSETTING_KEY_RETURNING_ATTRIBUTES_HISTORY
);
         for ( int i = 0; i < history.length; i++ )
         {
-            history[i] = Utils.arrayToString( Utils.stringToArray( history[i] ) );
+            history[i] = Utils.arrayToString( stringToArray( history[i] ) );
         }
         returningAttributesCombo.setItems( history );
         returningAttributesCombo.setText( Utils.arrayToString( this.initialReturningAttributes
) );
@@ -174,7 +177,7 @@
     public String[] getReturningAttributes()
     {
         String s = this.returningAttributesCombo.getText();
-        return Utils.stringToArray( s );
+        return stringToArray( s );
     }
 
 
@@ -197,4 +200,64 @@
 
     }
 
+    
+    /**
+     * Splits the given string into an array. Only the following
+     * characters are kept, all other are used to split the string
+     * and are truncated:
+     * <li>a-z
+     * <li>A-Z
+     * <li>0-9
+     * <li>-
+     * <li>.
+     * <li>;
+     * <li>_
+     * <li>*
+     * <li>+
+     * <li>@
+     * 
+     * @param s the string to split
+     * 
+     * @return the array with the splitted string, or null
+     */
+    public static String[] stringToArray( String s )
+    {
+        if ( s == null )
+        {
+            return null;
+        }
+        else
+        {
+            List<String> attributeList = new ArrayList<String>();
+
+            StringBuffer temp = new StringBuffer();
+            for ( int i = 0; i < s.length(); i++ )
+            {
+                char c = s.charAt( i );
+
+                if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c
<= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-'
+                    || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@'
)
+                {
+                    temp.append( c );
+                }
+                else
+                {
+                    if ( temp.length() > 0 )
+                    {
+                        attributeList.add( temp.toString() );
+                        temp = new StringBuffer();
+                    }
+                }
+            }
+            if ( temp.length() > 0 )
+            {
+                attributeList.add( temp.toString() );
+            }
+
+            return ( String[] ) attributeList.toArray( new String[attributeList.size()] );
+        }
+    }
+
+
+
 }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java?rev=689645&r1=689644&r2=689645&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
Wed Aug 27 15:47:07 2008
@@ -162,59 +162,6 @@
     }
 
 
-    public static String[] stringToArray( String s )
-    {
-        if ( s == null )
-        {
-            return null;
-        }
-        else
-        {
-            List attributeList = new ArrayList();
-
-            StringBuffer temp = new StringBuffer();
-            for ( int i = 0; i < s.length(); i++ )
-            {
-                char c = s.charAt( i );
-
-                if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c
<= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-'
-                    || c == '.' || c == ';' )
-                {
-                    temp.append( c );
-                }
-                else
-                {
-                    if ( temp.length() > 0 )
-                    {
-                        attributeList.add( temp.toString() );
-                        temp = new StringBuffer();
-                    }
-                }
-            }
-            if ( temp.length() > 0 )
-            {
-                attributeList.add( temp.toString() );
-            }
-
-            return ( String[] ) attributeList.toArray( new String[attributeList.size()] );
-        }
-
-        // else {
-        // s = s.trim();
-        // s = s.replaceAll(" ", "");
-        // s = s.replaceAll(",,", ",");
-        // String[] a;
-        // if(s.length() > 0) {
-        // a = s.split(",", 0);
-        // }
-        // else {
-        // a = new String[0];
-        // }
-        // return a;
-        // }
-    }
-
-
     public static String arrayToString( String[] array )
     {
         if ( array == null || array.length == 0 )



Mime
View raw message