java - Parse Exception Error Message -


i using parse.com backend. attempting update user's call sign, parse keeps throwing exception. when trying read message is, exception error message "null pointer."

error message

java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.string com.parse.parseexception.getmessage()' on null object reference @ logic.businesslogic$8.done(businesslogic.java:303) @ logic.businesslogic$8.done(businesslogic.java:293) @ com.parse.parsetaskutils$1.done(parsetaskutils.java:66) @ com.parse.parsetaskutils$1.done(parsetaskutils.java:63) @ com.parse.parsetaskutils$2$1.run(parsetaskutils.java:107) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:145) @ android.app.activitythread.main(activitythread.java:5835) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372)

code

public static void updatecallsign(string newcallsign, final context cntx) {      parseuser user = parseuser.getcurrentuser();     user.put("callsign", newcallsign);     user.saveinbackground(new savecallback() {         public void done(parseexception e) {             if (e != null) {                  toast.maketext(cntx, "call sign updated",                         toast.length_long).show();   log.d("success", "success");                 // saved             } else {                 // parseexception                      log.d("exception: ", e.getmessage());              }         }     });  } 

looks got if statement backwards. based on comments in code, think wanted this:

public static void updatecallsign(string newcallsign, final context cntx) {      parseuser user = parseuser.getcurrentuser();     user.put("callsign", newcallsign);     user.saveinbackground(new savecallback() {         public void done(parseexception e) {             if (e == null) { <--------- changed                 // saved                 toast.maketext(cntx, "call sign updated",                         toast.length_long).show();                 log.d("success", "success");             } else {                 // parseexception                 log.d("exception: ", e.getmessage());             }         }     });  } 

so change if (e != null) if (e == null) , should good. error message telling when called e.getmessage(), e null. in original code, of course case, since else clause triggered when e == null.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -