You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/01/12 15:38:27 UTC

[jira] Assigned: (HARMONY-2525) [classlib][jndi] javax.naming.CompoundName add(String), add(int, String) methods should follow exception throwing compatibility

     [ https://issues.apache.org/jira/browse/HARMONY-2525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov reassigned HARMONY-2525:
----------------------------------------

    Assignee: Alexei Zakharov

> [classlib][jndi] javax.naming.CompoundName add(String), add(int, String) methods should follow exception throwing compatibility
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2525
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2525
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Assigned To: Alexei Zakharov
>            Priority: Trivial
>         Attachments: Harmony-2525-Test.patch, Harmony-2525-Test.patch, Harmony-2525.patch, Harmony-2525.patch
>
>
> The behaviour of add(String), add(int, String) methods where String parameter is null is not explicitly specified.
> It is only said in the specification that String parameter have to be non-null.
> 1) add(null)
> RI: no exceptions are thrown
> Harmony: InvalidNameException is thrown
> 2) add(int, null)
> RI: no exceptions are thrown or IndexOutOfBoundsException is thrown
> Harmony: InvalidNameException is thrown
> The following test reproduces the problem:
> import junit.framework.TestCase;
> import java.util.*;
> import javax.naming.*;
> public class ExceptionCompatibilityTest extends TestCase {
>     public void test1() {
>         try {
>             CompoundName name = new CompoundName("", new Properties());
>             name.add(null);
>         } catch (InvalidNameException e) {
>             fail(e + " should not be thrown");
>         }
>     }
>     public void test2() {
>         try {
>             CompoundName name = new CompoundName("", new Properties());    
>             name.add(0, null);
>         } catch (InvalidNameException e) {
>             fail(e + "should not be thrown");
>         }
>     }
>     
>     public void test3() {
>         try {
>             CompoundName name = new CompoundName("", new Properties());    
>             name.add(10, null);
>         } catch (InvalidNameException e) {
>             fail("ArrayIndexOutOfBoundsException should be thrown");
>         } catch (ArrayIndexOutOfBoundsException e) {
>             //passed
>         }
>     }
> }

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