harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495671 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/DisplayMode.java test/api/java/common/java/awt/DisplayModeTest.java
Date Fri, 12 Jan 2007 18:09:39 GMT
Author: hindessm
Date: Fri Jan 12 10:09:38 2007
New Revision: 495671

URL: http://svn.apache.org/viewvc?view=rev&rev=495671
Log:
Applied patches from "[#HARMONY-2444] [classlib][awt]
java.awt.DisplayMode.equals(null) throws NPE instead of returning false".

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

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DisplayMode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DisplayMode.java?view=diff&rev=495671&r1=495670&r2=495671
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DisplayMode.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DisplayMode.java
Fri Jan 12 10:09:38 2007
@@ -68,6 +68,9 @@
     }
 
     public boolean equals(DisplayMode dm) {
+        if (dm == null) {
+            return false;
+        }
         if (dm.bitDepth != bitDepth) {
             return false;
         }

Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DisplayModeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DisplayModeTest.java?view=auto&rev=495671
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DisplayModeTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/DisplayModeTest.java
Fri Jan 12 10:09:38 2007
@@ -0,0 +1,26 @@
+package java.awt;
+
+import junit.framework.TestCase;
+
+public class DisplayModeTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(DisplayModeTest.class);
+    }
+
+    /**
+     * Test method for {@link java.awt.DisplayMode#equals(java.lang.Object)}.
+     */
+    public void testEqualsObject() {
+        assertFalse(new DisplayMode(1, 2, 3, 10).equals((Object) null));
+        assertFalse(new DisplayMode(1, 2, 3, 10).equals(new Object()));
+    }
+
+    /**
+     * Test method for {@link java.awt.DisplayMode#equals(java.awt.DisplayMode)}.
+     */
+    public void testEqualsDisplayMode() {
+        // Regression test for HARMONY-2444
+        assertFalse(new DisplayMode(1, 2, 3, 10).equals((DisplayMode) null));
+    }
+}

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



Mime
View raw message