harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE
Date Thu, 03 Aug 2006 15:28:14 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1031?page=all ]

Denis Kishenko updated HARMONY-1031:
------------------------------------

    Attachment: 1031-Bidi.patch

I'm sorry, but previous patches were incorrect

> [classlib][text]compatibility: Bidi expected IAE
> ------------------------------------------------
>
>                 Key: HARMONY-1031
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1031
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Denis Kishenko
>         Attachments: 1031-Bidi.patch, 1031-BidiTest.patch, Bidi.patch, BidiTest.patch
>
>
> 1. Compatibility bug in java.text.Bidi.reorderVisually(byte[], int, Object[],int,int)
>  - RI throws IAE while Harmony throws NegativeArrayException if last parameter is negative

> 2. Compatibility bug java.text.Bidi(char[] text, int textStart, byte[] embeddings, int
embStart, int paragraphLength, int flags)
> - RI throws IAE while Harmony throws ArrayIndexOutOfBoundsException if textStart <0
> - RI throws IAE while Harmony throws nothing if embStart <0
> - RI throws IAE while Harmony throws NegativeArraySizeException if paragraphLength <0
> - RI throws IAE while Harmony throws OutOfMemoryError if paragraphLength= Integer.MAX_VALUE
> - RI throws nothing while Harmony throws NPE if embStart= flags and paragraphLength=0.
> Test: 1 =======================================================================
> import java.text.*;
> public class test3 {
> public static void main (String[] args) {
>        Bidi bidi=null;
>        String par="asdfghsafl;";
>        AttributedString paragraph = new AttributedString("Paragraph of text|
> txet of hpargarap");
>        try {
>         bidi = new Bidi( paragraph.getIterator());
>             }
>         catch (Exception e) {
>                 System.out.println ("new Bidi" + e);
>         }
>         Object[] oa= new Object[] {new String("testString")};
>         byte[] levels = new byte[]{(byte)0xFF};
>         int levelStart = 1;
>         int Start = 1;
>         int count = -1;
>         try{
>              bidi.reorderVisually(levels, levelStart, oa, Start, count);
>         return;
>         }
>         catch (IllegalArgumentException e) {e.printStackTrace(); 
> System.out.println("passed");
>         }
>         catch (NegativeArraySizeException e) {e.printStackTrace(); 
> System.out.println("failed");
>         }       
> }
> }
> Output:
> ----------------------------------------------------------------jrockit-jdk1.5.0_03:

> java.lang.IllegalArgumentException: count -2 must be >= 0
> 	at java.text.Bidi.reorderVisually(Bidi.java:520)
> 	at bug9267.main(bug9267.java:26)
> passed
> ----------------------------------------------------------------Harmony
> java.lang.NegativeArraySizeException
> 	at java.text.Bidi.reorderVisually(Bidi.java:428)
> 	at bug9267.main(bug9267.java:26)
> failed
> Test: 2 =======================================================================
> import java.text.Bidi;
> import java.util.Set;
> import java.text.AttributedCharacterIterator;
> import java.util.Map;
> public class test  { 
>     public static void main (String[] args) { 
>        // RI throws IAE while Harmony throws ArrayIndexOutOfBoundsException if
> textStart <0
>        try {                                                                    
>            new Bidi(new char[] { 't','t','t'},-1,new byte[] { 2, 2 },1,1,1);
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>        // RI throws IAE while Harmony throws nothing if embStart <0
>        try {                                                                    
>            new Bidi(new char[] { 't','t','t'}, 1, new byte[] { 2, 2 }, -1,1,1
> );
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>        // RI throws IAE while Harmony throws NegativeArraySizeException if
> paragraphLength <0 
>        try {                                                                    
>            new Bidi(new char[] { 't','t','t'}, 1, new byte[] { 2, 2 }, 1,-1,1
> );
>        } catch (Exception e) {
>            e.printStackTrace();
>        } 
>        // RI throws IAE while Harmony throws OutOfMemoryError if
> paragraphLength= Integer.MAX_VALUE 
>        try {                                                                    
>            new Bidi(new char[] {}, 5, new byte[] { 2, 2,2,2,2,2 },
> 8,Integer.MAX_VALUE,5 );
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>        // RI throws  nothing while Harmony throws NPE if embStart= flags and
> paragraphLength=0.
>        try {                                                                    
>            new Bidi(new char[] {'o'}, 0, new byte[] { 2, 2}, 2, 0, 2 );
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>     }
> }
> Output 
> ----------------------------------------------------------------jrockit-jdk1.5.0_03
> java.lang.IllegalArgumentException: bad range: -1 length: 2 for text of length: 3
> 	at java.text.Bidi.<init>(Bidi.java:218)
> 	at bug9287.main(bug9287.java:13)
> java.lang.IllegalArgumentException: bad range: -1 length: 2 for embeddings of length:
3
> 	at java.text.Bidi.<init>(Bidi.java:223)
> 	at bug9287.main(bug9287.java:19)
> java.lang.IllegalArgumentException: bad length: -1
> 	at java.text.Bidi.<init>(Bidi.java:215)
> 	at bug9287.main(bug9287.java:26)
> java.lang.IllegalArgumentException: bad range: 5 length: 2147483647 for text of length:
0
> 	at java.text.Bidi.<init>(Bidi.java:218)
> 	at bug9287.main(bug9287.java:34)
> ----------------------------------------------------------------Harmony
> java.lang.ArrayIndexOutOfBoundsException: bad arrayCopy
> 	at java.lang.VMMemoryManager.arrayCopy()
> 	at java.lang.System.arraycopy()
> 	at java.text.Bidi.createUBiDi(Bidi.java:183)
> 	at java.text.Bidi.<init>(Bidi.java:144)
> 	at bug9287.main(bug9287.java:13)
> java.lang.NegativeArraySizeException
> 	at java.text.Bidi.createUBiDi(Bidi.java:182)
> 	at java.text.Bidi.<init>(Bidi.java:144)
> 	at bug9287.main(bug9287.java:26)
> java.lang.OutOfMemoryError: VM doesn't support arrays of the requested size
> 	at java.text.Bidi.createUBiDi(Bidi.java:182)
> 	at java.text.Bidi.<init>(Bidi.java:144)
> java.lang.NullPointerException: bad arrayCopy
> 	at java.lang.VMMemoryManager.arrayCopy()
> 	at java.lang.System.arraycopy()
> 	at java.text.Bidi.createUBiDi(Bidi.java:193)
> 	at java.text.Bidi.<init>(Bidi.java:144)
> 	at bug9287.main(bug9287.java:40)
> 	at bug9287.main(bug9287.java:34)

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

        

Mime
View raw message