You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Stepan Mishura (JIRA)" <ji...@apache.org> on 2006/06/15 08:35:30 UTC

[jira] Assigned: (HARMONY-604) java.net.URLConnection.addRequestProperty((String) null, String value) doesn't throw NPE

     [ http://issues.apache.org/jira/browse/HARMONY-604?page=all ]

Stepan Mishura reassigned HARMONY-604:
--------------------------------------

    Assign To: Stepan Mishura

> 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
>     Assignee: Stepan Mishura
>  Attachments: URLConnection.diffs
>
> 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