This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Patch: Cursor fixlet
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: Cursor fixlet
- From: Tom Tromey <tromey at redhat dot com>
- Date: 11 Jan 2001 11:10:20 -0700
- Reply-To: tromey at redhat dot com
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];