Re: svn commit: r741089 - in /ant/core/trunk/src: main/org/apache/tools/bzip2/ main/org/apache/tools/tar/ main/org/apache/tools/zip/ tests/junit/org/apache/tools/zip/

2009-02-05 Thread Peter Reilly
some of the findbugs issues are a little too severe.

Do we really need to copy the arrays??

Peter


On Thu, Feb 5, 2009 at 12:30 PM,  bode...@apache.org wrote:
 Author: bodewig
 Date: Thu Feb  5 12:30:01 2009
 New Revision: 741089

 URL: http://svn.apache.org/viewvc?rev=741089view=rev
 Log:
 fix a bunch of findbugs reported problems in the zip, tar and bzip2 classes.  
 PR 46661

 Modified:
ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
ant/core/trunk/src/main/org/apache/tools/tar/TarInputStream.java
ant/core/trunk/src/main/org/apache/tools/tar/TarOutputStream.java
ant/core/trunk/src/main/org/apache/tools/zip/AsiExtraField.java
ant/core/trunk/src/main/org/apache/tools/zip/UnrecognizedExtraField.java
ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java
ant/core/trunk/src/main/org/apache/tools/zip/ZipLong.java
ant/core/trunk/src/main/org/apache/tools/zip/ZipShort.java
ant/core/trunk/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
ant/core/trunk/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
ant/core/trunk/src/tests/junit/org/apache/tools/zip/ZipShortTest.java

 Modified: 
 ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
 URL: 
 http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java?rev=741089r1=741088r2=741089view=diff
 ==
 --- ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java 
 (original)
 +++ ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java 
 Thu Feb  5 12:30:01 2009
 @@ -613,7 +613,7 @@
 }

 if (ge  gs  nPart != nGroups  nPart != 1
 - ((nGroups - nPart) % 2 == 1)) {
 + ((nGroups - nPart) % 2 != 0)) {
 aFreq -= mtfFreq[ge];
 ge--;
 }
 @@ -983,9 +983,7 @@
 b = t;
 }
 if (b  c) {
 -t = b;
 b = c;
 -c = t;
 }
 if (a  b) {
 b = a;
 @@ -1030,7 +1028,7 @@

 med = med3(block[zptr[lo] + d + 1],
block[zptr[hi] + d  + 1],
 -   block[zptr[(lo + hi)  1] + d + 1]);
 +   block[zptr[(lo + hi)  1] + d + 1]);

 unLo = ltLo = lo;
 unHi = gtHi = hi;

 Modified: ant/core/trunk/src/main/org/apache/tools/tar/TarInputStream.java
 URL: 
 http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/tar/TarInputStream.java?rev=741089r1=741088r2=741089view=diff
 ==
 --- ant/core/trunk/src/main/org/apache/tools/tar/TarInputStream.java 
 (original)
 +++ ant/core/trunk/src/main/org/apache/tools/tar/TarInputStream.java Thu Feb  
 5 12:30:01 2009
 @@ -218,8 +218,13 @@
 + numToSkip +  bytes);
 }

 -if (numToSkip  0) {
 -skip(numToSkip);
 +while (numToSkip  0) {
 +long skipped = skip(numToSkip);
 +if (skipped = 0) {
 +throw new RuntimeException(failed to skip current tar
 +   +  entry);
 +}
 +numToSkip -= skipped;
 }

 readBuf = null;

 Modified: ant/core/trunk/src/main/org/apache/tools/tar/TarOutputStream.java
 URL: 
 http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/tar/TarOutputStream.java?rev=741089r1=741088r2=741089view=diff
 ==
 --- ant/core/trunk/src/main/org/apache/tools/tar/TarOutputStream.java 
 (original)
 +++ ant/core/trunk/src/main/org/apache/tools/tar/TarOutputStream.java Thu Feb 
  5 12:30:01 2009
 @@ -310,7 +310,7 @@

 wOffset += numToWrite;
 assemLen += numToWrite;
 -numToWrite -= numToWrite;
 +numToWrite = 0;
 }
 }


 Modified: ant/core/trunk/src/main/org/apache/tools/zip/AsiExtraField.java
 URL: 
 http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/zip/AsiExtraField.java?rev=741089r1=741088r2=741089view=diff
 ==
 --- ant/core/trunk/src/main/org/apache/tools/zip/AsiExtraField.java (original)
 +++ ant/core/trunk/src/main/org/apache/tools/zip/AsiExtraField.java Thu Feb  
 5 12:30:01 2009
 @@ -334,4 +334,14 @@
 return type | (mode  PERM_MASK);
 }

 +public Object clone() {
 +try {
 +AsiExtraField cloned = (AsiExtraField) super.clone();
 +cloned.crc = new CRC32();
 +return cloned;
 +} catch (CloneNotSupportedException cnfe) {
 +// impossible
 +throw new 

Re: svn commit: r741089 - in /ant/core/trunk/src: main/org/apache/tools/bzip2/ main/org/apache/tools/tar/ main/org/apache/tools/zip/ tests/junit/org/apache/tools/zip/

2009-02-05 Thread Stefan Bodewig
On 2009-02-05, Peter Reilly peter.kitt.rei...@gmail.com wrote:

 some of the findbugs issues are a little too severe.

any other than the array copy thing?

 Do we really need to copy the arrays??

Probably not really since nobody is using that class anyway, it is
more of an issue in commons-compress that I currently try to keep in
sync with Ant's trunk.

IMHO it is not necessary but doesn't hurt us either.

Stefan

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Anybody planning to attend ApacheCon in Amsterdam late March?

2009-02-05 Thread Jimmy Zhao

hi all,
I'm Jimmy (Junming Zhao).
Thanks Stefan for the sidenote. It's really a great opportunity to have my
talk accepted by the conference.  
Personally, I think my talk is more like a workshop or tutorial, it might
not so technical, but it would be interesting if people who want to know a
new way to do testing -- via AntUnit.

If possible, we would like to meet you there and hear your questions and
ideas about how to make AntUnit better, and I will definitely like to
contribute as best as I can.

- Jimmy


bodewig-2 wrote:
 
 Hi all,
 
 I'm trying to set my priorities for ApacheCon (looks as if I could be
 there for a few days).  In order to make anything useful out of the
 hackathon (apart from having a day for OSS hacking) I'd need anybody
 to partner with - so would anybody be there and if so, is there
 anything you'd like to work on?
 
 As a sidenote, Junming Zhao (who I've met shortly last year) is giving
 a talk on functional testing with AntUnit Friday morning - sounds
 promising.
 
 Stefan
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
 For additional commands, e-mail: dev-h...@ant.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Anybody-planning-to-attend-ApacheCon-in-Amsterdam-late-March--tp21684107p21855397.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org