You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2002/02/15 07:17:15 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient RequestOutputStream.java

dion        02/02/14 22:17:15

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        RequestOutputStream.java
  Log:
  Applied Sean C. Sullivan's patches for the constructors
  and throwing NullPointerException when a null stream is passed.
  Changed code from the form:
  "0".getBytes();
  to:
  new byte[] {(byte)'0'};
  
  Revision  Changes    Path
  1.7       +15 -9     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RequestOutputStream.java	5 Jan 2002 11:16:00 -0000	1.6
  +++ RequestOutputStream.java	15 Feb 2002 06:17:14 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v 1.6 2002/01/05 11:16:00 vmassol Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/01/05 11:16:00 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v 1.7 2002/02/15 06:17:14 dion Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/02/15 06:17:14 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -74,7 +74,9 @@
    * {@link OutputStream} wrapper supporting the chunked transfer encoding.
    * </p>
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.6 $ $Date: 2002/01/05 11:16:00 $
  + * @author <a href="mailto:sean@seansullivan.com">Sean C. Sullivan</a>
  + * @author <a href="mailto:dion@apache.org">dIon Gillard</a>
  + * @version $Revision: 1.7 $ $Date: 2002/02/15 06:17:14 $
    */
   public class RequestOutputStream
       extends OutputStream {
  @@ -83,11 +85,12 @@
   
       /**
        * Construct an output stream wrapping the given stream.
  +     * The stream will not use chunking.
        *
        * @param stream Wrapped input stream
        */
       public RequestOutputStream(OutputStream stream) {
  -        this.stream = stream;
  +        this(stream, false);
       }
   
       /**
  @@ -96,6 +99,9 @@
        * @param stream Wrapped input stream
        */
       public RequestOutputStream(OutputStream stream, boolean useChunking) {
  +        if (stream == null) {
  +            throw new NullPointerException("stream parameter is null");
  +        }
           this.stream = stream;
           this.useChunking = useChunking;
       }
  @@ -133,25 +139,25 @@
       /**
        * End chunk.
        */
  -    private byte endChunk[] = "\r\n".getBytes();
  +    private static final byte endChunk[] = new byte[] {(byte)13, (byte)10};
   
   
       /**
        * CRLF.
        */
  -    private byte crlf[] = "\r\n".getBytes();
  +    private static final byte crlf[] = new byte[] {(byte)13, (byte)10};
   
   
       /**
        * 0.
        */
  -    private byte zero[] = "0".getBytes();
  +    private static final byte zero[] = new byte[] {(byte)'0'};
   
   
       /**
        * 1.
        */
  -    private byte one[] = "1".getBytes();
  +    private static final byte one[] = new byte[] {(byte)'1'};
   
   
       // ------------------------------------------------------------- Properties
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>