Description of problem: Very similar to bug 229693 except with an error in a different spot (create user and remove other parts). Version-Release number of selected component (if applicable): fedora-ds-1.0.4-1.Linux How reproducible: Always Steps to Reproduce: Steps 1,2 from bug 229693 also apply here. 3. open the server localhost and in the directory tab select localhost and click New > User 4. Click Advanced... 5. Add postfixuser to Object Class, then delete everything in Object Class except for postfixuser and top. Add something for the mail address and maildrop 6. Click Ok, now in the Create New User window click Ok again A message pops up "Save Error Cannot save to directory server: java.lang.StringIndexOutOfBoundsException: String index out of range: 1 "
Turns out that this bug only occurs when the objectclass doesn't inherit from another (ie 'SUP top'), which it appears it's supposed to, and the attribute thing has nothing to do with it.
The problem here is that when you are running the user editor, the console expects there to be the "person" objectclass somewhere in there. Otherwise, it gets confused.
Created attachment 481673 [details] Console Framework Diffs The exception was occuring since the Console assumed that an entry created by going to "New->User" would have the givenname and sn attribute present and never checked if they were null before calling the String.substring() method. The fix is to first check if these attributes are null. There were other issues around this problem as well. The ResourcePageObservable class that is used to represent the entry being edited keeps a list of objectclasses along with the list of attributes and values for the entry (including the objectclass attribute). The problem was that removing an objectclass from the entry in the editor did not remove the objectclass from the objectclass list. This causes the editor to make assumptions about the entry, such as the presence of the givenname and sn attribute that caused the exception. The fix is to sync the objectclass list with the actual objectclasses that are present in the entry when a change is made.
Created attachment 481675 [details] DS Console Patch
Checked idm-console-framework patch into console (HEAD). Thanks to Noriko for her review! Checking in src/com/netscape/management/client/ug/ResourceEditor.java; /cvs/dirsec/console/src/com/netscape/management/client/ug/ResourceEditor.java,v <-- ResourceEditor.java new revision: 1.2; previous revision: 1.1 done Checking in src/com/netscape/management/client/ug/ResourcePageObservable.java; /cvs/dirsec/console/src/com/netscape/management/client/ug/ResourcePageObservable.java,v <-- ResourcePageObservable.java
Pushed ds-console patch to master. Thanks to Noriko for her review! Counting objects: 17, done. Delta compression using up to 2 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (9/9), 1.23 KiB, done. Total 9 (delta 4), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds-console.git 35194d5..2ada9d0 master -> master
Created attachment 513721 [details] SS Followed below steps on RHEL6 - DS9.0 2. Add the following schema: # cat /opt/fedora-ds/slapd-localhost/config/schema/61-maillist.ldif dn: cn=schema attributeTypes: ( 1.3.6.1.4.1.18320.1.2 NAME 'maildrop' DESC 'Email account or username to deliver all email to' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'A Postfix Schema' ) objectClasses: ( 1.3.6.1.4.1.18320.2.1 NAME 'PostfixUser' DESC 'Email user with a live email box at HCI' MUST (maildrop $ mail) X-ORIGIN 'A Postfix Schema' ) and restart the server ldapmodify -x -h localhost -p 1389 -D "cn=directory manager" -w Secret123 -v << EOF dn: cn=schema changetype: modify add: attributetypes attributeTypes: ( 1.3.6.1.4.1.18320.1.2 NAME 'maildrop' DESC 'Email account or username to deliver all email to' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X ORIGIN 'A Postfix Schema' ) EOF ldapmodify -x -h localhost -p 1389 -D "cn=directory manager" -w Secret123 -v << EOF dn: cn=schema changetype: modify add: objectClasses objectClasses: ( 1.3.6.1.4.1.18320.2.1 NAME 'PostfixUser' DESC 'Email user with a live email box at HCI' MUST (maildrop $ mail) X-ORIGIN 'A Postfix Schema' ) EOF and restarted the server. 3. open the server localhost and in the directory tab select localhost and click New > User 4. Click Advanced... 5. Add postfixuser to Object Class, then delete everything in Object Class except for postfixuser and top. Add something for the mail address and maildrop 6. Click Ok, now in the Create New User window click Ok again Perfectly working. no error. PFA for the Screen Shot.