harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r466035 - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/TexturePaint.java test/api/java/common/java/awt/TexturePaintTest.java
Date Fri, 20 Oct 2006 08:33:36 GMT
Author: mloenko
Date: Fri Oct 20 01:33:34 2006
New Revision: 466035

URL: http://svn.apache.org/viewvc?view=rev&rev=466035
Log:
applied patch from HARMONY-1471
[classlib][awt] TexturePaint expected NPE if one of input parameters is null

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/TexturePaintTest.java
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TexturePaint.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TexturePaint.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TexturePaint.java?view=diff&rev=466035&r1=466034&r2=466035
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TexturePaint.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TexturePaint.java
Fri Oct 20 01:33:34 2006
@@ -38,6 +38,12 @@
     Rectangle2D anchor;
 
     public TexturePaint(BufferedImage img, Rectangle2D anchor) {
+        if (img == null) {
+            throw new NullPointerException("Image is null");
+        }
+        if (anchor == null) {
+            throw new NullPointerException("Anchor is null");
+        }
         this.img = img;
         this.anchor = anchor;
     }

Added: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/TexturePaintTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/TexturePaintTest.java?view=auto&rev=466035
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/TexturePaintTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/TexturePaintTest.java
Fri Oct 20 01:33:34 2006
@@ -0,0 +1,42 @@
+/*
+ *  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;
+
+import java.awt.image.BufferedImage;
+
+import junit.framework.TestCase;
+
+public class TexturePaintTest extends TestCase {
+
+    public void testContructorBad() {
+        // Regression HARMONY-1471
+        try {
+            new TexturePaint(null, new Rectangle());
+            fail("expected NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        try {
+            new TexturePaint(new BufferedImage(10, 10,
+                    BufferedImage.TYPE_INT_ARGB), null);
+            fail("expected NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+    }
+}

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



Mime
View raw message