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/10 07:08:55 UTC
[jira] Created: (HARMONY-85) java.util.jar.Attributes.Name(String
name) does not throw IllegalArgumentException if name.length > 70
java.util.jar.Attributes.Name(String name) does not throw IllegalArgumentException if name.length > 70
------------------------------------------------------------------------------------------------------
Key: HARMONY-85
URL: http://issues.apache.org/jira/browse/HARMONY-85
Project: Harmony
Type: Bug
Components: Classlib
Reporter: Svetlana Samoilenko
According to j2se 1.4.2 and 1.5 specification for Attributes.Name(String name) a string length cannot exceed 70 characters.
Harmony does not throw IllegalArgumentException if name.length > 70.
Code to reproduce: import java.util.jar.*;
public class test2 {
public static void main(String args[]) throws Exception {
try {
//no more than 70 chars in attribute name allowed
new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
System.out.println("Failed. Should be IllegalArgumentException ");
} catch(IllegalArgumentException e) {
System.out.println("Expected IllegalArgumentException");
}
}
}
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)
Expected IllegalArgumentException
C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
Failed. Should be IllegalArgumentException
Siggested fix:
@@ -84,7 +84,7 @@
public Name(String s) {
int i = s.length();
- if (i == 0)
+ if (i == 0 || i> 70)
throw new IllegalArgumentException();
for (; --i >= 0;) {
char ch = s.charAt(i);
Suggested junit test case:
------------------------ AttributesTest.java -------------------------------------------------
import java.util.jar.*;
import junit.framework.*;
public class AttributesTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(AttributesTest.class);
}
public void test_constructor () {
try {
new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
fail("Should be IllegalArgumentException");
} catch(IllegalArgumentException 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-85) java.util.jar.Attributes.Name(String
name) does not throw IllegalArgumentException if name.length > 70
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-85?page=all ]
Tim Ellison resolved HARMONY-85:
--------------------------------
Resolution: Fixed
Svetlana,
Fixed in archive module in java.util.jar.Attributes.Name at repo revision 377734.
Please check that this fully resolves your problem.
> java.util.jar.Attributes.Name(String name) does not throw IllegalArgumentException if name.length > 70
> ------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-85
> URL: http://issues.apache.org/jira/browse/HARMONY-85
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
>
> According to j2se 1.4.2 and 1.5 specification for Attributes.Name(String name) a string length cannot exceed 70 characters.
> Harmony does not throw IllegalArgumentException if name.length > 70.
> Code to reproduce: import java.util.jar.*;
> public class test2 {
> public static void main(String args[]) throws Exception {
> try {
> //no more than 70 chars in attribute name allowed
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> System.out.println("Failed. Should be IllegalArgumentException ");
> } catch(IllegalArgumentException e) {
> System.out.println("Expected IllegalArgumentException");
> }
> }
> }
> 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)
> Expected IllegalArgumentException
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> Failed. Should be IllegalArgumentException
> Siggested fix:
> @@ -84,7 +84,7 @@
> public Name(String s) {
> int i = s.length();
> - if (i == 0)
> + if (i == 0 || i> 70)
> throw new IllegalArgumentException();
> for (; --i >= 0;) {
> char ch = s.charAt(i);
> Suggested junit test case:
> ------------------------ AttributesTest.java -------------------------------------------------
> import java.util.jar.*;
> import junit.framework.*;
> public class AttributesTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(AttributesTest.class);
> }
> public void test_constructor () {
> try {
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> fail("Should be IllegalArgumentException");
> } catch(IllegalArgumentException 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-85) java.util.jar.Attributes.Name(String
name) does not throw IllegalArgumentException if name.length > 70
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-85?page=all ]
Tim Ellison closed HARMONY-85:
------------------------------
Verified by Svetlana.
> java.util.jar.Attributes.Name(String name) does not throw IllegalArgumentException if name.length > 70
> ------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-85
> URL: http://issues.apache.org/jira/browse/HARMONY-85
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
>
> According to j2se 1.4.2 and 1.5 specification for Attributes.Name(String name) a string length cannot exceed 70 characters.
> Harmony does not throw IllegalArgumentException if name.length > 70.
> Code to reproduce: import java.util.jar.*;
> public class test2 {
> public static void main(String args[]) throws Exception {
> try {
> //no more than 70 chars in attribute name allowed
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> System.out.println("Failed. Should be IllegalArgumentException ");
> } catch(IllegalArgumentException e) {
> System.out.println("Expected IllegalArgumentException");
> }
> }
> }
> 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)
> Expected IllegalArgumentException
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> Failed. Should be IllegalArgumentException
> Siggested fix:
> @@ -84,7 +84,7 @@
> public Name(String s) {
> int i = s.length();
> - if (i == 0)
> + if (i == 0 || i> 70)
> throw new IllegalArgumentException();
> for (; --i >= 0;) {
> char ch = s.charAt(i);
> Suggested junit test case:
> ------------------------ AttributesTest.java -------------------------------------------------
> import java.util.jar.*;
> import junit.framework.*;
> public class AttributesTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(AttributesTest.class);
> }
> public void test_constructor () {
> try {
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> fail("Should be IllegalArgumentException");
> } catch(IllegalArgumentException 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-85) java.util.jar.Attributes.Name(String
name) does not throw IllegalArgumentException if name.length > 70
Posted by "Svetlana Samoilenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-85?page=comments#action_12366444 ]
Svetlana Samoilenko commented on HARMONY-85:
--------------------------------------------
Tim, thank you, bug is not reproducible with latest sources.
> java.util.jar.Attributes.Name(String name) does not throw IllegalArgumentException if name.length > 70
> ------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-85
> URL: http://issues.apache.org/jira/browse/HARMONY-85
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
>
> According to j2se 1.4.2 and 1.5 specification for Attributes.Name(String name) a string length cannot exceed 70 characters.
> Harmony does not throw IllegalArgumentException if name.length > 70.
> Code to reproduce: import java.util.jar.*;
> public class test2 {
> public static void main(String args[]) throws Exception {
> try {
> //no more than 70 chars in attribute name allowed
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> System.out.println("Failed. Should be IllegalArgumentException ");
> } catch(IllegalArgumentException e) {
> System.out.println("Expected IllegalArgumentException");
> }
> }
> }
> 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)
> Expected IllegalArgumentException
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> Failed. Should be IllegalArgumentException
> Siggested fix:
> @@ -84,7 +84,7 @@
> public Name(String s) {
> int i = s.length();
> - if (i == 0)
> + if (i == 0 || i> 70)
> throw new IllegalArgumentException();
> for (; --i >= 0;) {
> char ch = s.charAt(i);
> Suggested junit test case:
> ------------------------ AttributesTest.java -------------------------------------------------
> import java.util.jar.*;
> import junit.framework.*;
> public class AttributesTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(AttributesTest.class);
> }
> public void test_constructor () {
> try {
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> fail("Should be IllegalArgumentException");
> } catch(IllegalArgumentException 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-85) java.util.jar.Attributes.Name(String
name) does not throw IllegalArgumentException if name.length > 70
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-85?page=all ]
Tim Ellison reassigned HARMONY-85:
----------------------------------
Assign To: Tim Ellison
> java.util.jar.Attributes.Name(String name) does not throw IllegalArgumentException if name.length > 70
> ------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-85
> URL: http://issues.apache.org/jira/browse/HARMONY-85
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
>
> According to j2se 1.4.2 and 1.5 specification for Attributes.Name(String name) a string length cannot exceed 70 characters.
> Harmony does not throw IllegalArgumentException if name.length > 70.
> Code to reproduce: import java.util.jar.*;
> public class test2 {
> public static void main(String args[]) throws Exception {
> try {
> //no more than 70 chars in attribute name allowed
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> System.out.println("Failed. Should be IllegalArgumentException ");
> } catch(IllegalArgumentException e) {
> System.out.println("Expected IllegalArgumentException");
> }
> }
> }
> 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)
> Expected IllegalArgumentException
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> Failed. Should be IllegalArgumentException
> Siggested fix:
> @@ -84,7 +84,7 @@
> public Name(String s) {
> int i = s.length();
> - if (i == 0)
> + if (i == 0 || i> 70)
> throw new IllegalArgumentException();
> for (; --i >= 0;) {
> char ch = s.charAt(i);
> Suggested junit test case:
> ------------------------ AttributesTest.java -------------------------------------------------
> import java.util.jar.*;
> import junit.framework.*;
> public class AttributesTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(AttributesTest.class);
> }
> public void test_constructor () {
> try {
> new Attributes.Name( "01234567890123456789012345678901234567890123456789012345678901234567890");
> fail("Should be IllegalArgumentException");
> } catch(IllegalArgumentException 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