Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 8000 invoked from network); 7 Nov 2006 14:55:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Nov 2006 14:55:12 -0000 Received: (qmail 66088 invoked by uid 500); 7 Nov 2006 14:55:23 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 65987 invoked by uid 500); 7 Nov 2006 14:55:23 -0000 Mailing-List: contact harmony-commits-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-commits@incubator.apache.org Received: (qmail 65976 invoked by uid 99); 7 Nov 2006 14:55:23 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Nov 2006 06:55:23 -0800 X-ASF-Spam-Status: No, hits=1.6 required=10.0 tests=GAPPY_SUBJECT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Nov 2006 06:55:11 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 59F407142F5 for ; Tue, 7 Nov 2006 06:54:51 -0800 (PST) Message-ID: <24567534.1162911291365.JavaMail.jira@brutus> Date: Tue, 7 Nov 2006 06:54:51 -0800 (PST) From: "Alexey Petrenko (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Commented: (HARMONY-2087) [classlib][html] Compatibilty. j.s.t.h.p.DTD.getElement(int) returns null when the RI throws ArrayIndexOutOfBoundsException In-Reply-To: <27856229.1162910572538.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-2087?page=comments#action_12447816 ] Alexey Petrenko commented on HARMONY-2087: ------------------------------------------ Miguel, is it possible to create a unit test for this issue? > [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 > Assigned To: Alexey Petrenko > Attachments: DTD_05.patch > > > 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