/[classpath]/classpath/java/net/HttpURLConnection.java
ViewVC logotype

Diff of /classpath/java/net/HttpURLConnection.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by mark, Fri Nov 22 02:42:26 2002 UTC revision 1.12 by mark, Sat Nov 23 00:52:10 2002 UTC
# Line 464  public abstract class HttpURLConnection Line 464  public abstract class HttpURLConnection
464        connect();        connect();
465                
466      gotResponseVals = true;      gotResponseVals = true;
     // Response is the first header received from the connection.  
     String respField = getHeaderField(0);  
       
     if (respField == null || ! respField.startsWith("HTTP/"))  
       {  
         // Set to default values on failure.  
         responseCode = -1;  
         responseMessage = null;  
         return;  
       }  
467    
468      int firstSpc, nextSpc;      // If responseCode not yet explicitly set by subclass
469      firstSpc = respField.indexOf(' ');      if (responseCode == -1)
     nextSpc = respField.indexOf(' ', firstSpc + 1);  
     responseMessage = respField.substring(nextSpc + 1);  
     String codeStr = respField.substring(firstSpc + 1, nextSpc);  
     try  
470        {        {
471          responseCode = Integer.parseInt(codeStr);          // Response is the first header received from the connection.
472        }          String respField = getHeaderField(0);
473      catch (NumberFormatException e)          
474        {          if (respField == null || ! respField.startsWith("HTTP/"))
475          // Set to default values on failure.            {
476          responseCode = -1;              // Set to default values on failure.
477          responseMessage = null;              responseCode = -1;
478                responseMessage = null;
479                return;
480              }
481    
482            int firstSpc, nextSpc;
483            firstSpc = respField.indexOf(' ');
484            nextSpc = respField.indexOf(' ', firstSpc + 1);
485            responseMessage = respField.substring(nextSpc + 1);
486            String codeStr = respField.substring(firstSpc + 1, nextSpc);
487            try
488              {
489                responseCode = Integer.parseInt(codeStr);
490              }
491            catch (NumberFormatException e)
492              {
493                // Set to default values on failure.
494                responseCode = -1;
495                responseMessage = null;
496              }
497        }        }
498    }    }
499    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26