[DiSL-user] Problems using custom Transformers
Alessio Gambi
gambi at st.cs.uni-saarland.de
Thu Apr 20 12:13:45 CEST 2017
Dear DiSL-ers
I am having troubles in making my custom implementation working with DiSL.
So far I got to the following point:
- Implemented Transformer interface
- Triggered custom transformation
- NPE (see [1]) when the transformation is applied.
I rooted the problem in the following code (DiSL.java) ~ line 440/450 (I introduced few printouts):
public synchronized byte[] instrument(final byte[] originalBytes) throws DiSLException {
...
//
// Instrument the class. If the class is modified neither by DiSL,
// nor by any of the transformers, bail out early and return NULL
// to indicate that the class has not been modified in any way.
//
final InstrumentedClass instResult = instrumentClass(inputCN);
if (instResult == null && transformedBytes == originalBytes) {
return null;
}
In my case, I get the following condition: "instResult == null” BUT "transformedBytes != originalBytes”,
so the if statement does not trigger and later in the same method there’s an access to instResult which raise the NullPointerException
final ClassNode instCN = instResult.classNode;
I am digging a bit into the code to understand why instResult is null, but in the meanwhile you might suggest something as well.
Best
— Alessio
[1] Console output:
[exec] de.unisaarland.instrumentation: Info: Transforming mainP/Main
[exec] de.unisaarland.instrumentation: DependencyTrackingClassVisitor.visit()
[exec] de.unisaarland.instrumentation: Adding interface DependencyInstrumented to mainP/Main null java/lang/Object
[exec] dislserver: error instrumenting mainP/Main: java.lang.NullPointerException
[exec] at ch.usi.dag.disl.DiSL.instrument(DiSL.java:450)
[exec] at ch.usi.dag.dislserver.RequestProcessor.process(RequestProcessor.java:71)
[exec] at ch.usi.dag.dislserver.DiSLServer$ConnectionHandler.run(DiSLServer.java:99)
[exec] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[exec] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[exec] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[exec] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[exec] at java.lang.Thread.run(Thread.java:745)
[exec]
[exec] DiSL-agent error: instrumentation server error:
[exec] error instrumenting mainP/Main: java.lang.NullPointerException
[exec] at ch.usi.dag.disl.DiSL.instrument(DiSL.java:450)
[exec] at ch.usi.dag.dislserver.RequestProcessor.process(RequestProcessor.java:71)
[exec] at ch.usi.dag.dislserver.DiSLServer$ConnectionHandler.run(DiSLServer.java:99)
[exec] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[exec] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[exec] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[exec] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[exec] at java.lang.Thread.run(Thread.java:745)
[exec]
[exec] dislreserver: fatal error: java.io.EOFException
[exec] at java.io.DataInputStream.readByte(DataInputStream.java:267)
[exec] at ch.usi.dag.dislreserver.DiSLREServer.processRequests(DiSLREServer.java:105)
[exec] at ch.usi.dag.dislreserver.DiSLREServer.run(DiSLREServer.java:76)
[exec] at ch.usi.dag.dislreserver.DiSLREServer.main(DiSLREServer.java:58)
[exec]
[exec] de.unisaarland.instrumentation: Info: Done with mainP/Main
[exec] disl: Original class transformed
[exec] disl: InstrumentedClass : null
Alessio Gambi, Ph.D.
gambi at st.cs.uni-saarland.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://d3s.mff.cuni.cz/pipermail/disl-user/attachments/20170420/20a063d6/attachment.html>
More information about the Disl-user
mailing list