harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1158) [classlib][luni]Compatibility: java.net.URL new URL("ss", null, -3, null) throws MalformedURLException while RI throws NPE
Date Tue, 30 Jan 2007 06:27:33 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-1158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468516
] 

Mikhail Markov commented on HARMONY-1158:
-----------------------------------------

I've also investigated this issue and agree with Andrew and Ilya - RI's logic seems very weird
and it's hard to reproduce it.

+1 for moving it to Non-bug difference and closing.


> [classlib][luni]Compatibility: java.net.URL new URL("ss", null, -3, null) throws MalformedURLException
while RI throws NPE
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1158
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1158
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Ilya Okomin
>
> Compatibility. Different order of exceptions.
> RI throws unspecified NPE in java.net.URL("ss", null, -3, null) constructor if host ==null
while Harmony at first checks port and throws MalformedURLException.
> If host != null both RI and Harmony throw MalformedURLException.
> =============test.java=============
> import java.net.*;
> public class test  {
>     public static void main (String[] args) {
>        try {
>             new URL("ss", "0", -3, null);
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>        try {
>             new URL("ss", null, -3, null);
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>     }
> }
> =======================================
> Output on RI:
> java.net.MalformedURLException: Invalid port number :-3
>         at java.net.URL.<init>(URL.java:373)
>         at java.net.URL.<init>(URL.java:283)
>         at test.main(test.java:7)
> java.lang.NullPointerException
>         at java.net.Parts.<init>(URL.java:1259)
>         at java.net.URL.<init>(URL.java:380)
>         at java.net.URL.<init>(URL.java:283)
>         at test.main(test.java:13)
> Output on Harmony:
> java.net.MalformedURLException: Port out of range: -3
>         at java.net.URL.<init>(URL.java:393)
>         at java.net.URL.<init>(URL.java:367)
>         at test.main(test.java:7)
> java.net.MalformedURLException: Port out of range: -3
>         at java.net.URL.<init>(URL.java:393)
>         at java.net.URL.<init>(URL.java:367)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message