harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495848 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/Robot.java test/api/java/common/java/awt/RobotTest.java
Date Sat, 13 Jan 2007 08:27:02 GMT
Author: hindessm
Date: Sat Jan 13 00:27:01 2007
New Revision: 495848

URL: http://svn.apache.org/viewvc?view=rev&rev=495848
Log:
Applied patches from "[#HARMONY-2442] [classlib][awt] java.awt.Robot(null)
throws NPE instead of IllegalArgumentException".

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Robot.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/RobotTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Robot.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Robot.java?view=diff&rev=495848&r1=495847&r2=495848
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Robot.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Robot.java Sat
Jan 13 00:27:01 2007
@@ -41,7 +41,8 @@
 
     public Robot(GraphicsDevice screen) throws AWTException {
         Toolkit.checkHeadless();
-        if (screen.getType() != GraphicsDevice.TYPE_RASTER_SCREEN) {
+        if ((screen == null)
+                || (screen.getType() != GraphicsDevice.TYPE_RASTER_SCREEN)) {
             // awt.129=Not a screen device
             throw new IllegalArgumentException(Messages.getString("awt.129")); //$NON-NLS-1$
         }

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/RobotTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/RobotTest.java?view=diff&rev=495848&r1=495847&r2=495848
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/RobotTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/RobotTest.java
Sat Jan 13 00:27:01 2007
@@ -159,7 +159,7 @@
     /*
      * Class under test for void Robot(java.awt.GraphicsDevice)
      */
-    public final void testRobotGraphicsDevice() {
+    public final void testRobotGraphicsDevice() throws AWTException {
         try {
             robot = new Robot(new PrintDevice());
         } catch (IllegalArgumentException iae) {
@@ -178,6 +178,14 @@
             exceptionCaught = true;
         }
         assertFalse(exceptionCaught);
+        
+        // Regression test for HARMONY-2442
+        try {
+            new Robot(null);
+            fail("IllegalArgumentException was not thrown"); //$NON-NLS-1$
+        } catch (IllegalArgumentException ex) {
+            // expected
+        }
     }
 
     public final void testCreateScreenCapture() {



Mime
View raw message