harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vasily Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1232) [classlib][jndi] compatibility: ctor SearchResult(null, ...) throws IllegalArgumentException on Harmony and creates object on RI
Date Mon, 25 Dec 2006 20:19:23 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1232?page=all ]

Vasily Zakharov updated HARMONY-1232:
-------------------------------------

    Attachment: Harmony-1232.patch

It's pretty clear that neither 'name', nor 'attrs' can be null - otherwise getName() and getAttributes()
methods would return null, explicitly violating the spec - and that's what RI does. So this
issue is clearly a non-bug diff and must not be fixed to fit RI behavior. So this issue could
be closed as Won't Fix.

But in fact, Harmony throws IAE only if 'name' is null, 'attrs' is not checked. If 'attrs'
is null, object is created but NPE is thrown if, for example, toString() is called for it.

So my proposition is:

1. Add checking if 'attrs' is null and throwing IAE if it is.

2. Add tests verifying that IAE is thrown if either 'name' or 'attrs' is null.

These propositions are implemented in the patches attached.

Please pay attention to the message numbering in modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties,
it may require adjustment at the patching time.


> [classlib][jndi] compatibility: ctor SearchResult(null, ...) throws IllegalArgumentException
on Harmony and creates object on RI
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1232
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1232
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Vladimir Ivanov
>            Priority: Minor
>         Attachments: Harmony-1232-Test.patch, Harmony-1232.patch
>
>
> The constructor javax.naming.directory.SearchResult.SearchResult(String name, String
className,  Object obj,  Attributes attrs,  boolean isRelative) throws IllegalArgumentException
on Harmony and creates object on RI if name == null or attrs == null.
> The spec says:
> "name - The non-null name of the search item
> attrs - ... Cannot be null." so it is 'non-bug diff'
> ==================== test.java =======================
> import javax.naming.directory.SearchResult;
> import javax.swing.plaf.basic.BasicTableUI;
> public class test {
>     public static void main(String args[]) {
>         System.out.println("res = " + new SearchResult(null, "", new BasicTableUI(),
null, false));
>     }
> }
> ==================================================
> Output:
> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System
optimized over throughput (initial strategy singleparpar))
> res = (not relative)null: :javax.swing.plaf.basic.BasicTableUI@1b35ed:null
> C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion
test
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> Exception in thread "main" java.lang.IllegalArgumentException: name must not be null
>         at javax.naming.NameClassPair.<init>(NameClassPair.java:112)
>         at javax.naming.Binding.<init>(Binding.java:14)
>         at javax.naming.directory.SearchResult.<init>(SearchResult.java:176)
>         at test.main(test.java:6)

-- 
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