返回值为空时产生NullPointerException
求助!产生这个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;