检查整数字段为NULL

时间:2015-02-11 13:45:59

标签: null integer

我试图验证条件是否整数值是NULL还是0.这是我的代码。但它显示编程错误,说"运算符==未定义参数类型int,null"。请帮助或建议我采取进一步措施。

while ((line = bReader.readLine()) != null) 
{
/**
 * Splitting the content of tabbed separated line
 **/
String datavalue[] = line.split("\t");
long timestamp = Long.parseLong(datavalue[0]);
timestamp=timestamp % DAY_MODULO_IN_MS;
int  value     = Integer.parseInt(datavalue[1]);            
if (Integer.parseInt(datavalue[1]) == null) {
    throw new TemplateNullValueException("ERROR! Resolution is contain NULL value for " + timestamp);
}
else
{
    this.bufferedFileContentMap.put(timestamp, value);                  
}

}

谢谢, Venkat

1 个答案:

答案 0 :(得分:0)

if(Integer.parseInt(datavalue [1])== null){

这是问题所在, 首先,您将其转换为整数并检查,因此请检查0

相关问题