This is the mail archive of the java-patches@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: Cursor fixlet


I'm checking in this fixlet.

2001-01-11  Tom Tromey  <tromey@redhat.com>

	* java/awt/Cursor.java (Cursor(String)): Set type to custom.
	(Cursor(int), getPredefinedCursor): Throw exception if argument
	invalid.

Tom

Index: java/awt/Cursor.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Cursor.java,v
retrieving revision 1.2
diff -u -r1.2 Cursor.java
--- Cursor.java	2000/12/26 00:25:12	1.2
+++ Cursor.java	2001/01/11 17:48:18
@@ -36,6 +36,8 @@
 
   public Cursor(int type)
   {
+    if (type < 0 || type >= PREDEFINED_COUNT)
+      throw new IllegalArgumentException ("invalid cursor " + type);
     this.type = type;
     // FIXME: lookup and set name?
   }
@@ -46,13 +48,13 @@
   protected Cursor(String name)
   {
     this.name = name;
-    // FIXME
+    this.type = CUSTOM_CURSOR;
   }
 
   public static Cursor getPredefinedCursor(int type)
   {
-    if (type >= PREDEFINED_COUNT)
-      return null;
+    if (type < 0 || type >= PREDEFINED_COUNT)
+      throw new IllegalArgumentException ("invalid cursor " + type);
     if (predefined[type] == null)
       predefined[type] = new Cursor(type);
     return predefined[type];

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]