You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2002/02/12 21:08:03 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/dv/util Base64.java HexBin.java

neilg       02/02/12 12:08:03

  Modified:    java/src/org/apache/xerces/impl/dv/util Base64.java
                        HexBin.java
  Log:
  fix to enable validation of base64 material in schema instance documents on the OS/390.  Thanks to Stephen Dulin.
  
  Revision  Changes    Path
  1.3       +10 -3     xml-xerces/java/src/org/apache/xerces/impl/dv/util/Base64.java
  
  Index: Base64.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/util/Base64.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Base64.java	29 Jan 2002 01:15:12 -0000	1.2
  +++ Base64.java	12 Feb 2002 20:08:03 -0000	1.3
  @@ -57,6 +57,7 @@
   
   package org.apache.xerces.impl.dv.util;
   
  +import java.io.UnsupportedEncodingException;
   /**
    * This class provides encode/decode for RFC 2045 Base64 as
    * defined by RFC 2045, N. Freed and N. Borenstein.
  @@ -71,7 +72,7 @@
    *
    * @author Jeffrey Rodriguez
    * @author Sandy Gao
  - * @version $Id: Base64.java,v 1.2 2002/01/29 01:15:12 lehors Exp $
  + * @version $Id: Base64.java,v 1.3 2002/02/12 20:08:03 neilg Exp $
    */
   public final class  Base64 {
   
  @@ -333,8 +334,14 @@
           if (base64Data == null)
               return null;
   
  -        byte[] decoded = decode(base64Data.getBytes());
  -
  +	byte[] decoded = null;	
  +	try {
  +	  decoded = decode(base64Data.getBytes("utf-8"));
  +	}
  +	catch(UnsupportedEncodingException e) {	
  +	}
  +	finally {
           return decoded == null ? null : new String(decoded);
  +	}
       }
   }
  
  
  
  1.4       +10 -3     xml-xerces/java/src/org/apache/xerces/impl/dv/util/HexBin.java
  
  Index: HexBin.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/util/HexBin.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HexBin.java	29 Jan 2002 01:15:12 -0000	1.3
  +++ HexBin.java	12 Feb 2002 20:08:03 -0000	1.4
  @@ -57,12 +57,13 @@
   
   package org.apache.xerces.impl.dv.util;
   
  +import java.io.UnsupportedEncodingException;
   /**
    * format validation
    *
    * This class encodes/decodes hexadecimal data
    * @author Jeffrey Rodriguez
  - * @version $Id: HexBin.java,v 1.3 2002/01/29 01:15:12 lehors Exp $
  + * @version $Id: HexBin.java,v 1.4 2002/02/12 20:08:03 neilg Exp $
    */
   public final class  HexBin {
       static private final int  BASELENGTH   = 255;
  @@ -148,8 +149,14 @@
           if (binaryData == null)
               return null;
   
  -        byte[] decoded = decode(binaryData.getBytes());
  -
  +	byte[] decoded = null;
  + 	try {
  +          decoded = decode(binaryData.getBytes("utf-8"));
  +	}
  +	catch(UnsupportedEncodingException e) {
  + 	}
  +	finally {
           return decoded == null ? null : new String(decoded);
  +	}
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org