You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey A. Ivanov (JIRA)" <ji...@apache.org> on 2006/10/12 10:09:36 UTC

[jira] Commented: (HARMONY-1745) [classlib][swing] javax.swing.text.CompositeView.getView(int n) throws unspecified ArrayIndexOutOfBoundsException

    [ http://issues.apache.org/jira/browse/HARMONY-1745?page=comments#action_12441656 ] 
            
Alexey A. Ivanov commented on HARMONY-1745:
-------------------------------------------

At the most this is the non-bug difference from the RI since it relates only to the way child views are stored.
In your test code pv.getViewCount() will return 0, thus the call pv.getView(0) is invalid.
Moreover if you call pv.getView(1) on the RI, you'll get the same ArrayIndexOutOfBoundsException. This is why this issue is not a bug at all.

> [classlib][swing] javax.swing.text.CompositeView.getView(int n) throws unspecified ArrayIndexOutOfBoundsException
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1745
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1745
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Aleksey Victorivich Yantsen
>            Priority: Minor
>         Attachments: patch1745.txt
>
>
> Problem: CompositeView.getView(int) throws unspecified ArrayIndexOutOfBoundsException while RI does not.
> Test to reproduce:
> import junit.framework.TestCase;
> import javax.swing.text.Element;
> import javax.swing.text.ParagraphView;
> import javax.swing.text.View;
> import javax.swing.text.html.HTMLDocument;
> public class Test extends TestCase {
> 	public void testcase() {
> 		HTMLDocument doc = new HTMLDocument();
> 		Element localElement = doc.getDefaultRootElement();
> 		ParagraphView pv = new ParagraphView(localElement);
> 		View v = null;
> 		try {
> 			v = pv.getView(0);
> 		} catch (ArrayIndexOutOfBoundsException e) {
> 			e.printStackTrace();
> 			fail("Got unexpected ArrayIndexOutOfBoundsException : " + e);
> 		}
> 	}
> }
> Output on Sun 1.5: 
> ================== 
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .
> Time: 0.125
> OK (1 test)
> Output on Harmony: 
> ================== 
> 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 = r453471, (Oct  6 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> .java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
> 	at javax.swing.text.CompositeView.getView(CompositeView.java:56)
> 	at Test.testcase(Test.java:16)
> 	at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:258)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:16)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:19)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:28)
> 	at junit.framework.TestSuite.run(TestSuite.java:23)
> 	at junit.textui.TestRunner.doRun(TestRunner.java:116)
> 	at junit.textui.TestRunner.start(TestRunner.java:172)
> 	at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.407
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got unexpected ArrayIndexOutOfBoundsException : java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
> 	at Test.testcase(Test.java:19)
> 	at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0

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