[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-624) Interpolator class does not handle null argument arrays and arrays with only one argument

Frank Ulbricht (JIRA) jira-events at jboss.com
Wed Dec 20 11:13:46 EST 2006


Interpolator class does not handle null argument arrays and arrays with only one argument
-----------------------------------------------------------------------------------------

                 Key: JBSEAM-624
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-624
             Project: JBoss Seam
          Issue Type: Bug
            Reporter: Frank Ulbricht


In method Interpolator.interpolate(String, Object...) are two possible bugs:

1. If the params arrays is null the method throws a NullPointerException. The array originally comes from the method FacesMessages.addFromResourceBundle(String, Object...). If the method is called without arguments, like addFromResourceBundle("some_key") then Java will automatically create an array with length zero and everything works fine. But if the application get this array from somewhere else, and it is null, the problem begins.

2. If there is only one element in the array the params will not be formatted to the message at all. This is because of the line: 

if ( params.length>1 && string.indexOf('{')>=0 ) ...

should be:

if ( params.length>0 && string.indexOf('{')>=0 ) ...

-- 
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 seam-issues mailing list