New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeException reading from jar #6

Open
floyd-fuh opened this Issue Feb 7, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@floyd-fuh

floyd-fuh commented Feb 7, 2018

I get an exception when trying to instrument a jar file:

$ java -cp ../../instrumentor/build/libs/kelinci.jar edu.cmu.sv.kelinci.instrumentor.Instrumentor -i example.jar -o example-instrumented.jar
Exception in thread "main" java.lang.RuntimeException: Error reading from JAR file: org/exmaple/other/some.jar
        at edu.cmu.sv.kelinci.instrumentor.JarFileIO.extractJar(JarFileIO.java:107)
        at edu.cmu.sv.kelinci.instrumentor.JarFileIO.extractJar(JarFileIO.java:99)
        at edu.cmu.sv.kelinci.instrumentor.Options.getInput(Options.java:40)
        at edu.cmu.sv.kelinci.instrumentor.Instrumentor.main(Instrumentor.java:43)

It seems that the jar file can not be properly extracted. Could you maybe add the same behavior here, so that if it can not be extracted, instrumentation is skipped and the jar used as-is? That would be super cool.

@floyd-fuh

This comment has been minimized.

Show comment
Hide comment
@floyd-fuh

floyd-fuh Feb 7, 2018

Hm, while looking at this bug I'm not really sure if the recursion in the extractJar method is correctly implemented. Because if there is a jar in a jar, I think you can not simply read the jar inside by specifying a "path", like here:

JarFile jarFile = new JarFile(file);

But I'm unsure.

floyd-fuh commented Feb 7, 2018

Hm, while looking at this bug I'm not really sure if the recursion in the extractJar method is correctly implemented. Because if there is a jar in a jar, I think you can not simply read the jar inside by specifying a "path", like here:

JarFile jarFile = new JarFile(file);

But I'm unsure.

@rodykersten

This comment has been minimized.

Show comment
Hide comment
@rodykersten

rodykersten Feb 9, 2018

Contributor

Hmm I'm not sure if I actually tested with nested JARs. You are right about the extractJar method.

As a workaround, for now, you can comment out lines 97 and 99 of JarFileIO.java. Your output will then have the original, uninstrumented JAR.

Please feel free to send in a pull request to fix this.

Contributor

rodykersten commented Feb 9, 2018

Hmm I'm not sure if I actually tested with nested JARs. You are right about the extractJar method.

As a workaround, for now, you can comment out lines 97 and 99 of JarFileIO.java. Your output will then have the original, uninstrumented JAR.

Please feel free to send in a pull request to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment