harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r513362 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/image/BandedSampleModel.java test/api/java/common/java/awt/image/RasterTest.java
Date Thu, 01 Mar 2007 15:00:52 GMT
Author: apetrenko
Date: Thu Mar  1 07:00:46 2007
New Revision: 513362

URL: http://svn.apache.org/viewvc?view=rev&rev=513362
Log:
Patch for HARMONY-2875 "[classlib][awt] Compatibility: java.awt.image.Raster.getPixels() thows
ArrayIndexOutOfBoundsException on Harmony and works silent on RI"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/RasterTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java?view=diff&rev=513362&r1=513361&r2=513362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java
Thu Mar  1 07:00:46 2007
@@ -209,29 +209,6 @@
     }
 
     @Override
-    public int[] getPixels(int x, int y, int w, int h, int iArray[],
-            DataBuffer data) {
-        int pixels[];
-        int idx = 0;
-
-        if (iArray == null) {
-            pixels = new int[w * h * numBands];
-        } else {
-            pixels = iArray;
-        }
-
-        for (int i = y; i < y + h; i++) {
-            for (int j = x; j < x + w; j++) {
-                for (int n = 0; n < numBands; n++) {
-                    pixels[idx++] = getSample(j, i, n, data);
-                }
-            }
-        }
-
-        return pixels;
-    }
-
-    @Override
     public int getSample(int x, int y, int b, DataBuffer data) {
         if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
             // awt.63=Coordinates are not in bounds

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/RasterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/RasterTest.java?view=diff&rev=513362&r1=513361&r2=513362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/RasterTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/RasterTest.java
Thu Mar  1 07:00:46 2007
@@ -85,4 +85,17 @@
             // Expected
         }
     }
+    
+    public void testGetPixels() {
+        // Regression test for HARMONY-2875
+        try {
+            Raster.createRaster(new BandedSampleModel(1, 2, 3, 4),
+                    new DataBufferByte(new byte[191], 0),
+                    new Point(new Point(28, 43))).getPixels(6,
+                    Integer.MAX_VALUE, 1, 0, new int[] {});
+            fail("ArrayIndexOutOfBoundsException should be thrown"); //$NON-NLS-1$
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // expected
+        }
+    }
 }



Mime
View raw message