You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Denis Kishenko (JIRA)" <ji...@apache.org> on 2006/08/01 14:26:13 UTC

[jira] Created: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

[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


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

        

[jira] Commented: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

Posted by "Denis Kishenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1031?page=comments#action_12432446 ] 
            
Denis Kishenko commented on HARMONY-1031:
-----------------------------------------

Verified

> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 1031-Bidi(3).patch, 1031-Bidi.patch, 1031-BidiTest(2).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

        

[jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

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

    Attachment: 1031-BidiTest.patch

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

        

[jira] Commented: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

Posted by "Denis Kishenko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1031?page=comments#action_12426179 ] 
            
Denis Kishenko commented on HARMONY-1031:
-----------------------------------------

Paulex, when I changed patches 1031-Bidi and 1031-BidiTest I lost some code which fixes Test 1, it's my inattention.
Could you apply new patches.  

> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 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

        

[jira] Closed: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

Paulex Yang closed HARMONY-1031.
--------------------------------


Verified by Denis.

> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 1031-Bidi(3).patch, 1031-Bidi.patch, 1031-BidiTest(2).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

        

[jira] Resolved: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

Paulex Yang resolved HARMONY-1031.
----------------------------------

    Resolution: Fixed

Denis, latest patch applied at revision r439958, thanks a lot for this enhancement, and sorry for response so late. Please verify the problem is fully fixed as you expected.

> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 1031-Bidi(3).patch, 1031-Bidi.patch, 1031-BidiTest(2).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

        

[jira] Reopened: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

Paulex Yang reopened HARMONY-1031:
----------------------------------

             
Denis found more issues. Will look at it soon.

> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 1031-Bidi(3).patch, 1031-Bidi.patch, 1031-BidiTest(2).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

        

[jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

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

    Attachment: 1031-Bidi(2).patch

> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 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

        

[jira] Resolved: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

Paulex Yang resolved HARMONY-1031.
----------------------------------

    Resolution: Fixed

Denis, HARMONY-1031 and HARMONY-1059 patch applied together at revision r428634 with modifications, thanks a lot for the enhancement. About the modification, I removed the fail() statement in exception catching block, because we have made agreement on the list about this, I also modified the license to (2005, 2006) to reflect the update date, and I found that neighther requireBidi()'s implementation nor its test complies with RI, so I also modified them both. Please verify the problems are fully resolved  as you expected.

[1]
try{
blabla
}catch(Exception e){
   fail()
}


> [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
>         Assigned To: Paulex Yang
>         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

        

[jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

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

    Attachment: Bidi.patch

patch

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

        

[jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

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

    Attachment: 1031-Bidi(3).patch

One more change =)

Since I have returned to this issue I found another tricky situation. We should check count value to avoid out of memory.

Test 3 -------------------------------------------------------------------

import java.text.Bidi;

public class bug9452 {
    public static void main (String[] args) {
        try {
            Bidi.reorderVisually(new byte[] {}, 10, new Object[] {}, 10, Integer.MAX_VALUE - 20);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Output --------------------------------------------------------------

RI
java.lang.IllegalArgumentException: levelStart 10 and count 2147483627 out of range [0, 0]
	at java.text.Bidi.reorderVisually(Bidi.java:523)
	at bug9452.main(bug9452.java:52)

Harmony
java.lang.OutOfMemoryError: VM doesn't support arrays of the requested size
	at java.text.Bidi.reorderVisually(Bidi.java:437)
	at bug9452.main(bug9452.java:52)

This patch fixes this trouble.


> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 1031-Bidi(3).patch, 1031-Bidi.patch, 1031-BidiTest(2).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

        

[jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

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

    Attachment: 1031-BidiTest(2).patch

> [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
>         Assigned To: Paulex Yang
>         Attachments: 1031-Bidi(2).patch, 1031-Bidi.patch, 1031-BidiTest(2).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

        

[jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

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

    Attachment: BidiTest.patch

unit test patch

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

        

[jira] Assigned: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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

Paulex Yang reassigned HARMONY-1031:
------------------------------------

    Assignee: Paulex Yang

> [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
>         Assigned To: Paulex Yang
>         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

        

[jira] Updated: (HARMONY-1031) [classlib][text]compatibility: Bidi expected IAE

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