Fix cookie-handling to more precisely mirror the flow through the commons-httpclient implementation.

git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/branches/CONNECTORS-120@1415468 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java b/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java
index 016ec7e..8b3306b 100644
--- a/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java
+++ b/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java
@@ -1515,6 +1515,7 @@
         try
         {
           statusCode = methodThread.getResponseCode();
+          lastFetchCookies = methodThread.getCookies();
           switch (statusCode)
           {
           case HttpStatus.SC_REQUEST_TIMEOUT:
@@ -1638,28 +1639,7 @@
     public LoginCookies getLastFetchCookies()
       throws ManifoldCFException, ServiceInterruption
     {
-      if (fetchMethod == null)
-        throw new ManifoldCFException("Attempt to get cookies when there is no method");
-      if (methodThread == null || threadStarted == false)
-        throw new ManifoldCFException("Attempt to get cookies when no method thread");
-      try
-      {
-        return methodThread.getCookies();
-      }
-      catch (InterruptedException e)
-      {
-        methodThread.interrupt();
-        throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
-      }
-      catch (HttpException e)
-      {
-        handleHTTPException(e,"reading cookies");
-      }
-      catch (IOException e)
-      {
-        handleIOException(e,"reading cookies");
-      }
-      return null;
+      return lastFetchCookies;
     }
 
     /** Get response headers