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

StackOverflow https://stackoverflow.com/questions/21757392

  •  11-10-2022
  •  | 
  •  

문제

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;
}
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top