Bug 28504 - [PATCH] Capitalize /ZIP|[JWE]AR/; update Zip.reset() overloads
Summary: [PATCH] Capitalize /ZIP|[JWE]AR/; update Zip.reset() overloads
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.7.0
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Keywords: PatchAvailable
Depends on:
Reported: 2004-04-20 17:23 UTC by Jesse Glick
Modified: 2009-07-31 04:19 UTC (History)
0 users

Suggested patch (4.76 KB, patch)
2004-04-20 17:24 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2004-04-20 17:23:43 UTC
The (undocumented yet protected!) field 'archiveType' in Zip currently is set to
"zip", "jar", "war", or "ear". This patch capitalizes those values. I am not
sure about "ZIP" vs. "Zip" (usage acc. to Google is inconsistent), but typically
the other words as considered near-acronyms (_J_ava _AR_chive etc.) and should
be in all caps. The archiveType is used in various messages and it looks bad
IMHO to display e.g.

  Building jar: /tmp/foo.jar

so the patch will produce

  Building JAR: /tmp/foo.jar

Also "JAR archive" is technically redundant, just "JAR" is enough.

Also it seems that some overloads of Zip.<init> had redundant calls which I
commented out; and overloads of Zip.reset() were missing some attributes which
were set in the constructor. I am not sure about this part of the patch since
the documentation and intended usage of Zip.reset() seems vague - can't find any
code which actually calls it, or any reason why just Zip and subclasses have
such a method. Didn't notice any problems in Zip.cleanUp() overrides.

Unit tests pass for me with this patch, though I am not sure how much Zip
subclass functionality is currently actually tested.

If there is some intended usage of Zip.archiveType that would have an API
compatibility impact, i.e. changing the values would be incompatible for
someone, then consider using String.toUpperCase(Locale.US) when using the value
in Project.log messages. (Locale.US is necessary so that "zip" will become "ZIP"
even in Turkish locale.)
Comment 1 Jesse Glick 2004-04-20 17:24:32 UTC
Created attachment 11292 [details]
Suggested patch
Comment 2 Jesse Glick 2004-04-20 17:25:54 UTC
Note: Cab.java is not touched by the patch as it is not a Zip subclass, though
it has somewhat similar code for archiveType. Google usage seems to say "CAB" is
more common than "Cab".