<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: NullPointerException issue when using 'conditional if' in tMap in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/NullPointerException-issue-when-using-conditional-if-in-tMap/m-p/2357009#M122410</link>
    <description>I guess the data type of the OLD_DATA_TYPE is Integer - your tMap expression looks like this. 
&lt;BR /&gt;In this case you have made a very cumbersome way, please try this: 
&lt;BR /&gt; 
&lt;PRE&gt;row3.OLD_DATA_TYPE != null ?&amp;nbsp;row3.OLD_DATA_TYPE&amp;nbsp;: 0&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;The problem in your job is the output column is probably not nullable -&amp;gt; use as data type &lt;B&gt;int&lt;/B&gt; instead of &lt;B&gt;Integer&amp;nbsp;&lt;/B&gt;&lt;/FONT&gt; 
&lt;BR /&gt;Java converts automatically an so called wrapper type like Integer into the primitive data type int with an unboxing. The unboxing is nothing else then the call to the method intValue to the incoming Integer typed value. If the incoming value is null this implicit method call (which cannot be seen as readable code in your job) causes the NullPointerException. 
&lt;BR /&gt;Thats because I have used as null replacement value the zero.</description>
    <pubDate>Wed, 15 Oct 2014 09:08:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-10-15T09:08:00Z</dc:date>
    <item>
      <title>NullPointerException issue when using 'conditional if' in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/NullPointerException-issue-when-using-conditional-if-in-tMap/m-p/2357008#M122409</link>
      <description>Hi All, 
&lt;BR /&gt;I am using a conditional if statement in tMap component. This is the screenshot of my job. 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/195505/nullpointerjob.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBGg.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/131539iE6343762C4E45C73/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBGg.jpg" alt="0683p000009MBGg.jpg" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;The first row of the Excel file has an empty value in the OLD_DATA_SIZE column. 
&lt;BR /&gt;----------------------------------------------------------------------------------------------------------------- 
&lt;BR /&gt;The type of var2 is Integer and the job throws a NullPointer Exception. But, once I change the type to String and convert the var2 explicitly into Interger in the row 's' , it works fine. 
&lt;BR /&gt;As I figured out the ' 
&lt;FONT color="#ff3333"&gt;null&lt;/FONT&gt;' value which is at the end of the following expression creates the issue. 
&lt;BR /&gt; 
&lt;B&gt;!StringUtils.getSize(row3.OLD_DATA_TYPE).equals("") ? Integer.parseInt(StringUtils.getSize(row3.OLD_DATA_TYPE)) : (row3.OLD_DATA_SIZE != null ? row3.OLD_DATA_SIZE : &lt;FONT color="#ff3333"&gt;null&lt;/FONT&gt;) &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/B&gt; 
&lt;BR /&gt;Does anyone knows the reason behind this? 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/195505/nullpointer.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBCG.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150906i7ACAFE3722D47124/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBCG.jpg" alt="0683p000009MBCG.jpg" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;thivanka.</description>
      <pubDate>Wed, 15 Oct 2014 04:49:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/NullPointerException-issue-when-using-conditional-if-in-tMap/m-p/2357008#M122409</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-15T04:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: NullPointerException issue when using 'conditional if' in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/NullPointerException-issue-when-using-conditional-if-in-tMap/m-p/2357009#M122410</link>
      <description>I guess the data type of the OLD_DATA_TYPE is Integer - your tMap expression looks like this. 
&lt;BR /&gt;In this case you have made a very cumbersome way, please try this: 
&lt;BR /&gt; 
&lt;PRE&gt;row3.OLD_DATA_TYPE != null ?&amp;nbsp;row3.OLD_DATA_TYPE&amp;nbsp;: 0&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;FONT size="2"&gt;The problem in your job is the output column is probably not nullable -&amp;gt; use as data type &lt;B&gt;int&lt;/B&gt; instead of &lt;B&gt;Integer&amp;nbsp;&lt;/B&gt;&lt;/FONT&gt; 
&lt;BR /&gt;Java converts automatically an so called wrapper type like Integer into the primitive data type int with an unboxing. The unboxing is nothing else then the call to the method intValue to the incoming Integer typed value. If the incoming value is null this implicit method call (which cannot be seen as readable code in your job) causes the NullPointerException. 
&lt;BR /&gt;Thats because I have used as null replacement value the zero.</description>
      <pubDate>Wed, 15 Oct 2014 09:08:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/NullPointerException-issue-when-using-conditional-if-in-tMap/m-p/2357009#M122410</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-15T09:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: NullPointerException issue when using 'conditional if' in tMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/NullPointerException-issue-when-using-conditional-if-in-tMap/m-p/2357010#M122411</link>
      <description>Thanks for the reply jlolling. 
&lt;BR /&gt;Data type of the OLD_DATA_TYPE is Integer and it is Nullable. And in the database it is mapped to a column which is 
&lt;FONT color="#3333ff"&gt;NUMBER &lt;/FONT&gt;and 
&lt;FONT color="#3333ff"&gt;nullable&lt;/FONT&gt;. 
&lt;BR /&gt;Since OLD_DATA_TYPE is nullable we should be able to null I guess. 
&lt;BR /&gt;Later I tried making the data type of the Var.var2 and as String and did the relevant conversions(String --&amp;gt; Integer).&amp;nbsp; 
&lt;BR /&gt;Then it worked. But still I cannot figure out what happens when it comes to Integer (nullable). 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;thivanka.</description>
      <pubDate>Wed, 15 Oct 2014 09:46:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/NullPointerException-issue-when-using-conditional-if-in-tMap/m-p/2357010#M122411</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-15T09:46:00Z</dc:date>
    </item>
  </channel>
</rss>

