<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Dear DiSL-ers</div><div class=""><br class=""></div><div class="">I am having troubles in making my custom implementation working with DiSL.</div><div class=""><br class=""></div><div class="">So far I got to the following point:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>- Implemented Transformer interface</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>- Triggered custom transformation</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>- NPE (see [1]) when the transformation is applied.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I rooted the problem in the following code (DiSL.java) ~ line 440/450 (I introduced few printouts): </div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><span style="color: #931a68" class="">public</span> <span style="color: #931a68" class="">synchronized</span> <span style="color: #931a68" class="">byte</span>[] instrument(<span style="color: #931a68" class="">final</span> <span style="color: #931a68" class="">byte</span>[] <span style="color: #7e504f" class="">originalBytes</span>) <span style="color: #931a68" class="">throws</span> DiSLException {</div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>...</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #4e9072" class="">//</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(78, 144, 114);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre"> </span></span>// Instrument the class. If the class is modified neither by DiSL,</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(78, 144, 114);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre"> </span></span>// nor by any of the transformers, bail out early and return NULL</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(78, 144, 114);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre"> </span></span>// to indicate that the class has not been modified in any way.</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #4e9072" class="">//</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #931a68" class="">final</span> InstrumentedClass <span style="color: #7e504f" class="">instResult</span> = instrumentClass(<span style="color: #7e504f" class="">inputCN</span>);</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(126, 80, 79);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="color: #931a68" class="">if</span><span style="color: #000000" class=""> (</span>instResult<span style="color: #000000" class=""> == </span><span style="color: #931a68" class="">null</span><span style="color: #000000" class=""> && </span>transformedBytes<span style="color: #000000" class=""> == </span>originalBytes<span style="color: #000000" class="">) {</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(147, 26, 104);" class=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre"> </span></span>return<span style="color: #000000" class=""> </span>null<span style="color: #000000" class="">;</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><p style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span><br class="webkit-block-placeholder"></p></div><div class="">In my case, I get the following condition: "instResult == nullâ BUT "transformedBytes <b class="">!=</b> originalBytesâ,</div><div class="">so the if statement does not trigger and later in the same method thereâs an access to instResult which raise the NullPointerException</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #931a68" class="">final</span> ClassNode <span style="color: #7e504f" class="">instCN</span> = <span style="color: #7e504f" class="">instResult</span>.<span style="color: #0326cc" class="">classNode</span>;</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I am digging a bit into the code to understand why instResult is null, but in the meanwhile you might suggest something as well.</div><div class=""><br class=""></div><div class="">Best</div><div class=""><br class=""></div><div class="">â Alessio</div><div class=""><br class=""></div><div class="">[1] Console output:</div><div class=""><br class=""></div> [exec] de.unisaarland.instrumentation: Info: Transforming mainP/Main<br class=""> [exec] de.unisaarland.instrumentation: DependencyTrackingClassVisitor.visit()<br class=""> [exec] de.unisaarland.instrumentation: Adding interface DependencyInstrumented to mainP/Main null java/lang/Object<br class=""> [exec] dislserver: error instrumenting mainP/Main: java.lang.NullPointerException<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.disl.DiSL.instrument(DiSL.java:450)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.dislserver.RequestProcessor.process(RequestProcessor.java:71)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.dislserver.DiSLServer$ConnectionHandler.run(DiSLServer.java:99)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.FutureTask.run(FutureTask.java:266)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.lang.Thread.run(Thread.java:745)<br class=""> [exec] <br class=""> [exec] DiSL-agent error: instrumentation server error:<br class=""> [exec] error instrumenting mainP/Main: java.lang.NullPointerException<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.disl.DiSL.instrument(DiSL.java:450)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.dislserver.RequestProcessor.process(RequestProcessor.java:71)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.dislserver.DiSLServer$ConnectionHandler.run(DiSLServer.java:99)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.FutureTask.run(FutureTask.java:266)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.lang.Thread.run(Thread.java:745)<br class=""> [exec] <br class=""> [exec] dislreserver: fatal error: java.io.EOFException<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at java.io.DataInputStream.readByte(DataInputStream.java:267)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.dislreserver.DiSLREServer.processRequests(DiSLREServer.java:105)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.dislreserver.DiSLREServer.run(DiSLREServer.java:76)<br class=""> [exec] <span class="Apple-tab-span" style="white-space:pre"> </span>at ch.usi.dag.dislreserver.DiSLREServer.main(DiSLREServer.java:58)<br class=""> [exec] <br class=""> [exec] de.unisaarland.instrumentation: Info: Done with mainP/Main<br class=""> [exec] disl: Original class transformed<br class=""> [exec] disl: InstrumentedClass : null<br class=""><div class="">Alessio Gambi, Ph.D.<br class=""><a href="mailto:gambi@st.cs.uni-saarland.de" class="">gambi@st.cs.uni-saarland.de</a><br class=""><br class=""><br class=""></div><br class=""></body></html>