struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruce Phillips (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4126) Incorrect behavior for ELSupport.containsNulls()
Date Wed, 17 Jul 2013 15:10:49 GMT

    [ https://issues.apache.org/jira/browse/WW-4126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13711156#comment-13711156
] 

Bruce Phillips commented on WW-4126:
------------------------------------

After reviewing the public method containsNulls of class struts2 plugins embeddedjsp struts2/plugins/embeddedjsp/ELSupport
I'm not sure what the purpose of the method is.  I don't see where any of the other classes
in the embeddedjsp plugin call this method.

But clearly there is an issue with the code.

I've changed the if statement to if (obj[i] == null) - run the unit tests for the plugin and
they all still pass.
                
> Incorrect behavior for ELSupport.containsNulls()
> ------------------------------------------------
>
>                 Key: WW-4126
>                 URL: https://issues.apache.org/jira/browse/WW-4126
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Embedded JSP
>    Affects Versions: 2.3.14.3
>         Environment: any
>            Reporter: Adrian Nistor
>              Labels: patch
>             Fix For: 2.3.16
>
>         Attachments: patch2.diff, patch.diff
>
>
> The incorrect behavior appears in version 2.3.14.3 and in revision
> 1495522.  I attached a one-line patch (patch.diff) that fixes it.
> Method "ELSupport.containsNulls" checks if the "Object[] obj" array
> contains nulls like this:
> {code:java|borderStyle=solid}
> for (int i = 0; i < obj.length; i++) {
>     if (obj[0] == null) {
>         return true;
>     }
> }
> return false;
> {code} 
> Instead of "obj[0]", the code should be "obj[i]", as in patch.diff.
> If indeed the code is intended to check only "obj[0]", then there is
> no need for a loop and the entire method body should be only "return
> obj[0] == null;" (I attached patch2.diff, though it's unlikely that
> this is the correct behavior).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message