ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Newton" <snew...@standard.com>
Subject RE: filter copy corrupts jars?
Date Wed, 12 Jun 2002 22:41:49 GMT
No need to dig around too much. The Copy task uses FileUtils.copyFile().
The source there indicates that if there are filters in place, it uses
BufferedReader regardless of the file type, otherwise it uses 
FileInputStream.  BufferedReader is character input-stream based, so
binary files will get corrupted.

s

> -----Original Message-----
> From: Ken Wood [mailto:kwood@i2.com]
> Sent: Wednesday, June 12, 2002 3:16 PM
> To: Ant Developers List
> Subject: Re: filter copy corrupts jars?
> 
> 
> You could probably verify this by two ways:
> 
>   1. look at the exact size (down to the byte) of the
>       jar before and after copy. If it's different after
>       copy with token, even with no matches, the odds
>       are it was opened and copied in text mode, and the copy
>       attempted to deal with line endings.
> 
>   2. look at the source for the copy task. While probably
>       the ideal solution, it may take a while to obtain the
>       sources if you don't have them, and work your way
>       through the code to find the answer.
> 
> Keith Wannamaker wrote:
> 
> > That's a reasonable explanation, I suppose, but
> > does Java even have the notion of opening a file
> > in binary or text mode?  Wonder if the native impls
> > are consistent in this regard.
> >
> > Keith
> >
> > | -----Original Message-----
> > | From: Jon Skeet [mailto:jon.skeet@peramon.com]
> > | Sent: Wednesday, June 12, 2002 4:45 PM
> > | To: Ant Developers List
> > | Subject: RE: filter copy corrupts jars?
> > |
> > |
> > | > I ran into a problem that I don't have time to diagnose
> > | > more thoroughly, but perhaps someone with more knowledge
> > | > of the filter code can help.
> > | >
> > | > In a copy with multiple filtersets, a jar that doesn't match
> > | > any tokens is corrupted.  I verified no matches by running
> > | > with the verbose flag; I saw matches in text files, but no
> > | > matches for the jar.  In a copy with no filtersets, the
> > | > copied jar is fine.
> > | >
> > | > Is it at all conceivable that the file is being modified,
> > | > even if a token match is not reported by -v?
> > |
> > | Unless I'm just tired, you should *never* copy any binary 
> files with filtering turned on. Even if it doesn't match any
> > | tokens, it's still reading and writing as if it's text.
> > |
> > | As I say, I could be wrong...
> > |
> > | Jon
> > |
> > | --
> > | To unsubscribe, e-mail:   
<mailto:ant-dev-unsubscribe@jakarta.apache.org>
> | For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
> |
> |
>
> --
> To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message