harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException
Date Sat, 10 Feb 2007 23:12:06 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472049
] 

Alexei Zakharov commented on HARMONY-2459:
------------------------------------------

I took the testcase from Sergey's comment, changed it to catch ArrayIndexOutOfBoundsException
as stated in the summary for this JIRA, added several new testcases and finally added all
this to AbstractDocument_BranchElementTest. I had to update the patch for the code itself
too. So the updated version of Sergey's patch and patch for the test was committed at the
revision 505788. The test should pass both on Harmony and RI. Sergey, please verify.

> [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2459
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WIN XP
>            Reporter: Sergey Krivenko
>         Assigned To: Alexei Zakharov
>         Attachments: Harmony-2459-AbstractDocument.patch, Harmony-2459-AbstractDocumentTest.patch
>
>
> The following code throws ArrayIndexOutOfBoundsException on RI but NegativeArraySizeException
on Harmony:
> import javax.swing.text.AbstractDocument;
> import javax.swing.text.AttributeSet;
> import javax.swing.text.DefaultStyledDocument;
> import javax.swing.text.Document;
> import javax.swing.text.Element;
> import javax.swing.text.StyleContext;
> public class Test {
>     
>     public Test() {
>         DefaultStyledDocument localDefaultStyledDocument = new
>         DefaultStyledDocument(new StyleContext());
>                                 AbstractDocument.BranchElement
>         localAbstractDocument$BranchElement = localDefaultStyledDocument.new
>         BranchElement(new testElement(), (AttributeSet) null);
>         
>         try {
>             int returnValue = localAbstractDocument$BranchElement
>                     .getElementIndex(0);
>             System.out.println("returnValue= " + returnValue);
>         } catch(Exception e) {
>             e.printStackTrace();
>         }
>     }
>     public static void main(String[] args) {
>         new Test();
>     }
>     
>     class testElement implements Element {
>         
>         public AttributeSet getAttributes() {
>             return null;
>         }
>         
>         public Document getDocument() {
>             return null;
>         }
>         
>         public Element getElement(int p0) {
>             return null;
>         }
>         
>         public int getElementCount() {
>             return 0;
>         }
>         
>         public int getElementIndex(int p0) {
>             return 0;
>         }
>         
>         public int getEndOffset() {
>             return 0;
>         }
>         
>         public String getName() {
>             return "AA";
>         }
>         
>         public Element getParentElement() {
>             return null;
>         }
>         
>         public int getStartOffset() {
>             return 0;
>         }
>         
>         public boolean isLeaf() {
>             return false;
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message