Matt's Mind

Monday, December 06, 2004

Bad tools

Not to seem like I'm down on Sun or anything, but I can only assume that they really want us to avoid using their command line tools for Java development. First it's the Java runtime complaining about a class not found when really the class is there, it's a class that it depends on that's missing. Then, while using "jarsigner" today I get this error:

[signjar] java.lang.InternalError: jzentry == 0,
[signjar] jzfile = 10414112,
[signjar] total = 1555,
[signjar] name = C:\development\invision.ui.web\clovis_view.jar,
[signjar] i = 1,
[signjar] message = couldn't read LOC header
[signjar] at java.util.zip.ZipFile$2.nextElement(ZipFile.java:321)
[signjar] at sun.security.tools.JarSigner.getManifestFile(JarSigner.java:985)
...
"Oh no, that looks serious, I have a corrupt JAR file" was my natural response. Rebuild JAR file. Same error. Turns out that, although jarsigner allows you to specifiy the same source and target file, it doesn't quite go as far as actually handling that and tries to read and write to the same JAR file - bad. A simple if (inputFile.equals (outputFile) <warn poor sod user I can't do that> would have saved me, and probably 5,000 other programmers 10 minutes of time.

0 Comments:

Post a Comment

<< Home