🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Exceptions ??? Question from a newbie

#8789
From: Asger Joergensen
Date: Mon, 26 Feb 2001 18:40
25 lines
1853 bytes
Hi Torsten

Torsten Welches wrote:

> Asger,
>
> showInputDialog does not throw a NullPointerException when the user presses
> cancel but the returned String is null (your "Text" reference). I presume
> you try to "use" Text anywhere, like Text.length() or anything. No?
> The code you posted should not fail with a npa.

LOL and head shaking
You are absolutely right
a simple if(Text != null) was all i needed <g>
The book "Java how to program" tells in one of the first
chapters that if the user press cancel java will throw an
Exception and that they will deal with that problem in
chapter 14 about exception handling, so i thought it was
because it only would throw an exception and i didn't
even try to check if Text was null.

Thank You Very Very much.

Happy regards
Asger
Technical Details
Message-ID: <3A9AA304.98629F08@get2net.dk>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!news.stgl.sel.alcatel.de!news.stgl.sel.alcatel.de!bornews.borland.com!not-for-mail
References: <3A9A800F.60F38CCB@get2net.dk> <3a9a8791$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3163a1d1c8948d71
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-02-26 11:10:09 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!news.stgl.sel.alcatel.de!news.stgl.sel.alcatel.de!bornews.borland.com!not-for-mail
From: Asger Joergensen <Asger.P@get2net.dk>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Exceptions ??? Question from a newbie
Date: Mon, 26 Feb 2001 19:40:04 +0100
Organization: Another Netscape Collabra Server User
Lines: 28
Message-ID: <3A9AA304.98629F08@get2net.dk>
References: <3A9A800F.60F38CCB@get2net.dk> <3a9a8791$1_2@dnews>
NNTP-Posting-Host: p303-096.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