[jira] Resolved: (DIRSERVER-664) ExceptionService.modify() is not
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Directory Project > [jira] Resolved: (DIRSERVER-664) ExceptionService.modify() is not




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    [jira] Resolved: (DIRSERVER-664) ExceptionService.modify() is not  
Emmanuel Lecharny (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-06 12:11 AM

[ http://issues.apache.org/jira/brows...ER-664?page=all ]

Emmanuel Lecharny resolved DIRSERVER-664.
-----------------------------------------

Resolution: Fixed
Assignee: Emmanuel Lecharny

Thanks a lot Giamma !

The fix was perfect !

I added a junit test case just in case, and fixed the code the way you propo
sed to do.

> ExceptionService.modify() is not generating the correct exception
> -----------------------------------------------------------------
>
>                 Key: DIRSERVER-664
>                 URL: http://issues.apache.org/jira/browse/DIRSERVER-664
>             Project: Directory ApacheDS
>          Issue Type: Bug
>    Affects Versions: 1.0-RC4
>            Reporter: Giamma
>         Assigned To: Emmanuel Lecharny
>            Priority: Minor
>
> When trying to modify an attribute with an existing value, the following e
xception should be generated:
> LdapAttributeInUseException( "Trying to add existing value 'XYZ' to attrib
ute ABC");
> But instead the code is generating a IndexOutOfBoundsException because the
re is a bug in the code that is generating the correct exception.
> This is the wrong code:
>  public void modify( NextInterceptor nextInterceptor, Name name, Modificat
ionItem[] items ) throws NamingException
>     {
>         // check if entry to modify exists
>         String msg = "Attempt to modify non-existant entry: ";
>         assertHasEntry( nextInterceptor, msg, name );
>         Attributes entry = nexus.lookup( name );
>         for ( int ii = 0; ii < items.length; ii++ )
>         {
>             if ( items[ii].getModificationOp() == DirContext.ADD_ATTRI
BUTE )
>             {
>                 Attribute modAttr = items[ii].getAttribute();
>                 Attribute entryAttr = entry.get( modAttr.getID() );
>                 if ( entryAttr != null )
>                 {
>                     for ( int jj = 0; jj < modAttr.size(); jj++ )
>                     {
>                         if ( entryAttr.contains( modAttr.get( jj ) ) )
>                         {
>                             throw new LdapAttributeInUseException( "Trying
 to add existing value '"
>                                     + modAttr.get( ii ) + "' to attribute 
" + modAttr.getID() );                                   <----- HERE IS THE 
PROBLEM, should use modAttr.get( jj )
>                         }
>                     }
>                 }
>             }
>         }
>         nextInterceptor.modify( name, items );
>     }

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://iss
ues.apache.org/ji...nistrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira








[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:59 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register