directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r526282 - in /directory/ldapstudio/trunk: ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/ ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/search/
Date Fri, 06 Apr 2007 21:09:30 GMT
Author: seelmann
Date: Fri Apr  6 14:09:30 2007
New Revision: 526282

URL: http://svn.apache.org/viewvc?view=rev&rev=526282
Log:
Fixed issues with the empty DN (DIRSTUDIO-74).

Modified:
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
    directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIUtils.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java?view=diff&rev=526282&r1=526281&r2=526282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIConnectionContext.java
Fri Apr  6 14:09:30 2007
@@ -174,21 +174,8 @@
         this.isConnected = false;
         System.gc();
     }
-
-
-    public NameParser getNameParser() throws NamingException
-    {
-        if ( this.context != null )
-        {
-            return this.context.getNameParser( "" ); //$NON-NLS-1$
-        }
-        else
-        {
-            throw new NamingException( BrowserCoreMessages.model__no_connection );
-        }
-    }
-
-
+    
+    
     public NamingEnumeration search( final String searchBase, final String filter, final
SearchControls controls,
         final String derefAliasMethod, final String handleReferralsMethod, final Control[]
ldapControls,
         final ExtendedProgressMonitor monitor ) throws NamingException
@@ -234,8 +221,7 @@
 
                     try
                     {
-                        Name searchBaseName = getNameParser().parse( searchBase );
-                        this.namingEnumeration = searchCtx.search( searchBaseName, filter,
controls );
+                        this.namingEnumeration = searchCtx.search( searchBase, filter, controls
);
                     }
                     catch ( NameNotFoundException nffe )
                     {
@@ -307,8 +293,7 @@
                     LdapContext modCtx = context.newInstance( controls );
                     modCtx.addToEnvironment( Context.REFERRAL, "throw" ); //$NON-NLS-1$
 
-                    Name name = getNameParser().parse( dn );
-                    modCtx.modifyAttributes( name, modificationItems );
+                    modCtx.modifyAttributes( dn, modificationItems );
                 }
                 catch ( NamingException ne )
                 {
@@ -359,9 +344,7 @@
                     LdapContext modCtx = context.newInstance( controls );
                     modCtx.addToEnvironment( Context.REFERRAL, "throw" ); //$NON-NLS-1$
 
-                    Name oldName = getNameParser().parse( oldDn );
-                    Name newName = getNameParser().parse( newDn );
-                    modCtx.rename( oldName, newName );
+                    modCtx.rename( oldDn, newDn );
 
                 }
                 catch ( NamingException ne )
@@ -413,8 +396,7 @@
                     LdapContext modCtx = context.newInstance( controls );
                     modCtx.addToEnvironment( Context.REFERRAL, "throw" ); //$NON-NLS-1$
 
-                    Name name = getNameParser().parse( dn );
-                    modCtx.createSubcontext( name, attributes );
+                    modCtx.createSubcontext( dn, attributes );
                 }
                 catch ( NamingException ne )
                 {
@@ -465,8 +447,7 @@
                     LdapContext modCtx = context.newInstance( controls );
                     modCtx.addToEnvironment( Context.REFERRAL, "throw" ); //$NON-NLS-1$
 
-                    Name name = getNameParser().parse( dn );
-                    modCtx.destroySubcontext( name );
+                    modCtx.destroySubcontext( dn );
                 }
                 catch ( NamingException ne )
                 {

Modified: directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIUtils.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIUtils.java?view=diff&rev=526282&r1=526281&r2=526282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIUtils.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/JNDIUtils.java
Fri Apr  6 14:09:30 2007
@@ -22,8 +22,10 @@
 
 
 import javax.naming.Name;
+import javax.naming.NameParser;
 import javax.naming.NamingException;
 import javax.naming.directory.SearchResult;
+import javax.naming.ldap.InitialLdapContext;
 
 import org.apache.directory.ldapstudio.browser.core.model.DN;
 import org.apache.directory.ldapstudio.browser.core.model.NameException;
@@ -36,21 +38,9 @@
     public static DN getDn( SearchResult sr, String base, JNDIConnectionContext context )
throws NamingException,
         NameException, NoSuchFieldException
     {
-        DN dn = null;
-        if ( sr.isRelative() )
-        {
-            Name name = ( Name ) context.getNameParser().parse( base ).clone();
-            Name rdnName = context.getNameParser().parse( unescapeJndiName( sr.getName()
) );
-            name.addAll( rdnName );
-            dn = new DN( name.toString() );
-        }
-        else
-        {
-            URL url = new URL( sr.getName() );
-            dn = url.getDn();
-            // dn = new DN(sr.getName());
-        }
-        return dn;
+        String dn = sr.getNameInNamespace();
+        dn = unescapeJndiName( dn );
+        return new DN( dn );
     }
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java?view=diff&rev=526282&r1=526281&r2=526282
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/search/EntryWidget.java
Fri Apr  6 14:09:30 2007
@@ -174,7 +174,8 @@
                             entry = job.getReadEntry();
                         }
                     }
-                    else
+                    
+                    if( entry == null )
                     {
                         entry = connection.getRootDSE();
                     }



Mime
View raw message