harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r496267 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/image/ComponentSampleModel.java test/api/java/common/java/awt/image/ComponentSampleModelTest.java
Date Mon, 15 Jan 2007 10:19:17 GMT
Author: ayza
Date: Mon Jan 15 02:19:15 2007
New Revision: 496267

URL: http://svn.apache.org/viewvc?view=rev&rev=496267
Log:
Applying patch from HARMONY-2801 ([classlib][awt] java.awt.image.IndexColorModel.getNormalizedComponents()
throws UnsupportedOperationException while RI throws NPE)

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

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java?view=diff&rev=496267&r1=496266&r2=496267
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java
Mon Jan 15 02:19:15 2007
@@ -407,6 +407,11 @@
         } else {
             samples = iArray;
         }
+        
+        if (data == null) {
+            // awt.295=data is null
+            throw new NullPointerException(Messages.getString("awt.295")); //$NON-NLS-1$
+        }
 
         for (int i = y; i < y + h; i++) {
             for (int j = x; j < x + w; j++) {
@@ -580,5 +585,6 @@
     }
 
 }
+
 
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ComponentSampleModelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ComponentSampleModelTest.java?view=diff&rev=496267&r1=496266&r2=496267
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ComponentSampleModelTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ComponentSampleModelTest.java
Mon Jan 15 02:19:15 2007
@@ -77,4 +77,18 @@
         } 
     }
 
+
+    public void testGetSamples() {
+        // regression for HARMONY-2801
+        ComponentSampleModel csm = new ComponentSampleModel(3, 10, 10, 1, 10, new int[]{0});
+
+        try {
+            int[] returnValue =
+                    csm.getSamples(Integer.MAX_VALUE,4,1,1,0,new int[]{0},(DataBuffer) null);
+            fail("No exception");
+        } catch(NullPointerException expectedException) {
+            // expected
+        }
+    } 
 }
+



Mime
View raw message