You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Leo Li (JIRA)" <ji...@apache.org> on 2007/07/31 11:42:53 UTC
[jira] Resolved: (HARMONY-4577) [classlib][luni] Stack.pop method
of harmony throws EmptyStackException, while RI throws
ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/HARMONY-4577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Leo Li resolved HARMONY-4577.
-----------------------------
Resolution: Fixed
Hi, Spark
Patch applied at r561285. Thank you for your improvement. Please verify whether the problem is resolved as you expected.
Good luck!
Leo.
> [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<E> extends Stack<E>{
> /**
> *
> */
> 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<String> testStack = new BugStack<String>();
> 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.