[jboss-jira] [JBoss JIRA] Commented: (JBAS-4730) Code smell in SpyMapMessage
Adrian Brock (JIRA)
jira-events at lists.jboss.org
Tue Sep 18 09:36:11 EDT 2007
[ http://jira.jboss.com/jira/browse/JBAS-4730?page=comments#action_12377355 ]
Adrian Brock commented on JBAS-4730:
------------------------------------
This code has been there forever:
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/trunk/jbossmq/src/main/org/jboss/mq/SpyMapMessage.java?revision=3204&view=markup
So I don't know why it was done that way.
I'd guess according the javadoc it should be throwing a MessageFormatException rather than
a NumberFormatException when there is no value for primitives.
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/MapMessage.html#getInt(java.lang.String)
> Code smell in SpyMapMessage
> ---------------------------
>
> Key: JBAS-4730
> URL: http://jira.jboss.com/jira/browse/JBAS-4730
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: JMS service
> Affects Versions: JBossAS-4.2.0.GA, JBossAS-4.2.2.GA
> Environment: Branch_4_2 from around 7.sept.07
> Reporter: Heiko W. Rupp
> Assigned To: Adrian Brock
> Priority: Minor
>
> SpyMapMessage has in getInt()
> if (value == null)
> return Integer.parseInt(null);
> Integer.parseInt(null) will always throw a NumberFormatException, so the return statement has no effect. This leads to believe that something else was in mind when writing the code.
> If the NFE was intended to be thrown, then it should in my opinion directly be done there.
> getLong() has similar code and I guess other methods as well.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list