You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Caldarale, Charles R" <Ch...@UNISYS.com> on 2004/09/24 01:47:51 UTC

RE: [OFF-TOPIC] printing an object whose toString() method returns null

> From: Travis Stevens [mailto:Travis.Stevens@noaa.gov]
> Subject: printing an object whose toString() method returns null
> 
> Now I know that this is a programming mistake, but it would have been 
> nicer if a more specific error message was thrown.  This can be easily 
> accomplished by adding a check to the print(Object o) method that checks 
> the result of String.valueOf().

So we should increase everyone's path length because one person does something completely counter to the Java API intent?

> Unfortunately, the Jsp 2.0 specification does not address 
> this issue.

Nor should it, since this is a Java API issue, not a JSP spec one.

> The print(Object o) is not documented to throw a 
> NullPointerException, only an IOException.

>From the API spec:

"public class RuntimeException extends Exception

"RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. 

"A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught."

NullPointerException is merely the most common of the large set of RuntimeException subclasses.

 - Chuck

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: [OFF-TOPIC] printing an object whose toString() method returns null

Posted by "Anthony E. Carlos" <an...@digitalphenom.com>.
No need to be so surly about it, but thanks for answering his questions 
thoroughly.

On Sep 23, 2004, at 7:47 PM, Caldarale, Charles R wrote:

> From: Travis Stevens [mailto:Travis.Stevens@noaa.gov]
> Subject: printing an object whose toString() method returns null
>
> Now I know that this is a programming mistake, but it would have been
> nicer if a more specific error message was thrown.  This can be easily
> accomplished by adding a check to the print(Object o) method that 
> checks
> the result of String.valueOf().

So we should increase everyone's path length because one person does 
something completely counter to the Java API intent?

> Unfortunately, the Jsp 2.0 specification does not address
> this issue.

Nor should it, since this is a Java API issue, not a JSP spec one.

> The print(Object o) is not documented to throw a
> NullPointerException, only an IOException.

> From the API spec:

"public class RuntimeException extends Exception

"RuntimeException is the superclass of those exceptions that can be 
thrown during the normal operation of the Java Virtual Machine.

"A method is not required to declare in its throws clause any 
subclasses of RuntimeException that might be thrown during the 
execution of the method but not caught."

NullPointerException is merely the most common of the large set of 
RuntimeException subclasses.

  - Chuck

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org