bug-kawa
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-kawa] [bug #37910] gnu.bytecode.ZipLoader:loadAllClasses not checki


From: tk
Subject: [Bug-kawa] [bug #37910] gnu.bytecode.ZipLoader:loadAllClasses not checking for previous definitions
Date: Wed, 12 Dec 2012 15:50:40 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11

URL:
  <http://savannah.gnu.org/bugs/?37910>

                 Summary: gnu.bytecode.ZipLoader:loadAllClasses not checking
for previous definitions
                 Project: Kawa
            Submitted by: huh
            Submitted on: Wed 12 Dec 2012 03:50:39 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: Run-time exception
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

;; 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;





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 12 Dec 2012 03:50:39 PM GMT  Name: ziploader-patch  Size: 919B   By:
huh

<http://savannah.gnu.org/bugs/download.php?file_id=27083>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37910>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]