2010-07-09 95 views
0

无法弄清楚为什么我在这里得到空指针:System.out.println(method.getStatusCode()); !? 方法初始化并成功执行! 任何想法? 示例代码在这里。我正在使用commons-httpclient-3.1.jar帮助。获取执行异常PostMethod.getStatusCode()!

  PostMethod = new PostMethod(url); 

     LogInHelper.logRequest(httpClient, method); 

     try { 
      httpClient.executeMethod(method); 
      method.getResponseBodyAsString(); 
     } catch (HttpException e) { 
      LOG.error("@getSessionId() error connecting to " + url, e); 

     } catch (IOException e) { 
      LOG.error("@getSessionId() error connecting to " + url, e); 

     } 

     LogInHelper.logResponse(method); 

     System.out.println(method.getStatusCode()); 

回答

1

在这种情况下清理和重新编译整个项目。

+0

嗨。这太糟糕了,没有人回答你的问题。我只是和你有同样的问题。问题是我总是每天早上清理并重新编译项目。问题依然存在。我仰望互联网,没有像这样的问题的人。 – 2014-11-10 08:25:17