[jira] Created: (HARMONY-82) wrong signature for 2 constructors in java.net.DatagramPacket

2006-02-08 Thread Svetlana Samoilenko (JIRA)
wrong signature for 2 constructors in java.net.DatagramPacket
-

 Key: HARMONY-82
 URL: http://issues.apache.org/jira/browse/HARMONY-82
 Project: Harmony
Type: Bug
Reporter: Svetlana Samoilenko
Priority: Minor


According to j2se 1.4.2 and 1.5 specification java.net.DatagramPacket.(byte[], 
int, int, java.net.SocketAddress) and  java.net.DatagramPacket.(byte[], int, 
java.net.SocketAddress) must throw SocketException.



-- 
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] Created: (HARMONY-83) java.net.URL(String, String, int port, String) throws MalformedURLException when protocol is known

2006-02-08 Thread Svetlana Samoilenko (JIRA)
java.net.URL(String, String, int port, String) throws MalformedURLException 
when protocol is known
--

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


According to the j2se 1.4 and 1.5 specification constructor 
java.net.URL(String, String, int port, String) throws
MalformedURLException - if an unknown protocol is specified.
Harmony throws the exception if protocol is correct but a port out of range 
that contradicts specification.

Code to reproduce: 
import java.net.*; 
public class test2 { 
public static void main(String[] args) { 
   try { 
   new URL(http, google.com, 1093812784, file ); 
   System.out.println(Test passed); 
   } catch (MalformedURLException e) { 
   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:\tmpC:\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) 
Test passed

C:\tmpC:\harmony\trunk\deploy\jre\bin\java -showversion test2 
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
applicable. 
java.net.MalformedURLException: Port out of range: 1093812784
at java.net.URL.init(URL.java:382)
at java.net.URL.init(URL.java:356)
at test2.main(test2.java:6)

Suggested fix in attachment.

Suggested junit test case:
 URLTest.java 
- 
import java.net.*;
import junit.framework.*; 

public class URLTest extends TestCase { 
public static void main(String[] args) { 
junit.textui.TestRunner.run(URLTest.class); 
} 
public void test_constructor () { 
try { 
   new URL(http, google.com, 1093812784, file ); 
   } catch (MalformedURLException e) {  
  fail(unexpected MalformedURLException);   
   } 
   } 
}




-- 
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-83) java.net.URL(String, String, int port, String) throws MalformedURLException when protocol is known

2006-02-08 Thread Svetlana Samoilenko (JIRA)
[ 
http://issues.apache.org/jira/browse/HARMONY-83?page=comments#action_12365543 ] 

Svetlana Samoilenko commented on HARMONY-83:


I could not attach a file. server reperted about error. 

Index: C:/users/TCKTeam/ws/trunk/modules/luni/src/main/java/java/net/URL.java
===
--- C:/users/TCKTeam/ws/trunk/modules/luni/src/main/java/java/net/URL.java  
(revision 375577)
+++ C:/users/TCKTeam/ws/trunk/modules/luni/src/main/java/java/net/URL.java  
(working copy)
@@ -313,9 +313,6 @@
throw new MalformedURLException(e.toString());
}
 
-   if (port  -1 || port  65535)
-   throw new 
MalformedURLException(com.ibm.oti.util.Msg.getString(
-   K0325, port)); //$NON-NLS-1$
}
 
/**
@@ -378,10 +375,7 @@
 */
public URL(String protocol, String host, int port, String file,
URLStreamHandler handler) throws MalformedURLException {
-   if (port  -1 || port  65535)
-   throw new 
MalformedURLException(com.ibm.oti.util.Msg.getString(
-   K0325, port)); //$NON-NLS-1$
-
+   
if (host != null  host.indexOf(:) != -1  host.charAt(0) 
!= '[') {
host = [ + host + ];
}


 java.net.URL(String, String, int port, String) throws MalformedURLException 
 when protocol is known
 --

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


 According to the j2se 1.4 and 1.5 specification constructor 
 java.net.URL(String, String, int port, String) throws
 MalformedURLException - if an unknown protocol is specified.
 Harmony throws the exception if protocol is correct but a port out of range 
 that contradicts specification.
 Code to reproduce: 
 import java.net.*; 
 public class test2 { 
 public static void main(String[] args) { 
try { 
new URL(http, google.com, 1093812784, file ); 
System.out.println(Test passed); 
} catch (MalformedURLException e) { 
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:\tmpC:\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) 
 Test passed
 C:\tmpC:\harmony\trunk\deploy\jre\bin\java -showversion test2 
 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
 applicable. 
 java.net.MalformedURLException: Port out of range: 1093812784
 at java.net.URL.init(URL.java:382)
 at java.net.URL.init(URL.java:356)
 at test2.main(test2.java:6)
 Suggested fix in attachment.
 Suggested junit test case:
  URLTest.java 
 - 
 import java.net.*;
 import junit.framework.*; 
 public class URLTest extends TestCase { 
 public static void main(String[] args) { 
 junit.textui.TestRunner.run(URLTest.class); 
 } 
 public void test_constructor () { 
 try { 
new URL(http, google.com, 1093812784, file ); 
} catch (MalformedURLException e) {  
   fail(unexpected MalformedURLException);   
} 
} 
 }

-- 
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-59) java.text.MessageFormat.toPattern() causes IndexOutOfBoundsException in StringBuffer.setLength method

2006-02-08 Thread Tim Ellison (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-59?page=all ]

Tim Ellison reassigned HARMONY-59:
--

Assign To: Tim Ellison

 java.text.MessageFormat.toPattern() causes IndexOutOfBoundsException in  
 StringBuffer.setLength method
 --

  Key: HARMONY-59
  URL: http://issues.apache.org/jira/browse/HARMONY-59
  Project: Harmony
 Type: Bug
   Components: Classlib
 Reporter: tatyana doubtsova
 Assignee: Tim Ellison
  Attachments: ChoiceFormatTest.java, ChoiceFormat_patches.txt

 Problem details:
 According to j2se 1.4.2, method toPattern() should return a pattern 
 representing the current state of the message format. However, Harmony throws 
 IndexOutOfBoundsException for CHOICE {1,choice} message format.
 Code for reproducing Test.java:
 import java.text.*;
   public class Test {
   public static void main(String[] args) {
   MessageFormat mf = new MessageFormat(CHOICE 
 {1,choice});
   String ptrn = mf.toPattern();
   System.out.println(ptrn =  + ptrn);
   }
   }
 Steps to Reproduce:
 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in 
 README.txt.
 2. Compile Test.java using BEA 1.4 javac
  javac -d . Test.java
 3. Run java using compatible VM (J9)
  java -showversion Test
 Output:
 java version 1.4.2 (subset)
 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
 applicable.
 Exception in thread main java.lang.IndexOutOfBoundsException
   at java.lang.StringBuffer.setLength(StringBuffer.java:810)
   at java.text.ChoiceFormat.toPattern(ChoiceFormat.java:386)
   at java.text.MessageFormat.toPattern(MessageFormat.java:802)
   at Test.main(Test.java:5)
 Output on BEA 1.4.2 to compare with:
 ptrn = CHOICE {1,choice,}
 Suggested junit test case:
 package org.apache.harmony.tests.java.text;
 import java.text.MessageFormat;
 import java.util.Locale;
 import junit.framework.TestCase;
 public class MessageFormatTest extends TestCase {
 public static void main(String[] args) {
   junit.textui.TestRunner.run(MessageFormatTest.class);
 }
 public void test_toPattern() {
 try {
 MessageFormat mf = new MessageFormat(CHOICE {1,choice});
 String ptrn = mf.toPattern();
 } catch (Exception e) {
   fail(Assert 0: Unexpected exception  + e);
 }
 }   
 }

-- 
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-59) java.text.MessageFormat.toPattern() causes IndexOutOfBoundsException in StringBuffer.setLength method

2006-02-08 Thread Tim Ellison (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-59?page=all ]
 
Tim Ellison resolved HARMONY-59:


Resolution: Fixed

That patch is good -- thanks Nathan.

Fixed in TEXT java.text.ChoiceFormat at repo revision 375969.

Tatyana : please check that this fully resolves your problem.


 java.text.MessageFormat.toPattern() causes IndexOutOfBoundsException in  
 StringBuffer.setLength method
 --

  Key: HARMONY-59
  URL: http://issues.apache.org/jira/browse/HARMONY-59
  Project: Harmony
 Type: Bug
   Components: Classlib
 Reporter: tatyana doubtsova
 Assignee: Tim Ellison
  Attachments: ChoiceFormatTest.java, ChoiceFormat_patches.txt

 Problem details:
 According to j2se 1.4.2, method toPattern() should return a pattern 
 representing the current state of the message format. However, Harmony throws 
 IndexOutOfBoundsException for CHOICE {1,choice} message format.
 Code for reproducing Test.java:
 import java.text.*;
   public class Test {
   public static void main(String[] args) {
   MessageFormat mf = new MessageFormat(CHOICE 
 {1,choice});
   String ptrn = mf.toPattern();
   System.out.println(ptrn =  + ptrn);
   }
   }
 Steps to Reproduce:
 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in 
 README.txt.
 2. Compile Test.java using BEA 1.4 javac
  javac -d . Test.java
 3. Run java using compatible VM (J9)
  java -showversion Test
 Output:
 java version 1.4.2 (subset)
 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
 applicable.
 Exception in thread main java.lang.IndexOutOfBoundsException
   at java.lang.StringBuffer.setLength(StringBuffer.java:810)
   at java.text.ChoiceFormat.toPattern(ChoiceFormat.java:386)
   at java.text.MessageFormat.toPattern(MessageFormat.java:802)
   at Test.main(Test.java:5)
 Output on BEA 1.4.2 to compare with:
 ptrn = CHOICE {1,choice,}
 Suggested junit test case:
 package org.apache.harmony.tests.java.text;
 import java.text.MessageFormat;
 import java.util.Locale;
 import junit.framework.TestCase;
 public class MessageFormatTest extends TestCase {
 public static void main(String[] args) {
   junit.textui.TestRunner.run(MessageFormatTest.class);
 }
 public void test_toPattern() {
 try {
 MessageFormat mf = new MessageFormat(CHOICE {1,choice});
 String ptrn = mf.toPattern();
 } catch (Exception e) {
   fail(Assert 0: Unexpected exception  + e);
 }
 }   
 }

-- 
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-48) Extract x-net component from 'security2' module

2006-02-08 Thread Geir Magnusson Jr (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-48?page=all ]

Geir Magnusson Jr reassigned HARMONY-48:


Assign To: Geir Magnusson Jr

 Extract x-net component from 'security2' module
 ---

  Key: HARMONY-48
  URL: http://issues.apache.org/jira/browse/HARMONY-48
  Project: Harmony
 Type: Task
   Components: Classlib
 Reporter: Stepan Mishura
 Assignee: Geir Magnusson Jr
  Attachments: extractXnetPatch.txt

 'security2' module contains a number of components. 
 According to the current class library componentization a set of javax.net.* 
 packages is a separate module (x-net).
 And proposed components reorganization (see 
 http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200601.mbox/[EMAIL
  PROTECTED]) also suggests keeping these packages in a separate module 
 Since there are no objections x-net component may be extracted from 
 'security2' and formed as a separate module.

-- 
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-82) wrong signature for 2 constructors in java.net.DatagramPacket

2006-02-08 Thread Tim Ellison (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-82?page=all ]

Tim Ellison reassigned HARMONY-82:
--

Assign To: Tim Ellison

 wrong signature for 2 constructors in java.net.DatagramPacket
 -

  Key: HARMONY-82
  URL: http://issues.apache.org/jira/browse/HARMONY-82
  Project: Harmony
 Type: Bug
 Reporter: Svetlana Samoilenko
 Assignee: Tim Ellison
 Priority: Minor


 According to j2se 1.4.2 and 1.5 specification 
 java.net.DatagramPacket.(byte[], int, int, java.net.SocketAddress) and  
 java.net.DatagramPacket.(byte[], int, java.net.SocketAddress) must throw 
 SocketException.

-- 
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-82) wrong signature for 2 constructors in java.net.DatagramPacket

2006-02-08 Thread Tim Ellison (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-82?page=all ]
 
Tim Ellison resolved HARMONY-82:


Resolution: Fixed

Svetlana,

Fixed in LUNI java.net.DatagramPacket at repo revision 376009.

Please check this fully resolves your problem.


 wrong signature for 2 constructors in java.net.DatagramPacket
 -

  Key: HARMONY-82
  URL: http://issues.apache.org/jira/browse/HARMONY-82
  Project: Harmony
 Type: Bug
 Reporter: Svetlana Samoilenko
 Assignee: Tim Ellison
 Priority: Minor


 According to j2se 1.4.2 and 1.5 specification 
 java.net.DatagramPacket.(byte[], int, int, java.net.SocketAddress) and  
 java.net.DatagramPacket.(byte[], int, java.net.SocketAddress) must throw 
 SocketException.

-- 
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-72) java.net.URLConnection.setAllowUserInteraction (boolean b) throws unspecified SecurityException

2006-02-08 Thread Tim Ellison (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-72?page=all ]
 
Tim Ellison resolved HARMONY-72:


Resolution: Fixed

Svetlana,

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

Please check this fully resolves your problem.


 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:\tmpC:\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:\tmpC:\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



[jira] Commented: (HARMONY-42) com.ibm.io.nio.FileChannel is not fully implemented

2006-02-08 Thread Tim Ellison (JIRA)
[ 
http://issues.apache.org/jira/browse/HARMONY-42?page=comments#action_12365624 ] 

Tim Ellison commented on HARMONY-42:


Richard, just to let you know that I'm currently looking at this refactoring -- 
it will take me a while to get through it so please be patientg.

 com.ibm.io.nio.FileChannel is not fully implemented
 ---

  Key: HARMONY-42
  URL: http://issues.apache.org/jira/browse/HARMONY-42
  Project: Harmony
 Type: Bug
   Components: Classlib
 Reporter: Paulex Yang
 Assignee: Tim Ellison
  Attachments: FileChannel_patch.zip, Harmony42-IFileSystem-patch.txt, 
 Harmony42-IMemorySystem-patch.txt, 
 Harmony42-java_io_FileChannelFactory-patch.txt, 
 Harmony42-java_io_FileOutputStream-patch.txt, IFileSystem.java

 Many functions of FileChannel, such as memory map, transfer, 
 gathering/scattering I/O are not implemented. Further, three classes in 
 java.io, FileInputStream FileOutputStream, and RandomAccessFile, are related 
 to java.nio.FileChannel, so that they can be refactored to base on same JNI 
 interface, just like the network channels and sockets. 

-- 
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-58) Problems trying to run the security2 test suite

2006-02-08 Thread Geir Magnusson Jr (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-58?page=all ]
 
Geir Magnusson Jr closed HARMONY-58:


Resolution: Fixed

done 

Only difference between patch and what went is is manipulation of boot CP since 
it was half way - it was depending on security.jar in deploy/jre/bin/lib/boot 

So removed the line and will take up on dev list.

 Problems trying to run the security2 test suite
 ---

  Key: HARMONY-58
  URL: http://issues.apache.org/jira/browse/HARMONY-58
  Project: Harmony
 Type: Test
   Components: Classlib
  Environment: x86, WinXP, repo revision 373866
 Reporter: Tim Ellison
 Assignee: Geir Magnusson Jr
  Attachments: security2ClasslibTestsPatch.txt

 With a combination of Stepan and Geir's instructions I have:
 Built the classlib successfully code by:
  - putting a JDK on the path, unset JAVA_HOME and CLASSPATH
  - invoke the default target in trunk/make/build.xml
  - put in the VM
 Built the security tests successfully by:
  - cd modules/security2/make
  - ant tests.run  (ignore the run failures)
 Tried to run the tests by:
  - set CLASSPATH=%CLASSPATH%;junit.jar;bcprov.jar
  - set JAVA_HOME=trunk/deploy/jre
  - set PATH=%JAVA_HOME%/bin;%PATH%
  - hack the build.xml to remove the clean-ups
  - ant tests.run
 After a few targets going by it trys to run the test, but seems to hang with 
 CPU at 100% and the following output on the console:
 -
 snip
 run:
 [junit] Running java.security.AccessControlExceptionTest
 [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.04 sec
 [junit] Running java.security.AlgorithmParameterGeneratorSpiTests
 [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.209 sec
 [junit] Running java.security.AlgorithmParameterGeneratorTest1

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



[classlib] security2 - security

2006-02-08 Thread Geir Magnusson Jr
Unless I hear massive bellowing in opposition, I'm going to move 
security - security_orig and security2 - security sometime tomorrow. 
Please register protests now...


geir


Re: [classlib:security2] bootclasspath for security tests [HARMONY-58]

2006-02-08 Thread Geir Magnusson Jr
For the record, I put the jvmarg line back - I did some test class 
renaming, and things broke!  I put it back, and all is well.  Dunno. 
Leaving there so it doesn't break anyone else.  Will continue to chase 
down after dinner



Geir Magnusson Jr wrote:
I applied patch for HARMONY-58 (thanks Stepan and Tim) and closed the 
issue.


However, there was a small thing that bugged me.  We were setting the 
bootclasspath as follows :


jvmarg 
value=-Xbootclasspath/p:${build.jars.path}/crypto.jar${path.separator}${build.jars.path}/x_net.jar/ 



which has 2 of the 3 artifacts generated by security2 coming from the 
local modules/security2 tree, and the third, security.jar, coming from 
deploy/jre/lib/boot.  This isn't healthy.


So I just removed the above line, and now we depend on all three jars 
coming from the same place, namely the deploy boot classpath.


I only feel strongly that we are consistent.  We can change from deploy/ 
to modules/security2 if we need to.


I suspect this will be fine, but it does mean that working in 
modules/security2 means that you need to go to top level to re-run the 
build to get the jars in the right place.


I think I'll change the local make in modules/security2 to also copy the 
generated jars to ../../deploy/jre/lib/boot/



That way, you can work locally and still do the proper testing w/o 
having to out of the module you are working in.  I suspect that this 
will be a pattern we repeat in all modules.


geir




[jira] Commented: (HARMONY-70) java.io.FileInputStream.close() must close channel associated with this FileInputStream

2006-02-08 Thread Paulex Yang (JIRA)
[ 
http://issues.apache.org/jira/browse/HARMONY-70?page=comments#action_12365680 ] 

Paulex Yang commented on HARMONY-70:


This issue is similiar with issue 
40(http://issues.apache.org/jira/browse/HARMONY-40), pls. refer to my comments 
for that issue,  and these issues should be fixed by patches for issue 
42(http://issues.apache.org/jira/browse/HARMONY-42).

 java.io.FileInputStream.close() must close channel associated with this 
 FileInputStream
 ---

  Key: HARMONY-70
  URL: http://issues.apache.org/jira/browse/HARMONY-70
  Project: Harmony
 Type: Bug
   Components: Classlib
 Reporter: Vladimir Ivanov


 J2SE 1.4 specification reads for the method java.io.FileInputStream.close() :
 If this stream has an associated channel then the channel is closed as well.
 But the channel is still opened.
 Code to reproduce:
 import java.io.*; 
 import java.nio.channels.*;
 public class test29 { 
 public static void main(String[] args)  {
 try { 
 File f = File.createTempFile(temp, .txt); 
 f.deleteOnExit(); 
 FileInputStream fis = new FileInputStream(f); 
 FileChannel fch = fis.getChannel(); 
 fis.close();
 System.out.println(fch.isOpen =  + fch.isOpen()); 
 } catch (Exception e) { 
 System.out.println(unex =  + e); 
 } 
 } 
 }  
 Steps to Reproduce: 
 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in 
 README.txt. 
 2. Compile test29.java using BEA 1.4 javac 
  javac -d . test29.java 
 3. Run java using compatible VM (J9) 
  java -showversion test29
 Output:
 C:\tmp\tmp17C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
 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)
 fch.isOpen = false
 C:\tmp\tmp17C:\harmony\trunk\deploy\jre\bin\java -showversion test29
 java version 1.4.2 (subset)
 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
 applicable.
 fch.isOpen = true
 junit test:
  FileInputStreamTest.java 
 -
 import java.io.*; 
 import java.nio.channels.*;
 import junit.framework.*; 
 public class FileInputStreamTest extends TestCase { 
 public static void main(String[] args) { 
 junit.textui.TestRunner.run(FileInputStreamTest.class); 
 } 
 public void testClose() { 
 try { 
 File f = File.createTempFile(temp, .txt); 
 f.deleteOnExit(); 
 FileInputStream fis = new FileInputStream(f); 
 FileChannel fch = fis.getChannel(); 
 fis.close();
 assertFalse(FAILED, channel still opened!, fch.isOpen()); 
 } catch (Exception e) { 
 fail(Unexpected exception:  + e); 
 } 
 }
 } 

-- 
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-69) java.io.RandomAccessFile(String name, String mode) doesn't allow to open a file in a read-only mode

2006-02-08 Thread Paulex Yang (JIRA)
[ 
http://issues.apache.org/jira/browse/HARMONY-69?page=comments#action_12365682 ] 

Paulex Yang commented on HARMONY-69:


An alternative fix is to modify the problematic constructor as follows:
public RandomAccessFile(String fileName, String mode)
throws FileNotFoundException {
 this(new File(fileName),  mode);
}


 java.io.RandomAccessFile(String name, String mode) doesn't allow to open a 
 file in a read-only mode
 ---

  Key: HARMONY-69
  URL: http://issues.apache.org/jira/browse/HARMONY-69
  Project: Harmony
 Type: Bug
   Components: Classlib
 Reporter: Vladimir Ivanov


 java.io.RandomAccessFile(String name, String mode) doesn't allow to open a 
 file in a read-only mode. Looks like the mode is always rw.
 Note, java.io.RandomAccessFile(File file, String mode) works OK.
 Code to reproduce:
 import java.io.*; 
 import java.nio.channels.*;
 public class test29 { 
 private static void testMode(RandomAccessFile raf, int index) {
 try { 
 FileChannel fcr = raf.getChannel(); 
 // fcr.lock() should throw NonWritableChannelException for r 
 mode
 fcr.lock(0L, Long.MAX_VALUE, false); 
 fcr.close(); 
 System.out.println(Error  + index); 
 } catch (NonWritableChannelException e) { 
 System.out.println(Success + index + :  + e); 
 } catch (Throwable e) { 
 System.out.println(Exception + index + :  + e); 
 e.printStackTrace();
 } 
 }
 public static void testRandomAccessFile_File_String(File f, int index) {
 try { 
 System.out.println(Create RAF(File, Sting):  + f); 
 RandomAccessFile raf = new RandomAccessFile(f, r); 
 testMode(raf, index);
 raf.close(); 
 } catch (Throwable e) { 
 System.out.println(Exception + index + :  + e); 
 e.printStackTrace();
 } 
 }
 public static void testRandomAccessFile_String_String(String f, int 
 index) {
 try { 
 System.out.println(Create RAF(File, Sting):  + f); 
 RandomAccessFile raf = new RandomAccessFile(f, r); 
 testMode(raf, index);
 raf.close(); 
 } catch (Throwable e) { 
 System.out.println(Exception + index + :  + e); 
 e.printStackTrace();
 } 
 }
 public static void main(String[] args)  {
 try { 
 File f = File.createTempFile(temp, .txt); 
 f.deleteOnExit(); 
 testRandomAccessFile_File_String(f, 1);
 testRandomAccessFile_String_String(f.getAbsolutePath(), 2);
 testRandomAccessFile_File_String(f, 3);
 } catch (Throwable e) { 
 System.out.println(Unexpected exception:  + e); 
 e.printStackTrace();
 } 
 } 
 }  
 Steps to Reproduce: 
 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in 
 README.txt. 
 2. Compile test29.java using BEA 1.4 javac 
  javac -d . test29.java 
 3. Run java using compatible VM (J9) 
  java -showversion test29
 Output:
 C:\tmp\tmp17C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
 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)
 Create RAF(File, Sting): C:\DOCUME~1\vivanov1\LOCALS~1\Temp\temp23838.txt
 Success1: java.nio.channels.NonWritableChannelException
 Create RAF(File, Sting): C:\DOCUME~1\vivanov1\LOCALS~1\Temp\temp23838.txt
 Success2: java.nio.channels.NonWritableChannelException
 Create RAF(File, Sting): C:\DOCUME~1\vivanov1\LOCALS~1\Temp\temp23838.txt
 Success3: java.nio.channels.NonWritableChannelException
 C:\tmp\tmp17C:\harmony\trunk\deploy\jre\bin\java -showversion test29
 java version 1.4.2 (subset)
 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
 applicable.
 Create RAF(File, Sting): C:\DOCUME~1\vivanov1\LOCALS~1\Temp\temp24535.txt
 Success1: java.nio.channels.NonWritableChannelException
 Create RAF(File, Sting): C:\DOCUME~1\vivanov1\LOCALS~1\Temp\temp24535.txt
 Error 2
 Create RAF(File, Sting): C:\DOCUME~1\vivanov1\LOCALS~1\Temp\temp24535.txt
 Success3: java.nio.channels.NonWritableChannelException
 Suggested fix:
 Add the string to set up current mode like the string in the 
 RandomAccessFile(File, String) method in the class RandomAccessFile.java 
 sting #122:
 122: isReadOnly = mode.equals(r); 
 junit test:
  RandomAccessFileTest.java 
 -
 import java.io.*; 
 import java.nio.channels.*;
 import junit.framework.*; 
   
 public class RandomAccessFileTest extends 

[jira] Updated: (HARMONY-73) java.net.InetAddress.getLocalHost() returns wrong host name for loopback address

2006-02-08 Thread Paulex Yang (JIRA)
 [ http://issues.apache.org/jira/browse/HARMONY-73?page=all ]

Paulex Yang updated HARMONY-73:
---

Attachment: InetAddress.patch

A suggested modification is to add these two lines before Ln. 296 of 
java.net.InetAddress, 

if(this == LOOPBACK){
 return localhost;
}

So that the getHostName() will return localhost instead of 127.0.0.1.

The patch is attached. 

  java.net.InetAddress.getLocalHost() returns wrong host name for loopback 
 address
 -

  Key: HARMONY-73
  URL: http://issues.apache.org/jira/browse/HARMONY-73
  Project: Harmony
 Type: Bug
   Components: Classlib
 Reporter: Svetlana Samoilenko
 Priority: Minor
  Attachments: InetAddress.patch

 J2se 1.4.2 and 5.0 specifications for java.net.InetAddress.getLocalHost() 
 read, that if there is a security manager, its checkConnect method is called 
 with the local host name and -1 as its arguments to see if the operation is 
 allowed. 
 If the operation is not allowed, an InetAddress representing the loopback 
 address is returned as hostname/hostaddress (as followed from toString() 
 specification).
 The test listed below shows that the returned loopback address has wrong 
 hostname, 127.0.0.1 instead of loopback.
 Inet_SecurityManager class is called twice and therefore host name is 
 substituted with hostaddress address.
 Code to reproduce: 
 import java.net.*; 
 public class test2 { 
 public static void main(String[] args) { 
 try { 
 System.setSecurityManager(new Inet_SecurityManager());
 System.out.println(Loopback address =  + 
 InetAddress.getLocalHost());
 } catch (Exception e){ 
 System.out.println(Unexpected exception =  + e); 
 }; 
 } 
 } 
 class Inet_SecurityManager extends SecurityManager { 
 public void checkConnect(String host, int port) { 
 super.checkConnect(host,port); 
 throw new SecurityException();
 }
 }
 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:\tmpC:\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) 
 Inet_SecurityManager :host= nswssamoil1
 Inet_SecurityManager :port= -1
 Loopback address = localhost/127.0.0.1
 C:\tmpC:\harmony\trunk\deploy\jre\bin\java -showversion test2 
 (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as 
 applicable. 
 Inet_SecurityManager :host= nswssamoil1
 Inet_SecurityManager :port= -1
 Inet_SecurityManager :host= localhost
 Inet_SecurityManager :port= -1
 Loopback address = 127.0.0.1/127.0.0.1
 Suggested junit test case:
  InetAddressTest.java 
 - 
 import java.net.*; 
 import junit.framework.*; 
 public class InetAddressTest extends TestCase { 
 public static void main(String[] args) { 
 junit.textui.TestRunner.run(InetAddress.class); 
 } 
 public void test_getLocalHost() { 
 try{
 System.setSecurityManager(new Inet_SecurityManager()); 
 String hostname=InetAddress.getLocalHost().getHostName(); 
   
 assertEquals(localhost, hostname);
 } catch (Exception e){ 
 fail(Unexpected exception =  + e); 
 };   
} 
 }
 class Inet_SecurityManager extends SecurityManager { 
 public void checkConnect(String host, int port) { 
 super.checkConnect(host,port); 
 throw new SecurityException();
 }
 } 

-- 
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] Updated: (HARMONY-73) java.net.InetAddress.getLocalHost() returns wrong host name for loopback address

2006-02-08 Thread Geir Magnusson Jr
isn't localhost actually something in the local hosts file?  Don't you 
want to look this up?


Paulex Yang (JIRA) wrote:

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

Paulex Yang updated HARMONY-73:
---

Attachment: InetAddress.patch

A suggested modification is to add these two lines before Ln. 296 of java.net.InetAddress, 


if(this == LOOPBACK){
 return localhost;
}

So that the getHostName() will return localhost instead of 127.0.0.1.

The patch is attached. 


 java.net.InetAddress.getLocalHost() returns wrong host name for loopback 
address
-

 Key: HARMONY-73
 URL: http://issues.apache.org/jira/browse/HARMONY-73
 Project: Harmony
Type: Bug
  Components: Classlib
Reporter: Svetlana Samoilenko
Priority: Minor
 Attachments: InetAddress.patch

J2se 1.4.2 and 5.0 specifications for java.net.InetAddress.getLocalHost() read, that if there is a security manager, its checkConnect method is called with the local host name and -1 as its arguments to see if the operation is allowed. 
If the operation is not allowed, an InetAddress representing the loopback address is returned as hostname/hostaddress (as followed from toString() specification).

The test listed below shows that the returned loopback address has wrong hostname, 
127.0.0.1 instead of loopback.
Inet_SecurityManager class is called twice and therefore host name is 
substituted with hostaddress address.
Code to reproduce: 
import java.net.*; 
public class test2 { 
public static void main(String[] args) { 
try { 
System.setSecurityManager(new Inet_SecurityManager());

System.out.println(Loopback address =  + 
InetAddress.getLocalHost());
} catch (Exception e){ 
System.out.println(Unexpected exception =  + e); 
}; 
} 
} 
class Inet_SecurityManager extends SecurityManager { 
public void checkConnect(String host, int port) { 
super.checkConnect(host,port); 
throw new SecurityException();

}
}
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:\tmpC:\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) 
Inet_SecurityManager :host= nswssamoil1

Inet_SecurityManager :port= -1
Loopback address = localhost/127.0.0.1
C:\tmpC:\harmony\trunk\deploy\jre\bin\java -showversion test2 
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
Inet_SecurityManager :host= nswssamoil1

Inet_SecurityManager :port= -1
Inet_SecurityManager :host= localhost
Inet_SecurityManager :port= -1
Loopback address = 127.0.0.1/127.0.0.1
Suggested junit test case:
 InetAddressTest.java - 
import java.net.*; 
import junit.framework.*; 
public class InetAddressTest extends TestCase { 
public static void main(String[] args) { 
junit.textui.TestRunner.run(InetAddress.class); 
} 
public void test_getLocalHost() { 
try{
System.setSecurityManager(new Inet_SecurityManager()); 
String hostname=InetAddress.getLocalHost().getHostName();   
assertEquals(localhost, hostname);
} catch (Exception e){ 
fail(Unexpected exception =  + e); 
};   
   } 
}
class Inet_SecurityManager extends SecurityManager { 
public void checkConnect(String host, int port) { 
super.checkConnect(host,port); 
throw new SecurityException();

}
} 




Re: [classlib] security2 - security

2006-02-08 Thread Geir Magnusson Jr

Hm.  I thought security was stubs, but it isn't.

Is there anything in security/ that we don't have in security2/ or is 
better?


geir

Geir Magnusson Jr wrote:
Unless I hear massive bellowing in opposition, I'm going to move 
security - security_orig and security2 - security sometime tomorrow. 
Please register protests now...


geir




Re: [classlib:security2] bootclasspath for security tests [HARMONY-58]

2006-02-08 Thread Stepan Mishura
Hi Geir,


For the record, I put the jvmarg line back - I did some test class
renaming, and things broke!  I put it back, and all is well.  Dunno.
Leaving there so it doesn't break anyone else.  Will continue to chase
down after dinner


crypto.jar and x_net.jar are not created by the 'main build file' (i.e.
make/build.xml) and they are absent in Harmony boot (deploy/jre/lib/boot)
directory. So the build script from 'security2' builds them and places
explicitly to the bootclasspath.

If you remove jvmarg line then you need to update additionally
make/build.xml or the build script from 'security2' to put these jars to
Harmony boot directory.

I think that we should work out some kind of 'transition procedure' for
substituting security with security2 to be sure that we don't miss anything
and we are consistent. The first step may be extracting x-net component
because it is quite independent.

Thanks,
Stepan Mishura
Intel Middleware Products Division



On 2/9/06, Geir Magnusson Jr [EMAIL PROTECTED] wrote:

 For the record, I put the jvmarg line back - I did some test class
 renaming, and things broke!  I put it back, and all is well.  Dunno.
 Leaving there so it doesn't break anyone else.  Will continue to chase
 down after dinner


 Geir Magnusson Jr wrote:
  I applied patch for HARMONY-58 (thanks Stepan and Tim) and closed the
  issue.
 
  However, there was a small thing that bugged me.  We were setting the
  bootclasspath as follows :
 
  jvmarg
  value=-Xbootclasspath/p:${build.jars.path}/crypto.jar${path.separator
 }${build.jars.path}/x_net.jar/
 
 
  which has 2 of the 3 artifacts generated by security2 coming from the
  local modules/security2 tree, and the third, security.jar, coming from
  deploy/jre/lib/boot.  This isn't healthy.
 
  So I just removed the above line, and now we depend on all three jars
  coming from the same place, namely the deploy boot classpath.
 
  I only feel strongly that we are consistent.  We can change from deploy/
  to modules/security2 if we need to.
 
  I suspect this will be fine, but it does mean that working in
  modules/security2 means that you need to go to top level to re-run the
  build to get the jars in the right place.
 
  I think I'll change the local make in modules/security2 to also copy the
  generated jars to ../../deploy/jre/lib/boot/
 
 
  That way, you can work locally and still do the proper testing w/o
  having to out of the module you are working in.  I suspect that this
  will be a pattern we repeat in all modules.
 
  geir
 
 



Location for API extensions

2006-02-08 Thread Anton Avtamonov
We have agreed on org.apache.harmony package as a root package for
private implementation stuff. As I understand the major part of the
functionality located there is some kind of utility stuff used from
different places (packages) and therefore moved out from the API tree.
Besides, it also can contain some 'default' implementations when
public API represents interfaces only.

It looks for me that in general we can divide all such stuff into 2 categories:
 - utility methods appeared due to package visibility or other
reasons, 'default' implementations, etc. This category (in general) is
not likely to be interesting for the users of harmony platform
 - classes, which are referenced from API, but have stand-alone value,
which is not accessible from public API. Such classes, in fact, extend
the standard API and may be useful for the harmony users. I believe
such functionality exists in almost any module; their authors know
what is valuable.

What I propose is to identify such functionlity and separate it from
the 'hidden' utility stuff. Let's have some additinal root
(harmony.extensions say) specially intended to keep 'java-harmony'
improvements. What do you think?

--
Anton Avtamonov,
Intel Middleware Products Division