Plugin does not search jar files
--------------------------------

                 Key: MHIBERNATE-101
                 URL: http://jira.codehaus.org/browse/MHIBERNATE-101
             Project: Maven 2.x Hibernate Plugin
          Issue Type: Bug
          Components: annotationconfiguration
    Affects Versions: 2.2
            Reporter: Kevin Sheehan
            Assignee: Johann Reyes


The released version (2.2 of hibernate3-maven-plugin) has a bug that will not 
allow it to process jar files looking for annotated hibernate classes.

Additionally the property <scan-jars> is NOT included in the javadoc.

The problem is in the class AnnotationComponentConfiguration.  When the flags 
for scan-classes and scan-jars are processed the method scanForClasses is 
called.  The scan-classes section passes directories to the scanForClasses 
method while the scan-jars section passes jar files.

There is a test at the top of scanForClasses that checks if an empty directory 
list is passed  to scanForClasses and stops processing to prevent a runtime 
exception.

    private void scanForClasses( File directory, List<String> entities )
        throws MalformedURLException
    {
        if ( directory.list() != null )
       {
...
       }
    }

The issue is when scan-jars calls scanForClasses passing a jar the above test 
ALWAYS is null and the jar processing is bypassed.  A small change (below) 
fixes this...

    private void scanForClasses( File directory, List<String> entities )
        throws MalformedURLException
    {
        if ( directory.isFile() || directory.list() != null )
       {
...
       }
    }

The directory.list() != null needs to be there as in my case the test classes 
directory passed to the plugin is empty and would generate a runtime execption.

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

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to