Null Pointer Exception

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Merdith
    New Member
    • Nov 2007
    • 1

    #1

    Null Pointer Exception

    String x="";
    Vector From = (Vector)session .getAttribute(" DATESFROM");
    int isize = From.size();
    Vector To = (Vector)session .getAttribute(" DATESTO");
    int isize2 = To.size();
    System.out.prin tln(".........2 ");


    I am getting null pointer exception in int isize = From.size();
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by Merdith
    String x="";
    Vector From = (Vector)session .getAttribute(" DATESFROM");
    int isize = From.size();
    Vector To = (Vector)session .getAttribute(" DATESTO");
    int isize2 = To.size();
    System.out.prin tln(".........2 ");


    I am getting null pointer exception in int isize = From.size();
    That's because there's no attribute in your session called "DATESFROM" at that point. Either the name is not matching or the code for setting the object failed to set a non null value or failed to execute at all.

    Comment

    Working...