You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2014/05/20 18:06:38 UTC

[jira] [Commented] (TAP5-2096) JBoss 4.2.3 Classpath scanning fails for nested paths

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

ASF subversion and git services commented on TAP5-2096:
-------------------------------------------------------

Commit 5f8deb1fc109af839e670b2d8dd5342ba94a1833 in tapestry-5's branch refs/heads/master from [~jkemnade]
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=5f8deb1 ]

TAP5-2096: correctly scan for classes in nested directories
most of the changes such as making the inner Job class static were necessary just to make the class testable


> JBoss 4.2.3 Classpath scanning fails for nested paths
> -----------------------------------------------------
>
>                 Key: TAP5-2096
>                 URL: https://issues.apache.org/jira/browse/TAP5-2096
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-ioc
>    Affects Versions: 5.4
>            Reporter: Dustin Woods
>            Assignee: Jochen Kemnade
>              Labels: patch
>             Fix For: 5.4
>
>         Attachments: 0001-JBoss-4.2.3-Classpath-scanning-fails-for-nested-path.patch
>
>
> When creating pages in a subdirectory under 'pages', the ClasspathScannerImpl class recursively calls scanDir with only the last part of the package name and not the entire package name resulting in pages not being able to be loaded.
> Changing the line:
> final String nestedPackagePath = fileName + "/";
> to:
> final String nestedPackagePath = packagePath + fileName + "/";
>         /**
>          * Scan a dir for classes. Will recursively look in the supplied directory and all sub directories.
>          *
>          * @param packagePath
>          *         Name of package that this directory corresponds to.
>          * @param packageDir
>          *         Dir to scan for classes.
>          */
>         private void scanDir(String packagePath, File packageDir)
>         {
>             if (packageDir.exists() && packageDir.isDirectory())
>             {
>                 for (final File file : packageDir.listFiles())
>                 {
>                     String fileName = file.getName();
>                     if (file.isDirectory())
>                     {
>                         final String nestedPackagePath = fileName + "/";
>                         queue.push(new IOWork()
>                         {
>                             public void run() throws IOException
>                             {
>                                 scanDir(nestedPackagePath, file);
>                             }
>                         });
>                     }
>                     if (matcher.matches(packagePath, fileName))
>                     {
>                         matches.add(packagePath + fileName);
>                     }
>                 }
>             }
>         }
>         /**
>          * Scan a dir for classes. Will recursively look in the supplied directory and all sub directories.
>          *
>          * @param packagePath
>          *         Name of package that this directory corresponds to.
>          * @param packageDir
>          *         Dir to scan for classes.
>          */
>         private void scanDir(String packagePath, File packageDir)
>         {
>             if (packageDir.exists() && packageDir.isDirectory())
>             {
>                 for (final File file : packageDir.listFiles())
>                 {
>                     String fileName = file.getName();
>                     if (file.isDirectory())
>                     {
>                         final String nestedPackagePath = packagePath + fileName + "/";
>                         queue.push(new IOWork()
>                         {
>                             public void run() throws IOException
>                             {
>                                 scanDir(nestedPackagePath, file);
>                             }
>                         });
>                     }
>                     if (matcher.matches(packagePath, fileName))
>                     {
>                         matches.add(packagePath + fileName);
>                     }
>                 }
>             }
>         }



--
This message was sent by Atlassian JIRA
(v6.2#6252)