empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r1070505 - in /incubator/empire-db/trunk: empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/ empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/ empire-db/sr...
Date Mon, 14 Feb 2011 14:30:49 GMT
Author: francisdb
Date: Mon Feb 14 14:30:48 2011
New Revision: 1070505

URL: http://svn.apache.org/viewvc?rev=1070505&view=rev
Log:
fixing sonar issues

Modified:
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabaseDriver.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLConfiguration.java

Modified: incubator/empire-db/trunk/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java (original)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java Mon Feb 14 14:30:48 2011
@@ -22,6 +22,7 @@ import org.apache.empire.commons.Errors;
 import org.apache.empire.xml.XMLConfiguration;
 import org.apache.empire.xml.XMLUtil;
 import org.apache.log4j.xml.DOMConfigurator;
+import org.slf4j.Logger;
 import org.w3c.dom.Element;
 
 /**
@@ -33,6 +34,8 @@ import org.w3c.dom.Element;
  */
 public class SampleAdvConfig extends XMLConfiguration
 {
+	private static final Logger log = org.slf4j.LoggerFactory.getLogger(SampleAdvConfig.class);
+	
     // the logging configuration root node name
     private final String loggingNodeName = "log4j:configuration";
 

Modified: incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java (original)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java Mon Feb 14 14:30:48 2011
@@ -22,6 +22,7 @@ import org.apache.empire.commons.Errors;
 import org.apache.empire.xml.XMLConfiguration;
 import org.apache.empire.xml.XMLUtil;
 import org.apache.log4j.xml.DOMConfigurator;
+import org.slf4j.Logger;
 import org.w3c.dom.Element;
 /**
  * <PRE>
@@ -32,6 +33,8 @@ import org.w3c.dom.Element;
  */
 public class SampleConfig extends XMLConfiguration
 {
+	private static final Logger log = org.slf4j.LoggerFactory.getLogger(SampleConfig.class);
+	
     // the logging configuration root node name
     private final String loggingNodeName = "log4j:configuration";
 

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java Mon Feb 14 14:30:48 2011
@@ -164,7 +164,7 @@ public class StringUtils
      */
     public static boolean isEmpty(String s)
     {
-        return (s==null || s.trim().length() == 0);
+        return s == null || s.trim().length() == 0;
     }
     
     /**
@@ -173,10 +173,25 @@ public class StringUtils
      * @param s the string to validate
      * 
      * @return true if valid
+     * 
+     * @deprecated this has been renamed to isNotEmpty
      */
+    @Deprecated
     public static boolean isValid(String s)
     {
-        return (s != null && s.trim().length() > 0);
+        return s != null && s.trim().length() > 0;
+    }
+    
+    /**
+     * Checks if a string is not null or empty
+     * 
+     * @param s the string to validate
+     * 
+     * @return true if valid
+     */
+    public static boolean isNotEmpty(String s)
+    {
+        return s != null && s.trim().length() > 0;
     }
     
     /**

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java Mon Feb 14 14:30:48 2011
@@ -18,14 +18,6 @@
  */
 package org.apache.empire.db;
 
-import org.apache.empire.commons.Errors;
-import org.apache.empire.commons.ObjectUtils;
-import org.apache.empire.commons.Options;
-import org.apache.empire.data.DataType;
-import org.apache.empire.db.expr.column.DBValueExpr;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -34,6 +26,14 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.empire.commons.Errors;
+import org.apache.empire.commons.ObjectUtils;
+import org.apache.empire.commons.Options;
+import org.apache.empire.data.DataType;
+import org.apache.empire.db.expr.column.DBValueExpr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 /**
  * This abstract class is the applicaton's interface for a particular database schema.
@@ -60,6 +60,7 @@ public abstract class DBDatabase extends
         private DBSystemDate() 
         { 
             /* no instances */ 
+        	// FIXME what is wrong with a String constant?
         }
         @Override
         public String toString()
@@ -154,7 +155,7 @@ public abstract class DBDatabase extends
     {
         this.preparedStatementsEnabled = preparedStatementsEnabled;
         // log prepared statement 
-        log.info("PreparedStatementsEnabled is " + String.valueOf(preparedStatementsEnabled));
+        log.info("PreparedStatementsEnabled is " + preparedStatementsEnabled);
     }
 
     /**
@@ -398,7 +399,7 @@ public abstract class DBDatabase extends
      */
     public DBValueExpr getValueExpr(int value)
     {
-        return new DBValueExpr(this, new Integer(value), DataType.INTEGER);
+        return new DBValueExpr(this, Integer.valueOf(value), DataType.INTEGER);
     }
 
     /**
@@ -409,7 +410,7 @@ public abstract class DBDatabase extends
      */
     public DBValueExpr getValueExpr(long value)
     {
-        return new DBValueExpr(this, new Long(value), DataType.INTEGER);
+        return new DBValueExpr(this, Long.valueOf(value), DataType.INTEGER);
     }
 
     /**
@@ -622,7 +623,7 @@ public abstract class DBDatabase extends
      */
     public DBCommand createCommand()
     {
-        if (checkOpen()==false) 
+        if (!checkOpen()) 
             return null;
         return driver.createCommand(this);
     }
@@ -692,8 +693,8 @@ public abstract class DBDatabase extends
             clearError();
             Object result = rs.getObject(1);
             if (log.isDebugEnabled())
-	            log.debug("querySingleValue complete in " + String.valueOf(System.currentTimeMillis() - start) + " ms -> value="
-	                        + String.valueOf(result));
+	            log.debug("querySingleValue complete in " + (System.currentTimeMillis() - start) + " ms -> value="
+	                        + result);
             return result;
         } catch (SQLException e) 
         {
@@ -851,7 +852,7 @@ public abstract class DBDatabase extends
             }
             // No Value
             if (log.isInfoEnabled())
-                log.info("querySimpleList retured "+String.valueOf(count)+" items. Query completed in " + String.valueOf(System.currentTimeMillis() - start) + " ms");
+                log.info("querySimpleList retured " + count + " items. Query completed in " + (System.currentTimeMillis() - start) + " ms");
             clearError();
             return count;
         } catch (ClassCastException e) 
@@ -946,7 +947,7 @@ public abstract class DBDatabase extends
             }
             // No Value
             if (log.isInfoEnabled())
-                log.info("queryOptionList retured "+String.valueOf(result.size())+" items. Query completed in " + String.valueOf(System.currentTimeMillis() - start) + " ms");
+                log.info("queryOptionList retured " + result.size() + " items. Query completed in " + (System.currentTimeMillis() - start) + " ms");
             clearError();
             return result;
         } catch (SQLException e) 
@@ -1002,7 +1003,7 @@ public abstract class DBDatabase extends
             }
             // No Value
             if (log.isInfoEnabled())
-                log.info("queryObjectList retured "+String.valueOf(count)+" items. Query completed in " + String.valueOf(System.currentTimeMillis() - start) + " ms");
+                log.info("queryObjectList retured " + count + " items. Query completed in " + (System.currentTimeMillis() - start) + " ms");
             clearError();
             return count;
         } catch (SQLException e) 
@@ -1056,7 +1057,7 @@ public abstract class DBDatabase extends
             int affected = driver.executeSQL(sqlCmd, sqlParams, conn, setGenKeys);
             // Log
             if (log.isInfoEnabled())
-	            log.info("executeSQL affected " + String.valueOf(affected) + " Records / " + (System.currentTimeMillis() - start) + "ms");
+	            log.info("executeSQL affected " + affected + " Records / " + (System.currentTimeMillis() - start) + "ms");
             // number of affected records
             if (affected < 0)
             {
@@ -1120,7 +1121,7 @@ public abstract class DBDatabase extends
             }
             // Debug
             if (log.isDebugEnabled())
-                log.debug("executeQuery successful in " + String.valueOf(System.currentTimeMillis() - start) + " ms");
+                log.debug("executeQuery successful in " + (System.currentTimeMillis() - start) + " ms");
             // Return number of affected records
             success();
             return rs;

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabaseDriver.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabaseDriver.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabaseDriver.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabaseDriver.java Mon Feb 14 14:30:48 2011
@@ -18,16 +18,6 @@
  */
 package org.apache.empire.db;
 
-import org.apache.empire.commons.DateUtils;
-import org.apache.empire.commons.ErrorObject;
-import org.apache.empire.commons.Errors;
-import org.apache.empire.commons.ObjectUtils;
-import org.apache.empire.commons.StringUtils;
-import org.apache.empire.data.DataMode;
-import org.apache.empire.data.DataType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.Serializable;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -42,6 +32,16 @@ import java.util.HashSet;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.empire.commons.DateUtils;
+import org.apache.empire.commons.ErrorObject;
+import org.apache.empire.commons.Errors;
+import org.apache.empire.commons.ObjectUtils;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.data.DataMode;
+import org.apache.empire.data.DataType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * The DBDatabaseDriver class is an abstract base class for all database drivers.
  * Its purpose is to handle everything that is - or might be - database vendor specific. 
@@ -111,11 +111,11 @@ public abstract class DBDatabaseDriver e
     protected boolean ddlColumnDefaults = false;
 
     // Illegal name chars and reserved SQL keywords
-    protected static final char[]   illegalNameChars   = new char[] { '@', '?', '>', '=', '<', ';', ':', 
+    protected static final char[]   ILLEGAL_NAME_CHARS   = new char[] { '@', '?', '>', '=', '<', ';', ':', 
                                                                     '/', '.', '-', ',', '+', '*', ')', '(',
                                                                     '\'', '&', '%', '!', ' '
                                                                   };        
-    protected static final String[] generalSQLKeywords = new String[] { "user", "group", 
+    protected static final String[] GENERAL_SQL_KEYWORDS = new String[] { "user", "group", 
                                                            "table", "column", "view", "index", "constraint", 
                                                            "select", "udpate", "insert", "alter", "delete" };        
     protected final Set<String> reservedSQLKeywords;
@@ -233,8 +233,8 @@ public abstract class DBDatabaseDriver e
     public DBDatabaseDriver()
     {
         // Initialize List of reserved Keywords
-        reservedSQLKeywords = new HashSet<String>(generalSQLKeywords.length);
-        for (String keyWord:generalSQLKeywords){
+        reservedSQLKeywords = new HashSet<String>(GENERAL_SQL_KEYWORDS.length);
+        for (String keyWord:GENERAL_SQL_KEYWORDS){
              reservedSQLKeywords.add(keyWord);
         }
     }
@@ -268,8 +268,8 @@ public abstract class DBDatabaseDriver e
         int len = name.length();
         for (int i=0; i<len; i++)
         {   char c = name.charAt(i);
-            for (int j=0; j<illegalNameChars.length; j++)
-            {   char ic = illegalNameChars[j]; 
+            for (int j=0; j<ILLEGAL_NAME_CHARS.length; j++)
+            {   char ic = ILLEGAL_NAME_CHARS[j]; 
                 if (c>ic)
                     break;
                 if (c==ic)
@@ -372,7 +372,7 @@ public abstract class DBDatabaseDriver e
             return (type==DataType.DATE ? DateUtils.getDateOnly(ts) : ts);
         }
         // Other types
-        error(Errors.NotSupported, "getColumnAutoValue() for "+String.valueOf(type));
+        error(Errors.NotSupported, "getColumnAutoValue() for "+type);
         return null;
     }
 
@@ -395,7 +395,7 @@ public abstract class DBDatabaseDriver e
                 pstmt.setBinaryStream(i + 1, blobData.getInputStream(), blobData.getLength());
                 // log
                 if (log.isDebugEnabled())
-                    log.debug("Statement param " + String.valueOf(i+1) + " set to BLOB data");
+                    log.debug("Statement param " + (i+1) + " set to BLOB data");
             }
             else if(value instanceof DBClobData)
             {
@@ -404,14 +404,14 @@ public abstract class DBDatabaseDriver e
                 pstmt.setCharacterStream(i + 1, clobData.getReader(), clobData.getLength());
                 // log
                 if (log.isDebugEnabled())
-                    log.debug("Statement param " + String.valueOf(i+1) + " set to CLOB data");
+                    log.debug("Statement param " + (i+1) + " set to CLOB data");
             }
             else
             {   // simple parameter value 
                 pstmt.setObject(i + 1, value);
                 // log
                 if (log.isDebugEnabled())
-                    log.debug("Statement param " + String.valueOf(i+1) + " set to '" + String.valueOf(value)+ "'");
+                    log.debug("Statement param " + (i+1) + " set to '" + value + "'");
             }
         }
 	}
@@ -446,13 +446,12 @@ public abstract class DBDatabaseDriver e
     public Object getResultValue(ResultSet rset, int columnIndex, DataType dataType)
         throws SQLException
     {
-        // Check for character large object
         if (dataType == DataType.DATETIME)
         { // Get Timestamp (do not use getObject()!) 
             return rset.getTimestamp(columnIndex);
         } 
         else if (dataType == DataType.CLOB)
-        { // Get character large object
+        {
             java.sql.Clob clob = rset.getClob(columnIndex);
             return ((clob != null) ? clob.getSubString(1, (int) clob.length()) : null);
         } 
@@ -461,8 +460,10 @@ public abstract class DBDatabaseDriver e
             java.sql.Blob blob = rset.getBlob(columnIndex);
             return ((blob != null) ? blob.getBytes(1, (int) blob.length()) : null);
         } 
-        // Default
-        return rset.getObject(columnIndex);
+        else
+        {
+        	return rset.getObject(columnIndex);
+        }
     }
     
     /**
@@ -506,7 +507,9 @@ public abstract class DBDatabaseDriver e
                 ResultSet rs = stmt.getGeneratedKeys();
                 try {
                     while(rs.next())
+                    {
                         genKeys.set(rs.getObject(1));
+                    }
                 } finally {
                     rs.close();
                 }
@@ -638,10 +641,7 @@ public abstract class DBDatabaseDriver e
                 } 
                 else
                 { // Boolean from String
-                    String strVal = value.toString();
-                    boolVal = strVal.equals("1") |
-                              strVal.equalsIgnoreCase("true") |
-                              strVal.equalsIgnoreCase("y");
+                    boolVal = stringToBoolean(value);
                 }
                 return getSQLPhrase((boolVal) ? SQL_BOOLEAN_TRUE : SQL_BOOLEAN_FALSE);
             }
@@ -681,7 +681,7 @@ public abstract class DBDatabaseDriver e
     }
     
     /**
-     * gets an SQL command for creating, modifying or deleting objects in the database (tables, columns, constraints, etc.)
+     * Gets a SQL command for creating, modifying or deleting objects in the database (tables, columns, constraints, etc.)
      * 
      * @param type the command type 
      * @param dbo the databse object
@@ -695,7 +695,7 @@ public abstract class DBDatabaseDriver e
     }
     
     /**
-     * @return true if column default values are created with dll statements or false if not
+     * @return <code>true</code> if column default values are created with dll statements or <code>false</code> if not
      */
     public boolean isDDLColumnDefaults()
     {
@@ -704,11 +704,13 @@ public abstract class DBDatabaseDriver e
 
     /**
      * Set true if column default values should be included in DDL Statements  
-     * @param enable true if dll statements should include column default values or false if not
+     * 
+     * @param ddlColumnDefaults <code>true</code> if dll statements should include 
+     *   column default values or <code>false</code> if not
      */
-    public void setDDLColumnDefaults(boolean enable)
+    public void setDDLColumnDefaults(boolean ddlColumnDefaults)
     {
-        ddlColumnDefaults = enable;
+        this.ddlColumnDefaults = ddlColumnDefaults;
     }
 
     /**
@@ -746,5 +748,12 @@ public abstract class DBDatabaseDriver e
             buf.append(value);
         }
     }
+    
+	private boolean stringToBoolean(final Object value) {
+		String strVal = value.toString();
+		return "1".equals(strVal) ||
+		          "true".equalsIgnoreCase(strVal) ||
+		          "y".equalsIgnoreCase(strVal);
+	}
 
 }
\ No newline at end of file

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java Mon Feb 14 14:30:48 2011
@@ -18,7 +18,11 @@
  */
 package org.apache.empire.db;
 
-// Java
+import java.sql.Connection;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 import org.apache.empire.commons.Attributes;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataMode;
@@ -26,16 +30,10 @@ import org.apache.empire.data.DataType;
 import org.apache.empire.xml.XMLUtil;
 import org.w3c.dom.Element;
 
-import java.sql.Connection;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
 
 /**
  * This class represent one column of a table.
  * It contains all properties of this columns (e.g. the column width).
- * <P>
  * 
  *
  */
@@ -74,11 +72,12 @@ public class DBTableColumn extends DBCol
         this.dataMode = dataMode;
         this.defValue = defValue;
         // xml
-        attributes = new Attributes();
-        options = null;
-        // Add Column to Table
+        this.attributes = new Attributes();
+        this.options = null;
         if (table != null)
+        {
             table.addColumn(this);
+        }
     }
 
     /**
@@ -92,11 +91,12 @@ public class DBTableColumn extends DBCol
         this.size = other.size;
         this.dataMode = other.dataMode;
         this.defValue = other.defValue;
-        attributes = other.attributes;
-        options = other.options;
-        // Add Column to Table
+        this.attributes = other.attributes;
+        this.options = other.options;
         if (newTable != null)
+        {
             newTable.addColumn(this);
+        }
     }
     
     /**
@@ -208,12 +208,15 @@ public class DBTableColumn extends DBCol
     public void setRequired(boolean required)
     {
         if (isAutoGenerated())
-        {   // cannot change auto-generated columns
-            error(Errors.NoAccess);
-            return; 
+        {   
+        	// cannot change auto-generated columns
+            error(Errors.NoAccess); 
+        }
+        else
+        {
+        	// Set DataMode
+        	dataMode=(required ? DataMode.NotNull : DataMode.Nullable);
         }
-        // Set DataMode
-        dataMode=(required ? DataMode.NotNull : DataMode.Nullable);
     }
 
     /**
@@ -278,7 +281,7 @@ public class DBTableColumn extends DBCol
                         // OK
                     } catch (ParseException e)
                     {   // Error
-                        log.error("checkValue exception: " + e.toString() + " column=" + getName() + " value=" + String.valueOf(value));
+                        log.error("checkValue exception: " + e.toString() + " column=" + getName() + " value=" + value);
                         return error(DBErrors.FieldInvalidDateFormat, getName());
                     }
                 }    
@@ -295,7 +298,7 @@ public class DBTableColumn extends DBCol
                         // thows NumberFormatException if not a number!
                     } catch (NumberFormatException nfe)
                     {
-                        log.error("checkValue exception: " + nfe.toString() + " column=" + getName() + " value=" + String.valueOf(value));
+                        log.error("checkValue exception: " + nfe.toString() + " column=" + getName() + " value=" + value);
                         return error(DBErrors.FieldNotNumeric, getName());
                     }
                 }

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java Mon Feb 14 14:30:48 2011
@@ -233,7 +233,7 @@ public class DBDatabaseDriverDerby exten
             case SQL_FUNC_DECODE_ELSE:        return "else {0}";
             // Not defined
             default:
-                log.error("SQL phrase " + String.valueOf(phrase) + " is not defined!");
+                log.error("SQL phrase " + phrase + " is not defined!");
                 return "?";
         }
     }
@@ -259,7 +259,7 @@ public class DBDatabaseDriverDerby exten
                 return "CAST(? AS BLOB)";
            // Unknown Type                                       
            default:
-                log.error("getConvertPhrase: unknown type (" + String.valueOf(destType));
+                log.error("getConvertPhrase: unknown type " + destType);
                 return "?";
         }
     }
@@ -281,14 +281,12 @@ public class DBDatabaseDriverDerby exten
         }
     }
 
-    /**
-     * @see DBDatabaseDriver#getDDLScript(DBCmdType, DBObject, DBSQLScript)  
-     */
+    /** {@inheritDoc} */
     @Override
     public boolean getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
     {
         // The Object's database must be attached to this driver
-        if (dbo==null || dbo.getDatabase().getDriver()!=this)
+        if (dbo == null || dbo.getDatabase().getDriver() != this)
             return error(Errors.InvalidArg, dbo, "dbo");
         // Check Type of object
         if (dbo instanceof DBDatabase)
@@ -300,7 +298,7 @@ public class DBDatabaseDriverDerby exten
                 case DROP:
                     return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -312,7 +310,7 @@ public class DBDatabaseDriverDerby exten
                 case DROP:
                     return dropObject(((DBTable) dbo).getName(), "TABLE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -324,7 +322,7 @@ public class DBDatabaseDriverDerby exten
                 case DROP:
                     return dropObject(((DBView) dbo).getName(), "VIEW", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -336,7 +334,7 @@ public class DBDatabaseDriverDerby exten
                 case DROP:
                     return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -425,7 +423,7 @@ public class DBDatabaseDriverDerby exten
         {
             DBTableColumn c = (DBTableColumn) columns.next();
             sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
-            if (appendColumnDesc(c, sql, false)==false)
+            if (appendColumnDesc(c, sql, false) == false)
                 continue; // Ignore and continue;
             addSeparator = true;
         }
@@ -581,14 +579,14 @@ public class DBDatabaseDriverDerby exten
                 sql.append("CLOB");
                 if (c.getSize() > 0)
                 {
-                    sql.append("(" + String.valueOf((long) c.getSize()) + ") ");
+                    sql.append("(" + (long) c.getSize() + ") ");
                 }
                 break;
             case BLOB:
                 sql.append("BLOB");
                 if (c.getSize() > 0)
                 {
-                    sql.append("(" + String.valueOf((long) c.getSize()) + ") ");
+                    sql.append("(" + (long) c.getSize() + ") ");
                 }
                 break;
             case UNIQUEID:

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java Mon Feb 14 14:30:48 2011
@@ -18,6 +18,10 @@
  */
 package org.apache.empire.db.h2;
 
+import java.sql.Connection;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
@@ -37,10 +41,6 @@ import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
 
-import java.sql.Connection;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-
 
 /**
  * This class provides support for the H2 database system.
@@ -236,7 +236,7 @@ public class DBDatabaseDriverH2 extends 
             case SQL_FUNC_DECODE_ELSE:        return "else {0}";
             // Not defined
             default:
-                log.error("SQL phrase " + String.valueOf(phrase) + " is not defined!");
+                log.error("SQL phrase " + phrase + " is not defined!");
                 return "?";
         }
     }
@@ -262,7 +262,7 @@ public class DBDatabaseDriverH2 extends 
                 return "CAST(? AS BLOB)";
            // Unknown Type                                       
            default:
-                log.error("getConvertPhrase: unknown type (" + String.valueOf(destType));
+                log.error("getConvertPhrase: unknown type " + destType);
                 return "?";
         }
     }
@@ -303,7 +303,7 @@ public class DBDatabaseDriverH2 extends 
                 case DROP:
                     return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -315,7 +315,7 @@ public class DBDatabaseDriverH2 extends 
                 case DROP:
                     return dropObject(((DBTable) dbo).getName(), "TABLE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -327,7 +327,7 @@ public class DBDatabaseDriverH2 extends 
                 case DROP:
                     return dropObject(((DBView) dbo).getName(), "VIEW", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -339,7 +339,7 @@ public class DBDatabaseDriverH2 extends 
                 case DROP:
                     return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -574,7 +574,7 @@ public class DBDatabaseDriverH2 extends 
             case BLOB:
                 sql.append("BLOB");
                 if (c.getSize() > 0)
-                    sql.append(" (" + String.valueOf((long) c.getSize()) + ") ");
+                    sql.append(" (" + (long) c.getSize() + ") ");
                 break;
             case UNIQUEID:
                 // emulate using java.util.UUID

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java Mon Feb 14 14:30:48 2011
@@ -18,6 +18,10 @@
  */
 package org.apache.empire.db.hsql;
 
+import java.sql.Connection;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+
 import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdType;
@@ -36,10 +40,6 @@ import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
 
-import java.sql.Connection;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-
 
 /**
  * This class provides support for the HSQLDB database system.<br>
@@ -174,7 +174,7 @@ public class DBDatabaseDriverHSql extend
             case SQL_FUNC_DECODE_ELSE:  return "else {0}";
             // Not defined
             default:
-                log.error("SQL phrase " + String.valueOf(phrase) + " is not defined!");
+                log.error("SQL phrase " + phrase + " is not defined!");
                 return "?";
         }
     }
@@ -199,7 +199,7 @@ public class DBDatabaseDriverHSql extend
                 { // Convert using a format string
                     if (srcType == DataType.INTEGER || srcType == DataType.AUTOINC)
                     {
-                        log.error("getConvertPhrase: unknown type (" + String.valueOf(destType));
+                        log.error("getConvertPhrase: unknown type " + destType);
                         return "?";
                     }
                     else
@@ -268,7 +268,7 @@ public class DBDatabaseDriverHSql extend
                 case DROP:
                     return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -280,7 +280,7 @@ public class DBDatabaseDriverHSql extend
                 case DROP:
                     return dropObject(((DBTable) dbo).getName(), "TABLE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -292,7 +292,7 @@ public class DBDatabaseDriverHSql extend
                 case DROP:
                     return dropObject(((DBView) dbo).getName(), "VIEW", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -304,7 +304,7 @@ public class DBDatabaseDriverHSql extend
                 case DROP:
                     return alterRelation((DBRelation) dbo, type, script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -634,7 +634,7 @@ public class DBDatabaseDriverHSql extend
                 return script.addStmt(sql.toString());
             }
             default:
-                return error(Errors.NotImplemented, "Type not supported ("+String.valueOf(type)+")");
+                return error(Errors.NotImplemented, "Type not supported (" + type + ")");
         }
 
     }

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java Mon Feb 14 14:30:48 2011
@@ -18,6 +18,11 @@
  */
 package org.apache.empire.db.mysql;
 
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
@@ -37,11 +42,6 @@ import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
 
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-
 
 /**
  * This class provides support for the MySQL database system.
@@ -352,7 +352,7 @@ public class DBDatabaseDriverMySQL exten
                 return "CAST(? AS BLOB)";
            // Unknown Type                                       
            default:
-                log.error("getConvertPhrase: unknown type (" + String.valueOf(destType));
+                log.error("getConvertPhrase: unknown type " + destType);
                 return "?";
         }
     }
@@ -393,7 +393,7 @@ public class DBDatabaseDriverMySQL exten
                 case DROP:
                     return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -405,7 +405,7 @@ public class DBDatabaseDriverMySQL exten
                 case DROP:
                     return dropObject(((DBTable) dbo).getName(), "TABLE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -417,7 +417,7 @@ public class DBDatabaseDriverMySQL exten
                 case DROP:
                     return dropObject(((DBView) dbo).getName(), "VIEW", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -429,7 +429,7 @@ public class DBDatabaseDriverMySQL exten
                 case DROP:
                     return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -678,7 +678,7 @@ public class DBDatabaseDriverMySQL exten
             case BLOB:
                 sql.append("BLOB");
                 if (c.getSize() > 0)
-                    sql.append(" (" + String.valueOf((long) c.getSize()) + ") ");
+                    sql.append(" (" + (long) c.getSize() + ") ");
                 break;
             case UNIQUEID:
                 // emulate using java.util.UUID

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/oracle/DBDatabaseDriverOracle.java Mon Feb 14 14:30:48 2011
@@ -71,7 +71,7 @@ public class DBDatabaseDriverOracle exte
     public DBDatabaseDriverOracle()
     {
         // Info
-        log.info("DBDatabaseDriverOracle created. Boolean Type is " + String.valueOf(booleanType));
+        log.info("DBDatabaseDriverOracle created. Boolean Type is " + booleanType);
     }
 
     public boolean isOracle8Compatibilty()
@@ -92,7 +92,7 @@ public class DBDatabaseDriverOracle exte
     public void setBooleanType(BooleanType booleanType)
     {
         this.booleanType = booleanType;
-        log.info("DBDatabaseDriverOracle Boolean Type set to " + String.valueOf(booleanType));
+        log.info("DBDatabaseDriverOracle Boolean Type set to " + booleanType);
     }
 
     /**
@@ -194,7 +194,7 @@ public class DBDatabaseDriverOracle exte
             case SQL_FUNC_DECODE_ELSE:          return "{0}";
             // Not defined
             default:
-                log.error("SQL phrase " + String.valueOf(phrase) + " is not defined!");
+                log.error("SQL phrase " + phrase + " is not defined!");
                 return "?";
         }
     }
@@ -240,7 +240,7 @@ public class DBDatabaseDriverOracle exte
                 return "to_date(?)";
             // Unknown Type
             default:
-                log.error("getConvertPhrase: unknown type (" + String.valueOf(destType));
+                log.error("getConvertPhrase: unknown type " + destType);
                 return "?";
         }
     }
@@ -330,7 +330,7 @@ public class DBDatabaseDriverOracle exte
                 case DROP:
                     return dropObject(((DBDatabase) dbo).getSchema(), "USER", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLScript."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -342,7 +342,7 @@ public class DBDatabaseDriverOracle exte
                 case DROP:
                     return dropObject(((DBTable) dbo).getName(), "TABLE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -354,7 +354,7 @@ public class DBDatabaseDriverOracle exte
                 case DROP:
                     return dropObject(((DBView) dbo).getName(), "VIEW", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -366,7 +366,7 @@ public class DBDatabaseDriverOracle exte
                 case DROP:
                     return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -645,7 +645,7 @@ public class DBDatabaseDriverOracle exte
             case BLOB:
                 sql.append("BLOB");
                 if (c.getSize() > 0)
-                    sql.append(" (" + String.valueOf((long) c.getSize()) + ") ");
+                    sql.append(" (" + (long) c.getSize() + ") ");
                 break;
             case UNIQUEID:
                 // emulate using java.util.UUID

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/postgresql/DBDatabaseDriverPostgreSQL.java Mon Feb 14 14:30:48 2011
@@ -424,7 +424,7 @@ public class DBDatabaseDriverPostgreSQL 
                 case DROP:
                     return dropObject(((DBTable) dbo).getName(), "TABLE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -436,7 +436,7 @@ public class DBDatabaseDriverPostgreSQL 
                 case DROP:
                     return dropObject(((DBView) dbo).getName(), "VIEW", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -448,7 +448,7 @@ public class DBDatabaseDriverPostgreSQL 
                 case DROP:
                     return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -593,7 +593,7 @@ public class DBDatabaseDriverPostgreSQL 
         sql.append(")");
         // Comment?
         String comment = t.getComment();
-        if (StringUtils.isValid(comment))
+        if (StringUtils.isNotEmpty(comment))
         {   // Add the table comment
             sql.append(" COMMENT = '");
             sql.append(comment);

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java Mon Feb 14 14:30:48 2011
@@ -18,6 +18,11 @@
  */
 package org.apache.empire.db.sqlserver;
 
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.StringUtils;
@@ -38,11 +43,6 @@ import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
 
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-
 
 /**
  * This class provides support for the Microsoft SQL-Server database system.
@@ -173,11 +173,7 @@ public class DBDatabaseDriverMSSQL exten
 		this.sequenceTableName = sequenceTableName;
 	}
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.empire.db.DBDatabaseDriver#openDatabase(org.apache.empire.db.DBDatabase, java.sql.Connection)
-     */
+    /** {@inheritDoc} */
     @Override
     public boolean attachDatabase(DBDatabase db, Connection conn)
     {
@@ -336,7 +332,7 @@ public class DBDatabaseDriverMSSQL exten
                 return "convert(varbinary, ?)";
            // Unknown Type                                       
            default:
-               	log.error("getConvertPhrase: unknown type (" + String.valueOf(destType));
+               	log.error("getConvertPhrase: unknown type " + destType);
                 return "?";
         }
     }
@@ -396,7 +392,7 @@ public class DBDatabaseDriverMSSQL exten
                 case DROP:
                     return dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -408,7 +404,7 @@ public class DBDatabaseDriverMSSQL exten
                 case DROP:
                     return dropObject(((DBTable) dbo).getName(), "TABLE", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -420,7 +416,7 @@ public class DBDatabaseDriverMSSQL exten
                 case DROP:
                     return dropObject(((DBView) dbo).getName(), "VIEW", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -432,7 +428,7 @@ public class DBDatabaseDriverMSSQL exten
                 case DROP:
                     return dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                 default:
-                    return error(Errors.NotImplemented, "getDDLCommand."+dbo.getClass().getName()+"."+String.valueOf(type));
+                    return error(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -660,7 +656,7 @@ public class DBDatabaseDriverMSSQL exten
             case BLOB:
                 sql.append("[image]");
                 if (c.getSize() > 0)
-                    sql.append(" (" + String.valueOf((long) c.getSize()) + ") ");
+                    sql.append(" (" + (long) c.getSize() + ") ");
                 break;
             case UNIQUEID:
                 sql.append("[uniqueidentifier]");

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLConfiguration.java?rev=1070505&r1=1070504&r2=1070505&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLConfiguration.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLConfiguration.java Mon Feb 14 14:30:48 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.empire.xml;
 
+import java.io.Closeable;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
@@ -29,12 +30,12 @@ import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.commons.beanutils.BeanUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.empire.commons.ErrorObject;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -52,8 +53,7 @@ import org.xml.sax.SAXException;
  */
 public class XMLConfiguration extends ErrorObject
 {
-    // Logger (not final!)
-    protected static Logger log = LoggerFactory.getLogger(XMLConfiguration.class);
+    private static final Logger log = LoggerFactory.getLogger(XMLConfiguration.class);
 
     private Element configRootNode = null;
 
@@ -113,32 +113,24 @@ public class XMLConfiguration extends Er
             return success();
         } catch (FileNotFoundException e)
         {
-            log.error("Configuration file not found! filename=" + fileName);
+            log.error("Configuration file {} not found!", fileName, e);
             return error(Errors.FileNotFound, fileName);
         } catch (IOException e)
         {
-            log.error("Error reading configuration file " + fileName);
+            log.error("Error reading configuration file {}", fileName, e);
             return error(Errors.FileReadError, fileName);
         } catch (SAXException e)
         {
-            log.error("Invalid XML in configuraion file " + fileName, e);
+            log.error("Invalid XML in configuration file {}", fileName, e);
             return error(e);
         } catch (ParserConfigurationException e)
         {
-            log.error("ParserConfigurationException ", e);
+            log.error("ParserConfigurationException: {}", e.getMessage(), e);
             return error(e);
         } finally
-        { // Close reader
-            try
-            {
-                if (reader != null)
-                    reader.close();
-                if (inputStream != null)
-                    inputStream.close();
-            } catch (Exception e)
-            {
-                // Nothing to do.
-            }
+        { 
+        	close(reader);
+        	close(inputStream);
         }
     }
 
@@ -150,17 +142,17 @@ public class XMLConfiguration extends Er
         // Check arguments
         if (bean == null)
             return error(Errors.InvalidArg, null, "bean");
-        if (StringUtils.isValid(propertiesNodeName) == false)
+        if (StringUtils.isEmpty(propertiesNodeName))
             return error(Errors.InvalidArg, null, "propertiesNodeName");
         // Get configuration node
         Element propertiesNode = XMLUtil.findFirstChild(configRootNode, propertiesNodeName);
         if (propertiesNode == null)
         { // Configuration
-            log.error("Property-Node " + propertiesNodeName + " has not been found.");
+            log.error("Property-Node {} has not been found.", propertiesNodeName);
             return error(Errors.ItemNotFound, propertiesNodeName);
         }
         // configure Connection
-        log.info("reading bean properties from node: " + propertiesNodeName);
+        log.info("reading bean properties from node: {}", propertiesNodeName);
         NodeList nodeList = propertiesNode.getChildNodes();
         for (int i = 0; i < nodeList.getLength(); i++)
         {
@@ -180,29 +172,43 @@ public class XMLConfiguration extends Er
         String name = item.getNodeName();
         try
         {
-            String value = XMLUtil.getElementText(item);
-            BeanUtils.setProperty(bean, name, value);
+            String newValue = XMLUtil.getElementText(item);
+            BeanUtils.setProperty(bean, name, newValue);
 
-            Object check = BeanUtils.getProperty(bean, name);
-            if (ObjectUtils.compareEqual(value, check)==false)
+            Object value = BeanUtils.getProperty(bean, name);
+            if (ObjectUtils.compareEqual(newValue, value))
             {
-                log.error("Failed to set property '" + name + "'. Value is " + String.valueOf(check));
-                return;
+            	log.info("Configuration property '{}' set to \"{}\"", name, newValue);
+            }
+            else
+            {
+            	log.error("Failed to set property '{}'. Value is \"{}\"", name, value);
             }
-
-            // success
-            log.info("Configuration property '" + name + "' set to \"" + value + "\"");
 
         } catch (IllegalAccessException e)
         {
-            log.error("Access to Property " + name + " denied.");
+            log.error("Access to Property {} denied.", name);
         } catch (InvocationTargetException e)
         {
-            log.error("Unable to set Property " + name);
+            log.error("Unable to set Property {}", name);
         } catch (NoSuchMethodException e)
         {
-            log.error("Property '"  + name + "' not found in " + bean.getClass().getName());
+            log.error("Property '{}' not found in {}", name, bean.getClass().getName());
         }
     }
+    
+	private void close(final Closeable closeable) {
+		if (closeable != null)
+		{
+			try
+			{
+				closeable.close();
+			}
+			catch(IOException e)
+			{
+				log.debug(e.getMessage());
+			}
+		}
+	}
 
 }



Mime
View raw message