harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Petrenko (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-2525) [classlib][jndi] javax.naming.CompoundName add(String), add(int, String) methods should follow exception throwing compatibility
Date Fri, 29 Dec 2006 06:37:23 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-2525?page=all ]

Alexey Petrenko updated HARMONY-2525:
-------------------------------------

    Patch Info: [Patch Available]

> [classlib][jndi] javax.naming.CompoundName add(String), add(int, String) methods should
follow exception throwing compatibility
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2525
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2525
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>            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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message