harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miguel Montes (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2087) [classlib][html] Compatibilty. j.s.t.h.p.DTD.getElement(int) returns null when the RI throws ArrayIndexOutOfBoundsException
Date Tue, 07 Nov 2006 14:42:52 GMT
[classlib][html] Compatibilty. j.s.t.h.p.DTD.getElement(int) returns null when the RI throws
ArrayIndexOutOfBoundsException
---------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2087
                 URL: http://issues.apache.org/jira/browse/HARMONY-2087
             Project: Harmony
          Issue Type: Bug
            Reporter: Miguel Montes


The method j.s.t.h.p.DTD.getElement(int) gets an element from the DTD by index. When the argument
is not a valid index, the RI throws ArrayIndexOutOfBoundsException, while the current implementation
in Harmony returns null.

=============== Java Code ==================
import java.io.IOException;
import javax.swing.text.html.parser.DTD;
public class TestDTDGetElement {
    public static void main(String[] args) throws IOException {
        DTD dtd = DTD.getDTD("html");
   	System.out.println(dtd.getElement(200));
    }
}
==========================================

$ java -showversion TestDTDGetElement
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 200 >= 15
        at java.util.Vector.elementAt(Vector.java:432)
        at javax.swing.text.html.parser.DTD.getElement(DTD.java:141)
        at TestDTDGetElement.main(TestDTDGetElement.java:6)

$ /harmony-hdk-r468731/jdk/jre/bin/java -showversion TestDTDGetElement
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r468731, (Oct 28 2006), Linux/ia32/gcc 3.4.6, release build
http://incubator.apache.org/harmony
null

Attached is a patch


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

        

Mime
View raw message