2009/09/22

java NullPointerException Error

One of my cronjob running error last night, the error message is the following, java.lang.NullPointerException    at UpdtCreatePrdIndex.translateStr(UpdtCreatePrdIndex.java:648)  Trace into the code, the error is in,  private static String translateStr(String trans_str) {        trans_str = trans_str.replaceAll(""","\"");        trans_str = trans_str.replaceAll("®","");        trans_str = trans_str.replaceAll("™","");        return trans_str }  Finally, find out the reason that we updated database table yesterday, and some field has value NULL. When those fields called this method, they failed.  NULL.replaceAll("a", "b") will cause  java.lang.NullPointerException 

No comments:

Post a Comment