Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java null check语句上的null指针异常_Java_Nullpointerexception - Fatal编程技术网

Java null check语句上的null指针异常

Java null check语句上的null指针异常,java,nullpointerexception,Java,Nullpointerexception,下面的null check语句如何引发null指针异常?请求可能是空的吗?我很困惑,谁来帮忙 if(!getTGTid(request).equalsIgnoreCase(null) || !getTGTid(request).equalsIgnoreCase("")) { 方法 private String getTGTid(HttpServletRequest request) { return request.getParameter("tgtId"); } 如果getTGTid(

下面的null check语句如何引发null指针异常?请求可能是空的吗?我很困惑,谁来帮忙

if(!getTGTid(request).equalsIgnoreCase(null) || 
!getTGTid(request).equalsIgnoreCase("")) {
方法

private String getTGTid(HttpServletRequest request) {
return request.getParameter("tgtId"); 
}
如果
getTGTid(request)
为null,
getTGTid(request).equalsIgnoreCase(null)
将抛出
NullPointerException

使用


谢谢,埃兰,我会试试的。上下文不一样。
if (getTGTid(request) != null && !getTGTid(request).equalsIgnoreCase(""))