Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-2641

[classlib][awt] Compatibility: java.awt.image.DataBufferByte(int,int) does not throw ArrayIndexOutOfBoundsException on Harmony while it does on RI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • None

    Description

      RI throws unspecified ArrayIndexOutOfBoundsException for java.awt.image.DataBufferByte(int size, int numBanks) when numBanks == 0, while Harmony works silently.
      Test to reproduce:
      ----------- test.java -------------
      import junit.framework.TestCase;
      import junit.textui.TestRunner;

      import java.awt.image.DataBufferByte;

      public class test extends TestCase {
      public static void main(String args[])

      { TestRunner.run(test.class); }

      public void testRun() {
      try

      { DataBufferByte db = new DataBufferByte(21, 0); fail("ArrayIndexOutOfBoundsException expected"); }

      catch (ArrayIndexOutOfBoundsException expectedException)

      { // Expected expectedException.printStackTrace(); }

      }
      }
      -------------------------------
      Output RI:
      ========
      .java.lang.ArrayIndexOutOfBoundsException
      at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:60)
      at test.testRun(test.java:13)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at junit.textui.TestRunner.doRun(TestRunner.java:116)
      at junit.textui.TestRunner.doRun(TestRunner.java:109)
      at junit.textui.TestRunner.run(TestRunner.java:72)
      at junit.textui.TestRunner.run(TestRunner.java:57)
      at test.main(test.java:8)

      Time: 0,03

      OK (1 test)

      Output Harmony:
      =============
      .F
      Time: 0.08
      There was 1 failure:
      1) testRun(test)junit.framework.AssertionFailedError: ArrayIndexOutOfBoundsException expected
      at test.testRun(test.java:14)
      at java.lang.reflect.VMReflection.invokeMethod(Native Method)
      at test.main(test.java:8)

      FAILURES!!!
      Tests run: 1, Failures: 1, Errors: 0

      I suggest to resolve this bug as non-bug difference since there is nothing said in spec about any exceptions in DataBuffer constructor and it is not obvious what was the reason of failure on RI.

      Attachments

        Activity

          People

            cap Alexey Petrenko
            ilya.okomin Ilya Okomin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: