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 ");
     

get it

 http://hinekv1.ddns.net:8008/get.php?username=Varga_Florentina1tv&password=j5MgWBs18t&type=m3u_plus&output=mpegts http://www.lo...