jochen      2005/05/22 13:52:28

  Modified:    src/java/org/apache/xmlrpc/util Tag: b20050512_streaming
                        HttpUtil.java
               src/java/org/apache/xmlrpc/serializer Tag:
                        b20050512_streaming ByteArraySerializer.java
               src/java/org/apache/xmlrpc/parser Tag: b20050512_streaming
                        ByteArrayParser.java
               src/test/org/apache/xmlrpc/test Tag: b20050512_streaming
                        SerializerTest.java
               src/java/org/apache/xmlrpc/webserver Tag:
                        b20050512_streaming Connection.java
  Added:       src/java/org/apache/xmlrpc/serializer Tag:
                        b20050512_streaming SerializableSerializer.java
  Removed:     src/java/org/apache/xmlrpc/util Tag: b20050512_streaming
                        Base64.java
  Log:
  Moved base64 encoder/decoder to ws-commons.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.3   +1 -0      ws-xmlrpc/src/java/org/apache/xmlrpc/util/HttpUtil.java
  
  Index: HttpUtil.java
  ===================================================================
  RCS file: /home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/util/HttpUtil.java,v
  retrieving revision 1.4.2.2
  retrieving revision 1.4.2.3
  diff -u -r1.4.2.2 -r1.4.2.3
  --- HttpUtil.java     21 May 2005 02:37:07 -0000      1.4.2.2
  +++ HttpUtil.java     22 May 2005 20:52:27 -0000      1.4.2.3
  @@ -20,6 +20,7 @@
   import java.io.UnsupportedEncodingException;
   import java.util.StringTokenizer;
   
  +import org.apache.ws.commons.util.Base64;
   import org.apache.xmlrpc.common.XmlRpcStreamConfig;
   
   
  
  
  
  No                   revision
  No                   revision
  1.1.2.2   +4 -20     
ws-xmlrpc/src/java/org/apache/xmlrpc/serializer/Attic/ByteArraySerializer.java
  
  Index: ByteArraySerializer.java
  ===================================================================
  RCS file: 
/home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/serializer/Attic/ByteArraySerializer.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ByteArraySerializer.java  12 May 2005 01:58:52 -0000      1.1.2.1
  +++ ByteArraySerializer.java  22 May 2005 20:52:27 -0000      1.1.2.2
  @@ -17,7 +17,8 @@
   
   import java.io.IOException;
   
  -import org.apache.xmlrpc.util.Base64.Encoder;
  +import org.apache.ws.commons.util.Base64;
  +import org.apache.ws.commons.util.Base64.Encoder;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  @@ -30,32 +31,15 @@
        /** Tag name of a base64 value.
         */
        public static final String BASE_64_TAG = "base64";
  -     static class SAXIOException extends IOException {
  -             private static final long serialVersionUID = 
3258131345216451895L;
  -             final SAXException saxException;
  -             SAXIOException(SAXException e) {
  -                     super();
  -                     saxException = e;
  -             }
  -             SAXException getSAXException() { return saxException; }
  -     }
        public void write(final ContentHandler pHandler, Object pObject) throws 
SAXException {
                pHandler.startElement("", VALUE_TAG, VALUE_TAG, 
ZERO_ATTRIBUTES);
                pHandler.startElement("", BASE_64_TAG, BASE_64_TAG, 
ZERO_ATTRIBUTES);
                byte[] buffer = (byte[]) pObject;
  -             Encoder encoder = new Encoder(buffer.length >= 1024 ? 1024 : 
((buffer.length+3)/4)*4) {
  -                     protected void writeBuffer() throws IOException {
  -                             try {
  -                                     pHandler.characters(charBuffer, 0, 
charOffset);
  -                             } catch (SAXException e) {
  -                                     throw new SAXIOException(e);
  -                             }
  -                     }
  -             };
  +             Encoder encoder = new Base64.SAXEncoder(buffer.length >= 1024 ? 
1024 : ((buffer.length+3)/4)*4, pHandler);
                try {
                        encoder.write(buffer, 0, buffer.length);
                        encoder.flush();
  -             } catch (ByteArraySerializer.SAXIOException e) {
  +             } catch (Base64.SAXIOException e) {
                        throw e.getSAXException();
                } catch (IOException e) {
                        throw new SAXException(e);
  
  
  
  No                   revision
  
  Index: ByteArraySerializer.java
  ===================================================================
  RCS file: 
/home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/serializer/Attic/ByteArraySerializer.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ByteArraySerializer.java  12 May 2005 01:58:52 -0000      1.1.2.1
  +++ ByteArraySerializer.java  22 May 2005 20:52:27 -0000      1.1.2.2
  @@ -17,7 +17,8 @@
   
   import java.io.IOException;
   
  -import org.apache.xmlrpc.util.Base64.Encoder;
  +import org.apache.ws.commons.util.Base64;
  +import org.apache.ws.commons.util.Base64.Encoder;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  @@ -30,32 +31,15 @@
        /** Tag name of a base64 value.
         */
        public static final String BASE_64_TAG = "base64";
  -     static class SAXIOException extends IOException {
  -             private static final long serialVersionUID = 
3258131345216451895L;
  -             final SAXException saxException;
  -             SAXIOException(SAXException e) {
  -                     super();
  -                     saxException = e;
  -             }
  -             SAXException getSAXException() { return saxException; }
  -     }
        public void write(final ContentHandler pHandler, Object pObject) throws 
SAXException {
                pHandler.startElement("", VALUE_TAG, VALUE_TAG, 
ZERO_ATTRIBUTES);
                pHandler.startElement("", BASE_64_TAG, BASE_64_TAG, 
ZERO_ATTRIBUTES);
                byte[] buffer = (byte[]) pObject;
  -             Encoder encoder = new Encoder(buffer.length >= 1024 ? 1024 : 
((buffer.length+3)/4)*4) {
  -                     protected void writeBuffer() throws IOException {
  -                             try {
  -                                     pHandler.characters(charBuffer, 0, 
charOffset);
  -                             } catch (SAXException e) {
  -                                     throw new SAXIOException(e);
  -                             }
  -                     }
  -             };
  +             Encoder encoder = new Base64.SAXEncoder(buffer.length >= 1024 ? 
1024 : ((buffer.length+3)/4)*4, pHandler);
                try {
                        encoder.write(buffer, 0, buffer.length);
                        encoder.flush();
  -             } catch (ByteArraySerializer.SAXIOException e) {
  +             } catch (Base64.SAXIOException e) {
                        throw e.getSAXException();
                } catch (IOException e) {
                        throw new SAXException(e);
  
  
  
  No                   revision
  
  Index: ByteArraySerializer.java
  ===================================================================
  RCS file: 
/home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/serializer/Attic/ByteArraySerializer.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ByteArraySerializer.java  12 May 2005 01:58:52 -0000      1.1.2.1
  +++ ByteArraySerializer.java  22 May 2005 20:52:27 -0000      1.1.2.2
  @@ -17,7 +17,8 @@
   
   import java.io.IOException;
   
  -import org.apache.xmlrpc.util.Base64.Encoder;
  +import org.apache.ws.commons.util.Base64;
  +import org.apache.ws.commons.util.Base64.Encoder;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  @@ -30,32 +31,15 @@
        /** Tag name of a base64 value.
         */
        public static final String BASE_64_TAG = "base64";
  -     static class SAXIOException extends IOException {
  -             private static final long serialVersionUID = 
3258131345216451895L;
  -             final SAXException saxException;
  -             SAXIOException(SAXException e) {
  -                     super();
  -                     saxException = e;
  -             }
  -             SAXException getSAXException() { return saxException; }
  -     }
        public void write(final ContentHandler pHandler, Object pObject) throws 
SAXException {
                pHandler.startElement("", VALUE_TAG, VALUE_TAG, 
ZERO_ATTRIBUTES);
                pHandler.startElement("", BASE_64_TAG, BASE_64_TAG, 
ZERO_ATTRIBUTES);
                byte[] buffer = (byte[]) pObject;
  -             Encoder encoder = new Encoder(buffer.length >= 1024 ? 1024 : 
((buffer.length+3)/4)*4) {
  -                     protected void writeBuffer() throws IOException {
  -                             try {
  -                                     pHandler.characters(charBuffer, 0, 
charOffset);
  -                             } catch (SAXException e) {
  -                                     throw new SAXIOException(e);
  -                             }
  -                     }
  -             };
  +             Encoder encoder = new Base64.SAXEncoder(buffer.length >= 1024 ? 
1024 : ((buffer.length+3)/4)*4, pHandler);
                try {
                        encoder.write(buffer, 0, buffer.length);
                        encoder.flush();
  -             } catch (ByteArraySerializer.SAXIOException e) {
  +             } catch (Base64.SAXIOException e) {
                        throw e.getSAXException();
                } catch (IOException e) {
                        throw new SAXException(e);
  
  
  
  1.1.2.1   +55 -0     
ws-xmlrpc/src/java/org/apache/xmlrpc/serializer/Attic/SerializableSerializer.java
  
  
  
  
  No                   revision
  No                   revision
  1.1.2.2   +3 -3      
ws-xmlrpc/src/java/org/apache/xmlrpc/parser/Attic/ByteArrayParser.java
  
  Index: ByteArrayParser.java
  ===================================================================
  RCS file: 
/home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/parser/Attic/ByteArrayParser.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ByteArrayParser.java      13 May 2005 00:18:21 -0000      1.1.2.1
  +++ ByteArrayParser.java      22 May 2005 20:52:27 -0000      1.1.2.2
  @@ -20,7 +20,7 @@
   
   import javax.xml.namespace.QName;
   
  -import org.apache.xmlrpc.util.Base64;
  +import org.apache.ws.commons.util.Base64;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXParseException;
  @@ -71,8 +71,8 @@
                if (level++ == 0) {
                        baos = new ByteArrayOutputStream();
                        decoder = new Base64.Decoder(1024){
  -                             protected void writeBuffer() throws IOException 
{
  -                                     baos.write(byteBuffer, 0, 
byteBufferOffset);
  +                             protected void writeBuffer(byte[] pBytes, int 
pOffset, int pLen) throws IOException {
  +                                     baos.write(pBytes, pOffset, pLen);
                                }
                        };
                } else {
  
  
  
  No                   revision
  No                   revision
  1.1.2.4   +0 -16     
ws-xmlrpc/src/test/org/apache/xmlrpc/test/Attic/SerializerTest.java
  
  Index: SerializerTest.java
  ===================================================================
  RCS file: 
/home/cvs/ws-xmlrpc/src/test/org/apache/xmlrpc/test/Attic/SerializerTest.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- SerializerTest.java       14 May 2005 21:17:48 -0000      1.1.2.3
  +++ SerializerTest.java       22 May 2005 20:52:27 -0000      1.1.2.4
  @@ -30,7 +30,6 @@
   import org.apache.xmlrpc.client.XmlRpcSunHttpTransportFactory;
   import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
   import org.apache.xmlrpc.serializer.XmlRpcWriter;
  -import org.apache.xmlrpc.util.Base64;
   import org.xml.sax.SAXException;
   
   import junit.framework.TestCase;
  @@ -72,21 +71,6 @@
                return sw.toString();
        }
   
  -     /** Test for the base64 decoder/encoder.
  -      * @throws Exception The test failed.
  -      */
  -     public void testBase64() throws Exception {
  -             for (int i = 0;  i <= 256;  i++) {
  -                     byte[] bytes = new byte[i];
  -                     for (int j = 0;  j < i;  j++) {
  -                             bytes[j] = (byte) j;
  -                     }
  -                     char[] chars = Base64.encode(bytes);
  -                     byte[] result = Base64.decode(chars);
  -                     assertTrue(Arrays.equals(bytes, result));
  -             }
  -     }
  -
        /** Test serialization of a byte parameter.
         * @throws Exception The test failed.
         */
  
  
  
  No                   revision
  No                   revision
  1.1.2.4   +1 -1      
ws-xmlrpc/src/java/org/apache/xmlrpc/webserver/Attic/Connection.java
  
  Index: Connection.java
  ===================================================================
  RCS file: 
/home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/webserver/Attic/Connection.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- Connection.java   21 May 2005 02:37:08 -0000      1.1.2.3
  +++ Connection.java   22 May 2005 20:52:27 -0000      1.1.2.4
  @@ -25,13 +25,13 @@
   import java.net.Socket;
   import java.util.StringTokenizer;
   
  +import org.apache.ws.commons.util.Base64;
   import org.apache.xmlrpc.common.XmlRpcHttpRequestConfig;
   import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl;
   import org.apache.xmlrpc.common.XmlRpcNotAuthorizedException;
   import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
   import org.apache.xmlrpc.server.XmlRpcHttpServerConfig;
   import org.apache.xmlrpc.server.XmlRpcStreamServer;
  -import org.apache.xmlrpc.util.Base64;
   import org.apache.xmlrpc.util.LimitedInputStream;
   import org.apache.xmlrpc.util.ThreadPool;
   
  
  
  

Reply via email to