harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r495321 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/image/Raster.java main/java/common/org/apache/harmony/awt/internal/nls/messages.properties test/api/java/common/java/awt/image/RasterTest.java
Date Thu, 11 Jan 2007 18:31:59 GMT
Author: ayza
Date: Thu Jan 11 10:31:58 2007
New Revision: 495321

URL: http://svn.apache.org/viewvc?view=rev&rev=495321
Log:
The patch from HARMONY-2885 was applied ([classlib][awt] Compatibility: java.awt.image.Raster.createRaster()
doesn't throw RasterFormatException if DataBuffer type is incorrect)

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties
    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/Raster.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java?view=diff&rev=495321&r1=495320&r2=495321
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java
Thu Jan 11 10:31:58 2007
@@ -534,6 +534,11 @@
             throw new NullPointerException(Messages.getString("awt.27F")); //$NON-NLS-1$
         }
 
+        if (sm.dataType != db.dataType) {
+            // awt.293=SampleModel and DataBuffer have different data types
+            throw new RasterFormatException(Messages.getString("awt.293")); //$NON-NLS-1$
+        }
+        
         if (location == null) {
             location = new Point(0, 0);
         }
@@ -835,4 +840,5 @@
     }
 
 }
+
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties?view=diff&rev=495321&r1=495320&r2=495321
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/internal/nls/messages.properties
Thu Jan 11 10:31:58 2007
@@ -482,6 +482,7 @@
 awt.290=Source and destination rasters do not have the same height!
 awt.291=Source and destination images do not have the same width!
 awt.292=Source and destination images do not have the same height!
+awt.293=SampleModel and DataBuffer have different data types
 
 awt.err.00=file dialog {0} error!
 awt.err.01=error: {0}

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=495321&r1=495320&r2=495321
==============================================================================
--- 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 Jan 11 10:31:58 2007
@@ -19,9 +19,10 @@
 package java.awt.image;
 
 import junit.framework.TestCase;
+import java.awt.Point;
 
 public class RasterTest extends TestCase {
-    // A regression test for harmony-2717
+    // Regression test for harmony-2717
     public void test_createPackedRaster()
     {
         try {
@@ -31,6 +32,20 @@
             System.out.println(expectedException +" was thrown");
         } catch (RasterFormatException expectedException) {
             fail(expectedException +" was thrown");
+        }
+    }
+    
+    // Regression test for harmony-2885
+    public void testDataTypes() {
+        SinglePixelPackedSampleModel sm = new SinglePixelPackedSampleModel(
+                DataBuffer.TYPE_USHORT, 2, 26, new int[798]);
+
+        try {
+            Raster localRaster = Raster.createRaster(sm, new DataBufferShort(1,
+                    1), new Point());
+            fail("RasterFormatException expected!");
+        } catch (RasterFormatException expectedException) {
+            // Expected
         }
     }
 }



Mime
View raw message