🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8786

Exceptions ??? Question from a newbie

#8786
From: Asger Joergensen
Date: Mon, 26 Feb 2001 16:10
34 lines
1857 bytes
Hi there

I think this is strange, i have this code:

   try{
    Text = JOptionPane.showInputDialog("Enter a five character
Palindrome");
    }
    catch(NullPointerException Ne){
     JOptionPane.showMessageDialog(null,  Ne.toString(),
                "Error",
                JOptionPane.PLAIN_MESSAGE);
         ExceptionThrown = true;
    }
    catch(Exception e){
     JOptionPane.showMessageDialog(null,  e.toString(),
                "Error",
                JOptionPane.PLAIN_MESSAGE);
         ExceptionThrown = true;
    }
    finally{
     //this makes the Dos box close automaticly
     if(ExceptionThrown)
      System.exit(0);
    }

If the user press cancel in the input dialog Jave tells me that
an NullPointerException is thrown, but the above code doesn't
catch anything.
Could someone tell me what is going on and how to get it right ??
Maybe a more corect way of dealing with the inputdialog.

Thans in advance
Asger
Technical Details
Message-ID: <3A9A800F.60F38CCB@get2net.dk>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!skynet.be!newsfeed01.tsnz.net!bornews.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3163a1d1c8948d71,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-02-26 08:34:10 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!skynet.be!newsfeed01.tsnz.net!bornews.borland.com!not-for-mail
From: Asger Joergensen <Asger.P@get2net.dk>
Newsgroups: borland.public.jbuilder.java.language
Subject: Exceptions ??? Question from a newbie
Date: Mon, 26 Feb 2001 17:10:55 +0100
Organization: Another Netscape Collabra Server User
Lines: 36
Message-ID: <3A9A800F.60F38CCB@get2net.dk>
NNTP-Posting-Host: p304-002.ppp.get2net.dk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: da,en