[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches]: Patch: JPasswordField
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches]: Patch: JPasswordField |
Date: |
Wed, 24 Aug 2005 18:16:47 +0200 |
Hi Lillian,
On Mon, 2005-08-15 at 15:45 -0400, Lillian Angel wrote:
> /**
> - * getText
> + * Returns the text contained in this TextComponent. If the
> + * underlying document is null, will give a NullPointerException.
> *
> * @return String
> *
> @@ -215,11 +218,20 @@
> */
> public String getText()
> {
> - return null; // TODO
> + try
> + {
> + return getDocument().getText(0, getColumns());
> + }
> + catch (BadLocationException ble)
> + {
> + return "";
> + }
> }
Are you sure you want to return the empty string if there is a
BadLocationException thrown from the underlying code? It looks like that
might hide problems with the Document (sub) class implementation. Better
would be to chain it in a InternalError() and throw that since it seems
that BadLocationException should never be thrown when getText() is
called like this.
Cheers,
Mark
signature.asc
Description: This is a digitally signed message part