harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject 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
Date Mon, 29 Jan 2007 17:08:38 GMT
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



Mime
View raw message