求助!产生这个NullPointerException该如何解决?
摘取部分代码如下:
long contentLength = res.getContentLength();//出现异常时这个值为0 byte[] responseBody = res.getBody();
String text = "";
text = new String(responseBody, charset);//charset处理过,没问题,就执行到这里出现异常了。
Variable result;
result = new NodeVariable(text); return result;
摘取部分代码如下:
long contentLength = res.getContentLength();//出现异常时这个值为0 byte[] responseBody = res.getBody();
String text = "";
text = new String(responseBody, charset);//charset处理过,没问题,就执行到这里出现异常了。
Variable result;
result = new NodeVariable(text); return result;
我现在分少的可怜,才29分,谁帮我解决问题我结帐的时候加分!
if( lz==null && "".equals(lz) )
{
... ...
}或者try/catch起来在catch里处理
这个两个空指针大招居然还没普及喵~~~``