hadoopstring-utils

StringUtils.isNotEmpty(str) seems not working properly on hadoop cluster data validation


I am not sure and facing strange nullpointer issue as below. could someone please help me on this in the below code

 if ((COUNTRY_CODE.equalsIgnoreCase(Country.TEST.name())) && (strCellId.matches("[0-9]*")))

is throwing nullpointer in the log file(as per line number). The only offending code i can see is strCellId.matches("[0-9]*") if strCellId is null

however, StringUtils.isNotEmpty(strCellId) is called already before we enter to if condition. please see the condition

public static boolean validateCellId(String strCellId)
{
  if (StringUtils.isNotEmpty(strCellId)) {
     //here the nullpointer is coming  
    if ((COUNTRY_CODE.equalsIgnoreCase(Country.TEST.name())) && (strCellId.matches("[0-9]*"))) {
      return true;
    }
  }

  return false;
}

Solution

  • Its My Bad . @zsxwing you are right. My country was not initialized, i should have check this, i just overlooked it with confidence.Thanks