You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dave Brosius <da...@oracle.com> on 2022/07/04 15:01:50 UTC

Re: [External] : Odd jdk8->jdk17 behaviour with ant

Rubber Duck Debugging at it's finest.

I changed the code to do

<jar destfile="${some_temp_location}"..../>
<move file="${some_temp_location}" tofile="${the_real_location}"/>

and now it works fine.



On 7/4/22 10:45, Dave Brosius wrote:
> Hi Folks,
>
>     I realize this is probably difficult to understand, or give ideas 
> on, but i'll give it a go.
>
> I have an existing build.xml file that's been used for years to build 
> on java8 (ant 1.10.2). Now trying to migrate stuff to 17.
>
> Ran in to this problem, and going to simplify as best as possible.
>
> Have 3 ant targets, related as such
>
> <target name="coordinator" depends="producer, consumer"/>
>
> the producer target uses the <jar> task to produce a jar file, that 
> includes resource bundle property files.
>
> the consumer target has a custom ant task that loads Locales using the 
> above jar's resource bundles. (thus the above jar is on this task's 
> classpath)
>
> In java 8 running
>
> ant coordinator
>
> works fine. In java 17, if I do
>
> ant producer
> ant consumer
>
> it also works fine, if however i do
>
> ant coordinator
>
> i get
>
> java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
>
>
> when the custom ant task tries to load the resource bundle from the jar
>
> I have to assume this is  because ant isn't done writing the jar yet? 
> Or maybe it hasn't been flushed yet? There is no ant task forking 
> going on here. (Can you even fork a <jar> task?)
>
> Any ideas what could be wrong, or how to fix?
>
>
> thanks,
>
> dave
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: [External] : Odd jdk8->jdk17 behaviour with ant

Posted by Dave Brosius <da...@oracle.com>.
this is linux mint (5.4.0-120-generic)

I agree there is something going on with ant. like the jar isn't closing 
until the ant process closes. As for a sample, I grossly simplified the 
explanation. but the two steps that fail back to back are jar creation 
and an ant task that reads a locale from that jar.


On 7/4/22 21:45, Jaikiran Pai wrote:
> Hello Dave,
>
> I see that you seem to have got past this. However, looking at what 
> you describe in your first post, this looks like a genuine issue that 
> needs some investigation to narrow down why this fails on Java 17. 
> Would you be able to share a reproducer for this? What operating 
> system is this issue showing up?
>
> > There is no ant task forking going on here. (Can you even fork a 
> <jar> task?)
>
> Ant doesn't launch the "jar" command for the jar task. Instead it 
> internally uses (an in-process) set of APIs for writing out the output 
> stream.
>
> -Jaikiran
>
>
> On 04/07/22 8:31 pm, Dave Brosius wrote:
>> Rubber Duck Debugging at it's finest.
>>
>> I changed the code to do
>>
>> <jar destfile="${some_temp_location}"..../>
>> <move file="${some_temp_location}" tofile="${the_real_location}"/>
>>
>> and now it works fine.
>>
>>
>>
>> On 7/4/22 10:45, Dave Brosius wrote:
>>> Hi Folks,
>>>
>>>     I realize this is probably difficult to understand, or give 
>>> ideas on, but i'll give it a go.
>>>
>>> I have an existing build.xml file that's been used for years to 
>>> build on java8 (ant 1.10.2). Now trying to migrate stuff to 17.
>>>
>>> Ran in to this problem, and going to simplify as best as possible.
>>>
>>> Have 3 ant targets, related as such
>>>
>>> <target name="coordinator" depends="producer, consumer"/>
>>>
>>> the producer target uses the <jar> task to produce a jar file, that 
>>> includes resource bundle property files.
>>>
>>> the consumer target has a custom ant task that loads Locales using 
>>> the above jar's resource bundles. (thus the above jar is on this 
>>> task's classpath)
>>>
>>> In java 8 running
>>>
>>> ant coordinator
>>>
>>> works fine. In java 17, if I do
>>>
>>> ant producer
>>> ant consumer
>>>
>>> it also works fine, if however i do
>>>
>>> ant coordinator
>>>
>>> i get
>>>
>>> java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
>>>
>>>
>>> when the custom ant task tries to load the resource bundle from the jar
>>>
>>> I have to assume this is  because ant isn't done writing the jar 
>>> yet? Or maybe it hasn't been flushed yet? There is no ant task 
>>> forking going on here. (Can you even fork a <jar> task?)
>>>
>>> Any ideas what could be wrong, or how to fix?
>>>
>>>
>>> thanks,
>>>
>>> dave
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: [External] : Odd jdk8->jdk17 behaviour with ant

Posted by Dave Brosius <da...@oracle.com>.
Interestingly my first attempt was to add a <sleep seconds="60"/> as the 
first step of consumer. That did nothing.

On 7/4/22 21:45, Jaikiran Pai wrote:
> Hello Dave,
>
> I see that you seem to have got past this. However, looking at what 
> you describe in your first post, this looks like a genuine issue that 
> needs some investigation to narrow down why this fails on Java 17. 
> Would you be able to share a reproducer for this? What operating 
> system is this issue showing up?
>
> > There is no ant task forking going on here. (Can you even fork a 
> <jar> task?)
>
> Ant doesn't launch the "jar" command for the jar task. Instead it 
> internally uses (an in-process) set of APIs for writing out the output 
> stream.
>
> -Jaikiran
>
>
> On 04/07/22 8:31 pm, Dave Brosius wrote:
>> Rubber Duck Debugging at it's finest.
>>
>> I changed the code to do
>>
>> <jar destfile="${some_temp_location}"..../>
>> <move file="${some_temp_location}" tofile="${the_real_location}"/>
>>
>> and now it works fine.
>>
>>
>>
>> On 7/4/22 10:45, Dave Brosius wrote:
>>> Hi Folks,
>>>
>>>     I realize this is probably difficult to understand, or give 
>>> ideas on, but i'll give it a go.
>>>
>>> I have an existing build.xml file that's been used for years to 
>>> build on java8 (ant 1.10.2). Now trying to migrate stuff to 17.
>>>
>>> Ran in to this problem, and going to simplify as best as possible.
>>>
>>> Have 3 ant targets, related as such
>>>
>>> <target name="coordinator" depends="producer, consumer"/>
>>>
>>> the producer target uses the <jar> task to produce a jar file, that 
>>> includes resource bundle property files.
>>>
>>> the consumer target has a custom ant task that loads Locales using 
>>> the above jar's resource bundles. (thus the above jar is on this 
>>> task's classpath)
>>>
>>> In java 8 running
>>>
>>> ant coordinator
>>>
>>> works fine. In java 17, if I do
>>>
>>> ant producer
>>> ant consumer
>>>
>>> it also works fine, if however i do
>>>
>>> ant coordinator
>>>
>>> i get
>>>
>>> java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
>>>
>>>
>>> when the custom ant task tries to load the resource bundle from the jar
>>>
>>> I have to assume this is  because ant isn't done writing the jar 
>>> yet? Or maybe it hasn't been flushed yet? There is no ant task 
>>> forking going on here. (Can you even fork a <jar> task?)
>>>
>>> Any ideas what could be wrong, or how to fix?
>>>
>>>
>>> thanks,
>>>
>>> dave
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: [External] : Odd jdk8->jdk17 behaviour with ant

Posted by Jaikiran Pai <ja...@apache.org>.
Hello Dave,

I see that you seem to have got past this. However, looking at what you 
describe in your first post, this looks like a genuine issue that needs 
some investigation to narrow down why this fails on Java 17. Would you 
be able to share a reproducer for this? What operating system is this 
issue showing up?

 > There is no ant task forking going on here. (Can you even fork a 
<jar> task?)

Ant doesn't launch the "jar" command for the jar task. Instead it 
internally uses (an in-process) set of APIs for writing out the output 
stream.

-Jaikiran


On 04/07/22 8:31 pm, Dave Brosius wrote:
> Rubber Duck Debugging at it's finest.
>
> I changed the code to do
>
> <jar destfile="${some_temp_location}"..../>
> <move file="${some_temp_location}" tofile="${the_real_location}"/>
>
> and now it works fine.
>
>
>
> On 7/4/22 10:45, Dave Brosius wrote:
>> Hi Folks,
>>
>>     I realize this is probably difficult to understand, or give ideas 
>> on, but i'll give it a go.
>>
>> I have an existing build.xml file that's been used for years to build 
>> on java8 (ant 1.10.2). Now trying to migrate stuff to 17.
>>
>> Ran in to this problem, and going to simplify as best as possible.
>>
>> Have 3 ant targets, related as such
>>
>> <target name="coordinator" depends="producer, consumer"/>
>>
>> the producer target uses the <jar> task to produce a jar file, that 
>> includes resource bundle property files.
>>
>> the consumer target has a custom ant task that loads Locales using 
>> the above jar's resource bundles. (thus the above jar is on this 
>> task's classpath)
>>
>> In java 8 running
>>
>> ant coordinator
>>
>> works fine. In java 17, if I do
>>
>> ant producer
>> ant consumer
>>
>> it also works fine, if however i do
>>
>> ant coordinator
>>
>> i get
>>
>> java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
>>
>>
>> when the custom ant task tries to load the resource bundle from the jar
>>
>> I have to assume this is  because ant isn't done writing the jar yet? 
>> Or maybe it hasn't been flushed yet? There is no ant task forking 
>> going on here. (Can you even fork a <jar> task?)
>>
>> Any ideas what could be wrong, or how to fix?
>>
>>
>> thanks,
>>
>> dave
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org