You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ay...@apache.org on 2007/01/29 18:08:38 UTC

svn commit: r501111 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/ToolkitImpl.java test/api/java/common/java/awt/ToolkitTest.java

Author: ayza
Date: Mon Jan 29 09:08:37 2007
New Revision: 501111

URL: http://svn.apache.org/viewvc?view=rev&rev=501111
Log:
Applying patch from HARMONY-2498 ([classlib][awt] java.awt.Tollkit.getImage(null) throws NPE while RI doesn't)

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

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java?view=diff&rev=501111&r1=501110&r2=501111
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java Mon Jan 29 09:08:37 2007
@@ -410,7 +410,8 @@
 
     static Image getImage(String filename, Toolkit toolkit) {
         synchronized (imageCache) {
-            Image im = imageCache.get(filename);
+            Image im = (filename == null ? null : imageCache.get(filename));
+
             if (im == null) {
                 try {
                     im = toolkit.createImage(filename);
@@ -418,6 +419,7 @@
                 } catch (Exception e) {
                 }
             }
+
             return im;
         }
     }

Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ToolkitTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ToolkitTest.java?view=auto&rev=501111
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ToolkitTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ToolkitTest.java Mon Jan 29 09:08:37 2007
@@ -0,0 +1,43 @@
+/*
+ *  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 junit.framework.TestCase;
+
+public class ToolkitTest extends TestCase {
+
+    public ToolkitTest() {
+        super();
+    }
+
+    public ToolkitTest(String name) {
+        super(name);
+    }
+
+    public void testGetImage() {
+        try {    
+            Toolkit tk = Toolkit.getDefaultToolkit();            
+
+            assertNotNull(tk.getImage((String) null));
+        } catch (NullPointerException npe) {             
+            fail("Unexpected NPE");            
+        }
+    }
+
+}

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