Dialog.java (constructor): Accept null title as per spec.
authorFernando Nasser <fnasser@redhat.com>
Mon, 5 Jan 2004 21:23:12 +0000 (21:23 +0000)
committerFernando Nasser <fnasser@gcc.gnu.org>
Mon, 5 Jan 2004 21:23:12 +0000 (21:23 +0000)
        * java/awt/Dialog.java (constructor): Accept null title as per spec.
        * java/awt/FileDialog.java (constructor): Throw exception on invalid
        argument as per spec.

From-SVN: r75444

libjava/ChangeLog
libjava/java/awt/Dialog.java
libjava/java/awt/FileDialog.java

index c5556a9626d0ea323394c9490372fffa1b8f4be3..c3d654529e57b71ddff68e9416b5323d52b34a76 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-05  Fernando Nasser  <fnasser@redhat.com>
+
+       * java/awt/Dialog.java (constructor): Accept null title as per spec.
+       * java/awt/FileDialog.java (constructor): Throw exception on invalid
+       argument as per spec.
+
 2004-01-05  Fernando Nasser  <fnasser@redhat.com>
 
        * java/awt/Choice.java (add): Leave posting of ItemEvents to peer.
index eee8361146a09aca19ca3a032af4c6703c0e3456..ac2e6ed3de9ba3f100bca2e9312caa62f1175823 100644 (file)
@@ -187,7 +187,8 @@ Dialog (Frame parent, String title, boolean modal, GraphicsConfiguration gc)
 {
   super (parent, gc);
 
-  this.title = title;
+  // A null title is equivalent to an empty title  
+  this.title = (title != null) ? title : "";
   this.modal = modal;
   visible = false;
 
@@ -254,8 +255,9 @@ public
 Dialog (Dialog parent, String title, boolean modal, GraphicsConfiguration gc)
 {
   super (parent, parent.getGraphicsConfiguration ());
-  
-  this.title = title;
+
+  // A null title is equivalent to an empty title  
+  this.title = (title != null) ? title : "";
   this.modal = modal;
   visible = false;
 
@@ -289,7 +291,9 @@ getTitle()
 public synchronized void
 setTitle(String title)
 {
-  this.title = title;
+  // A null title is equivalent to an empty title  
+  this.title = (title != null) ? title : "";
+
   if (peer != null)
     {
       DialogPeer d = (DialogPeer) peer;
index 6ff2b7667489b98e36d2384672a25d4ebfff3cd5..24a621084b92a0e415970110885e37364252bffd 100644 (file)
@@ -147,6 +147,11 @@ public
 FileDialog(Frame parent, String title, int mode)
 {
   super(parent, title, true);
+  
+  if ((mode != LOAD) && (mode != SAVE))
+    throw new IllegalArgumentException (
+      "Mode argument must be either LOAD or SAVE");
+
   setMode (mode);
 }