harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r495338 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/image/ColorModel.java test/api/java/common/java/awt/image/ColorModelTest.java
Date Thu, 11 Jan 2007 19:15:22 GMT
Author: ayza
Date: Thu Jan 11 11:15:21 2007
New Revision: 495338

URL: http://svn.apache.org/viewvc?view=rev&rev=495338
Log:
Applying patch from HARMONY-2793 ([classlib][awt] java.awt.image.IndexColorModel.getNormalizedComponents
throws IllegalArgumentException on Harmony instead of ArrayIndexOutOfBoundsException)

Added:
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ColorModelTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java?view=diff&rev=495338&r1=495337&r2=495338
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java
Thu Jan 11 11:15:21 2007
@@ -264,18 +264,8 @@
             throw new UnsupportedOperationException(Messages.getString("awt.26C")); //$NON-NLS-1$
         }
 
-        if (components.length - offset < numComponents) {
-            // awt.272=The length of components minus offset is less than numComponents
-            throw new IllegalArgumentException(Messages.getString("awt.272")); //$NON-NLS-1$
-        }
-
         if (normComponents == null) {
             normComponents = new float[numComponents + offset];
-        } else {
-            if (normComponents.length - normOffset < numComponents) {
-                // awt.273=The length of normComponents minus normOffset is less than numComponents
-                throw new IllegalArgumentException(Messages.getString("awt.273")); //$NON-NLS-1$
-            }
         }
 
         if (hasAlpha && isAlphaPremultiplied) {

Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ColorModelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ColorModelTest.java?view=auto&rev=495338
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ColorModelTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ColorModelTest.java
Thu Jan 11 11:15:21 2007
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package java.awt.image;
+
+import junit.framework.TestCase;
+
+public class ColorModelTest extends TestCase {
+
+    /**
+     * Test method for
+     * {@link java.awt.image.ColorModel#getNormalizedComponents(int[], int, float[], int)}.
+     * Regression for HARMONY-2793
+     */
+    public void testGetNormalizedComponentsIntArrayIntFloatArrayInt() {
+        try {
+            new IndexColorModel(1, 1, new byte[] { 1, 1, 1 }, 0, false)
+                    .getNormalizedComponents(
+                            new int[] { 1, -23, 5, 67, 89, 0 }, 1, new float[] {
+                                    1, -23, 5, 67, 89, 0 }, 200);
+            fail("ArrayIndexOutOfBoundsException should be thrown"); //$NON-NLS-1$
+        } catch (ArrayIndexOutOfBoundsException ex) {
+            // expected
+        }
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ColorModelTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message