db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r462553 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils/io: ConverterConfiguration.java converters/ByteArrayBase64Converter.java
Date Tue, 10 Oct 2006 20:43:53 GMT
Author: tomdz
Date: Tue Oct 10 13:43:52 2006
New Revision: 462553

URL: http://svn.apache.org/viewvc?view=rev&rev=462553
Log:
Fix for DDLUTILS-100

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/io/ConverterConfiguration.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/io/converters/ByteArrayBase64Converter.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/io/ConverterConfiguration.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/ConverterConfiguration.java?view=diff&rev=462553&r1=462552&r2=462553
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/io/ConverterConfiguration.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/io/ConverterConfiguration.java Tue Oct
10 13:43:52 2006
@@ -19,6 +19,8 @@
 import java.sql.Types;
 import java.util.HashMap;
 
+import org.apache.commons.codec.binary.Base64;
+import org.apache.ddlutils.io.converters.ByteArrayBase64Converter;
 import org.apache.ddlutils.io.converters.DateConverter;
 import org.apache.ddlutils.io.converters.NumberConverter;
 import org.apache.ddlutils.io.converters.SqlTypeConverter;
@@ -46,22 +48,26 @@
      */
     public ConverterConfiguration()
     {
+        NumberConverter          numberConverter = new NumberConverter();
+        ByteArrayBase64Converter binaryConverter = new ByteArrayBase64Converter();
 
-        NumberConverter numberConverter = new NumberConverter();
-
-        registerConverter(Types.DATE,      new DateConverter());
-        registerConverter(Types.TIME,      new TimeConverter());
-        registerConverter(Types.TIMESTAMP, new TimestampConverter());
-        registerConverter(Types.BIGINT,    numberConverter);
-        registerConverter(Types.BIT,       numberConverter);
-        registerConverter(Types.DECIMAL,   numberConverter);
-        registerConverter(Types.DOUBLE,    numberConverter);
-        registerConverter(Types.FLOAT,     numberConverter);
-        registerConverter(Types.INTEGER,   numberConverter);
-        registerConverter(Types.NUMERIC,   numberConverter);
-        registerConverter(Types.REAL,      numberConverter);
-        registerConverter(Types.SMALLINT,  numberConverter);
-        registerConverter(Types.TINYINT,   numberConverter);
+        registerConverter(Types.DATE,          new DateConverter());
+        registerConverter(Types.TIME,          new TimeConverter());
+        registerConverter(Types.TIMESTAMP,     new TimestampConverter());
+        registerConverter(Types.BIGINT,        numberConverter);
+        registerConverter(Types.BIT,           numberConverter);
+        registerConverter(Types.DECIMAL,       numberConverter);
+        registerConverter(Types.DOUBLE,        numberConverter);
+        registerConverter(Types.FLOAT,         numberConverter);
+        registerConverter(Types.INTEGER,       numberConverter);
+        registerConverter(Types.NUMERIC,       numberConverter);
+        registerConverter(Types.REAL,          numberConverter);
+        registerConverter(Types.SMALLINT,      numberConverter);
+        registerConverter(Types.TINYINT,       numberConverter);
+        registerConverter(Types.BINARY,        binaryConverter);
+        registerConverter(Types.VARBINARY,     binaryConverter);
+        registerConverter(Types.LONGVARBINARY, binaryConverter);
+        registerConverter(Types.BLOB,          binaryConverter);
     }
 
     /**

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/io/converters/ByteArrayBase64Converter.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/converters/ByteArrayBase64Converter.java?view=diff&rev=462553&r1=462552&r2=462553
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/io/converters/ByteArrayBase64Converter.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/io/converters/ByteArrayBase64Converter.java
Tue Oct 10 13:43:52 2006
@@ -33,7 +33,7 @@
     {
         try
         {
-            return textRep == null ? null : Base64.encodeBase64(textRep.getBytes());
+            return textRep == null ? null : Base64.decodeBase64(textRep.getBytes());
         }
         catch (Exception ex)
         {
@@ -48,7 +48,7 @@
     {
         try
         {
-            return obj == null ? null : new String(Base64.decodeBase64((byte[])obj));
+            return obj == null ? null : new String(Base64.encodeBase64((byte[])obj));
         }
         catch (Exception ex)
         {



Mime
View raw message