Bug 110396 - java.util.zip.ZipException: error in opening zip file
Summary: java.util.zip.ZipException: error in opening zip file
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.6.2   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-23 01:50 EDT by hari CLA
Modified: 2008-08-20 15:36 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hari CLA 2005-09-23 01:50:07 EDT
I'm trying to upgrade from AspectJ1.2.1 to AspectJ1.5.
I'm trying to aspectize a jar and make a new jar. But this is working fine in 
AspectJ1.2.1 even now. But this problem occurs in aspectJ1.5. Is thr any 
workaround for this 

---- Compiler Messages ---
abort ABORT -- (BCException) Can't open archive: struts.jar: 
java.util.zip.ZipException: error in opening zip file
Can't open archive: struts.jar: java.util.zip.ZipException: error in opening 
zip file
org.aspectj.weaver.BCException: Can't open archive: struts.jar: 
java.util.zip.ZipException: error in opening zip file
	at org.aspectj.weaver.bcel.ClassPathManager$ZipFileEntry.ensureOpen
(ClassPathManager.java:253)
	at org.aspectj.weaver.bcel.ClassPathManager$ZipFileEntry.find
(ClassPathManager.java:225)
	at org.aspectj.weaver.bcel.ClassPathManager.find
(ClassPathManager.java:92)
	at org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass
(BcelWorld.java:259)
	at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate
(BcelWorld.java:234)
	at org.aspectj.weaver.World.resolveToReferenceType(World.java:282)
	at org.aspectj.weaver.World.resolve(World.java:205)
	at org.aspectj.weaver.World.resolve(World.java:127)
	at org.aspectj.weaver.World.resolve(World.java:250)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld
(AjBuildManager.java:594)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild
(AjBuildManager.java:189)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild
(AjBuildManager.java:140)
	at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
	at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
	at org.aspectj.tools.ajc.Main.run(Main.java:324)
	at org.aspectj.tools.ajc.Main.runMain(Main.java:238)
	at org.aspectj.tools.ajc.Main.main(Main.java:82)

---- org.aspectj.weaver.bcel.BcelWorld ----
Comment 1 Andrew Clement CLA 2005-09-23 03:59:48 EDT
Hmmm, is struts.jar definetly a valid jar file?  you can unzip/unjar it OK
outside of AspectJ?  Is this only happening on solaris like the other bug, or is
it also happening on windows?

All the code that is failing is basically doing is:

zipFile = new ZipFile(new File("struts.jar"))  

Aspectj hasn't even had a chance to touch the contents of it by the time it goes
wrong.
Comment 2 hari CLA 2005-09-23 04:09:20 EDT
No this is happening even in windows when i tried with AspectJ1.5. But itz 
working quite fine when i tried with Ver1.2.1. Is thr any work around for 
this.. I was stuck up in the middle as i'm unable to change completely to 
Ver1.5 because of this kind of error nor i cudn't proceed with 1.2.1 because 
of that internal compiler error
 
Comment 3 Andrew Clement CLA 2005-09-23 04:12:26 EDT
But have you tried opening the struts.jar outside of AspectJ, just on the
command line - is the jar OK??

It is possible that extra processing in AspectJ5 is requiring us to open that
jar where we didn't bother previously - under AspectJ1.2.1 we may never have
tried to open it.  

All I can suggest is moving struts.jar to the end of your classpath - AspectJ is
not necessarily looking for a class from that archive, it is just opening all
the jars on the classpath in turn trying to find something.
Comment 4 hari CLA 2005-09-23 05:13:19 EDT
Yeah. I'm manually able to open tht jar. But this is not the case only with 
struts.jar. I'm getting this error for all the jars that i'm tryin to 
aspectize.. 
Comment 5 Adrian Colyer CLA 2005-09-23 07:11:30 EDT
FWIW, I've verified that I can open (and weave) struts.jar on Windows with AJ 5. 
Comment 6 Andrew Clement CLA 2005-10-28 09:31:48 EDT
Is this still a problem for you?
Comment 7 Andrew Clement CLA 2005-11-02 11:40:40 EST
Finally I recreated this today by accident.  It occurs if the output jar you are
writing to is on your classpath !!
Comment 8 Andrew Clement CLA 2005-11-02 11:43:02 EST
or if a jar on the classpath is zero size - which happens if you have it as the
outjar - we open the file to write to then attempt to open it when resolving
something from the classpath, bang.
Comment 9 Andrew Clement CLA 2007-10-23 09:12:26 EDT
investigate if still a problem for 1.5.4
Comment 10 Andrew Clement CLA 2008-08-20 15:36:09 EDT
per my comments 7 and 8, I think this is addressed now in AspectJ1.6 as those situations are now checked.  please reopen if still an issue.