Wednesday 25 April 2018

Handling NULL POINTER EXCEPTION

1ST WAY  USAGE:
if( (Relational.ISNULL(test_string)) || ("null".equals(test_string)) || ("".equals(test_string))   )
System.out.println("HAS GOT A NULL VALUE ");
    else
     
        System.out.println("HAS GOT A VALID VALUE ");


2ND WAY USAGE:

( (Relational.ISNULL(test_string)) || ("null".equals(test_string)) || ("".equals(test_string))   )
? "HAVING NULL" :  "HAVING DATA"


=======================================================
Below is the Tested Talend code in DETAIL with various ways of NULL data:
=======================================================

String test_string="TALEND";

System.out.println("\ntest_string=\"TALEND\";");
if( (Relational.ISNULL(test_string)) || ("null".equals(test_string)) || ("".equals(test_string))   )
System.out.println("HAS GOT A NULL VALUE ");
    else
     
        System.out.println("HAS GOT A VALID VALUE ");

test_string="null";

System.out.println("\ntest_string=\"null\";");
if( (Relational.ISNULL(test_string)) || ("null".equals(test_string)) || ("".equals(test_string))   )
System.out.println("HAS GOT A NULL VALUE ");
    else
     
        System.out.println("HAS GOT A VALID VALUE ");

test_string="";
System.out.println("\ntest_string=\"\";");

if( (Relational.ISNULL(test_string)) || ("null".equals(test_string)) || ("".equals(test_string))   )
System.out.println("HAS GOT A NULL VALUE ");
    else
     
        System.out.println("HAS GOT A VALID VALUE ");


test_string=null;

System.out.println("\ntest_string=null;");

if( (Relational.ISNULL(test_string)) || ("null".equals(test_string)) || ("".equals(test_string))   )
System.out.println("HAS GOT A NULL VALUE ");
    else
     
        System.out.println("HAS GOT A VALID VALUE ");
     

Relational.ISNULL() USAGE WITH RESULTS

System.out.println("Relational.ISNULL(null)      : "+Relational.ISNULL(null));

System.out.println("Relational.ISNULL(\"null\")   :  "+Relational.ISNULL("null"));

System.out.println("Relational.ISNULL(\"\")        :"+Relational.ISNULL(""));

System.out.println("Relational.ISNULL(false)     :  "+Relational.ISNULL(false));

System.out.println("Relational.ISNULL(true)     :  "+Relational.ISNULL(true));

============
OUTPUT :
===========
Relational.ISNULL(null)      : true
Relational.ISNULL("null")   :  false
Relational.ISNULL("")        :false
Relational.ISNULL(false)     :  false
Relational.ISNULL(true)     :  false

TALEND CURRENT DATE FORMAT

Various ways of getting Current Date :
===============================


TalendDate.getDate("yyyy-MM-dd HH:mm:ss")

new Date()

TalendDate.getDate("yyyy-MM-dd'T'HH:mm:ss")

Exception in component tDecryptColumn_1

Exception in component tDecryptColumn_1
javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:922)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:833)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at unified_platform_git.test_ram_0_1.TEST_RAM.tFixedFlowInput_8Process(TEST_RAM.java:2937)
at unified_platform_git.test_ram_0_1.TEST_RAM.runJobInTOS(TEST_RAM.java:5782)
at unified_platform_git.test_ram_0_1.TEST_RAM.main(TEST_RAM.java:5201)


Sol : Sol : The sequence of columns (in Edit Schema) used in tDecryptColumn_1 component should be same as the column sequence in the prior component.

Eg :   Say, like you got the SCHEMA in   tDecryptColumn_1 component as            name,class,sharedsecret,password as the sequence.


Say like , we have used XMLMAP component prior to tDecryptColumn_1 component that has
sequence of columns(in Edit Schema) as name,class,password,,sharedsecret.

Then we will be getting the above error.
In order to avoid the error, we just need change the sequence of columns as below.

name,class,sharedsecret,password  in  EDIT SCHEMA of XMLMAP component.

COURTS : CASES : LAWYERS : JUDGES : ::::::::: VICTIMS : ACCUSED

  *We have got so many SMART people in our COUNTRY. *we have got so many IIT completed SMART students in our COUNTRY. * we have got so many ...