commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsde...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods GetMethod.java
Date Tue, 30 Jul 2002 03:01:48 GMT
jsdever     2002/07/29 20:01:47

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        ConnectMethod.java HttpConnection.java
                        HttpMethodBase.java RequestOutputStream.java
                        ResponseInputStream.java URIUtil.java
               httpclient/src/java/org/apache/commons/httpclient/methods
                        GetMethod.java
  Log:
  Another increment for http://issues.apache.org/bugzilla/show_bug.cgi?id=10804
  Patchfile: http://issues.apache.org/bugzilla/showattachment.cgi?attach_id=2522
  
  Make all wireLog output be at debug level.
  
  Revision  Changes    Path
  1.3       +4 -7      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java
  
  Index: ConnectMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectMethod.java	28 Jul 2002 18:08:57 -0000	1.2
  +++ ConnectMethod.java	30 Jul 2002 03:01:47 -0000	1.3
  @@ -133,9 +133,6 @@
       /** Log object for this class. */
       private static final Log log = LogFactory.getLog(ConnectMethod.class);
   
  -    /** Log for any wire messages. */
  -    private static final Log wireLog = LogFactory.getLog("httpclient.wirelog");
  -
       /** The wrapped method */
       private HttpMethod method;
   }
  
  
  
  1.14      +23 -22    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
  
  Index: HttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HttpConnection.java	28 Jul 2002 18:08:57 -0000	1.13
  +++ HttpConnection.java	30 Jul 2002 03:01:47 -0000	1.14
  @@ -358,7 +358,8 @@
        * if the socket is already secure.
        * @throws IOException if an error occured creating the secure socket
        */
  -    public void tunnelCreated() throws IllegalStateException, IOException {
  +    public void tunnelCreated()
  +    throws IllegalStateException, IOException {
           log.trace("enter HttpConnection.tunnelCreated()");
   
           if (!isSecure() || !isProxied()) {
  @@ -398,7 +399,8 @@
        * @throws IOException if an I/O problem occurs
        * @return a stream to write the request to
        */
  -    public OutputStream getRequestOutputStream() throws IOException, IllegalStateException
{
  +    public OutputStream getRequestOutputStream()
  +    throws IOException, IllegalStateException {
           log.trace("enter HttpConnection.getRequestOutputStream()");
           assertOpen();
           return new RequestOutputStream(_output);
  @@ -457,8 +459,8 @@
           log.trace("enter HttpConnection.write(byte[])");
   
           assertOpen();
  -        if(wireLog.isInfoEnabled() && (data.length > 0)) {
  -            wireLog.info(">> \"" + new String(data) + "\"");
  +        if(wireLog.isDebugEnabled() && (data.length > 0)) {
  +            wireLog.debug(">> \"" + new String(data) + "\"");
           }
           try {
               _output.write(data);
  @@ -500,19 +502,18 @@
           log.trace("enter HttpConnection.writeLine(byte[])");
   
           assertOpen();
  -        if(wireLog.isInfoEnabled() && (data.length > 0)) {
  -            wireLog.info(">> \"" + new String(data) + "\"");
  +        if(wireLog.isDebugEnabled() && (data.length > 0)) {
  +            wireLog.debug(">> \"" + new String(data) + "\"");
           }
           try{
               _output.write(data);
               writeLine();
  -        } catch(SocketException e){
  -            if(log.isDebugEnabled()) {
  -                log.debug("HttpConnection: Socket exception while writing data",e);
  -            }
  -            throw new HttpRecoverableException(e.toString());
  -        } catch(IOException e){
  -            throw e;
  +        } catch(SocketException se){
  +	    log.info("SocketException while writing data to output", se);
  +            throw new HttpRecoverableException(se.toString());
  +        } catch(IOException ioe){
  +	    log.info("IOException while writing data to output", ioe);
  +            throw ioe;
           }
       }
   
  @@ -528,7 +529,7 @@
       throws IOException, IllegalStateException, HttpRecoverableException {
           log.trace("enter HttpConnection.writeLine()");
   
  -        wireLog.info(">> \\r\\n");
  +        wireLog.debug(">> \\r\\n");
           try{
               _output.write(CRLF);
           } catch(SocketException se){
  @@ -579,8 +580,8 @@
        * @throws IllegalStateException if I am not connected
        * @throws IOException if an I/O problem occurs
        */
  -    public void printLine() throws IOException, IllegalStateException, 
  -    HttpRecoverableException {
  +    public void printLine()
  +    throws IOException, IllegalStateException, HttpRecoverableException {
           log.trace("enter HttpConnection.printLine()");
           writeLine();
       }
  @@ -615,8 +616,8 @@
               }
               buf.append((char)ch);
           }
  -        if(wireLog.isInfoEnabled() && buf.length() > 0) {
  -            wireLog.info("<< \"" + buf.toString() + "\" [\\r\\n]");
  +        if(wireLog.isDebugEnabled() && buf.length() > 0) {
  +            wireLog.debug("<< \"" + buf.toString() + "\" [\\r\\n]");
           }
           return (buf.toString());
       }
  
  
  
  1.40      +6 -6      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- HttpMethodBase.java	29 Jul 2002 23:40:01 -0000	1.39
  +++ HttpMethodBase.java	30 Jul 2002 03:01:47 -0000	1.40
  @@ -1337,8 +1337,8 @@
               if (out == null) {
                   throw new IOException("Unable to buffer data");
               }
  -            if (wireLog.isInfoEnabled()) {
  -                wireLog.info("<< \"" + new String(buffer,0,nb) + "\"");
  +            if (wireLog.isDebugEnabled()) {
  +                wireLog.debug("<< \"" + new String(buffer, 0, nb) + "\"");
               }
               out.write(buffer, 0, nb);
               foundLength += nb;
  
  
  
  1.12      +17 -17    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java
  
  Index: RequestOutputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- RequestOutputStream.java	28 Jul 2002 18:08:57 -0000	1.11
  +++ RequestOutputStream.java	30 Jul 2002 03:01:47 -0000	1.12
  @@ -243,20 +243,20 @@
        */
       public void write(int b) throws IOException {
   
  -        //TODO: If using chunking, the chunks are one byte long!
  +        //FIXME: If using chunking, the chunks are one byte long!
           if (useChunking) {
               stream.write(one, 0, one.length);
               stream.write(crlf, 0, crlf.length);
               stream.write(b);
               stream.write(endChunk, 0, endChunk.length);
  -            if(wireLog.isInfoEnabled()) {
  -                wireLog.info(">> byte 1 \\r\\n (chunk length \"header\")");
  -                wireLog.info(">> byte " + b + "\\r\\n (chunked byte)");
  +            if(wireLog.isDebugEnabled()) {
  +                wireLog.debug(">> byte 1 \\r\\n (chunk length \"header\")");
  +                wireLog.debug(">> byte " + b + "\\r\\n (chunked byte)");
               }
           } else {
               stream.write(b);
  -            if(wireLog.isInfoEnabled()) {
  -                wireLog.info(">> byte " + b);
  +            if(wireLog.isDebugEnabled()) {
  +                wireLog.debug(">> byte " + b);
               }
           }
       }
  @@ -273,14 +273,14 @@
               stream.write(chunkHeader, 0, chunkHeader.length);
               stream.write(b, off, len);
               stream.write(endChunk, 0, endChunk.length);
  -            if(wireLog.isInfoEnabled()) {
  -                wireLog.info(">> byte(s)" + len + " \\r\\n (chunk length \"header\")");
  -                wireLog.info(">> \"" + new String(b,off,len)+ "\"\\r\\n (chunked
bytes)");
  +            if(wireLog.isDebugEnabled()) {
  +                wireLog.debug(">> byte(s)" + len + " \\r\\n (chunk length \"header\")");
  +                wireLog.debug(">> \"" + new String(b,off,len)+ "\"\\r\\n (chunked
bytes)");
               }
           } else {
               stream.write(b, off, len);
  -            if(wireLog.isInfoEnabled() && len > 0) {
  -                wireLog.info(">> \"" + new String(b,off,len) + "\"");
  +            if(wireLog.isDebugEnabled() && len > 0) {
  +                wireLog.debug(">> \"" + new String(b,off,len) + "\"");
               }
           }
       }
  @@ -299,8 +299,8 @@
   		  stream.write(zero, 0, zero.length);
   		  stream.write(crlf, 0, crlf.length);
   		  stream.write(endChunk, 0, endChunk.length);
  -		  if(wireLog.isInfoEnabled()) {
  -		     wireLog.info(">> byte 0 \\r\\n\\r\\n (final chunk)");
  +		  if(wireLog.isDebugEnabled()) {
  +		     wireLog.debug(">> byte 0 \\r\\n\\r\\n (final chunk)");
   		  }
   	       }
   	       super.close();
  
  
  
  1.17      +8 -9      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java
  
  Index: ResponseInputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ResponseInputStream.java	28 Jul 2002 18:08:57 -0000	1.16
  +++ ResponseInputStream.java	30 Jul 2002 03:01:47 -0000	1.17
  @@ -371,11 +371,10 @@
   
                   while (nbRead < length) {
                       try {
  -                        currentRead =
  -                            stream.read(buffer, nbRead,
  +                        currentRead = stream.read(buffer, nbRead,
                                           length - nbRead);
                       } catch (Throwable t) {
  -                        t.printStackTrace();
  +                        log.debug("Exception thrown reading chunk from response", t);
                           throw new IOException();
                       }
                       if (currentRead < 0) {
  @@ -389,7 +388,7 @@
   
               }
   
  -        } else {
  +        } else { //not using chunking
   
               try {
                   if (buffer == null)
  @@ -397,7 +396,7 @@
                   length = stream.read(buffer);
                   count += length;
               } catch (Throwable t) {
  -                t.printStackTrace();
  +                log.debug("Exception thrown reading from response", t);
                   throw new IOException();
               }
   
  
  
  
  1.10      +10 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java
  
  Index: URIUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- URIUtil.java	28 Jul 2002 18:08:57 -0000	1.9
  +++ URIUtil.java	30 Jul 2002 03:01:47 -0000	1.10
  @@ -62,6 +62,9 @@
   
   package org.apache.commons.httpclient;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   import java.io.UnsupportedEncodingException;
   import java.util.BitSet;
   
  @@ -532,6 +535,7 @@
           try {
               return encode(str.getBytes(enc), safe, spaceAsPlus);
           } catch (UnsupportedEncodingException e) {
  +	    log.warn("Unsupported encoding " + enc + " requested, using default");
               e.printStackTrace();
               return encode(str.getBytes(), safe, spaceAsPlus);
           }
  @@ -793,5 +797,7 @@
           }
       }
   
  +    /** Log object for this class. */
  +    private static final Log log = LogFactory.getLog(URIUtil.class);
   }
   
  
  
  
  1.14      +3 -6      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java
  
  Index: GetMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- GetMethod.java	28 Jul 2002 18:08:59 -0000	1.13
  +++ GetMethod.java	30 Jul 2002 03:01:47 -0000	1.14
  @@ -94,9 +94,6 @@
       /** Log object for this class. */
       private static final Log log = LogFactory.getLog(GetMethod.class);
   
  -    /** Log for any wire messages. */
  -    private static final Log wireLog = LogFactory.getLog("httpclient.wire");
  -
       /** Temporary directory. */
       private static final String TEMP_DIR = "temp/";
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message