[infinispan-issues] [JBoss JIRA] (ISPN-1727) ComponentMetadataPersister is using dangerous characters in regular expression replacement

Manik Surtani (JIRA) jira-events at lists.jboss.org
Wed Jan 18 00:42:18 EST 2012


    [ https://issues.jboss.org/browse/ISPN-1727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660045#comment-12660045 ] 

Manik Surtani commented on ISPN-1727:
-------------------------------------

The purpose of this class is to scan the classpath at build time, and using reflection, analyse newly compiled classes for annotations we're interested in and build a dependency map.  Which is then serialized and packaged in the jar.  Triggered by the Maven build process.
                
> ComponentMetadataPersister is using dangerous characters in regular expression replacement
> ------------------------------------------------------------------------------------------
>
>                 Key: ISPN-1727
>                 URL: https://issues.jboss.org/browse/ISPN-1727
>             Project: Infinispan
>          Issue Type: Bug
>    Affects Versions: 5.1.0.CR3
>            Reporter: Sanne Grinovero
>            Assignee: Manik Surtani
>             Fix For: 5.1.0.FINAL
>
>
> {code}
> private static String extractFqcn(String path, File f) {
>       return f.getAbsolutePath().replace(path, "").replace(File.separator, ".").replace(".class", "").replaceFirst(".", "");
>    }
> {code}
> A problem is here - at least I think so as I've not seen any complaints; while "replace" is expecting a literal, "replaceFirst" is taking first argument as a regex pattern to match; and "." is a wildcard..
> This method is a good candidate for a *unit test* but I'm not understanding what the purpose is - if someone could plase add examples of intended functionality.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the infinispan-issues mailing list