You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Sergey Krivenko (JIRA)" <ji...@apache.org> on 2006/12/05 13:41:22 UTC

[jira] Created: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

[classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException 
--------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2459
                 URL: http://issues.apache.org/jira/browse/HARMONY-2459
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: WIN XP
            Reporter: Sergey Krivenko


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

        

[jira] Commented: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "sergey krivenko (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2459?page=all ]

sergey krivenko updated HARMONY-2459:
-------------------------------------

    Attachment: Harmony-2459-AbstractDocumentTest.patch

The attached is a patch to the test

> [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2459
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WIN XP
>            Reporter: Sergey Krivenko
>         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.
-
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

        

[jira] Updated: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey A. Ivanov updated HARMONY-2459:
--------------------------------------

    Attachment: H2459-AbstractDocument_BranchElementTest.2.patch

H2459-AbstractDocument_BranchElementTest.2.patch simplifies the test case written by Alexei.

Please review and apply.
Thank you in advance.

> [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: H2459-AbstractDocument_BranchElementTest.2.patch, 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.


[jira] Assigned: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov reassigned HARMONY-2459:
----------------------------------------

    Assignee: Alexei Zakharov

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


[jira] Commented: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472306 ] 

Alexey A. Ivanov commented on HARMONY-2459:
-------------------------------------------

Alexey, Sergey,

The test case should be simplified: the custom implementation of Element interface is not essential to reproducing this issue. BranchElement in the testReplace04 could be instantiated as follows:
BranchElement branch = document.new BranchElement(null, null);

And you can use fields declared in the test case, like doc and par, rather than declaring local variables.

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


[jira] Updated: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Sergey Krivenko (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2459?page=all ]

Sergey Krivenko updated HARMONY-2459:
-------------------------------------

    Attachment: Harmony-2459-AbstractDocument.patch

The attached is a patch that fixes the bug

> [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2459
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WIN XP
>            Reporter: Sergey Krivenko
>         Attachments: Harmony-2459-AbstractDocument.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.
-
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

        

[jira] Updated: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Sergey Krivenko (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2459?page=all ]

Sergey Krivenko updated HARMONY-2459:
-------------------------------------

    Patch Info: [Patch Available]

> [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2459
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WIN XP
>            Reporter: Sergey Krivenko
>         Attachments: Harmony-2459-AbstractDocument.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.
-
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

        

[jira] Resolved: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov resolved HARMONY-2459.
--------------------------------------

    Resolution: Fixed

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


[jira] Commented: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Sergey Krivenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2459?page=comments#action_12455613 ] 
            
Sergey Krivenko commented on HARMONY-2459:
------------------------------------------

Sorry, I made a mistake. The test code should be this:


import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.PlainDocument;

public class Test  {

    public Test () {
        PlainDocument localPlainDocument = new PlainDocument();
        Element localElement = new testElement();
        AbstractDocument.BranchElement localAbstractDocument$BranchElement = 
            localPlainDocument.new BranchElement(
                   localElement,
                   (AttributeSet) null);
        int localVariable0 = Integer.MIN_VALUE;
        int localVariable1 = 5;
        Element localElement1 = null;
        Element[] array0 = new Element[] 
                   {
                               localElement1, localElement1,
                               localElement1 };
        try {
                   localAbstractDocument$BranchElement.replace(
                               localVariable0,
                               localVariable1,
                               array0);
                   System.out.println("No Exception!");
        } 
        catch (Exception expectedException) {
            expectedException.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;
                }
    }

}


> [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2459
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WIN XP
>            Reporter: Sergey Krivenko
>
> 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.
-
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

        

[jira] Commented: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2459?page=comments#action_12456388 ] 
            
Alexey Petrenko commented on HARMONY-2459:
------------------------------------------

Sergey, can you please provide a unit test?

> [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2459
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WIN XP
>            Reporter: Sergey Krivenko
>         Attachments: Harmony-2459-AbstractDocument.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.
-
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

        

[jira] Commented: (HARMONY-2459) [classlib] [swing] Method replace() in class AbstractDocument$BranchElement throws NegativeArraySizeException

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464429 ] 

Mark Hindess commented on HARMONY-2459:
---------------------------------------

These two patches are identical - both are the fix.  Please can we have the test patch?


> [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
>         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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira