db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fox (Resolved) (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TORQUE-118) Maven2 plugin fails to detect that schema was changed when generating om, etc
Date Sun, 04 Mar 2012 13:34:00 GMT

     [ https://issues.apache.org/jira/browse/TORQUE-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Thomas Fox resolved TORQUE-118.

       Resolution: Fixed
    Fix Version/s: 4.0

The problem will not occur any more because the 4.0 generation plugin does not check for an
unchanged schema any more automatically
> Maven2 plugin fails to detect that schema was changed when generating om, etc
> -----------------------------------------------------------------------------
>                 Key: TORQUE-118
>                 URL: https://issues.apache.org/jira/browse/TORQUE-118
>             Project: Torque
>          Issue Type: Bug
>          Components: Maven 2 Plugin
>    Affects Versions: 3.3
>         Environment: OS: Linux
> JDK: jdk1.6.0_07
> Maven: apache-maven-2.0.9
>            Reporter: Mitri Hanania
>            Priority: Minor
>             Fix For: 4.0
> Using the Maven2 plugin, generate the OM classes from a schema file. Then make a change
to the schema file and try to re-generate the OM classes. The Maven2 plugin will state that
the schema has not changed with respect to the report file.
> After debugging, it seems that the method schemaChanged() in class org.apache.torque.mojo.DataModelTaskMojo
attempts to compare the last modified dates between the schema file and the report file. It
uses the classes FileSet and DirectoryScanner to obtain a list of schema files to compare
against the report file. The method DirectoryScanner.getIncludedFiles() is called to return
a list of schema files in the directory specified by the "schemaDir" property. According to
the javadocs, DirectoryScanner.getIncludedFiles() returns a list of file names relative to
the "base" directory. However, the file names are being used as if they are absolute file
names when trying to retrieve the last modified time. Hence, always resulting in a last modified
time of 0, which causes the schema file to alway fail when comparing to see if the schema
file has a last modified time greater than the report file.
> A work around that I have been using is to always delete the report files when a change
is made to the schema file.
> A proposed fix is to create the schema java.io.File object using the "schemaDir" property
and the relative file name:
> for (int i = 0; i < fileNames.length; ++i)
> {
>    File file = new File(schemaDir, fileNames[i]);
>    if (file.lastModified() > report.lastModified())
>    {
>      schemaChanged = true;
>      break;
>    }
> }

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


To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message