EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
Expand all | Collapse all

java.lang.NullPointerException

  • 1.  java.lang.NullPointerException

    Posted Fri January 11, 2019 06:27 AM
        try               
                    get catinp with
                    #sql{
                    select
                    CTCODORG, CTCODUTE, CTCODBAS, CTCODSUP, CTCODINF, 
                    CTUTETIT, CTDESCRI, CTDATCRE, CTDATLAV, CTANNULL, 
                    CTALFA01, CTALFA02, CTALFA05, CTALFA10, CTALFA20, 
                    CTALFA100, CTNUM01, CTNUM02, CTNUM03, CTNRDOCUM, 
                    CTNRALLE, CTNRCOMM, CTNRAZREG, CTNRAZUTE, CTNRAZGRU, 
                    CTSTATO1, CTSTATO2
                    from X.CATENA
          where ctcodorg =: organizzazione
        and ctcodute =:utenteDiRicerca
        and ctcodute =:questoutente
          or ctcodorg =: organizzazione
        and ctcodute =:utenteDiRicerca
        and ctcodute <>:questoutente
        and ctalfa01 <>:asterisco
    order by
    CTCODORG, CTCODUTE, CTCODBAS, CTCODSUP, CTCODINF, 
    CTUTETIT asc
                    };
       onException(ex1 FileIOException)
          syslib.writeStdout("FileIOException ");
       onException(ex2 RuntimeException)
          syslib.writeStdout("RuntimeException ");
       onException(ex3 SQLException)
          syslib.writeStdout("SQLException "); 
       onException(ex6 NullValueException)
          syslib.writeStdout("NullValueException ");      
       onException(ex4 AnyException)
          syslib.writeStdout("AnyException ");
       end // try

     

    How can I identify the error?:

    EGL0100E Error: java.lang.NullPointerException.
    EGL0002I The error occurred in spaceDiLavoro3 when processing the reads function leggi..

    catta


  • 2.  Re: java.lang.NullPointerException

    Posted Fri January 11, 2019 08:32 AM

    Hi,

    I think some field return a null value and the field is not defined as nullable field in the record.

    You could remove the try...onException and see if you get an other exception where you can see the field name.

     

    To define a field as nullable in the record add an '?' like this:

        MAUNTDAT date?{column = "MAUNTDAT", IsSqlNullable = true};

     

    You could also try to excecute the SQL script in an external SQL viewer.

     

     

    Kind Regards!

    Marcel-D


  • 3.  Re: java.lang.NullPointerException

    Posted Tue January 15, 2019 04:24 AM

     

     

    paolo catta do.documenta@gmail.com

    10:17 (4 minuti fa)
     
    dW-notify
     
     
     
     
     
    Thanks for the reply. I can not identify the type of error. The code is as follows:
                try  
         
                get cat
                        with #sql{
             select
             CTCODORG, CTCODUTE, CTCODBAS, CTCODSUP, CTCODINF, 
             CTUTETIT, CTDESCRI, CTDATCRE, CTDATLAV, CTANNULL, 
             CTALFA01, CTALFA02, CTALFA05, CTALFA10, CTALFA20, 
             CTALFA100, CTNUM01, CTNUM02, CTNUM03, CTNRDOCUM, 
             CTNRALLE, CTNRCOMM, CTNRAZREG, CTNRAZUTE, CTNRAZGRU, 
             CTSTATO1, CTSTATO2
             from X.CATENA
          where ctcodorg =: organizzazione
    //     and ctcodute =:utenteDiRicerca
    //     and ctcodute <>:questoutente
    //     and CTALFA01 <>:asterisco
    //      or ctcodorg =: organizzazione
    //     and ctcodute =:utenteDiRicerca
    //     and ctcodute =:questoutente                 
             order by
             CTCODORG, CTCODUTE, CTCODBAS, CTCODSUP, CTCODINF, 
             CTUTETIT asc
             };
     
       onException(ex1 FileIOException)
          syslib.writeStdout(" FileIOException cat");
       onException(ex2 RuntimeException)
          syslib.writeStdout(" RuntimeException cat");
       onException(ex3 SQLException)
          syslib.writeStdout(" SQLException cat");
              writeStdOut ( "SQL Exception, SQL code = " 
            + sysVar.sqlData.sqlCode +", state:  " + sysVar.sqlData.sqlstate+
            ", sqlerrmc:  " +sysVar.sqlData.sqlerrmc+
            ", sqlwarn[1]:  "+sysVar.sqlData.sqlwarn[1] +
            ", sqlwarn[2]:  "+sysVar.sqlData.sqlwarn[2] + 
            ", sqlwarn[3]:  "+sysVar.sqlData.sqlwarn[3] +
            ", sqlwarn[4]:  "+sysVar.sqlData.sqlwarn[4] +
            ", sqlwarn[5]:  "+sysVar.sqlData.sqlwarn[5] + 
            ", sqlwarn[7]:  "+sysVar.sqlData.sqlwarn[7]+
            ", sqlwarn[8]:  "+sysVar.sqlData.sqlwarn[8] +
            ", sqlwarn[9:  "+sysVar.sqlData.sqlwarn[9] + 
            ", sqlwarn[10:  "+sysVar.sqlData.sqlwarn[10] +
            ", sqlwarn[11]:  "+sysVar.sqlData.sqlwarn[11]);  
       onException(ex6 NullValueException)
          syslib.writeStdout(" NullValueException cat");      
       onException(ex4 AnyException)
         syslib.writeStdout(" AnyException cat" );
    end
     
    The error message is as follows:
    SQLException cat
    SQL Exception, SQL code = -104, state:  42601, sqlerrmc:                                                                        , sqlwarn[1]:   , sqlwarn[2]:   , sqlwarn[3]:   , sqlwarn[4]:   , sqlwarn[5]:   , sqlwarn[7]:   , sqlwarn[8]:   , sqlwarn[9:   , sqlwarn[10:   , sqlwarn[11]:   
     
    How can I identify the type of error?
    catta


  • 4.  Re: java.lang.NullPointerException

    Posted Tue January 15, 2019 05:13 AM

    Hi,

    the SQL code: -104 means this:

    ILLEGAL SYMBOL "token". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: token-list

     

    I think the '//' in the where clause is wrong.

    To comment something in the SQL you have to use: '--'

     

    Kind Regards!

    Marcel-D


  • 5.  Re: java.lang.NullPointerException

    Posted Tue January 15, 2019 08:39 AM

    There are invalid simbol on your  where condiction

    Change for this:

     

                    select
                    CTCODORG, CTCODUTE, CTCODBAS, CTCODSUP, CTCODINF, 
                    CTUTETIT, CTDESCRI, CTDATCRE, CTDATLAV, CTANNULL, 
                    CTALFA01, CTALFA02, CTALFA05, CTALFA10, CTALFA20, 
                    CTALFA100, CTNUM01, CTNUM02, CTNUM03, CTNRDOCUM, 
                    CTNRALLE, CTNRCOMM, CTNRAZREG, CTNRAZUTE, CTNRAZGRU, 
                    CTSTATO1, CTSTATO2
                    from X.CATENA
          where ctcodorg = :organizzazione
        and ctcodute = :utenteDiRicerca
        and ctcodute = :questoutente
          or ctcodorg = :organizzazione
        and ctcodute = :utenteDiRicerca
        and ctcodute <> :questoutente
        and ctalfa01 <> :asterisco
    order by
    CTCODORG, CTCODUTE, CTCODBAS, CTCODSUP, CTCODINF, CTUTETIT asc

     

    Hsieh


  • 6.  Re: java.lang.NullPointerException

    Posted Thu January 17, 2019 02:40 AM

    Looking at this, you might wan't to add parenthesis to your Where-clause, if you mean the OR to divide 2 scenarioes in your code?

    Like this:
     

    where
       (ctcodorg =: organizzazione and
        ctcodute =:utenteDiRicerca and
        ctcodute =:questoutente)  
        or
       (ctcodorg =: organizzazione  and
        ctcodute =:utenteDiRicerca and
        ctcodute <>:questoutente and
        ctalfa01 <>:asterisco)

     

    PVIL