Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 93386 invoked from network); 31 Jul 2007 08:22:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jul 2007 08:22:47 -0000 Received: (qmail 35980 invoked by uid 500); 31 Jul 2007 08:22:46 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 33842 invoked by uid 500); 31 Jul 2007 08:22:40 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 27082 invoked by uid 99); 31 Jul 2007 08:22:14 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2007 01:22:14 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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, 31 Jul 2007 08:22:13 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 25A4E7141F0 for ; Tue, 31 Jul 2007 01:21:53 -0700 (PDT) Message-ID: <9480553.1185870113152.JavaMail.jira@brutus> Date: Tue, 31 Jul 2007 01:21:53 -0700 (PDT) From: "Leo Li (JIRA)" To: commits@harmony.apache.org Subject: [jira] Assigned: (HARMONY-4577) [classlib][luni] Stack.pop method of harmony throws EmptyStackException, while RI throws ArrayIndexOutOfBoundsException In-Reply-To: <14615805.1185858352935.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 [ https://issues.apache.org/jira/browse/HARMONY-4577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Leo Li reassigned HARMONY-4577: ------------------------------- Assignee: Leo Li > [classlib][luni] Stack.pop method of harmony throws EmptyStackException, while RI throws ArrayIndexOutOfBoundsException > ----------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-4577 > URL: https://issues.apache.org/jira/browse/HARMONY-4577 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: spark shen > Assignee: Leo Li > Attachments: Stack-Patch.txt, StackTest-Patch.txt > > > The protected field elementCount can be modified by its subclass. And if this > field is modified to a value which exceeds the array boundry, and invoke the pop() method, > RI will throw an ArrayIndexOutOfBoundsException but trunk5 will throw an EmptyStackException. > The following test case will show: > tatic class BugStack extends Stack{ > /** > * > */ > private static final long serialVersionUID = -9133762075342926141L; > /** > * > */ > public void setLength(int elementCount) > { > this.elementCount = elementCount; > } > > public int getLength() > { > return elementCount; > } > } > > //test for wrong exception threw by pop method > public void test_pop_modify_elementCount(){ > BugStack testStack = new BugStack(); > testStack.push("A"); > testStack.push("B"); > testStack.setLength(20); > try{ > testStack.pop(); > } > catch(ArrayIndexOutOfBoundsException e) > { > //Expected to throw ArrayIndexOutOfBoundsException here > } > catch(EmptyStackException e) > { > fail("Should throw ArrayIndexOutOfBoundsException here"); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.