Me 2. This is why I always try to copy in some other working IO code :)
-dain
On Jan 17, 2007, at 7:28 PM, David Blevins wrote:
Aha! Yep, that'll do it :) That's the kind of bug I would make. I
do that kind of stuff all the time.
-David
On Jan 17, 2007, at 7:15 PM, Karan Malhi wrote:
Ok, there was a bug in my code. When i was writing the bytes to
the output
stream, i was writing some extra bytes. here is what i had earlier
byte buffer[] = new byte[4096];
for (int c = jis.read(buffer); c != -1; c = jis.read
(buffer))
{
jos.write(buffer); // i was writing all 4096
bytes here
}
And here is what i have changed it into
byte buffer[] = new byte[4096];
for (int c = jis.read(buffer); c != -1; c = jis.read
(buffer))
{
jos.write(buffer,0,c); // just writing the
number of
bytes read from the inputstream
}
Works fine now. I will submit a patch
On 1/17/07, Karan Malhi <[EMAIL PROTECTED]> wrote:
David,
1. you sure you're using compression?
--I am using the JarInputStream and JarOutputStream. I also tried
to set
the compression level to 9 but didnt acheive anything.
2. if suggestion #1 doesn't lead anywhere, feel free to take the
chunk of Ant code you need and trim it down, clean it up and use
that.
--I was thinking that before digging into ANT, if somebody could
look at
the code and see whats wrong, then that could save some trouble.
I am
probably missing something in the code. This is the first time i
have worked
with Jar input and outputstreams. Dain did send me a link to the
DeploymentUtil of Geronimo, I will further look into that and see
how it was
done in DeploymentUtil.
The code behaves a bit differently with different jars. For
example, i
took ant.jar and tried to add files to it. even if i dont add a
file and
keep running my program on ant.jar, it keeps increasing its size
(but
stops increasing the size after 4 or 5 runs). however, if i pick
another jar
and try to add a file to it, the code works fine (size is the
same as
produced by the "jar" command). I probably need to do some more
testing
before i can come up with a definitive conclusion, but for now i
am guessing
maybe it is something with ant.jar or something wrong with my code.
karan
On Jan 17, 2007, at 8:39 AM, Karan Malhi wrote:
> Please do not review the patch yet. i did not svn update before
> creating the
> patch, will do it tonight and submit the correct patch. Apologize
> for the
> confusion
>
> On 1/16/07, Karan Malhi <[EMAIL PROTECTED]> wrote:
>>
>> I have attached another patch, without the ANT libraries. Please
>> review
>> it. It works fine, I am not happy with the size of the jar it
creates
>> though. Any thoughts or input would be a good learning experience
>> for me.
>>
>> https://issues.apache.org/jira/browse/OPENEJB-434
>>
>>
>> On 1/16/07, Jacek Laskowski < [EMAIL PROTECTED]> wrote:
>> >
>> > On 1/16/07, Karan Malhi < [EMAIL PROTECTED]> wrote:
>> >
>> > > I then tried to use the Jar class from ANT and it works
perfectly
>> > (same as
>> > > the jar command) and is much simpler to use. Do you think we
>> could use
>> > the
>> > > ant classes for openejb project.?
>> >
>> > I think Ant's fine as long as we don't use it as if we're
>> executed it
>> > from the command line, but using its classes. I'm not
convinced,
>> > though, it's the best bet as Ant is more than copying jars
and for
>> > such a small task we should not need it at all.
>> >
>> > Jacek
>> >
>> > --
>> > Jacek Laskowski
>> > http://www.JacekLaskowski.pl <http://www.jaceklaskowski.pl/>
>> >
>>
>>
>>
>> --
>> Karan Malhi
>>
>
>
>
> --
> Karan Malhi
--
Karan Malhi
--
Karan Malhi