You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2006/12/18 15:55:54 UTC
svn commit: r488294 - in /harmony/enhanced/classlib/trunk/modules/awt/src:
main/java/common/java/awt/image/
test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/
Author: apetrenko
Date: Mon Dec 18 06:55:54 2006
New Revision: 488294
URL: http://svn.apache.org/viewvc?view=rev&rev=488294
Log:
Patch for HARMONY-1629 "[classlib][awt]Compatibility: java.awt.image.LookupOp constructor for null LookupTable parameter throws NPE on RI while it doesn't on Harmony."
Added:
harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/
harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/LookupOpTest.java (with props)
Modified:
harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/LookupOp.java
Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/LookupOp.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/LookupOp.java?view=diff&rev=488294&r1=488293&r2=488294
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/LookupOp.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/LookupOp.java Mon Dec 18 06:55:54 2006
@@ -58,6 +58,9 @@
}
public LookupOp(LookupTable lookup, RenderingHints hints) {
+ if (lookup == null){
+ throw new NullPointerException(Messages.getString("awt.01", "lookup"));
+ }
lut = lookup;
this.hints = hints;
canUseIpp = lut instanceof ByteLookupTable || lut instanceof ShortLookupTable;
Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/LookupOpTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/LookupOpTest.java?view=auto&rev=488294
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/LookupOpTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/LookupOpTest.java Mon Dec 18 06:55:54 2006
@@ -0,0 +1,57 @@
+/*
+ * 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 org.apache.harmony.awt.tests.java.awt.image;
+
+import java.awt.RenderingHints;
+import java.awt.image.LookupOp;
+import java.awt.image.LookupTable;
+
+import junit.framework.TestCase;
+
+public class LookupOpTest extends TestCase {
+
+ public LookupOpTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for 'java.awt.image.LookupOp.LookupOp(LookupTable, RenderingHints)'
+ * when the LookupTable argument is null.
+ */
+ public final void test_LookupOp_LookupTableRenderingHints_NullLookupTable() {
+ // regression test for Harmony-1629
+ RenderingHints hints = new RenderingHints(null);
+ try {
+ LookupOp returnValue = new LookupOp((LookupTable)null, hints);
+ fail("NullPointerException expected");
+ } catch (NullPointerException npe) {
+ // expected
+ }
+ }
+
+
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/image/LookupOpTest.java
------------------------------------------------------------------------------
svn:eol-style = native