<?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: java.lang.NullPointerException in Installing and Upgrading</title>
    <link>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383495#M4661</link>
    <description>HI&amp;nbsp;&lt;BR /&gt;&lt;FONT color="#212121"&gt;&lt;FONT size="3"&gt;&lt;FONT face="arial, sans-serif"&gt;I wonder if there is some component in Talend to as the locale of the Java "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#212121"&gt;&lt;FONT size="3"&gt;&lt;FONT face="arial, sans-serif"&gt;&lt;A href="https://docs.oracle.com/javase/tutorial/i18n/locale/create.html" rel="nofollow noopener noreferrer"&gt;https://docs.oracle.com/javase/tutorial/i18n/locale/create.html&lt;/A&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#212121"&gt;&lt;FONT size="3"&gt;&lt;FONT face="arial, sans-serif"&gt;" or some conponente I can do code pure java ?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description>
    <pubDate>Wed, 10 Feb 2016 17:39:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-02-10T17:39:57Z</dc:date>
    <item>
      <title>java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383492#M4658</link>
      <description>I have a simple job which uses Microsoft Excel spreadsheets as a source. &amp;nbsp;I need to take fields from different spreadsheets and make one output file. &amp;nbsp;I have a calculation in my tmap expression that uses multiple String fields that can be null in the source file. &amp;nbsp;When I run the job, I get the error java.lang.NullPointerException error. &amp;nbsp;I know I have to check for Null conditions upfront, but how do you do it for multiple fields? &amp;nbsp;All of my fields in the schema are set up to allow nulls. &amp;nbsp;
&lt;BR /&gt;Below is what I have for my calculation in the expression of tmap with the null check for the fields that can be null at the beginning of the calculation. &amp;nbsp;All records return a Null on the output because at least one of the code fields is blank. &amp;nbsp;Instead of OR, I tried AND which gave me the NullPointerException error. &amp;nbsp;&amp;nbsp;
&lt;BR /&gt;
&lt;PRE&gt;UAFLossDraft.UAF_CODE1==null || UAFLossDraft.UAF_CODE2==null || UAFLossDraft.UAF_CODE3==null || UAFLossDraft.UAF_CODE4==null?null:UAFLossDraft.UAF_CODE1.equals("U")?"U":UAFLossDraft.UAF_CODE2.equals("H") || UAFLossDraft.UAF_CODE2.equals("E")?"U":MainDataFile.WARNING_CODES!=5 &amp;amp;&amp;amp; UAFLossDraft.UAF_CODE1.equals("R") || UAFLossDraft.UAF_CODE2.equals("R") || UAFLossDraft.UAF_CODE3.equals("R") || UAFLossDraft.UAF_CODE4.equals("R")?"U":null &lt;/PRE&gt;
&lt;BR /&gt;I tried going into the Advanced settings of each Excel component and checked the Stop Reading on encountering empty&amp;nbsp;
&lt;BR /&gt;I guess I could incorporate the null check within the calculation (I.E.&amp;nbsp;
&lt;FONT color="black"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;UAFLossDraft.UAF_CODE1==&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;B&gt;&lt;FONT color="#7f0055"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;null&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;
&lt;FONT color="black"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;?null: UAFLossDraft.UAF_CODE1.equals(&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT color="#2a00ff"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;"U"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT color="black"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;)?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT color="#2a00ff"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;"U":&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT color="black"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt; UAFLossDraft.UAF_CODE2==&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;B&gt;&lt;FONT color="#7f0055"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;null?null...)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;
&lt;FONT color="#2a00ff"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Consolas"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;but I can see that getting messy real quick as there are a couple of conditions that use different codes.
&lt;BR /&gt;Is there any easier way to check for nulls on multiple fields used in calculations?</description>
      <pubDate>Sat, 16 Nov 2024 10:48:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383492#M4658</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T10:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383493#M4659</link>
      <description>I'm not entirely sure what you want from your logic (brackets make it much easier to read and write combining multiple ANDs and ORs), but I think this might help. Write a String method (routine) to handle null values for you. Something like this (written freehand so might need checking).... 
&lt;BR /&gt; 
&lt;PRE&gt;public static String removeNullString(String data){&lt;BR /&gt;     return data == null ? "" : data;&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;That will return either the String data or an empty String. 
&lt;BR /&gt;You can then use it in your logic like so (I am assuming it is in a routine called TestRoutine)..... 
&lt;BR /&gt; 
&lt;PRE&gt;routines.TestRoutine.removeNullString(UAFLossDraft.UAF_CODE1).equals("U")?"U":routines.TestRoutine.removeNullString(UAFLossDraft.UAF_CODE2).equals("H") ||&amp;nbsp;routines.TestRoutine.removeNullString(UAFLossDraft.UAF_CODE2).equals("E")?"U":MainDataFile.WARNING_CODES!=5 &amp;amp;&amp;amp;&amp;nbsp;routines.TestRoutine.removeNullString(UAFLossDraft.UAF_CODE1).equals("R") ||&amp;nbsp;routines.TestRoutine.removeNullString(UAFLossDraft.UAF_CODE2).equals("R") ||&amp;nbsp;routines.TestRoutine.removeNullString(UAFLossDraft.UAF_CODE3).equals("R") ||&amp;nbsp;routines.TestRoutine.removeNullString(UAFLossDraft.UAF_CODE4).equals("R")?"U":null &lt;/PRE&gt; 
&lt;BR /&gt;I have removed the initial check for all nulls because that will not happen now. A null will be returned as an empty String which will enable you to carry out the method calls without returning a NullPointerException. 
&lt;BR /&gt;As I said, this was written freehand so may need some checking and tweaking. But it should work for you.</description>
      <pubDate>Wed, 10 Feb 2016 16:18:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383493#M4659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-10T16:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383494#M4660</link>
      <description>Thank you for your assistance. &amp;nbsp;I was able to get this to work and I am now getting the data I need without the NullPointerException error. &amp;nbsp;This really makes the calculation a lot cleaner and easier to read.
&lt;BR /&gt;Thanks again! &amp;nbsp;I appreciate it.</description>
      <pubDate>Wed, 10 Feb 2016 17:27:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383494#M4660</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-10T17:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383495#M4661</link>
      <description>HI&amp;nbsp;&lt;BR /&gt;&lt;FONT color="#212121"&gt;&lt;FONT size="3"&gt;&lt;FONT face="arial, sans-serif"&gt;I wonder if there is some component in Talend to as the locale of the Java "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#212121"&gt;&lt;FONT size="3"&gt;&lt;FONT face="arial, sans-serif"&gt;&lt;A href="https://docs.oracle.com/javase/tutorial/i18n/locale/create.html" rel="nofollow noopener noreferrer"&gt;https://docs.oracle.com/javase/tutorial/i18n/locale/create.html&lt;/A&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#212121"&gt;&lt;FONT size="3"&gt;&lt;FONT face="arial, sans-serif"&gt;" or some conponente I can do code pure java ?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Wed, 10 Feb 2016 17:39:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383495#M4661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-10T17:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: java.lang.NullPointerException</title>
      <link>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383496#M4662</link>
      <description>Set the locale of the JVM is static and affects the whole running vm. You can put this simple code with the help of the tJava component in your job.</description>
      <pubDate>Wed, 10 Feb 2016 19:52:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Installing-and-Upgrading/java-lang-NullPointerException/m-p/2383496#M4662</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-10T19:52:03Z</dc:date>
    </item>
  </channel>
</rss>

