You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Svetlana Samoilenko (JIRA)" <ji...@apache.org> on 2006/02/02 12:30:03 UTC

[jira] Created: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

 java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
--------------------------------------------------------------------------

         Key: HARMONY-71
         URL: http://issues.apache.org/jira/browse/HARMONY-71
     Project: Harmony
        Type: Bug
  Components: Classlib  
    Reporter: Svetlana Samoilenko


According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.

Code to reproduce: 
import java.io.IOException; 
import java.net.*; 

public class test2 { 
    public static void main(String[] args) {  
        HttpURLConnection u=null; 
        try { 
            u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
            u.connect();
        } catch (MalformedURLException e) { 
            System.out.println("unexpected MalformedURLException"+e);               
        } catch (IOException f) { 
            System.out.println("unexpected IOException"+f);               
        }  
        try {            
           u.setUseCaches(true); 
        } catch (IllegalStateException e) { 
           System.out.println("OK. Expected IllegalStateException");   
           e.printStackTrace();
        }; 
    } 
}

Steps to Reproduce: 
1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
2. Compile test2.java using BEA 1.4 javac 
> javac -d . test2.java 
3. Run java using compatible VM (J9) 
> java -showversion test2 

Output: 
C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
java version "1.4.2_04" 
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
OK. Expected IllegalStateException
java.lang.IllegalStateException: Already connected
        at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
        at test2.main([Ljava.lang.String;)V(test2.java:17) 

C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
java.lang.IllegalAccessError: Connection already established
        at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
        at test2.main(test2.java:17) 

Suggested junit test case:
------------------------ URLConnectionTest.java ------------------------------------------------- 
import java.io.IOException; 
import java.net.*;
import junit.framework.*; 

public class URLConnectionTest extends TestCase { 
    public static void main(String[] args) { 
        junit.textui.TestRunner.run(URLConnectionTest.class); 
    } 
    public void test_setUseCaches () { 
        HttpURLConnection u=null; 
        try { 
            u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
            u.connect();
        } catch (MalformedURLException e) { 
            fail("unexpected MalformedURLException"+e);               
        } catch (IOException f) { 
            fail("unexpected IOException"+f);               
        }  
        try {            
           u.setUseCaches(true); 
        } catch (IllegalStateException e) { //expected
        }; 
   } 
}



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


[jira] Commented: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

Posted by "Svetlana Samoilenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-71?page=comments#action_12365851 ] 

Svetlana Samoilenko commented on HARMONY-71:
--------------------------------------------

Verified on revision 376014. Expected IllegalStateException exception is thrown.
Thanks.


>  java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
> --------------------------------------------------------------------------
>
>          Key: HARMONY-71
>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Svetlana Samoilenko
>     Assignee: Tim Ellison

>
> According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.
> Code to reproduce: 
> import java.io.IOException; 
> import java.net.*; 
> public class test2 { 
>     public static void main(String[] args) {  
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             System.out.println("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             System.out.println("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { 
>            System.out.println("OK. Expected IllegalStateException");   
>            e.printStackTrace();
>         }; 
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
> 2. Compile test2.java using BEA 1.4 javac 
> > javac -d . test2.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test2 
> Output: 
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
> java version "1.4.2_04" 
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
> OK. Expected IllegalStateException
> java.lang.IllegalStateException: Already connected
>         at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
>         at test2.main([Ljava.lang.String;)V(test2.java:17) 
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
> java.lang.IllegalAccessError: Connection already established
>         at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
>         at test2.main(test2.java:17) 
> Suggested junit test case:
> ------------------------ URLConnectionTest.java ------------------------------------------------- 
> import java.io.IOException; 
> import java.net.*;
> import junit.framework.*; 
> public class URLConnectionTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(URLConnectionTest.class); 
>     } 
>     public void test_setUseCaches () { 
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             fail("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             fail("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { //expected
>         }; 
>    } 
> }

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


[jira] Commented: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-71?page=comments#action_12365225 ] 

Vladimir Strigun commented on HARMONY-71:
-----------------------------------------

Trivial fix for the issue:
@@ -920,7 +920,7 @@
         */
        public void setUseCaches(boolean newValue) {
                if (connected) {
-                       throw new IllegalAccessError(Msg.getString("K0037"));
+                       throw new IllegalStateException(Msg.getString("K0037"));
                }
                this.useCaches = newValue;
        }

>  java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
> --------------------------------------------------------------------------
>
>          Key: HARMONY-71
>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Svetlana Samoilenko

>
> According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.
> Code to reproduce: 
> import java.io.IOException; 
> import java.net.*; 
> public class test2 { 
>     public static void main(String[] args) {  
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             System.out.println("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             System.out.println("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { 
>            System.out.println("OK. Expected IllegalStateException");   
>            e.printStackTrace();
>         }; 
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
> 2. Compile test2.java using BEA 1.4 javac 
> > javac -d . test2.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test2 
> Output: 
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
> java version "1.4.2_04" 
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
> OK. Expected IllegalStateException
> java.lang.IllegalStateException: Already connected
>         at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
>         at test2.main([Ljava.lang.String;)V(test2.java:17) 
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
> java.lang.IllegalAccessError: Connection already established
>         at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
>         at test2.main(test2.java:17) 
> Suggested junit test case:
> ------------------------ URLConnectionTest.java ------------------------------------------------- 
> import java.io.IOException; 
> import java.net.*;
> import junit.framework.*; 
> public class URLConnectionTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(URLConnectionTest.class); 
>     } 
>     public void test_setUseCaches () { 
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             fail("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             fail("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { //expected
>         }; 
>    } 
> }

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


Re: [jira] Commented: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

Posted by Tim Ellison <t....@gmail.com>.
I would rather that you just opened a new JIRA issue for that as it
doesn't relate to the original problem.

FYI there is a local server incoming in the HARMONY-57 contribution, so
don't spend any time on it, see:
<HARMONY-57>\Harmony\Harmony_Tests\src\test\java\tests\support\Support_HttpServer.java

Regards,
Tim

Stepan Mishura (JIRA) wrote:
>     [ http://issues.apache.org/jira/browse/HARMONY-71?page=comments#action_12366637 ] 
> 
> Stepan Mishura commented on HARMONY-71:
> ---------------------------------------
> 
> Tim, 
> 
> Added test case (test_setUseCachesZ) depends on network and it fails if it can not create connection with apache.org. The same for HARMONY-72. I'm going to attach a patch file with a local server in it. Could you reopen this JIRA? 
> 
> Thanks,
> Stepan.
> 
>>  java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
>> --------------------------------------------------------------------------
>>
>>          Key: HARMONY-71
>>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>>      Project: Harmony
>>         Type: Bug
>>   Components: Classlib
>>     Reporter: Svetlana Samoilenko
>>     Assignee: Tim Ellison
> 
>> According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.
>> Code to reproduce: 
>> import java.io.IOException; 
>> import java.net.*; 
>> public class test2 { 
>>     public static void main(String[] args) {  
>>         HttpURLConnection u=null; 
>>         try { 
>>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>>             u.connect();
>>         } catch (MalformedURLException e) { 
>>             System.out.println("unexpected MalformedURLException"+e);               
>>         } catch (IOException f) { 
>>             System.out.println("unexpected IOException"+f);               
>>         }  
>>         try {            
>>            u.setUseCaches(true); 
>>         } catch (IllegalStateException e) { 
>>            System.out.println("OK. Expected IllegalStateException");   
>>            e.printStackTrace();
>>         }; 
>>     } 
>> }
>> Steps to Reproduce: 
>> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
>> 2. Compile test2.java using BEA 1.4 javac 
>>> javac -d . test2.java 
>> 3. Run java using compatible VM (J9) 
>>> java -showversion test2 
>> Output: 
>> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
>> java version "1.4.2_04" 
>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
>> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
>> OK. Expected IllegalStateException
>> java.lang.IllegalStateException: Already connected
>>         at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
>>         at test2.main([Ljava.lang.String;)V(test2.java:17) 
>> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
>> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
>> java.lang.IllegalAccessError: Connection already established
>>         at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
>>         at test2.main(test2.java:17) 
>> Suggested junit test case:
>> ------------------------ URLConnectionTest.java ------------------------------------------------- 
>> import java.io.IOException; 
>> import java.net.*;
>> import junit.framework.*; 
>> public class URLConnectionTest extends TestCase { 
>>     public static void main(String[] args) { 
>>         junit.textui.TestRunner.run(URLConnectionTest.class); 
>>     } 
>>     public void test_setUseCaches () { 
>>         HttpURLConnection u=null; 
>>         try { 
>>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>>             u.connect();
>>         } catch (MalformedURLException e) { 
>>             fail("unexpected MalformedURLException"+e);               
>>         } catch (IOException f) { 
>>             fail("unexpected IOException"+f);               
>>         }  
>>         try {            
>>            u.setUseCaches(true); 
>>         } catch (IllegalStateException e) { //expected
>>         }; 
>>    } 
>> }
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

[jira] Commented: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-71?page=comments#action_12366637 ] 

Stepan Mishura commented on HARMONY-71:
---------------------------------------

Tim, 

Added test case (test_setUseCachesZ) depends on network and it fails if it can not create connection with apache.org. The same for HARMONY-72. I'm going to attach a patch file with a local server in it. Could you reopen this JIRA? 

Thanks,
Stepan.

>  java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
> --------------------------------------------------------------------------
>
>          Key: HARMONY-71
>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Svetlana Samoilenko
>     Assignee: Tim Ellison

>
> According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.
> Code to reproduce: 
> import java.io.IOException; 
> import java.net.*; 
> public class test2 { 
>     public static void main(String[] args) {  
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             System.out.println("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             System.out.println("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { 
>            System.out.println("OK. Expected IllegalStateException");   
>            e.printStackTrace();
>         }; 
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
> 2. Compile test2.java using BEA 1.4 javac 
> > javac -d . test2.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test2 
> Output: 
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
> java version "1.4.2_04" 
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
> OK. Expected IllegalStateException
> java.lang.IllegalStateException: Already connected
>         at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
>         at test2.main([Ljava.lang.String;)V(test2.java:17) 
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
> java.lang.IllegalAccessError: Connection already established
>         at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
>         at test2.main(test2.java:17) 
> Suggested junit test case:
> ------------------------ URLConnectionTest.java ------------------------------------------------- 
> import java.io.IOException; 
> import java.net.*;
> import junit.framework.*; 
> public class URLConnectionTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(URLConnectionTest.class); 
>     } 
>     public void test_setUseCaches () { 
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             fail("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             fail("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { //expected
>         }; 
>    } 
> }

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


[jira] Closed: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-71?page=all ]
     
Tim Ellison closed HARMONY-71:
------------------------------


Verified by Svetlana

>  java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
> --------------------------------------------------------------------------
>
>          Key: HARMONY-71
>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Svetlana Samoilenko
>     Assignee: Tim Ellison

>
> According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.
> Code to reproduce: 
> import java.io.IOException; 
> import java.net.*; 
> public class test2 { 
>     public static void main(String[] args) {  
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             System.out.println("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             System.out.println("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { 
>            System.out.println("OK. Expected IllegalStateException");   
>            e.printStackTrace();
>         }; 
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
> 2. Compile test2.java using BEA 1.4 javac 
> > javac -d . test2.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test2 
> Output: 
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
> java version "1.4.2_04" 
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
> OK. Expected IllegalStateException
> java.lang.IllegalStateException: Already connected
>         at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
>         at test2.main([Ljava.lang.String;)V(test2.java:17) 
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
> java.lang.IllegalAccessError: Connection already established
>         at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
>         at test2.main(test2.java:17) 
> Suggested junit test case:
> ------------------------ URLConnectionTest.java ------------------------------------------------- 
> import java.io.IOException; 
> import java.net.*;
> import junit.framework.*; 
> public class URLConnectionTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(URLConnectionTest.class); 
>     } 
>     public void test_setUseCaches () { 
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             fail("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             fail("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { //expected
>         }; 
>    } 
> }

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


[jira] Assigned: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-71?page=all ]

Tim Ellison reassigned HARMONY-71:
----------------------------------

    Assign To: Tim Ellison

>  java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
> --------------------------------------------------------------------------
>
>          Key: HARMONY-71
>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Svetlana Samoilenko
>     Assignee: Tim Ellison

>
> According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.
> Code to reproduce: 
> import java.io.IOException; 
> import java.net.*; 
> public class test2 { 
>     public static void main(String[] args) {  
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             System.out.println("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             System.out.println("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { 
>            System.out.println("OK. Expected IllegalStateException");   
>            e.printStackTrace();
>         }; 
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
> 2. Compile test2.java using BEA 1.4 javac 
> > javac -d . test2.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test2 
> Output: 
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
> java version "1.4.2_04" 
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
> OK. Expected IllegalStateException
> java.lang.IllegalStateException: Already connected
>         at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
>         at test2.main([Ljava.lang.String;)V(test2.java:17) 
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
> java.lang.IllegalAccessError: Connection already established
>         at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
>         at test2.main(test2.java:17) 
> Suggested junit test case:
> ------------------------ URLConnectionTest.java ------------------------------------------------- 
> import java.io.IOException; 
> import java.net.*;
> import junit.framework.*; 
> public class URLConnectionTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(URLConnectionTest.class); 
>     } 
>     public void test_setUseCaches () { 
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             fail("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             fail("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { //expected
>         }; 
>    } 
> }

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


[jira] Resolved: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-71?page=all ]
     
Tim Ellison resolved HARMONY-71:
--------------------------------

    Resolution: Fixed

Svetlana,

Fixed in LUNI java.net.URLConnection at repo revision 376014.

Please check this fully resolves your problem.


>  java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError
> --------------------------------------------------------------------------
>
>          Key: HARMONY-71
>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Svetlana Samoilenko
>     Assignee: Tim Ellison

>
> According to j2se 1.4.2 specification method java.net.URLConnection.setUseCaches(boolean) throws IllegalStateException, if already connected. Harmony throws java.lang.IllegalAccessError instead, that contradicts the specification.
> Code to reproduce: 
> import java.io.IOException; 
> import java.net.*; 
> public class test2 { 
>     public static void main(String[] args) {  
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             System.out.println("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             System.out.println("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { 
>            System.out.println("OK. Expected IllegalStateException");   
>            e.printStackTrace();
>         }; 
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
> 2. Compile test2.java using BEA 1.4 javac 
> > javac -d . test2.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test2 
> Output: 
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
> java version "1.4.2_04" 
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) 
> OK. Expected IllegalStateException
> java.lang.IllegalStateException: Already connected
>         at java.net.URLConnection.setUseCaches(Z)V(URLConnection.java:828) 
>         at test2.main([Ljava.lang.String;)V(test2.java:17) 
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
> java.lang.IllegalAccessError: Connection already established
>         at java.net.URLConnection.setUseCaches(URLConnection.java:923) 
>         at test2.main(test2.java:17) 
> Suggested junit test case:
> ------------------------ URLConnectionTest.java ------------------------------------------------- 
> import java.io.IOException; 
> import java.net.*;
> import junit.framework.*; 
> public class URLConnectionTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(URLConnectionTest.class); 
>     } 
>     public void test_setUseCaches () { 
>         HttpURLConnection u=null; 
>         try { 
>             u=(HttpURLConnection)(new URL("http://intel.com").openConnection());
>             u.connect();
>         } catch (MalformedURLException e) { 
>             fail("unexpected MalformedURLException"+e);               
>         } catch (IOException f) { 
>             fail("unexpected IOException"+f);               
>         }  
>         try {            
>            u.setUseCaches(true); 
>         } catch (IllegalStateException e) { //expected
>         }; 
>    } 
> }

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