<?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 Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338676#M106889</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have a very simple transformation with a tMap which deals with a column with has Double.&lt;/P&gt;&lt;P&gt;My input file is simple : &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000EZMJzAAP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146839i273833963D8747A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000EZMJzAAP.png" alt="0695b00000EZMJzAAP.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my output file, I want to fill in the 2 column with 1.5 if the type of room is related to "group A"&lt;/P&gt;&lt;P&gt;I use a tMap : &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000EZMHjAAP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147312iA07A7653A94741AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000EZMHjAAP.png" alt="0695b00000EZMHjAAP.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My tMap is set as such:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000EZMLRAA5.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140558iFD5F0AD1B60AC188/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000EZMLRAA5.png" alt="0695b00000EZMLRAA5.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i run the job , I have a message error with java.lang.NullPointerException.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however, if my second column "area" is set a String instead of a double and in the tmap I write&lt;/P&gt;&lt;P&gt;&lt;B&gt;row1.group.equals("Group A")? "1.5": row1.area&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Then it works perfectly.&lt;/P&gt;&lt;P&gt;However I need a double as I will later perform some mathematical operations later.&lt;/P&gt;&lt;P&gt;can you explain why i doesn't work with a double?&lt;/P&gt;</description>
    <pubDate>Tue, 20 Apr 2021 08:21:29 GMT</pubDate>
    <dc:creator>citrods</dc:creator>
    <dc:date>2021-04-20T08:21:29Z</dc:date>
    <item>
      <title>Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338676#M106889</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have a very simple transformation with a tMap which deals with a column with has Double.&lt;/P&gt;&lt;P&gt;My input file is simple : &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000EZMJzAAP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146839i273833963D8747A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000EZMJzAAP.png" alt="0695b00000EZMJzAAP.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my output file, I want to fill in the 2 column with 1.5 if the type of room is related to "group A"&lt;/P&gt;&lt;P&gt;I use a tMap : &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000EZMHjAAP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147312iA07A7653A94741AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000EZMHjAAP.png" alt="0695b00000EZMHjAAP.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My tMap is set as such:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000EZMLRAA5.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140558iFD5F0AD1B60AC188/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000EZMLRAA5.png" alt="0695b00000EZMLRAA5.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i run the job , I have a message error with java.lang.NullPointerException.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however, if my second column "area" is set a String instead of a double and in the tmap I write&lt;/P&gt;&lt;P&gt;&lt;B&gt;row1.group.equals("Group A")? "1.5": row1.area&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Then it works perfectly.&lt;/P&gt;&lt;P&gt;However I need a double as I will later perform some mathematical operations later.&lt;/P&gt;&lt;P&gt;can you explain why i doesn't work with a double?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 08:21:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338676#M106889</guid>
      <dc:creator>citrods</dc:creator>
      <dc:date>2021-04-20T08:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338677#M106890</link>
      <description>&lt;P&gt;HI, I reproduce your error , it's because row1.area can be null when group not equals Group A and ternary in the Tmap seems to don't work with nullable Double( this is weird cause Double like Integer support nullable values) . To bypass this I make a custom routine :&lt;/P&gt;&lt;P&gt;package routines;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public class Double_routine {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public static Double check(String group,Double area ) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ("Group A".equals(group)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 1.5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return area;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and in the Tmap I call it : Double_routine.check(row1.group,row1.area)&lt;/P&gt;&lt;P&gt;and it's work !&lt;/P&gt;&lt;P&gt;Send me Love and Kudos&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 12:33:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338677#M106890</guid>
      <dc:creator>gjeremy1617088143</dc:creator>
      <dc:date>2021-04-20T12:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338678#M106891</link>
      <description>&lt;P&gt;after few search you could use this : &lt;B&gt;"Group A".equals(row1.group)? new Double(1.5): row1.area.&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If any of the operands is of a reference type, unboxing conversion is performed. Then: If either operand is of type double, the other is converted to double instead of Double&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 13:51:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338678#M106891</guid>
      <dc:creator>gjeremy1617088143</dc:creator>
      <dc:date>2021-04-20T13:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338679#M106892</link>
      <description>&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;i'm a beginner. What do you mean by custom routine and package routines?&lt;/P&gt;&lt;P&gt;can I have a screenshot of the job you made?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also i dudn't get your 2nd message&lt;/P&gt;&lt;P&gt;"if any of the operands is of a reference type,&lt;B&gt; unboxing conversion is performed&lt;/B&gt;. Then: If either operand is of type double, t&lt;B&gt;he other is converted to double instead of Double&lt;/B&gt;"&lt;/P&gt;&lt;P&gt;what is an &lt;B&gt;unboxing conversion&lt;/B&gt;?&lt;/P&gt;&lt;P&gt;what is the difference between double and Double?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 15:19:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338679#M106892</guid>
      <dc:creator>citrods</dc:creator>
      <dc:date>2021-04-21T15:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338680#M106893</link>
      <description>&lt;P&gt;Hi, double is a primitive java type and Double is a wrapper of double, so double is not nullable, Double is nullable.when you write 1.5 in your ternary it read it as a double and so it read row1.area as a double( it’ a consequence of the ternary autoboxing) , some values of area are null then it throw a null pointer exception. To avoid this you have to write new Double(1.5) then row1.area will be interpreted as a Double in the ternary expression and output will accept null value. An other way to avoid that is to write a simple routine with Double as return Value( the full code of the routine is in the first sentence). A routine in talend is similar to a java class. You can find them on the repository view —&amp;gt; Code—&amp;gt; Routines. You can write your own by the way. Send me Love and Kudos&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 21:12:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338680#M106893</guid>
      <dc:creator>gjeremy1617088143</dc:creator>
      <dc:date>2021-04-21T21:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338681#M106894</link>
      <description>&lt;P&gt;Hi, if my answer is ok , could you select it as the best please&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 07:24:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338681#M106894</guid>
      <dc:creator>gjeremy1617088143</dc:creator>
      <dc:date>2021-05-07T07:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Simple case with a column which contains Double : I dont understand this error with java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338682#M106895</link>
      <description>&lt;P&gt;ok&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 14:12:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Simple-case-with-a-column-which-contains-Double-I-dont/m-p/2338682#M106895</guid>
      <dc:creator>citrods</dc:creator>
      <dc:date>2021-05-07T14:12:35Z</dc:date>
    </item>
  </channel>
</rss>

