# NullPointerException in CodeParser

**URL:** <https://forum.cloverdx.com/t/nullpointerexception-in-codeparser/404>\
**Category:** CloverDX Platform\
**Created:** [October 1, 2008, 12:00am UTC](https://forum.cloverdx.com/t/nullpointerexception-in-codeparser/404 "2008-10-01T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveybob](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@daveybob](https://forum.cloverdx.com/u/daveybob)\
**Post date:** [October 1, 2008, 12:00am UTC](https://forum.cloverdx.com/t/nullpointerexception-in-codeparser/404/1 "2008-10-01T00:00:00Z")

</div>

I have a fairly simple graph. I’m reading a table of driver values (id and name) from Sybase, and doing a DBJoin to another database (SQL Server) matching on id. Unmatched records are going to a StructuredWriter, and unmatched records are going to another StructuredWriter.

I didn’t initially have any transformation defined, and this came out as exceptions about not being able to set fetch size and fetch direction…not exactly clear.

But I got past that and set up a very simple transformation, mapping in.0.id to out.0.id and in.0.name to out.0.name.

And now I’m blowing up with this:  
DBJOIN0 …FAILED !  
Reason: java.lang.NullPointerException  
at org.jetel.graph.Phase.init(Phase.java:161)  
at org.jetel.graph.runtime.WatchDog.executePhase(WatchDog.java:564)  
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:155)  
at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:70)  
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)  
at java.util.concurrent.FutureTask.run(FutureTask.java:138)  
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:619)  
Caused by: Element [DBJOIN0:]-java.lang.NullPointerException  
at org.jetel.component.DBJoin.init(DBJoin.java:348)  
at org.jetel.graph.Phase.init(Phase.java:158)  
… 8 more  
Caused by: java.lang.NullPointerException  
at **org.jetel.util.CodeParser.(CodeParser.java:217)**  
at org.jetel.component.RecordTransformFactory.loadClassDynamic(RecordTransformFactory.java:179)  
at org.jetel.component.RecordTransformFactory.createTransform(RecordTransformFactory.java:84)  
at org.jetel.component.DBJoin.init(DBJoin.java:343)

The core of the problem appears to be in the CodeParser where it’s trying to read the transformation I set up through the UI.

I tried to paste the source text, but the XML all gets truncated.

---

<div class="post-metadata">

**Author:** ![daveybob](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@daveybob](https://forum.cloverdx.com/u/daveybob)\
**Post date:** [October 1, 2008, 5:34pm UTC](https://forum.cloverdx.com/t/nullpointerexception-in-codeparser/404/2 "2008-10-01T17:34:53Z")

</div>

The only way I could find to post the actual graph was to get rid of the ‘\<’ and ‘\>’ chars. I replaced the ‘\<’ with ‘@’ and the ‘\>’ with ‘%’. Here it is:

@?xml version=“1.0” encoding=“UTF-8”?%  
@Graph created=“Wed Oct 01 08:53:22 EDT 2008” guiVersion=“1.10” id=“1222865602462” licenseType=“Evaluation license.” modified=“Wed Oct 01 13:30:20 EDT 2008” name=“RefreshCluster” revision=“1.11”%  
@Global%  
@Metadata fileURL=“meta/Cluster.fmt” id=“Metadata0”/%  
@Connection dbConfig=“conn/AuthStarDB.cfg” id=“Connection0” type=“JDBC”/%  
@Connection dbConfig=“conn/Reporting.cfg” id=“Connection1” type=“JDBC”/%  
@Property fileURL=“workspace.prm” id=“GraphParameter0”/%  
@/Global%  
@Phase number=“0”%  
@Node dbConnection=“Connection1” enabled=“enabled” guiHeight=“0” guiName=“DBJoin” guiWidth=“0” guiX=“312” guiY=“307” id=“DBJOIN0” joinKey=“CLUSTERID” sqlQuery=“select CLUSTERID, CLUSTERNAME from CLUSTER” type=“DBJOIN”%  
@attr name=“transform”%@![CDATA[${out.0.CLUSTERID} = ${in.0.CLUSTERID};  
${out.0.CLUSTERNAME} = ${in.0.CLUSTERNAME};  
]]%@/attr%  
@/Node%  
@Node dbConnection=“Connection0” enabled=“enabled” guiHeight=“0” guiName=“DB Input Table” guiWidth=“0” guiX=“55” guiY=“200” id=“DB\_INPUT\_TABLE0” sqlQuery=“select ID, CLUSTERNAME from Cluster” type=“DB\_INPUT\_TABLE”/%  
@Node enabled=“enabled” fileURL=“c:/dev/clover/etl/data-out/cluster.txt” guiHeight=“0” guiName=“Structured Data Writer” guiWidth=“0” guiX=“285” guiY=“174” id=“STRUCTURE\_WRITER0” mask=“\<Cluster\> \<CLUSTERID=$CLUSTERID/\> \<CLUSTERNAME=$CLUSTERNAME/\> \<Cluster/\> " type=“STRUCTURE\_WRITER”/%  
@Node enabled=“enabled” fileURL=“c:/dev/clover/etl/data-out/matchedclusters.txt” guiHeight=“0” guiName=“Structured Data Writer” guiWidth=“0” guiX=“510” guiY=“289” id=“STRUCTURE\_WRITER1” mask=”\<Cluster\> \<CLUSTERID=$CLUSTERID/\> \<CLUSTERNAME=$CLUSTERNAME/\> \<Cluster/\> " type=“STRUCTURE\_WRITER”/%  
@Node enabled=“enabled” fileURL=“c:/dev/clover/etl/data-out/unmatchedclusters.txt” guiHeight=“0” guiName=“Structured Data Writer” guiWidth=“0” guiX=“519” guiY=“389” id=“STRUCTURE\_WRITER2” mask=“\<Cluster\> \<CLUSTERID=$CLUSTERID/\> \<CLUSTERNAME=$CLUSTERNAME/\> \<Cluster/\> " type=“STRUCTURE\_WRITER”/%  
@Edge fromNode=“DBJOIN0:0” guiBendpoints=”" id=“Edge2” inPort=“Port 0 (Body port)” metadata=“Metadata0” outPort=“Port 0 (joined records)” toNode=“STRUCTURE\_WRITER1:0”/%  
@Edge fromNode=“DBJOIN0:1” guiBendpoints=“” id=“Edge3” inPort=“Port 0 (Body port)” metadata=“Metadata0” outPort=“Port 1 (skipped records)” toNode=“STRUCTURE\_WRITER2:0”/%  
@Edge fromNode=“DB\_INPUT\_TABLE0:0” guiBendpoints=“” id=“Edge0” inPort=“Port 0 (Body port)” metadata=“Metadata0” outPort=“Port 0 (out)” toNode=“STRUCTURE\_WRITER0:0”/%  
@Edge fromNode=“DB\_INPUT\_TABLE0:1” guiBendpoints=“” id=“Edge5” inPort=“Port 0 (in)” metadata=“Metadata0” outPort=“Port 1 (out)” toNode=“DBJOIN0:0”/%  
@/Phase%  
@/Graph%

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [October 2, 2008, 7:11am UTC](https://forum.cloverdx.com/t/nullpointerexception-in-codeparser/404/3 "2008-10-02T07:11:26Z")

</div>

Hello,  
it’s really Clover.ETL bug. In time being you have to write transformation in java, eg. for populating input records:

```auto
import org.jetel.component.DataRecordTransform;
import org.jetel.data.DataRecord;
import org.jetel.exception.TransformException;

public class MyTransform extends DataRecordTransform {

	public boolean transform(DataRecord[] arg0, DataRecord[] arg1)
			throws TransformException {
		arg1[0].copyFrom(arg0[0]);
		return true;
	}

}

```

By the way it’s strange, that graph without transformation code throws an exception.
