views:

10

answers:

0

Couldn't figure out why I'm getting Null pointer here : System.out.println(method.getStatusCode()); !? method initialized and successfully executed! Any ideas? Sample code here. I'm using 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());

related questions