You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Simon Kitching (JIRA)" <ji...@codehaus.org> on 2005/06/24 12:56:52 UTC

[jira] Created: (MPJAVA-38) sourceModifications handled incorrectly when more than one clause present

sourceModifications handled incorrectly when more than one clause present
-------------------------------------------------------------------------

         Key: MPJAVA-38
         URL: http://jira.codehaus.org/browse/MPJAVA-38
     Project: maven-java-plugin
        Type: Bug
    Versions: 1.5    
    Reporter: Simon Kitching


The loop
     <j:forEach var="sm" items="${pom.build.sourceModifications}">
     <ant:available property="classPresent" classname="${sm.className}"/>
is flawed. When the class is not present, the <available> action does NOT reset $classPresent to a false value; instead, its previous value is left unaltered (ie is the value from the previous time around the loop).

So a sourceModified clause with a classname that is present will cause all following sourceModified clauses to be skipped, regardless of whether their test class is present or not.

The following ant file demonstrates this nicely:

<project name="foo" default="def" basedir=".">
<target name="def">

 <echo>av: ${av}</echo>
 <available property="av" classname="dafasfas"/>
 <echo>av: ${av}</echo>
 <available property="av" classname="java.lang.String"/>
 <echo>av: ${av}</echo>
 <available property="av" classname="no.such.class"/>
 <echo>av: ${av}</echo>
</target>

</project>

perhaps simply inserting an assignment to reset the variable to false immediately before the <ant:available> test will fix this?

-- 
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, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Closed: (MPJAVA-38) sourceModifications handled incorrectly when more than one clause present

Posted by "Lukas Theussl (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MPJAVA-38?page=all ]
     
Lukas Theussl closed MPJAVA-38:
-------------------------------

     Resolution: Fixed
    Fix Version: 1.6

> sourceModifications handled incorrectly when more than one clause present
> -------------------------------------------------------------------------
>
>          Key: MPJAVA-38
>          URL: http://jira.codehaus.org/browse/MPJAVA-38
>      Project: maven-java-plugin
>         Type: Bug

>     Versions: 1.5
>     Reporter: Simon Kitching
>      Fix For: 1.6
>  Attachments: sourceModifications.patch
>
>
> The loop
>      <j:forEach var="sm" items="${pom.build.sourceModifications}">
>      <ant:available property="classPresent" classname="${sm.className}"/>
> is flawed. When the class is not present, the <available> action does NOT reset $classPresent to a false value; instead, its previous value is left unaltered (ie is the value from the previous time around the loop).
> So a sourceModified clause with a classname that is present will cause all following sourceModified clauses to be skipped, regardless of whether their test class is present or not.
> The following ant file demonstrates this nicely:
> <project name="foo" default="def" basedir=".">
> <target name="def">
>  <echo>av: ${av}</echo>
>  <available property="av" classname="dafasfas"/>
>  <echo>av: ${av}</echo>
>  <available property="av" classname="java.lang.String"/>
>  <echo>av: ${av}</echo>
>  <available property="av" classname="no.such.class"/>
>  <echo>av: ${av}</echo>
> </target>
> </project>
> perhaps simply inserting an assignment to reset the variable to false immediately before the <ant:available> test will fix this?

-- 
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, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Updated: (MPJAVA-38) sourceModifications handled incorrectly when more than one clause present

Posted by "Ignacio G. Mac Dowell (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MPJAVA-38?page=all ]

Ignacio G. Mac Dowell updated MPJAVA-38:
----------------------------------------

    Attachment: sourceModifications.patch

I came across this same problem... 

Truly, ant:available is working as expected. Quoting http://ant.apache.org/manual/CoreTasks/available.html

"If the resource is present, the property value is set to true by default; otherwise, the property is <b>not set</b>"

I tried to reset the value through ant:property and it doesn't work. What does work is using the jelly core tag:
            <j:set var="classPresent" value=""/>
before each invocation of ant:available

Simple, but not very elegant... If someother way is proposed (via j:invokeStatic or something like that) I can provide patches. IMHO this issue is critical if you have more than one sourceModification.

Patch attached.


> sourceModifications handled incorrectly when more than one clause present
> -------------------------------------------------------------------------
>
>          Key: MPJAVA-38
>          URL: http://jira.codehaus.org/browse/MPJAVA-38
>      Project: maven-java-plugin
>         Type: Bug
>     Versions: 1.5
>     Reporter: Simon Kitching
>  Attachments: sourceModifications.patch
>
>
> The loop
>      <j:forEach var="sm" items="${pom.build.sourceModifications}">
>      <ant:available property="classPresent" classname="${sm.className}"/>
> is flawed. When the class is not present, the <available> action does NOT reset $classPresent to a false value; instead, its previous value is left unaltered (ie is the value from the previous time around the loop).
> So a sourceModified clause with a classname that is present will cause all following sourceModified clauses to be skipped, regardless of whether their test class is present or not.
> The following ant file demonstrates this nicely:
> <project name="foo" default="def" basedir=".">
> <target name="def">
>  <echo>av: ${av}</echo>
>  <available property="av" classname="dafasfas"/>
>  <echo>av: ${av}</echo>
>  <available property="av" classname="java.lang.String"/>
>  <echo>av: ${av}</echo>
>  <available property="av" classname="no.such.class"/>
>  <echo>av: ${av}</echo>
> </target>
> </project>
> perhaps simply inserting an assignment to reset the variable to false immediately before the <ant:available> test will fix this?

-- 
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, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org