[Soot-list] Problem with JSR conversion

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Sat Jan 9 11:44:22 EST 2010


The bytecode of the problematic class is attached to this bug report,
by the way:
https://svn.sable.mcgill.ca/bugzilla/show_bug.cgi?id=101

Eric

2010/1/9 Eric Bodden <bodden at st.informatik.tu-darmstadt.de>:
> When trying Soot on the new DaCapo version I came across this problem:
>
> Method renameFile in class org.apache.lucene.store.FSDirectory
> contains JSR instructions. Soot fails with this exception when trying
> to convert them:
>
> Exception in thread "main" java.lang.NullPointerException
>        at java.util.Hashtable.get(Hashtable.java:334)
>        at soot.coffi.CFG.adjustExceptionTable(CFG.java:775)
>        at soot.coffi.CFG.eliminateJsrRets(CFG.java:351)
>        at soot.coffi.CFG.<init>(CFG.java:83)
>        at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:87)
>        at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:82)
>        at soot.SootMethod.retrieveActiveBody(SootMethod.java:329)
>        at soot.PackManager.retrieveAllBodies(PackManager.java:964)
>        at soot.PackManager.runPacks(PackManager.java:331)
>        at soot.Main.run(Main.java:202)
>        at soot.Main.main(Main.java:145)
>
> Unfortunately I know nothing about this code and don't quite seem to
> be able to fix it. Feng Qian seems to be the last one who did
> significant work on this code. Do you have any ideas what may be wrong
> there?
>
> javap output of the method is below...
>
> Cheers,
> Eric
>
> --
> Eric Bodden
> Software Technology Group, Technische Universität Darmstadt, Germany
> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>
> public synchronized void renameFile(java.lang.String,
> java.lang.String)   throws java.io.IOException;
>  Code:
>   0:   aload_0
>   1:   invokevirtual   #75; //Method ensureOpen:()V
>   4:   new     #7; //class java/io/File
>   7:   dup
>   8:   aload_0
>   9:   getfield        #40; //Field directory:Ljava/io/File;
>   12:  aload_1
>   13:  invokespecial   #46; //Method
> java/io/File."<init>":(Ljava/io/File;Ljava/lang/String;)V
>   16:  astore_3
>   17:  new     #7; //class java/io/File
>   20:  dup
>   21:  aload_0
>   22:  getfield        #40; //Field directory:Ljava/io/File;
>   25:  aload_2
>   26:  invokespecial   #46; //Method
> java/io/File."<init>":(Ljava/io/File;Ljava/lang/String;)V
>   29:  astore  4
>   31:  aload   4
>   33:  invokevirtual   #11; //Method java/io/File.exists:()Z
>   36:  ifeq    75
>   39:  aload   4
>   41:  invokevirtual   #47; //Method java/io/File.delete:()Z
>   44:  ifne    75
>   47:  new     #13; //class java/io/IOException
>   50:  dup
>   51:  new     #14; //class java/lang/StringBuffer
>   54:  dup
>   55:  invokespecial   #15; //Method java/lang/StringBuffer."<init>":()V
>   58:  ldc     #48; //String Cannot delete
>   60:  invokevirtual   #18; //Method
> java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer;
>   63:  aload   4
>   65:  invokevirtual   #16; //Method
> java/lang/StringBuffer.append:(Ljava/lang/Object;)Ljava/lang/StringBuffer;
>   68:  invokevirtual   #19; //Method
> java/lang/StringBuffer.toString:()Ljava/lang/String;
>   71:  invokespecial   #20; //Method
> java/io/IOException."<init>":(Ljava/lang/String;)V
>   74:  athrow
>   75:  aload_3
>   76:  aload   4
>   78:  invokevirtual   #80; //Method java/io/File.renameTo:(Ljava/io/File;)Z
>   81:  ifne    345
>   84:  aconst_null
>   85:  astore  5
>   87:  aconst_null
>   88:  astore  6
>   90:  new     #81; //class java/io/FileInputStream
>   93:  dup
>   94:  aload_3
>   95:  invokespecial   #82; //Method
> java/io/FileInputStream."<init>":(Ljava/io/File;)V
>   98:  astore  5
>   100: new     #83; //class java/io/FileOutputStream
>   103: dup
>   104: aload   4
>   106: invokespecial   #84; //Method
> java/io/FileOutputStream."<init>":(Ljava/io/File;)V
>   109: astore  6
>   111: aload_0
>   112: getfield        #53; //Field buffer:[B
>   115: ifnonnull       127
>   118: aload_0
>   119: sipush  1024
>   122: newarray byte
>   124: putfield        #53; //Field buffer:[B
>   127: aload   5
>   129: aload_0
>   130: getfield        #53; //Field buffer:[B
>   133: invokevirtual   #85; //Method java/io/InputStream.read:([B)I
>   136: dup
>   137: istore  7
>   139: iflt    157
>   142: aload   6
>   144: aload_0
>   145: getfield        #53; //Field buffer:[B
>   148: iconst_0
>   149: iload   7
>   151: invokevirtual   #86; //Method java/io/OutputStream.write:([BII)V
>   154: goto    127
>   157: aload_3
>   158: invokevirtual   #47; //Method java/io/File.delete:()Z
>   161: pop
>   162: jsr     227
>   165: goto    345
>   168: astore  7
>   170: new     #13; //class java/io/IOException
>   173: dup
>   174: new     #14; //class java/lang/StringBuffer
>   177: dup
>   178: invokespecial   #15; //Method java/lang/StringBuffer."<init>":()V
>   181: ldc     #87; //String Cannot rename
>   183: invokevirtual   #18; //Method
> java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer;
>   186: aload_3
>   187: invokevirtual   #16; //Method
> java/lang/StringBuffer.append:(Ljava/lang/Object;)Ljava/lang/StringBuffer;
>   190: ldc     #88; //String  to
>   192: invokevirtual   #18; //Method
> java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer;
>   195: aload   4
>   197: invokevirtual   #16; //Method
> java/lang/StringBuffer.append:(Ljava/lang/Object;)Ljava/lang/StringBuffer;
>   200: invokevirtual   #19; //Method
> java/lang/StringBuffer.toString:()Ljava/lang/String;
>   203: invokespecial   #20; //Method
> java/io/IOException."<init>":(Ljava/lang/String;)V
>   206: astore  8
>   208: aload   8
>   210: aload   7
>   212: invokevirtual   #89; //Method
> java/io/IOException.initCause:(Ljava/lang/Throwable;)Ljava/lang/Throwable;
>   215: pop
>   216: aload   8
>   218: athrow
>   219: astore  9
>   221: jsr     227
>   224: aload   9
>   226: athrow
>   227: astore  10
>   229: aload   5
>   231: ifnull  277
>   234: aload   5
>   236: invokevirtual   #90; //Method java/io/InputStream.close:()V
>   239: goto    277
>   242: astore  11
>   244: new     #29; //class java/lang/RuntimeException
>   247: dup
>   248: new     #14; //class java/lang/StringBuffer
>   251: dup
>   252: invokespecial   #15; //Method java/lang/StringBuffer."<init>":()V
>   255: ldc     #91; //String Cannot close input stream:
>   257: invokevirtual   #18; //Method
> java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer;
>   260: aload   11
>   262: invokevirtual   #92; //Method
> java/io/IOException.toString:()Ljava/lang/String;
>   265: invokevirtual   #18; //Method
> java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer;
>   268: invokevirtual   #19; //Method
> java/lang/StringBuffer.toString:()Ljava/lang/String;
>   271: aload   11
>   273: invokespecial   #32; //Method
> java/lang/RuntimeException."<init>":(Ljava/lang/String;Ljava/lang/Throwable;)V
>   276: athrow
>   277: jsr     291
>   280: goto    343
>   283: astore  12
>   285: jsr     291
>   288: aload   12
>   290: athrow
>   291: astore  13
>   293: aload   6
>   295: ifnull  341
>   298: aload   6
>   300: invokevirtual   #93; //Method java/io/OutputStream.close:()V
>   303: goto    341
>   306: astore  14
>   308: new     #29; //class java/lang/RuntimeException
>   311: dup
>   312: new     #14; //class java/lang/StringBuffer
>   315: dup
>   316: invokespecial   #15; //Method java/lang/StringBuffer."<init>":()V
>   319: ldc     #94; //String Cannot close output stream:
>   321: invokevirtual   #18; //Method
> java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer;
>   324: aload   14
>   326: invokevirtual   #92; //Method
> java/io/IOException.toString:()Ljava/lang/String;
>   329: invokevirtual   #18; //Method
> java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer;
>   332: invokevirtual   #19; //Method
> java/lang/StringBuffer.toString:()Ljava/lang/String;
>   335: aload   14
>   337: invokespecial   #32; //Method
> java/lang/RuntimeException."<init>":(Ljava/lang/String;Ljava/lang/Throwable;)V
>   340: athrow
>   341: ret     13
>   343: ret     10
>   345: return
>  Exception table:
>   from   to  target type
>    90   162   168   Class java/io/IOException
>
>    90   165   219   any
>   168   224   219   any
>   234   239   242   Class java/io/IOException
>
>   229   280   283   any
>   283   288   283   any
>   298   303   306   Class java/io/IOException
>


More information about the Soot-list mailing list