无法弄清楚为什么我在这里得到空指针: System.out.println(method.getStatusCode()); !?方法初始化并成功执行!有任何想法吗?示例代码在这里。我正在使用 commons-httpclient-3.1.jar
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());