Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.0.0-M12
-
None
-
None
Description
The entry editor does not allow you to add an attribute with a null value, like a mail for instance (where value can be null, per IA5String syntax).
When saving the modified entry, you get the following exception :
!ENTRY org.eclipse.ui 4 0 2017-03-10 06:40:16.420 !MESSAGE Unhandled event loop exception !STACK 0 ... Caused by: java.lang.RuntimeException: Empty value in attribute mail at org.apache.directory.studio.entryeditors.EntryEditorManager.saveSharedWorkingCopy(EntryEditorManager.java:991) at org.apache.directory.studio.entryeditors.EntryEditorInput.saveSharedWorkingCopy(EntryEditorInput.java:283) at org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor.doSave(EntryEditor.java:221) ... 59 more
The code is :
... for ( IAttribute attribute : workingCopy.getAttributes() ) { for ( IValue value : attribute.getValues() ) { if ( ( value.isEmpty() ) { // throw new RuntimeException( NLS.bind( Messages .getString( "EntryEditorManager.EmptyValueInAttribute" ), attribute.getDescription() ) ); //$NON-NLS-1$ } ...
What we would like to do is :
... for ( IAttribute attribute : workingCopy.getAttributes() ) { for ( IValue value : attribute.getValues() ) { LdapSyntax syntax = attribute.getEntry().getBrowserConnection().getSchema().getLdapSyntaxDescription( attribute.getDescription() ); SyntaxChecker syntaxChecker = syntax.getSyntaxChecker(); if (!syntax.getSyntaxChecker().isValidSyntax( value.getRawValue() ) ) { // throw new RuntimeException( NLS.bind( Messages .getString( "EntryEditorManager.EmptyValueInAttribute" ), attribute.getDescription() ) ); //$NON-NLS-1$ } ...
but sadly, the SyntaxChecker is not accessible in the LdapSyntax we get back (it's null).
That is annoying, but understandable, assuming that all the LDAP servers we are connected to aren't able to feed the Schema properly...