Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 97924 invoked from network); 10 Feb 2006 05:39:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Feb 2006 05:39:44 -0000 Received: (qmail 15089 invoked by uid 500); 10 Feb 2006 05:39:39 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 15025 invoked by uid 500); 10 Feb 2006 05:39:39 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 15009 invoked by uid 99); 10 Feb 2006 05:39:39 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2006 21:39:38 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id E1676186 for ; Fri, 10 Feb 2006 06:39:03 +0100 (CET) Message-ID: <1270192400.1139549943921.JavaMail.jira@ajax.apache.org> Date: Fri, 10 Feb 2006 06:39:03 +0100 (CET) From: "Svetlana Samoilenko (JIRA)" To: harmony-dev@incubator.apache.org Subject: [jira] Commented: (HARMONY-72) java.net.URLConnection.setAllowUserInteraction (boolean b) throws unspecified SecurityException In-Reply-To: <1995712527.1138880283039.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-72?page=comments#action_12365848 ] Svetlana Samoilenko commented on HARMONY-72: -------------------------------------------- Verified on revision 376014. Expected IllegalStateException exception is thrown. Thanks. > java.net.URLConnection.setAllowUserInteraction (boolean b) throws unspecified SecurityException > ----------------------------------------------------------------------------------------------- > > Key: HARMONY-72 > URL: http://issues.apache.org/jira/browse/HARMONY-72 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assignee: Tim Ellison > > According to j2se 1.4.2 spec java.net.URLConnection.setAllowUserInteraction(boolean) throws IllegalStateException - if already connected. > Harmony throws java.lang.SecurityException instead. > 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.setAllowUserInteraction(false); > } 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.setAllowUserInteraction(Z)V(URLConnection.java:765) > at test2.main([Ljava.lang.String;)V(test2.java:16) > at test2.main([Ljava.lang.String;)V(test2.java:18) > 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.SecurityException: Connection already established > at java.net.URLConnection.setAllowUserInteraction(URLConnection.java:736) > at test2.main(test2.java:18) > 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.setAllowUserInteraction(false); > } 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