harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-604) java.net.URLConnection.addRequestProperty((String) null, String value) doesn't throw NPE
Date Thu, 15 Jun 2006 05:52:30 GMT
java.net.URLConnection.addRequestProperty((String) null, String value) doesn't throw NPE 
-----------------------------------------------------------------------------------------

         Key: HARMONY-604
         URL: http://issues.apache.org/jira/browse/HARMONY-604
     Project: Harmony
        Type: Bug

    Reporter: Vladimir Ivanov


The spec says for the java.net.URLConnectionaddRequestProperty(String key, String value)
"Throws: NullPointerException - if key is null" but harmony java.net.URLConnection.addRequestProperty((String)
null, String value) doesn't throw NPE.
================================
import java.io.*; 
import java.net.*; 

public class Test { 

    public static void main(String[] args) {  
            try { 
                 URL url = new URL("jar:file:/home/file.jar!/");
                 JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
                 jarConnection.addRequestProperty(null,"http://xml.org/sax/features/namespace-prefixes");
                 System.out.println("Failed");               
            } catch (MalformedURLException e) { 
                 System.out.println("MalformedURLException");                         
            } catch (IOException e) { 
                 System.out.println("IOException");               
            } catch (NullPointerException e) { 
                e.printStackTrace();              
                System.out.println("Passed");               
            }  
    } 
}

Steps to Reproduce: 
1.Compile Test.java using BEA 1.4.2 javac 
% javac -d Test.java
2. Run Test class


The output on Harmony: 
Failed 

The output on RI: 
java.lang.NullPointerException: key is null
        at java.net.URLConnection.addRequestProperty(Unknown Source)
        at Test.main(Test.java:491)
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