Index: java/org/apache/commons/httpclient/ConnectMethod.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java,v retrieving revision 1.2 diff -u -u -r1.2 ConnectMethod.java --- java/org/apache/commons/httpclient/ConnectMethod.java 28 Jul 2002 18:08:57 -0000 1.2 +++ java/org/apache/commons/httpclient/ConnectMethod.java 30 Jul 2002 02:51:42 -0000 @@ -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; } Index: java/org/apache/commons/httpclient/HttpConnection.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v retrieving revision 1.13 diff -u -u -r1.13 HttpConnection.java --- java/org/apache/commons/httpclient/HttpConnection.java 28 Jul 2002 18:08:57 -0000 1.13 +++ java/org/apache/commons/httpclient/HttpConnection.java 30 Jul 2002 02:51:44 -0000 @@ -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()); } Index: java/org/apache/commons/httpclient/HttpMethodBase.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.39 diff -u -u -r1.39 HttpMethodBase.java --- java/org/apache/commons/httpclient/HttpMethodBase.java 29 Jul 2002 23:40:01 -0000 1.39 +++ java/org/apache/commons/httpclient/HttpMethodBase.java 30 Jul 2002 02:51:49 -0000 @@ -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; Index: java/org/apache/commons/httpclient/RequestOutputStream.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v retrieving revision 1.11 diff -u -u -r1.11 RequestOutputStream.java --- java/org/apache/commons/httpclient/RequestOutputStream.java 28 Jul 2002 18:08:57 -0000 1.11 +++ java/org/apache/commons/httpclient/RequestOutputStream.java 30 Jul 2002 02:51:50 -0000 @@ -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(); Index: java/org/apache/commons/httpclient/ResponseInputStream.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v retrieving revision 1.16 diff -u -u -r1.16 ResponseInputStream.java --- java/org/apache/commons/httpclient/ResponseInputStream.java 28 Jul 2002 18:08:57 -0000 1.16 +++ java/org/apache/commons/httpclient/ResponseInputStream.java 30 Jul 2002 02:51:50 -0000 @@ -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(); } Index: java/org/apache/commons/httpclient/URIUtil.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java,v retrieving revision 1.9 diff -u -u -r1.9 URIUtil.java --- java/org/apache/commons/httpclient/URIUtil.java 28 Jul 2002 18:08:57 -0000 1.9 +++ java/org/apache/commons/httpclient/URIUtil.java 30 Jul 2002 02:51:53 -0000 @@ -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); } Index: java/org/apache/commons/httpclient/methods/GetMethod.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v retrieving revision 1.13 diff -u -u -r1.13 GetMethod.java --- java/org/apache/commons/httpclient/methods/GetMethod.java 28 Jul 2002 18:08:59 -0000 1.13 +++ java/org/apache/commons/httpclient/methods/GetMethod.java 30 Jul 2002 02:51:53 -0000 @@ -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/";