StringUtils.isNotEmpty(str)在hadoop集群数据验证中似乎无法正常工作

StringUtils.isNotEmpty(str)在hadoop集群数据验证中似乎无法正常工作,hadoop,string-utils,Hadoop,String Utils,我不确定,并面临以下奇怪的问题。有人能在下面的代码里帮我吗 if ((COUNTRY_CODE.equalsIgnoreCase(Country.TEST.name())) && (strCellId.matches("[0-9]*"))) 正在日志文件中抛出空指针(根据行号)。我能看到的唯一有问题的代码是strCellId.matches(“[0-9]*”)如果strCellId为空 然而,StringUtils.isNotEmpty(strCellId)在我们进入if条件

我不确定,并面临以下奇怪的问题。有人能在下面的代码里帮我吗

 if ((COUNTRY_CODE.equalsIgnoreCase(Country.TEST.name())) && (strCellId.matches("[0-9]*")))
正在日志文件中抛出空指针(根据行号)。我能看到的唯一有问题的代码是
strCellId.matches(“[0-9]*”)
如果
strCellId
为空

然而,
StringUtils.isNotEmpty(strCellId)
在我们进入if条件之前已经被调用了。请看情况

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;
}
这是我的错。
@你说得对。我的国家/地区没有初始化,我应该检查一下,我只是信心十足地忽略了它。谢谢

哪一行出现空指针异常?什么呼叫?我已经更新了代码中的注释。而且我相信,即使我们使用null调用这个validateCellId方法,stringutil也应该小心,不允许进入内部if条件。如果我遗漏了什么,请告诉我。你能提供堆栈跟踪吗?您可能会忘记在
国家/地区\u代码
国家/地区上写首字母。测试
。这是我的错。我的国家没有初始化。谢谢