openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r462617 - in /incubator/openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/or...
Date Tue, 10 Oct 2006 22:39:17 GMT
Author: awhite
Date: Tue Oct 10 15:39:15 2006
New Revision: 462617

URL: http://svn.apache.org/viewvc?view=rev&rev=462617
Log:
Take advantage StringUtils where appropriate.


Modified:
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/PropertiesReverseCustomizer.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ClassNameDiscriminatorStrategy.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/NameSet.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Schema.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaSerializer.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAVersion.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ResultPacker.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogOutputStream.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/CFMetaDataParser.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
    incubator/openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/ReverseMappingToolTask.java Tue Oct 10 15:39:15 2006
@@ -19,7 +19,7 @@
 import java.io.FileInputStream;
 import java.util.Properties;
 
-import org.apache.tools.ant.types.EnumeratedAttribute;
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
 import org.apache.openjpa.jdbc.meta.PropertiesReverseCustomizer;
@@ -30,6 +30,7 @@
 import org.apache.openjpa.lib.conf.Configurations;
 import org.apache.openjpa.lib.util.CodeFormat;
 import org.apache.openjpa.lib.util.Files;
+import org.apache.tools.ant.types.EnumeratedAttribute;
 
 /**
  * Executes the {@link ReverseMappingTool} on the specified XML files.
@@ -222,9 +223,9 @@
     protected void executeOn(String[] files)
         throws Exception {
         ClassLoader loader = getClassLoader();
-        if (dirName != null && dirName.length() > 0)
+        if (!StringUtils.isEmpty(dirName))
             flags.directory = Files.getFile(dirName, loader);
-        if (typeMap != null && typeMap.length() > 0)
+        if (!StringUtils.isEmpty(typeMap))
             flags.typeMap = Configurations.parseProperties(typeMap);
 
         // load customizer properties

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCConfigurationImpl.java Tue Oct 10 15:39:15 2006
@@ -19,6 +19,7 @@
 import java.sql.ResultSet;
 import javax.sql.DataSource;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfigurationImpl;
 import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
 import org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory;
@@ -535,7 +536,7 @@
         if (dbdictionary == null) {
             String clsName = dbdictionaryPlugin.getClassName();
             String props = dbdictionaryPlugin.getProperties();
-            if (clsName != null && clsName.length() > 0) {
+            if (!StringUtils.isEmpty(clsName)) {
                 dbdictionary = DBDictionaryFactory.newDBDictionary
                     (this, clsName, props);
             } else {
@@ -754,7 +755,7 @@
                 // the driver name is always required, so if not specified,
                 // then no connection factory 2
                 String driver = getConnection2DriverName();
-                if (driver != null && driver.length() > 0)
+                if (!StringUtils.isEmpty(driver))
                     ds = DataSourceFactory.newDataSource(this, true);
             }
             if (ds != null) {

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/MappingFactoryValue.java Tue Oct 10 15:39:15 2006
@@ -88,7 +88,7 @@
         String metaProps = metaPlugin.getProperties();
 
         // if no mapping factory set, check for default for this factory
-        if (clsName == null || clsName.length() == 0) {
+        if (StringUtils.isEmpty(clsName)) {
             String def;
             if (!StringUtils.isEmpty(mapping)) {
                 def = unalias(metaPlugin.alias(metaClsName),
@@ -96,7 +96,7 @@
                 if (def != null)
                     clsName = unalias(def);
             }
-            if (clsName == null) {
+            if (StringUtils.isEmpty(clsName)) {
                 def = unalias(metaPlugin.alias(metaClsName),
                     _metaFactoryDefaults, true);
                 if (def != null)

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java Tue Oct 10 15:39:15 2006
@@ -20,6 +20,7 @@
 import java.util.Iterator;
 import java.util.Properties;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
 import org.apache.openjpa.jdbc.meta.MappingTool;
@@ -138,7 +139,7 @@
     private void synchronizeMappings(ClassLoader loader) {
         JDBCConfiguration conf = (JDBCConfiguration) getConfiguration();
         String action = conf.getSynchronizeMappings();
-        if (action == null || action.length() == 0)
+        if (StringUtils.isEmpty(action))
             return;
 
         Collection classes = conf.getMetaDataRepositoryInstance().

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java Tue Oct 10 15:39:15 2006
@@ -27,6 +27,7 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.meta.MappingRepository;
 import org.apache.openjpa.jdbc.meta.QueryResultMapping;
@@ -174,10 +175,8 @@
             }
             _meta = candidate;
 
-            String sql = ctx.getQueryString();
-            if (sql != null)
-                sql = sql.trim();
-            if (sql == null || sql.length() == 0)
+            String sql = StringUtils.trimToNull(ctx.getQueryString());
+            if (sql == null)
                 throw new UserException(_loc.get("no-sql"));
             _select = sql.length() > 6
                 && sql.substring(0, 6).equalsIgnoreCase("select");

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/PropertiesReverseCustomizer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/PropertiesReverseCustomizer.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/PropertiesReverseCustomizer.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/PropertiesReverseCustomizer.java Tue Oct 10 15:39:15 2006
@@ -19,6 +19,7 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.schema.ForeignKey;
 import org.apache.openjpa.jdbc.schema.Table;
@@ -219,12 +220,7 @@
      * Return the property value for the given key, or null if none.
      */
     protected String getProperty(String key) {
-        String val = _props.getProperty(key);
-        if (val != null) {
-            val = val.trim();
-            if (val.length() == 0)
-                val = null;
-        }
+        String val = StringUtils.trimToNull(_props.getProperty(key));
         _unaccessed.remove(key);
         return val;
     }

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java Tue Oct 10 15:39:15 2006
@@ -25,6 +25,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.sql.Joins;
 import org.apache.openjpa.lib.meta.SourceTracker;
@@ -284,7 +285,7 @@
          * Map the given path to the given result id.
          */
         public void addMapping(String path, Object id) {
-            if (path == null || path.length() == 0)
+            if (StringUtils.isEmpty(path))
                 throw new MetaDataException(_loc.get("null-path",
                     QueryResultMapping.this, _candidate));
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ReverseMappingTool.java Tue Oct 10 15:39:15 2006
@@ -236,9 +236,7 @@
      * indicate no package.
      */
     public void setPackageName(String packageName) {
-        if (packageName != null && packageName.length() == 0)
-            packageName = null;
-        _package = packageName;
+        _package = StringUtils.trimToNull(packageName);
     }
 
     /**
@@ -1470,7 +1468,7 @@
      * package-private for testing.
      */
     static String replaceInvalidCharacters(String str) {
-        if (str == null || str.length() == 0)
+        if (StringUtils.isEmpty(str))
             return str;
 
         StringBuffer buf = new StringBuffer(str);
@@ -1542,14 +1540,10 @@
                 if (propNames[nameIdx] == null)
                     continue;
 
-                typeSpec = _typeMap.getProperty(propNames[nameIdx]);
-                if (typeSpec != null) {
-                    typeSpec = typeSpec.trim();
-                    if (typeSpec.length() == 0)
-                        typeSpec = null;
-                    else
-                        typeName = propNames[nameIdx];
-                }
+                typeSpec = StringUtils.trimToNull(_typeMap.getProperty
+                    (propNames[nameIdx]));
+                if (typeSpec != null) 
+                    typeName = propNames[nameIdx];
             }
             if (typeSpec != null)
                 _log.info(_loc.get("reverse-type", typeName, typeSpec));

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ClassNameDiscriminatorStrategy.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ClassNameDiscriminatorStrategy.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ClassNameDiscriminatorStrategy.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ClassNameDiscriminatorStrategy.java Tue Oct 10 15:39:15 2006
@@ -20,6 +20,7 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.schema.Column;
@@ -88,7 +89,7 @@
             String className;
             while (rs.next()) {
                 className = dict.getString(rs, 1);
-                if (className == null || className.length() == 0)
+                if (StringUtils.isEmpty(className))
                     throw new ClassNotFoundException(_loc.get("no-class-name",
                         disc.getClassMapping(), col).getMessage());
                 Class.forName(className, true, loader);

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java Tue Oct 10 15:39:15 2006
@@ -23,6 +23,7 @@
 import java.sql.Timestamp;
 import java.sql.Types;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.meta.JavaSQLTypes;
 import org.apache.openjpa.meta.JavaTypes;
 import serp.util.Numbers;
@@ -461,9 +462,7 @@
      * The name of the column this column joins to, if any. Used for mapping.
      */
     public void setTarget(String target) {
-        if (target != null && target.length() == 0)
-            target = null;
-        _target = target;
+        _target = StringUtils.trimToNull(target);
     }
 
     /**

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java Tue Oct 10 15:39:15 2006
@@ -24,6 +24,7 @@
 import java.util.List;
 import javax.sql.DataSource;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.lib.conf.Configurations;
@@ -62,7 +63,7 @@
         boolean factory2) {
         String driver = (factory2) ? conf.getConnection2DriverName()
             : conf.getConnectionDriverName();
-        if (driver == null || driver.length() == 0)
+        if (StringUtils.isEmpty(driver))
             throw new UserException(_loc.get("no-driver", driver)).
                 setFatal(true);
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/NameSet.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/NameSet.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/NameSet.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/NameSet.java Tue Oct 10 15:39:15 2006
@@ -18,6 +18,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.lib.util.Localizer;
 
 /**
@@ -49,7 +50,7 @@
      * @param validate if true, null or empty names will not be accepted
      */
     protected void addName(String name, boolean validate) {
-        if (name == null || name.length() == 0) {
+        if (StringUtils.isEmpty(name)) {
             if (validate)
                 throw new IllegalArgumentException(_loc.get("bad-name", name)
                     .getMessage());

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Schema.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Schema.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Schema.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Schema.java Tue Oct 10 15:39:15 2006
@@ -18,6 +18,8 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * Represents a database schema.
  *
@@ -87,9 +89,7 @@
     public void setName(String name) {
         if (getSchemaGroup() != null)
             throw new IllegalStateException();
-        if (name != null && name.length() == 0)
-            name = null;
-        _name = name;
+        _name = StringUtils.trimToNull(name);
     }
 
     /**

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java Tue Oct 10 15:39:15 2006
@@ -486,9 +486,7 @@
         String tableSchema;
         for (int i = 0; cols != null && i < cols.length; i++) {
             tableName = cols[i].getTableName();
-            tableSchema = cols[i].getSchemaName();
-            if (tableSchema != null && tableSchema.length() == 0)
-                tableSchema = null;
+            tableSchema = StringUtils.trimToNull(cols[i].getSchemaName());
 
             // ignore special tables
             if (!_openjpaTables &&
@@ -600,9 +598,7 @@
         String name;
         String colName;
         for (int i = 0; pks != null && i < pks.length; i++) {
-            schemaName = pks[i].getSchemaName();
-            if (schemaName != null && schemaName.length() == 0)
-                schemaName = null;
+            schemaName = StringUtils.trimToNull(pks[i].getSchemaName());
             schema = group.getSchema(schemaName);
             if (schema == null)
                 continue;
@@ -659,9 +655,7 @@
         String colName;
         String pkName;
         for (int i = 0; idxs != null && i < idxs.length; i++) {
-            schemaName = idxs[i].getSchemaName();
-            if (schemaName != null && schemaName.length() == 0)
-                schemaName = null;
+            schemaName = StringUtils.trimToNull(idxs[i].getSchemaName());
             schema = group.getSchema(schemaName);
             if (schema == null)
                 continue;
@@ -676,7 +670,7 @@
 
             // statistics don't have names; skip them
             name = idxs[i].getName();
-            if (name == null || name.length() == 0
+            if (StringUtils.isEmpty(name)
                 || (pkName != null && name.equalsIgnoreCase(pkName))
                 || _dict.isSystemIndex(name, table))
                 continue;
@@ -741,9 +735,7 @@
         boolean seqWas0 = false; // some drivers incorrectly start at 0
         Collection invalids = null;
         for (int i = 0; fks != null && i < fks.length; i++) {
-            schemaName = fks[i].getSchemaName();
-            if (schemaName != null && schemaName.length() == 0)
-                schemaName = null;
+            schemaName = StringUtils.trimToNull(fks[i].getSchemaName());
             schema = group.getSchema(schemaName);
             if (schema == null)
                 continue;
@@ -767,7 +759,7 @@
                 _log.trace(_loc.get("gen-fk", new Object[]{ name, table,
                     fkColName, pkTableName, pkColName, seq + "" }));
 
-            if (pkSchemaName != null && pkSchemaName.length() > 0)
+            if (!StringUtils.isEmpty(pkSchemaName))
                 pkTableName = pkSchemaName + "." + pkTableName;
             pkTable = group.findTable(pkTableName);
             if (pkTable == null)
@@ -832,9 +824,7 @@
         String sequenceSchema;
         for (int i = 0; seqs != null && i < seqs.length; i++) {
             sequenceName = seqs[i].getName();
-            sequenceSchema = seqs[i].getSchemaName();
-            if (sequenceSchema != null && sequenceSchema.length() == 0)
-                sequenceSchema = null;
+            sequenceSchema = StringUtils.trimToNull(seqs[i].getSchemaName());
 
             // ignore special tables
             if (!_openjpaTables &&

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java Tue Oct 10 15:39:15 2006
@@ -31,6 +31,7 @@
 import java.util.Set;
 import javax.sql.DataSource;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
@@ -1424,7 +1425,7 @@
             gen.setOpenJPATables(flags.openjpaTables);
 
             String schemas = conf.getSchemas();
-            if (schemas == null || schemas.length() == 0)
+            if (StringUtils.isEmpty(schemas))
                 schemas = "all";
             log.info(_loc.get("sch-reflect", schemas));
             gen.generateSchemas();

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaSerializer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaSerializer.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaSerializer.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaSerializer.java Tue Oct 10 15:39:15 2006
@@ -24,10 +24,11 @@
 import java.util.Map;
 import java.util.TreeSet;
 
-import org.xml.sax.SAXException;
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.lib.meta.XMLMetaDataSerializer;
 import org.apache.openjpa.lib.util.Localizer;
+import org.xml.sax.SAXException;
 
 /**
  * Serializes {@link Schema}s to XML matching the document
@@ -261,7 +262,7 @@
         throws SAXException {
         addAttribute("name", col.getName());
         addAttribute("type", Schemas.getJDBCName(col.getType()));
-        if (col.getTypeName() != null && col.getTypeName().length() > 0
+        if (!StringUtils.isEmpty(col.getTypeName())
             && !col.getTypeName().equalsIgnoreCase
             (Schemas.getJDBCName(col.getType())))
             addAttribute("type-name", col.getTypeName());

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Tue Oct 10 15:39:15 2006
@@ -56,6 +56,7 @@
 import java.util.Set;
 import javax.sql.DataSource;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
 import org.apache.openjpa.jdbc.kernel.JDBCStore;
@@ -535,9 +536,7 @@
             return (char) getInt(rs, column);
 
         String str = getString(rs, column);
-        if (str == null || str.length() == 0)
-            return 0;
-        return str.charAt(0);
+        return (StringUtils.isEmpty(str)) ? 0 : str.charAt(0);
     }
 
     /**
@@ -642,7 +641,7 @@
     public Locale getLocale(ResultSet rs, int column)
         throws SQLException {
         String str = getString(rs, column);
-        if (str == null || str.length() == 0)
+        if (StringUtils.isEmpty(str))
             return null;
 
         String[] params = Strings.split(str, "_", 3);
@@ -1488,7 +1487,7 @@
      * from {@link Types}.
      */
     public String getTypeName(Column col) {
-        if (col.getTypeName() != null && col.getTypeName().length() > 0)
+        if (!StringUtils.isEmpty(col.getTypeName()))
             return appendSize(col, col.getTypeName());
 
         if (col.isAutoAssigned() && autoAssignTypeName != null)
@@ -1623,7 +1622,7 @@
             joinSyntax = SYNTAX_TRADITIONAL;
         else if ("database".equals(syntax))
             joinSyntax = SYNTAX_DATABASE;
-        else if (syntax != null && syntax.length() > 0)
+        else if (!StringUtils.isEmpty(syntax))
             throw new IllegalArgumentException(syntax);
     }
 
@@ -3252,8 +3251,7 @@
             == DatabaseMetaData.columnNoNulls);
 
         String def = colMeta.getString("COLUMN_DEF");
-        if (def != null && def.length() > 0
-            && !"null".equalsIgnoreCase(def))
+        if (!StringUtils.isEmpty(def) && !"null".equalsIgnoreCase(def))
             c.setDefaultString(def);
         return c;
     }
@@ -3661,8 +3659,7 @@
 
         // if user has unset sequence sql, null it out so we know sequences
         // aren't supported
-        if (nextSequenceQuery != null && nextSequenceQuery.length() == 0)
-            nextSequenceQuery = null;
+        nextSequenceQuery = StringUtils.trimToNull(nextSequenceQuery);
     }
 
     //////////////////////////////////////
@@ -3679,7 +3676,7 @@
         throws SQLException {
         if (!connected)
             connectedConfiguration(conn);
-        if (initializationSQL != null && initializationSQL.length() > 0) {
+        if (!StringUtils.isEmpty(initializationSQL)) {
             PreparedStatement stmnt = null;
             try {
                 stmnt = conn.prepareStatement(initializationSQL);

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java Tue Oct 10 15:39:15 2006
@@ -20,6 +20,7 @@
 import java.sql.SQLException;
 import javax.sql.DataSource;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.lib.conf.Configurations;
 import org.apache.openjpa.lib.log.Log;
@@ -158,7 +159,7 @@
      * Guess the dictionary class name to use based on the product string.
      */
     private static String dictionaryClassForString(String prod) {
-        if (prod == null || prod.length() == 0)
+        if (StringUtils.isEmpty(prod))
             return null;
         prod = prod.toLowerCase();
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java Tue Oct 10 15:39:15 2006
@@ -23,6 +23,7 @@
 import java.sql.Types;
 import java.util.Arrays;
 
+import org.apache.commons.lang.StringUtils;
 import org.hsqldb.Trace;
 import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
 import org.apache.openjpa.jdbc.schema.Column;
@@ -147,7 +148,7 @@
         String pkStr;
         if (pk != null) {
             pkStr = getPrimaryKeyConstraintSQL(pk);
-            if (pkStr != null && pkStr.length() > 0)
+            if (!StringUtils.isEmpty(pkStr))
                 buf.append(", ").append(pkStr);
         }
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java Tue Oct 10 15:39:15 2006
@@ -20,6 +20,7 @@
 import java.sql.Types;
 import java.util.Arrays;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.schema.ForeignKey;
@@ -95,7 +96,7 @@
 
     public String[] getCreateTableSQL(Table table) {
         String[] sql = super.getCreateTableSQL(table);
-        if (tableType != null && tableType.length() > 0)
+        if (!StringUtils.isEmpty(tableType))
             sql[0] = sql[0] + " TYPE = " + tableType;
         return sql;
     }

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java Tue Oct 10 15:39:15 2006
@@ -36,6 +36,7 @@
 import java.util.TreeMap;
 
 import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
@@ -1264,7 +1265,7 @@
      */
     private void where(String sql, PathJoins pj) {
         // no need to use joins...
-        if (sql == null || sql.length() == 0)
+        if (StringUtils.isEmpty(sql))
             return;
 
         if (_where == null)
@@ -1310,7 +1311,7 @@
      */
     private void having(String sql, PathJoins pj) {
         // no need to use joins...
-        if (sql == null || sql.length() == 0)
+        if (StringUtils.isEmpty(sql))
             return;
 
         if (_having == null)

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java Tue Oct 10 15:39:15 2006
@@ -23,6 +23,7 @@
 import java.sql.Types;
 import java.util.Arrays;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.schema.ForeignKey;
 import org.apache.openjpa.jdbc.schema.PrimaryKey;
@@ -242,7 +243,7 @@
 
         // warn about jdbc compliant flag
         String url = conf.getConnectionURL();
-        if (url != null && url.length() > 0
+        if (!StringUtils.isEmpty(url)
             && url.toLowerCase().indexOf("jdbc:sybase:tds") != -1
             && url.toLowerCase().indexOf("be_as_jdbc_compliant_as_possible=")
             == -1) {

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java Tue Oct 10 15:39:15 2006
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.datacache.ConcurrentDataCache;
 import org.apache.openjpa.datacache.ConcurrentQueryCache;
 import org.apache.openjpa.datacache.DataCacheManager;
@@ -937,9 +938,9 @@
      * Lookup the connection factory at the given name.
      */
     private Object lookupConnectionFactory(String name) {
-        if (name == null || name.trim().length() == 0)
+        name = StringUtils.trimToNull(name);
+        if (name == null)
             return null;
-
         return Configurations.lookup(name);
     }
 

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAVersion.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAVersion.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAVersion.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAVersion.java Tue Oct 10 15:39:15 2006
@@ -21,6 +21,8 @@
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * This class contains version information for OpenJPA. It uses
  * Ant's filter tokens to convert the template into a java
@@ -42,7 +44,7 @@
     static {
         Package pack = OpenJPAVersion.class.getPackage();
         String vers = pack == null ? null : pack.getImplementationVersion();
-        if (vers == null || vers.length() == 0)
+        if (StringUtils.isEmpty(vers))
             vers = "0.0.0";
         VERSION_NUMBER = vers;
 

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/RemoteCommitProviderValue.java Tue Oct 10 15:39:15 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.openjpa.conf;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.event.RemoteCommitEventManager;
 import org.apache.openjpa.event.RemoteCommitProvider;
 import org.apache.openjpa.lib.conf.Configuration;
@@ -128,12 +129,9 @@
             return;
 
         _opts = Configurations.parseProperties(getProperties());
-        String transmit = _opts.removeProperty("transmitPersistedObjectIds",
-            "TransmitPersistedObjectIds", null);
-        if (transmit != null) {
-            transmit = transmit.trim();
-            if (transmit.length() > 0)
-                _transmitPersIds = Boolean.valueOf (transmit);
-		}
+        String transmit = StringUtils.trimToNull(_opts.removeProperty
+            ("transmitPersistedObjectIds", "TransmitPersistedObjectIds", null));
+        if (transmit != null)
+            _transmitPersIds = Boolean.valueOf (transmit);
 	}
 }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/MethodStoreQuery.java Tue Oct 10 15:39:15 2006
@@ -27,6 +27,7 @@
 import java.util.Map;
 
 import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.lib.rop.ListResultObjectProvider;
 import org.apache.openjpa.lib.rop.RangeResultObjectProvider;
 import org.apache.openjpa.lib.rop.ResultObjectProvider;
@@ -217,7 +218,7 @@
                 return;
 
             String methName = q.getContext().getQueryString();
-            if (methName == null || methName.length() == 0)
+            if (StringUtils.isEmpty(methName))
                 throw new UserException(_loc.get("no-method"));
 
             int dotIdx = methName.lastIndexOf('.');

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java Tue Oct 10 15:39:15 2006
@@ -26,6 +26,7 @@
 import java.util.Map;
 
 import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.enhance.PersistenceCapable;
 import org.apache.openjpa.kernel.exps.AggregateListener;
@@ -540,11 +541,7 @@
         try {
             assertOpen();
             assertNotReadOnly();
-            if (params != null)
-                params = params.trim();
-            if (params != null && params.length() == 0)
-                params = null;
-            _params = params;
+            _params = StringUtils.trimToNull(params);
             invalidateCompilation();
         } finally {
             unlock();
@@ -1110,7 +1107,7 @@
      */
     private void logExecution(int op, Map params) {
         String s = _query;
-        if (s == null || s.length() == 0)
+        if (StringUtils.isEmpty(s))
             s = toString();
 
         String msg = "executing-query";

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ResultPacker.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ResultPacker.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ResultPacker.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ResultPacker.java Tue Oct 10 15:39:15 2006
@@ -30,6 +30,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.util.OpenJPAException;
 import org.apache.openjpa.util.UserException;
@@ -257,7 +258,7 @@
      */
     private static Member findSet(String alias, Class type, Field[] fields,
         Method[] methods) {
-        if (alias == null || alias.length() == 0)
+        if (StringUtils.isEmpty(alias))
             return null;
         if (type == Object.class)
             type = null;

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractCFMetaDataFactory.java Tue Oct 10 15:39:15 2006
@@ -31,6 +31,7 @@
 import java.util.zip.ZipFile;
 import java.util.zip.ZipInputStream;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.lib.meta.ClassArgParser;
 import org.apache.openjpa.lib.meta.ClasspathMetaDataIterator;
 import org.apache.openjpa.lib.meta.FileMetaDataIterator;
@@ -80,7 +81,7 @@
      * directories supplied by user via auto-configuration.
      */
     public void setFiles(String files) {
-        if (files == null || files.length() == 0)
+        if (StringUtils.isEmpty(files))
             this.files = null;
         else {
             String[] strs = Strings.split(files, ";", 0);
@@ -107,7 +108,7 @@
      * supplied by user via auto-configuration.
      */
     public void setURLs(String urls) {
-        if (urls == null || urls.length() == 0)
+        if (StringUtils.isEmpty(urls))
             this.urls = null;
         else {
             String[] strs = Strings.split(urls, ";", 0);
@@ -134,7 +135,7 @@
      */
     public void setResources(String rsrcs) {
         // keep list mutable so subclasses can add implicit locations
-        this.rsrcs = (rsrcs == null || rsrcs.length() == 0) ? null
+        this.rsrcs = (StringUtils.isEmpty(rsrcs)) ? null
             : new ArrayList(Arrays.asList(Strings.split(rsrcs, ";", 0)));
     }
 
@@ -152,7 +153,7 @@
      */
     public void setClasspathScan(String cpath) {
         // keep list mutable so subclasses can add implicit locations
-        this.cpath = (cpath == null || cpath.length() == 0) ? null
+        this.cpath = (StringUtils.isEmpty(cpath)) ? null
             : new ArrayList(Arrays.asList(Strings.split(cpath, ";", 0)));
     }
 

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/AbstractMetaDataFactory.java Tue Oct 10 15:39:15 2006
@@ -22,6 +22,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.meta.ClassArgParser;
@@ -55,7 +56,7 @@
      * auto-configuration.
      */
     public void setTypes(String types) {
-        this.types = (types == null || types.length() == 0) ? null
+        this.types = (StringUtils.isEmpty(types)) ? null
             : new HashSet(Arrays.asList(Strings.split(types, ";", 0)));
     }
 

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FieldMetaData.java Tue Oct 10 15:39:15 2006
@@ -1036,12 +1036,7 @@
      * the field's elements.
      */
     public void setOrderDeclaration(String dec) {
-        if (dec != null) {
-            dec = dec.trim();
-            if (dec.length() == 0)
-                dec = null;
-        }
-        _orderDec = dec;
+        _orderDec = StringUtils.trimToNull(dec);
         _orders = null;
     }
 
@@ -1398,7 +1393,7 @@
      * @return the method for invocation
      */
     private Method findMethod(String method) {
-        if (method == null || method.length() == 0)
+        if (StringUtils.isEmpty(method))
             return null;
 
         // get class name and get package name divide on the last '.', so the

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java Tue Oct 10 15:39:15 2006
@@ -19,6 +19,7 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.kernel.Query;
 import org.apache.openjpa.lib.meta.SourceTracker;
 import org.apache.openjpa.lib.xml.Commentable;
@@ -185,7 +186,7 @@
     public void setInto(Query query) {
         if (_candidate != null)
             query.setCandidateType(_candidate, true);
-        if (_query != null && _query.length() > 0)
+        if (!StringUtils.isEmpty(_query))
             query.setQuery(_query);
         if (_res != null)
             query.setResultType(_res);

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java Tue Oct 10 15:39:15 2006
@@ -30,6 +30,7 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.exception.NestableRuntimeException;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.util.JavaVersions;
@@ -71,7 +72,7 @@
     private static String getPluginComponent(String plugin, boolean clsName) {
         if (plugin != null)
             plugin = plugin.trim();
-        if (plugin == null || plugin.length() == 0)
+        if (StringUtils.isEmpty(plugin))
             return null;
 
         int openParen = -1;
@@ -96,9 +97,9 @@
      * Combine the given class name and properties into a plugin string.
      */
     public static String getPlugin(String clsName, String props) {
-        if (clsName == null || clsName.length() == 0)
+        if (StringUtils.isEmpty(clsName))
             return props;
-        if (props == null || props.length() == 0)
+        if (StringUtils.isEmpty(props))
             return clsName;
         return clsName + "(" + props + ")";
     }
@@ -129,7 +130,7 @@
      */
     static Object newInstance(String clsName, Value val, Configuration conf,
         ClassLoader loader, boolean fatal) {
-        if (clsName == null || clsName.length() == 0)
+        if (StringUtils.isEmpty(clsName))
             return null;
         if (loader == null && conf != null)
             loader = conf.getClass().getClassLoader();
@@ -173,7 +174,7 @@
     public static void populateConfiguration(Configuration conf, Options opts) {
         String props = opts.removeProperty("properties", "p", null);
         ConfigurationProvider provider;
-        if (props != null && props.length() > 0) {
+        if (!StringUtils.isEmpty(props)) {
             String path = props;
             String anchor = null;
             int idx = path.lastIndexOf('#');
@@ -279,7 +280,7 @@
             return;
 
         Properties props = null;
-        if (properties != null && properties.length() > 0)
+        if (!StringUtils.isEmpty(properties))
             props = parseProperties(properties);
         configureInstance(obj, conf, props, configurationName);
     }
@@ -388,11 +389,9 @@
      */
     public static Options parseProperties(String properties) {
         Options opts = new Options();
+        properties = StringUtils.trimToNull(properties);
         if (properties == null)
             return opts;
-        properties = properties.trim();
-        if (properties.length() == 0)
-            return opts;
 
         try {
             String[] props = Strings.split(properties, ",", 0);
@@ -453,7 +452,7 @@
      * Looks up the given name in JNDI. If the name is null, null is returned.
      */
     public static Object lookup(String name) {
-        if (name == null || name.length() == 0)
+        if (StringUtils.isEmpty(name))
             return null;
 
         Context ctx = null;

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java Tue Oct 10 15:39:15 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.openjpa.lib.conf;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * A double {@link Value}.
  *
@@ -54,7 +56,7 @@
     }
 
     protected void setInternalString(String val) {
-        if (val == null || val.length() == 0)
+        if (StringUtils.isEmpty(val))
             set(0D);
         else
             set(Double.parseDouble(val));

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java Tue Oct 10 15:39:15 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.openjpa.lib.conf;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * An int {@link Value}.
  *
@@ -54,7 +56,7 @@
     }
 
     protected void setInternalString(String val) {
-        if (val == null || val.length() == 0)
+        if (StringUtils.isEmpty(val))
             set(0);
         else
             set(Integer.parseInt(val));

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java Tue Oct 10 15:39:15 2006
@@ -19,6 +19,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * A list of plugins. Defaults and aliases on plugin lists apply only
  * to individual class names.
@@ -117,9 +119,9 @@
      * properties string.
      */
     public void setString(String str) {
-        if (str == null || str.length() == 0)
+        if (StringUtils.isEmpty(str))
             str = getDefault();
-        if (str == null || str.length() == 0) {
+        if (StringUtils.isEmpty(str)) {
             _names = EMPTY;
             _props = EMPTY;
             set(null, true);

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java Tue Oct 10 15:39:15 2006
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.MissingResourceException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.lib.util.Services;
 
@@ -148,7 +149,7 @@
      */
     public static ConfigurationProvider load(String resource, String anchor, 
         ClassLoader loader) {
-        if (resource == null || resource.length() == 0)
+        if (StringUtils.isEmpty(resource))
             return null;
         if (loader == null)
             loader = Thread.currentThread().getContextClassLoader();

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogOutputStream.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogOutputStream.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogOutputStream.java Tue Oct 10 15:39:15 2006
@@ -48,9 +48,12 @@
 
     public void flush() throws IOException {
         super.flush();
+        byte[] bytes = toByteArray();
+        if (bytes.length == 0)
+            return;
 
-        String msg = new String(toByteArray());
-        if (msg != null && msg.length() > 0 && msg.indexOf(_sep) != -1) {
+        String msg = new String(bytes);
+        if (msg.indexOf(_sep) != -1) {
             // break up the message based on the line separator; this
             // may be because the flushed buffer contains mutliple lines
             for (StringTokenizer tok = new StringTokenizer(msg, _sep);

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/CFMetaDataParser.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/CFMetaDataParser.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/CFMetaDataParser.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/CFMetaDataParser.java Tue Oct 10 15:39:15 2006
@@ -15,9 +15,10 @@
  */
 package org.apache.openjpa.lib.meta;
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.openjpa.lib.util.Localizer;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
-import org.apache.openjpa.lib.util.Localizer;
 import serp.util.Strings;
 
 /**
@@ -173,8 +174,7 @@
         throws SAXException {
         if (getClassAttributeName() != null) {
             _class = attrs.getValue(getClassAttributeName());
-            if (_package != null && _package.length() > 0
-                && _class.indexOf('.') == -1)
+            if (!StringUtils.isEmpty(_package) && _class.indexOf('.') == -1)
                 _class = _package + "." + _class;
         }
         return true;
@@ -188,8 +188,7 @@
             _class = null;
         else {
             _class = currentText();
-            if (_package != null && _package.length() > 0
-                && _class.indexOf('.') == -1)
+            if (!StringUtils.isEmpty(_package) && _class.indexOf('.') == -1)
                 _class = _package + "." + _class;
         }
     }
@@ -289,13 +288,13 @@
      */
     public static Class classForName(String name, String pkg,
         boolean resolve, ClassLoader loader) {
-        if (name == null || name.length() == 0)
+        if (StringUtils.isEmpty(name))
             return null;
 
         if (loader == null)
             loader = Thread.currentThread().getContextClassLoader();
         boolean fullName = name.indexOf('.') != -1;
-        boolean noPackage = pkg == null || pkg.length() == 0;
+        boolean noPackage = StringUtils.isEmpty(pkg);
         try {
             if (fullName || noPackage)
                 return Strings.toClass(name, resolve, loader);

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassArgParser.java Tue Oct 10 15:39:15 2006
@@ -31,6 +31,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.exception.NestableRuntimeException;
 import org.apache.openjpa.lib.util.Files;
 import org.apache.openjpa.lib.util.Localizer;
@@ -354,10 +355,7 @@
             return clsName;
         } finally {
             if (in != null)
-                try {
-                    in.close();
-                } catch (IOException ioe) {
-                }
+                try { in.close(); } catch (IOException ioe) {}
         }
     }
 

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Files.java Tue Oct 10 15:39:15 2006
@@ -28,6 +28,7 @@
 import java.net.URL;
 import java.net.URLDecoder;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.exception.NestableRuntimeException;
 import serp.util.Strings;
 
@@ -134,7 +135,7 @@
     public static File getPackageFile(File base, String pkg, boolean mkdirs) {
         if (base == null)
             base = new File(System.getProperty("user.dir"));
-        if (pkg == null || pkg.length() == 0) {
+        if (StringUtils.isEmpty(pkg)) {
             if (mkdirs && !base.exists())
                 base.mkdirs();
             return base;

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Options.java Tue Oct 10 15:39:15 2006
@@ -103,7 +103,7 @@
             if (i == args.length || args[i].startsWith("-")) {
                 key = trimQuote(key);
                 if (key != null) {
-                    if (value != null && value.length() > 0)
+                    if (!StringUtils.isEmpty(value))
                         setProperty(key, trimQuote(value));
                     else
                         setProperty(key, "true");
@@ -291,7 +291,7 @@
      */
     private static boolean matchOptionToMember(String key, Object[] match)
         throws Exception {
-        if (key == null || key.length() == 0)
+        if (StringUtils.isEmpty(key))
             return false;
 
         // unfortunately we can't use bean properties for setters; any

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java Tue Oct 10 15:39:15 2006
@@ -29,6 +29,7 @@
 import javax.resource.cci.LocalTransaction;
 import javax.resource.cci.ResultSetInfo;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.ee.ManagedRuntime;
 import org.apache.openjpa.kernel.Broker;
@@ -729,7 +730,7 @@
      * Validate that the user provided SQL.
      */
     private static void validateSQL(String query) {
-        if (query == null || query.trim().length() == 0)
+        if (StringUtils.trimToNull(query) == null)
             throw new ArgumentException(_loc.get("no-sql"), null, null, false);
     }
 

Modified: incubator/openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java?view=diff&rev=462617&r1=462616&r2=462617
==============================================================================
--- incubator/openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java (original)
+++ incubator/openjpa/trunk/openjpa-xmlstore/src/main/java/org/apache/openjpa/xmlstore/XMLFileHandler.java Tue Oct 10 15:39:15 2006
@@ -520,7 +520,7 @@
 
                 case JavaTypes.OBJECT:
                 case JavaTypes.OID:
-                    // convert the characters into bytes, and run them through an
+                    // convert the chars into bytes, and run them through an 
                     // ObjectInputStream in order to get the serialized object
                     byte[] bytes = Base16Encoder.decode(str);
                     ByteArrayInputStream bais = new ByteArrayInputStream(bytes);



Mime
View raw message