playframework 2.3 - java.lang.NullPointerException: null when add value to model play framework -


i new play framework, try add new value model in controller , got java.lang.nullpointerexception: null

this model

public class dokumenkeluarfilemodel extends model {  public dokumenkeluarmodel keluar; public dokumenmasukmodel masuk;  @formats.datetime(pattern="dd/mm/yyyy") public date tanggal;  public static finder<long, dokumenkeluarfilemodel> find = new finder(long.class, dokumenkeluarfilemodel.class);   public static string save(dokumenkeluarfilemodel dok){     try {         dok.save();         return "success";     }catch (exception e){         return "failed save data, error message : "+e.getmessage();     }   } } 

this controller

public static string savedoc(form<dokumenkeluarmodel> formkel){      string status = "";          for(dokumenmasukmodel doc: candidateunique){             dokumenkeluarfilemodel kelfile = new dokumenkeluarfilemodel();              kelfile.keluar.id = formkel.get().id;             kelfile.masuk.id = doc.id;             kelfile.tanggal = formkel.get().tanggal;             status = dokumenkeluarfilemodel.save(kelfile);             if(!status.equals("success")){                 flash("ermsg",status);                 break;             }         }      return status; } 

i got error java.lang.nullpointerexception: null , in debugger found

kelfile.masuk.id = java.lang.nullpointerexception

kelfile.keluar.id = java.lang.nullpointerexception

i think error relate problem. did wrong when declare model?


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -