bugKawa - Bugs: bug #37910, ...

 
 

bug #37910: gnu.bytecode.ZipLoader:loadAllClasses not checking for previous definitions

Submitted by:  tk <huh>
Submitted on:  Wed 12 Dec 2012 03:50:39 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Run-time exceptionStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 13 Dec 2012 07:09:19 AM UTC, comment #1:

Thanks! I checked in your patch.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Wed 12 Dec 2012 03:50:39 PM UTC, original submission:

;; when loading from a compiled zip file, ZipLoader:loadAllClasses is attempting to define classes already created via ZipLoader:loadClass:
;; (rev 7387)

$ cat f.scm
(define-simple-class <a> ())
(define-simple-class <b> (<a>))
$ rlwrap java -jar kawa-1.13.jar
#|kawa:1|# (compile-file "f.scm" "f.zip")
#|kawa:2|# (load"f.zip")
java.lang.LinkageError: loader (instance of gnu/bytecode/ZipLoader): attempted duplicate class definition for name: "a"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at gnu.bytecode.ZipLoader.loadAllClasses(ZipLoader.java:133)
at kawa.Shell.checkCompiledZip(Shell.java:372)
at kawa.Shell.runFile(Shell.java:470)
at kawa.standard.load.apply2(load.java:66)
at kawa.standard.load.apply1(load.java:26)
at gnu.mapping.Procedure.apply(Procedure.java:130)
at gnu.mapping.Procedure.apply(Procedure.java:113)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:373)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:210)
at kawa.Shell.run(Shell.java:279)
at kawa.Shell.run(Shell.java:194)
at kawa.Shell.run(Shell.java:175)
at kawa.repl.main(repl.java:890)
#|kawa:3|#

fix:
$ svn diff gnu/bytecode/ZipLoader.java
Index: gnu/bytecode/ZipLoader.java
===================================================================
--- gnu/bytecode/ZipLoader.java (revision 7387)
+++ gnu/bytecode/ZipLoader.java (working copy)
@@ -130,11 +130,13 @@
java.io.InputStream strm = zar.getInputStream(member);
byte[] bytes = new byte[member_size];
new java.io.DataInputStream(strm).readFully(bytes);
- Class clas = defineClass (name, bytes, 0, member_size);
- if (mainClass == null)
- mainClass = clas;
- loadedClasses.addElement(name);
- loadedClasses.addElement(clas);
+ if (!loadedClasses.contains(name)) {
+ Class clas = defineClass (name, bytes, 0, member_size);
+ if (mainClass == null)
+ mainClass = clas;
+ loadedClasses.addElement(name);
+ loadedClasses.addElement(clas);
+ }
}
close();
return mainClass;

tk <huh>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #27083:  ziploader-patch added by huh (919B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  • -unavailable- added by huh (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 13 Dec 2012 07:09:19 AM UTCbothnerStatusNone=>Fixed
      Assigned toNone=>bothner
      Open/ClosedOpen=>Closed
    Wed 12 Dec 2012 03:50:39 PM UTChuhAttached File-=>Added ziploader-patch, #27083

    Back to the top


    Powered by Savane 3.1-cleanup1