You are right, it needs to be changed.  I can't do it right now (Hiram can
you??) but if it ain't done by Monday morning I'll fix it up.

I haven't looked at that bit of code before, incidentally the method
Boolean.getBoolean(String s) doesn't do what whoever wrote that piece of
code thought it did...

Cheers,
David Maplesden.

> -----Original Message-----
> From: Scott M Stark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 17, 2001 4:53 PM
> To: [EMAIL PROTECTED]
> Subject: [JBoss-dev] Why is SpyMessage throwing NPEs?
> 
> 
> org.jboss.mq.SpyMessage is throwing NPE for null properties:
> 
>    public boolean getBooleanProperty( String name )
>       throws JMSException {
>       Object value = prop.get( name );
>       if ( value == null ) {
>          throw new NullPointerException();
>       }
> 
>       if ( value instanceof Boolean ) {
>          return ( ( Boolean )value ).booleanValue();
>       } else if ( value instanceof String ) {
>          return Boolean.getBoolean( ( String )value );
>       } else {
>          throw new MessageFormatException( "Invalid conversion" );
>       }
>    }
> 
> Not only is this a pain in the ass, it also is not compliant 
> with my reading
> of the 1.0.2 spec:
> 
> <jms-spec-1.0.2>
> 3.5.4 Property Value Conversion
> Properties support the following conversion table. The marked 
> cases must be
> supported. The unmarked cases must throw the JMS 
> MessageFormatException.
> The String to numeric conversions must throw the
> java.lang.NumberFormatException if the numeric's valueOf() 
> method does not
> accept the String value as a valid representation. Attempting 
> to read a null
> value as a Java primitive type must be treated as calling the 
> primitive's
> corresponding valueOf(String) conversion method with a null value.
> 
> 3.5.8 Non-existent Properties
> Getting a property value for a name which has not been set is 
> handled as if
> the
> the property exists with a null value.
> </jms-spec-1.0.2>
> 
> 
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development
> 

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to