harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r502228 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/image/ReplicateScaleFilter.java test/api/java/common/java/awt/image/AreaAveragingScaleFilterTest.java
Date Thu, 01 Feb 2007 14:33:53 GMT
Author: ayza
Date: Thu Feb  1 06:33:52 2007
New Revision: 502228

URL: http://svn.apache.org/viewvc?view=rev&rev=502228
Log:
Applying patch from HARMONY-2656 ([classlib][awt] Compatibility: java.awt.AreaAveragingScaleFilter.setPixels()
throws different Exceptions on RI and Harmony when the height is negative)

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

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java?view=diff&rev=502228&r1=502227&r2=502228
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java
Thu Feb  1 06:33:52 2007
@@ -167,6 +167,10 @@
      * Initialization of srccols and srcrows arrays
      */
     private void initArrays(){
+        if ((destWidth < 0) || (destHeight < 0)) {
+            throw new IndexOutOfBoundsException();
+        }
+        
         srccols = new int[destWidth];
         int ca = srcWidth >>> 1;
         for(int i = 0; i < destWidth; i++){
@@ -181,4 +185,5 @@
     }
 
 }
+
 

Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/AreaAveragingScaleFilterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/AreaAveragingScaleFilterTest.java?view=auto&rev=502228
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/AreaAveragingScaleFilterTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/AreaAveragingScaleFilterTest.java
Thu Feb  1 06:33:52 2007
@@ -0,0 +1,35 @@
+/*
+ *  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 AreaAveragingScaleFilterTest extends TestCase {
+
+    public void testSetPixelsIntIntIntIntColorModelIntArrayIntInt() {
+        // Regression for HARMONY-2656
+        try {
+            new AreaAveragingScaleFilter(143, -1).setPixels(1, 1, 1, 1,
+                    (ColorModel) null, new int[0], 2, 1);
+            fail("IndexOutOfBoundsException expected"); //$NON-NLS-1$
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+    }
+}

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



Mime
View raw message