[jboss-jira] [JBoss JIRA] Created: (JBRULES-1814) org.drools.agent.RuleAgent list() can produce lists containing strings consisting of whitechars only

Cezary Dendek (JIRA) jira-events at lists.jboss.org
Tue Oct 21 07:59:21 EDT 2008


org.drools.agent.RuleAgent list() can produce lists containing strings consisting of whitechars only
----------------------------------------------------------------------------------------------------

                 Key: JBRULES-1814
                 URL: https://jira.jboss.org/jira/browse/JBRULES-1814
             Project: JBoss Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-core
    Affects Versions:  5.0.0.M2
            Reporter: Cezary Dendek
            Assignee: Mark Proctor


static List list(String property) contains following lines (2 occurences):

        if ( current.trim() != "" ) {
            items.add( current );
        }

as it is object references comparision (not string itself) it can fail (in fact it depends on implementation of trim(): if it is not optimised to return empty string explicitly - which should be cached by JVM - it will return new empty string causing the bug)
It should be written eg. in this way:

        if ( !"".equals(current.trim()) ) {
            items.add( current );
        }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list