Bug 229699 - objectclass without parent causes StringIndexOutOfBounds in console
Summary: objectclass without parent causes StringIndexOutOfBounds in console
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: UI - Configuration
Version: 1.0.4
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Amita Sharma
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 434915
TreeView+ depends on / blocked
 
Reported: 2007-02-22 20:12 UTC by Aaron Luchko
Modified: 2015-12-07 17:02 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-07 17:02:59 UTC
Embargoed:


Attachments (Terms of Use)
Console Framework Diffs (4.81 KB, patch)
2011-03-01 16:13 UTC, Nathan Kinder
nhosoi: review+
Details | Diff
DS Console Patch (2.98 KB, patch)
2011-03-01 16:17 UTC, Nathan Kinder
nhosoi: review+
Details | Diff
SS (13.82 KB, image/png)
2011-07-19 07:14 UTC, Amita Sharma
no flags Details

Description Aaron Luchko 2007-02-22 20:12:21 UTC
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
"

Comment 1 Aaron Luchko 2007-02-23 03:10:08 UTC
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.


Comment 3 Rich Megginson 2008-12-05 22:49:35 UTC
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.

Comment 5 Nathan Kinder 2011-03-01 16:13:02 UTC
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.

Comment 6 Nathan Kinder 2011-03-01 16:17:38 UTC
Created attachment 481675 [details]
DS Console Patch

Comment 7 Nathan Kinder 2011-03-01 19:26:51 UTC
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

Comment 8 Nathan Kinder 2011-03-01 19:27:45 UTC
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

Comment 11 Amita Sharma 2011-07-19 07:14:59 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.