You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2013/06/20 09:09:24 UTC

[jira] [Commented] (WW-4116) Wasted work in PackageBasedActionConfigBuilder.checkPackageLocators()

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

ASF subversion and git services commented on WW-4116:
-----------------------------------------------------

Commit 1494876 from [~lukaszlenart]
[ https://svn.apache.org/r1494876 ]

WW-4116 Reduces work when scanning packages
                
> Wasted work in PackageBasedActionConfigBuilder.checkPackageLocators()
> ---------------------------------------------------------------------
>
>                 Key: WW-4116
>                 URL: https://issues.apache.org/jira/browse/WW-4116
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Convention
>    Affects Versions: 2.3.14.3
>         Environment: any
>            Reporter: Adrian Nistor
>            Assignee: Lukasz Lenart
>              Labels: patch, performance
>             Fix For: 2.3.16
>
>         Attachments: patch.diff, patchFull.diff
>
>
> The problem appears in version 2.3.14.3 and in revision 1493157.  I
> attached a two-line patch (patch.diff) that fixes it.
> In method "PackageBasedActionConfigBuilder.checkPackageLocators", the
> loop over "packageLocators" should only be executed when
> "classPackageName.length() > 0" is "true", because the loop's only
> side effect (the "return true;" statement) cannot be executed when
> "classPackageName.length() > 0" is "false".  Note that
> "classPackageName" is not modified inside the loop.
> In fact, the loop over "packageLocators" should be executed only when
> the condition of the loop's "if":
> {code:java|borderStyle=solid}
> if (classPackageName.length() > 0
>         && (packageLocatorsBasePackage == null || classPackageName
>         .startsWith(packageLocatorsBasePackage)))
> {code}
> is "true", because the loop's only side effect (the "return true;"
> statement) cannot be executed when this condition is false.  Also, the
> elements inside this condition are not modified inside the loop.  I
> attached a second patch (patchFull.diff) that implements this complete
> solution.

--
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