directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r882305 - in /directory/studio/trunk: ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/ ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/ ldif-parser/src/test/java/org/apache/...
Date Thu, 19 Nov 2009 21:31:10 GMT
Author: seelmann
Date: Thu Nov 19 21:31:09 2009
New Revision: 882305

URL: http://svn.apache.org/viewvc?rev=882305&view=rev
Log:
Fix for DIRSTUDIO-598 (Base64 encoded DN marked as invalid in LDIF editor)

Modified:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
    directory/studio/trunk/ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java
    directory/studio/trunk/ldif-parser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java?rev=882305&r1=882304&r2=882305&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
Thu Nov 19 21:31:09 2009
@@ -102,7 +102,7 @@
         EntryEditorInput input = getEntryEditorInput( element );
         try
         {
-            LdapDN newDN = new LdapDN( records[0].getDnLine().getUnfoldedDn() );
+            LdapDN newDN = new LdapDN( records[0].getDnLine().getValueAsString() );
             if ( !newDN.equals( input.getResolvedEntry().getDn() ) )
             {
                 throw new CoreException( new Status( IStatus.ERROR, BrowserUIConstants.PLUGIN_ID,
NLS.bind( Messages
@@ -139,7 +139,7 @@
         // only continue if the LDIF model is valid
         LdifRecord[] records = getLdifModel().getRecords();
         if ( records.length != 1 || !( records[0] instanceof LdifContentRecord ) || !records[0].isValid()
-            || !LdapDN.isValid( records[0].getDnLine().getUnfoldedDn() ) )
+            || !records[0].getDnLine().isValid() )
         {
             return;
         }

Modified: directory/studio/trunk/ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java?rev=882305&r1=882304&r2=882305&view=diff
==============================================================================
--- directory/studio/trunk/ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java
(original)
+++ directory/studio/trunk/ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLine.java
Thu Nov 19 21:31:09 2009
@@ -75,7 +75,7 @@
 
     public boolean isValid()
     {
-        return super.isValid() && LdapDN.isValid( getUnfoldedDn() );
+        return super.isValid() && LdapDN.isValid( getValueAsString() );
     }
 
 
@@ -89,7 +89,7 @@
         {
             return "Missing DN";
         }
-        else if ( !LdapDN.isValid( getUnfoldedDn() ) )
+        else if ( !LdapDN.isValid( getValueAsString() ) )
         {
             return "Invalid DN";
         }

Modified: directory/studio/trunk/ldif-parser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldif-parser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java?rev=882305&r1=882304&r2=882305&view=diff
==============================================================================
--- directory/studio/trunk/ldif-parser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java
(original)
+++ directory/studio/trunk/ldif-parser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java
Thu Nov 19 21:31:09 2009
@@ -74,4 +74,18 @@
         String formattedString = dnLine.toFormattedString( formatParameters );
         assertEquals( formattedString, "dn:: Y249w6TDtsO8LG91PWRlcGFydG1lbnQsbz1vcmcsZGM9ZXhhbXBsZSxkYz1jb20=\n"
);
     }
+
+
+    /**
+     * Test for DIRSTUDIO-598
+     * (Base64 encoded DN marked as invalid in LDIF editor)
+     */
+    public void testIsValid()
+    {
+        LdifDnLine dnLine = LdifDnLine.create( "cn=\\#\\\\\\+\\, \\\"öé\\\",ou=users,ou=system"
);
+        assertTrue( dnLine.isValid() );
+        assertEquals( "Y249XCNcXFwrXCwgXCLDtsOpXCIsb3U9dXNlcnMsb3U9c3lzdGVt", dnLine.getUnfoldedDn()
);
+        assertEquals( "cn=\\#\\\\\\+\\, \\\"öé\\\",ou=users,ou=system", dnLine.getValueAsString()
);
+    }
+
 }



Mime
View raw message