harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r470905 - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/image/ByteLookupTable.java test/api/java/common/java/awt/image/ByteLookupTableTest.java
Date Fri, 03 Nov 2006 17:05:38 GMT
Author: apetrenko
Date: Fri Nov  3 09:05:37 2006
New Revision: 470905

URL: http://svn.apache.org/viewvc?view=rev&rev=470905
Log:
Modified patch for HARMONY-1666 "[classlib][awt] ByteLookupTable(4, new byte[]{}) expected
IllegalArgumentException"

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ByteLookupTableTest.java
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java?view=diff&rev=470905&r1=470904&r2=470905
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java
Fri Nov  3 09:05:37 2006
@@ -27,6 +27,8 @@
     private byte data[][];
     public ByteLookupTable(int offset, byte[] data) {
         super(offset, 1);
+        if (data.length < 1)
+            throw new IllegalArgumentException("Length of data should not be less then one");
         this.data = new byte[1][data.length];
         // The data array stored as a reference
         this.data[0] = data;

Added: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ByteLookupTableTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ByteLookupTableTest.java?view=auto&rev=470905
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ByteLookupTableTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/ByteLookupTableTest.java
Fri Nov  3 09:05:37 2006
@@ -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 ByteLookupTableTest extends TestCase {
+    
+    public void testConstructor() {
+        // Regression test HARMONY-1666
+        try {
+            new ByteLookupTable(4, new byte[]{});
+            fail("Expected IAE");
+        } catch(IllegalArgumentException e) {
+            // expected;
+        }
+    }
+
+}
+



Mime
View raw message