Revision: 6240
http://squirrel-sql.svn.sourceforge.net/squirrel-sql/?rev=6240&view=rev
Author: wis775
Date: 2011-04-20 19:54:58 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
Upgrade from commons-lang:1.0 to commons-lang:2.6.
commons-lang:2.6 contains some methods, that are identical to the Squirrel specific StringUtilities. These methods are removed.
Now, some modules have a new compile dependency to commons-lang. Thats why commons-lang are defined within the dependencyManagement section.
Modified Paths:
--------------
trunk/sql12/app/pom.xml
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/Application.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/HelpViewerWindow.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/db/aliasproperties/AddDriverPropertyDialog.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/session/CatalogsPanel.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/GeneralPreferencesPanel.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/UpdatePreferencesPanel.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTreeCellRenderer.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/properties/SessionObjectTreePropertiesPanel.java
trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/update/UpdateUtilImpl.java
trunk/sql12/fw/pom.xml
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/FloatingPointBase.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/AbstractWhereClausePart.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/IsNullWhereClausePart.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DB2DialectExt.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DialectUtils.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/OptionalSqlClause.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/debug/DebugEventListener.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/DatabaseObjectInfo.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/SQLConnection.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/StringUtilities.java
trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/Utilities.java
trunk/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/util/StringUtilitiesTest.java
trunk/sql12/plugins/i18n/pom.xml
trunk/sql12/plugins/i18n/src/main/java/net/sourceforge/squirrel_sql/plugins/i18n/TranslatorsController.java
trunk/sql12/plugins/pom.xml
trunk/sql12/plugins/refactoring/pom.xml
trunk/sql12/plugins/refactoring/src/main/java/net/sourceforge/squirrel_sql/plugins/refactoring/DBUtil.java
trunk/sql12/pom.xml
Modified: trunk/sql12/app/pom.xml
===================================================================
--- trunk/sql12/app/pom.xml 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/pom.xml 2011-04-20 19:54:58 UTC (rev 6240)
@@ -82,6 +82,10 @@
<artifactId>gsbase</artifactId>
</dependency>
<dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/Application.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/Application.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/Application.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -39,6 +39,8 @@
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
+import org.apache.commons.lang.StringUtils;
+
import net.sourceforge.squirrel_sql.client.action.ActionCollection;
import net.sourceforge.squirrel_sql.client.gui.FileViewerFactory;
import net.sourceforge.squirrel_sql.client.gui.SquirrelSplashScreen;
@@ -284,7 +286,7 @@
private Locale constructPreferredLocale(SquirrelPreferences prefs)
{
String langCountryPair = prefs.getPreferredLocale();
- if (StringUtilities.isEmpty(langCountryPair))
+ if (StringUtils.isEmpty(langCountryPair))
{
langCountryPair = "en_US";
}
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/HelpViewerWindow.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/HelpViewerWindow.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/HelpViewerWindow.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -58,11 +58,12 @@
import net.sourceforge.squirrel_sql.fw.util.FileWrapperFactoryImpl;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import net.sourceforge.squirrel_sql.fw.util.Utilities;
import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
+import org.apache.commons.lang.StringUtils;
+
/**
* This window shows the SQuirreL Help files.
*
@@ -529,7 +530,7 @@
if (docURL != null)
{
String docTitle = dn.toString();
- if (StringUtilities.isEmpty(docTitle))
+ if (StringUtils.isEmpty(docTitle))
{
docTitle = docURL.toExternalForm();
}
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/db/aliasproperties/AddDriverPropertyDialog.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/db/aliasproperties/AddDriverPropertyDialog.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/db/aliasproperties/AddDriverPropertyDialog.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -33,8 +33,9 @@
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
+
/**
* Dialog that gets displayed when a user chooses to add a driver property to the table.
*/
@@ -104,7 +105,7 @@
public void actionPerformed(ActionEvent arg0)
{
String name = propertyNameTF.getText();
- if (!StringUtilities.isEmpty(name))
+ if (!StringUtils.isEmpty(name))
{
String value = propertyValueTF.getText();
String desc = propertyDescriptionTF.getText();
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/session/CatalogsPanel.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/session/CatalogsPanel.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/session/CatalogsPanel.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -19,10 +19,11 @@
import net.sourceforge.squirrel_sql.fw.sql.ISQLConnection;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
+import org.apache.commons.lang.StringUtils;
+
public class CatalogsPanel extends JPanel
{
/** Internationalized strings for this class. */
@@ -66,7 +67,7 @@
if (_catalogsCmb != null)
{
final ISQLConnection conn = _session.getSQLConnection();
- if (!StringUtilities.areStringsEqual(conn.getCatalog(), _catalogsCmb.getSelectedCatalog()))
+ if (!StringUtils.equals(conn.getCatalog(), _catalogsCmb.getSelectedCatalog()))
{
_catalogsCmb.setSelectedCatalog(conn.getCatalog());
}
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/GeneralPreferencesPanel.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/GeneralPreferencesPanel.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/GeneralPreferencesPanel.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -28,6 +28,8 @@
import javax.swing.*;
import javax.swing.border.EmptyBorder;
+import org.apache.commons.lang.StringUtils;
+
import net.sourceforge.squirrel_sql.client.ApplicationArguments;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.util.ApplicationFiles;
@@ -177,7 +179,7 @@
_selectOnRightMouseClick.setSelected(prefs.getSelectOnRightMouseClick());
_showPleaseWaitDialog.setSelected(prefs.getShowPleaseWaitDialog());
String preferredLocalString = prefs.getPreferredLocale();
- if (StringUtilities.isEmpty(preferredLocalString))
+ if (StringUtils.isEmpty(preferredLocalString))
{
preferredLocalString = "en_US";
}
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/UpdatePreferencesPanel.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/UpdatePreferencesPanel.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/preferences/UpdatePreferencesPanel.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -50,8 +50,9 @@
import net.sourceforge.squirrel_sql.client.update.UpdateUtilImpl;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
+
public class UpdatePreferencesPanel extends JPanel
{
private static final Color CONNECTION_FAILURE_COLOR = Color.RED;
@@ -533,7 +534,7 @@
String portStr = _updateServerPort.getText();
StringBuilder tmp = new StringBuilder("http://");
tmp.append(_updateServerName.getText());
- if (!StringUtilities.isEmpty(portStr))
+ if (!StringUtils.isEmpty(portStr))
{
tmp.append(":");
tmp.append(_updateServerPort.getText());
@@ -647,7 +648,7 @@
try
{
int port = 80;
- if (!StringUtilities.isEmpty(portString))
+ if (!StringUtils.isEmpty(portString))
{
port = Integer.parseInt(_updateServerPort.getText());
}
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTreeCellRenderer.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTreeCellRenderer.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTreeCellRenderer.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -7,6 +7,9 @@
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.*;
+
+import org.apache.commons.lang.StringUtils;
+
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -62,12 +65,12 @@
String filterhint = "";
- if(false == StringUtilities.isEmpty(objectFilterInclude))
+ if(false == StringUtils.isEmpty(objectFilterInclude))
{
filterhint += "Inc:" + objectFilterInclude;
}
- if(false == StringUtilities.isEmpty(objectFilterExclude))
+ if(false == StringUtils.isEmpty(objectFilterExclude))
{
if(0 == filterhint.length())
{
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/properties/SessionObjectTreePropertiesPanel.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/properties/SessionObjectTreePropertiesPanel.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/session/properties/SessionObjectTreePropertiesPanel.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -40,8 +40,9 @@
import net.sourceforge.squirrel_sql.fw.gui.MultipleLineLabel;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
+
/**
* This panel allows the user to tailor object tree settings for a session.
*
@@ -244,13 +245,13 @@
oldLoadSchemasCatalogs != newLoadSchemasCatalogs ||
oldShowRowCount != newShowRowCount ||
- !StringUtilities.areStringsEqual(oldCatalogFilterInclude, newCatalogFilterInclude) ||
- !StringUtilities.areStringsEqual(oldSchemaFilterInclude, newSchemaFilterInclude) ||
- !StringUtilities.areStringsEqual(oldObjectFilterInclude, newObjectFilterInclude) ||
+ !StringUtils.equals(oldCatalogFilterInclude, newCatalogFilterInclude) ||
+ !StringUtils.equals(oldSchemaFilterInclude, newSchemaFilterInclude) ||
+ !StringUtils.equals(oldObjectFilterInclude, newObjectFilterInclude) ||
- !StringUtilities.areStringsEqual(oldCatalogFilterExclude, newCatalogFilterExclude) ||
- !StringUtilities.areStringsEqual(oldSchemaFilterExclude, newSchemaFilterExclude) ||
- !StringUtilities.areStringsEqual(oldObjectFilterExclude, newObjectFilterExclude)
+ !StringUtils.equals(oldCatalogFilterExclude, newCatalogFilterExclude) ||
+ !StringUtils.equals(oldSchemaFilterExclude, newSchemaFilterExclude) ||
+ !StringUtils.equals(oldObjectFilterExclude, newObjectFilterExclude)
)
{
_objectTreeRefreshNeeded = true;
Modified: trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/update/UpdateUtilImpl.java
===================================================================
--- trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/update/UpdateUtilImpl.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/update/UpdateUtilImpl.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -56,10 +56,11 @@
import net.sourceforge.squirrel_sql.fw.util.IOUtilities;
import net.sourceforge.squirrel_sql.fw.util.IOUtilitiesImpl;
import net.sourceforge.squirrel_sql.fw.util.IProxySettings;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
+import org.apache.commons.lang.StringUtils;
+
/**
* Low-level utility methods for the UpdateController. Among other things this class provides file locations
* for important directories that are needed for backup/restore, installation/removal of updates and existing
@@ -308,7 +309,7 @@
public void moveFiles(FileWrapper fromDir, String filePattern, boolean matchPattern, FileWrapper toDir)
throws FileNotFoundException, IOException
{
- if (StringUtilities.isEmpty(filePattern)) {
+ if (StringUtils.isEmpty(filePattern)) {
throw new IllegalArgumentException("filePattern arg cannot be empty or null");
}
if (!fromDir.isDirectory()) { throw new IllegalArgumentException("Expected fromDir("
@@ -355,7 +356,7 @@
public void copyDir(FileWrapper fromDir, String filePattern, boolean matchPattern, FileWrapper toDir)
throws FileNotFoundException, IOException
{
- if (StringUtilities.isEmpty(filePattern)) {
+ if (StringUtils.isEmpty(filePattern)) {
throw new IllegalArgumentException("filePattern arg cannot be empty or null");
}
verifyDirectory(fromDir, toDir);
Modified: trunk/sql12/fw/pom.xml
===================================================================
--- trunk/sql12/fw/pom.xml 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/pom.xml 2011-04-20 19:54:58 UTC (rev 6240)
@@ -102,7 +102,6 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>1.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/FloatingPointBase.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/FloatingPointBase.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/FloatingPointBase.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -3,17 +3,13 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.text.NumberFormat;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
-import javax.swing.JLabel;
import javax.swing.JRadioButton;
-import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -21,8 +17,9 @@
import net.sourceforge.squirrel_sql.fw.gui.OkJPanel;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
+
public abstract class FloatingPointBase extends BaseDataTypeComponent
{
private static final StringManager s_stringMgr =
@@ -105,7 +102,7 @@
maximumFractionDigits = 5; // by default use 5
String maximumFractionDigitsString = DTProperties.get(DataTypeBigDecimal.class.getName(), "maximumFractionDigits");
- if (StringUtilities.isEmpty(maximumFractionDigitsString) == false)
+ if (StringUtils.isEmpty(maximumFractionDigitsString) == false)
{
maximumFractionDigits =Integer.valueOf(maximumFractionDigitsString);
}
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/AbstractWhereClausePart.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/AbstractWhereClausePart.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/AbstractWhereClausePart.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -1,7 +1,6 @@
package net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.whereClause;
import net.sourceforge.squirrel_sql.fw.datasetviewer.ColumnDisplayDefinition;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import org.apache.commons.lang.StringUtils;
@@ -103,7 +102,7 @@
* @param clause
*/
protected void setWhereClause(String clause){
- if(StringUtilities.isBlank(clause)){
+ if(StringUtils.isBlank(clause)){
throw new IllegalArgumentException("clause must not be blank.");
}
this.whereClause = clause;
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/IsNullWhereClausePart.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/IsNullWhereClausePart.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/whereClause/IsNullWhereClausePart.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -1,12 +1,11 @@
package net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.whereClause;
import java.sql.PreparedStatement;
-import java.sql.SQLException;
import net.sourceforge.squirrel_sql.fw.datasetviewer.ColumnDisplayDefinition;
-import net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IDataTypeComponent;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
+
/**
* The part of an where-clause, which presents an <code>column is null</code>
* statement. This implemementation doesn't use parameters, so it is not allowed
@@ -36,7 +35,7 @@
if(columnDef == null){
throw new IllegalArgumentException("columnDef must not be null");
}
- if(StringUtilities.isBlank(columnDef.getColumnName())){
+ if(StringUtils.isBlank(columnDef.getColumnName())){
throw new IllegalArgumentException("columnDef contains not an usable columnName");
}
return (columnDef.getColumnName() + " is null");
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DB2DialectExt.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DB2DialectExt.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DB2DialectExt.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -35,9 +35,9 @@
import net.sourceforge.squirrel_sql.fw.sql.ITableInfo;
import net.sourceforge.squirrel_sql.fw.sql.JDBCTypeMapper;
import net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import org.antlr.stringtemplate.StringTemplate;
+import org.apache.commons.lang.StringUtils;
import org.hibernate.HibernateException;
/**
@@ -1228,12 +1228,12 @@
final String schema = qualifier.getSchema();
final String catalog = qualifier.getCatalog();
final StringBuilder result = new StringBuilder();
- if (!StringUtilities.isEmpty(catalog))
+ if (!StringUtils.isEmpty(catalog))
{
result.append(DialectUtils.shapeIdentifier(catalog, prefs, this));
result.append(".");
}
- if (!StringUtilities.isEmpty(schema))
+ if (!StringUtils.isEmpty(schema))
{
result.append(DialectUtils.shapeIdentifier(schema, prefs, this));
result.append(".");
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DialectUtils.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DialectUtils.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/DialectUtils.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -28,17 +28,25 @@
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map.Entry;
import java.util.Vector;
-import java.util.Map.Entry;
-import net.sourceforge.squirrel_sql.fw.sql.*;
+import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
+import net.sourceforge.squirrel_sql.fw.sql.ForeignKeyColumnInfo;
+import net.sourceforge.squirrel_sql.fw.sql.ForeignKeyInfo;
+import net.sourceforge.squirrel_sql.fw.sql.ISQLDatabaseMetaData;
+import net.sourceforge.squirrel_sql.fw.sql.ITableInfo;
+import net.sourceforge.squirrel_sql.fw.sql.IndexInfo;
+import net.sourceforge.squirrel_sql.fw.sql.JDBCTypeMapper;
+import net.sourceforge.squirrel_sql.fw.sql.PrimaryKeyInfo;
+import net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
import org.antlr.stringtemplate.StringTemplate;
+import org.apache.commons.lang.StringUtils;
import org.hibernate.HibernateException;
/**
@@ -2455,12 +2463,12 @@
for (final IndexInfo indexInfo : indexInfos)
{
final String indexName = indexInfo.getSimpleName();
- if (StringUtilities.isEmpty(indexName))
+ if (StringUtils.isEmpty(indexName))
{
continue;
}
final String columnName = indexInfo.getColumnName();
- if (StringUtilities.isEmpty(columnName))
+ if (StringUtils.isEmpty(columnName))
{
continue;
}
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/OptionalSqlClause.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/OptionalSqlClause.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/dialects/OptionalSqlClause.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -19,9 +19,8 @@
package net.sourceforge.squirrel_sql.fw.dialects;
import org.antlr.stringtemplate.StringTemplate;
+import org.apache.commons.lang.StringUtils;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
-
/**
* There are a number of dialects which produce DDL statements which have "optional" clauses such
* that when a value is provided, then a keyword must be used to give context to that value; but when
@@ -69,7 +68,7 @@
result = _st.toString();
}
} else {
- if (!StringUtilities.isEmpty(_variablePart)) {
+ if (!StringUtils.isEmpty(_variablePart)) {
result = new StringBuilder(_staticPart).append(" ").append(_variablePart).toString();
}
}
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/debug/DebugEventListener.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/debug/DebugEventListener.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/debug/DebugEventListener.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -30,7 +30,7 @@
import javax.swing.ToolTipManager;
import javax.swing.border.Border;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
/**
@@ -114,9 +114,9 @@
toolTipText.append("Button with parentClass=");
toolTipText.append(parentClassName);
} else {
- if (!StringUtilities.isEmpty(sourceName)) {
+ if (!StringUtils.isEmpty(sourceName)) {
toolTipText.append(sourceName);
- } else if (!StringUtilities.isEmpty(sourceClassName)) {
+ } else if (!StringUtils.isEmpty(sourceClassName)) {
toolTipText.append(sourceClassName);
}
}
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/DatabaseObjectInfo.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/DatabaseObjectInfo.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/DatabaseObjectInfo.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -21,8 +21,9 @@
import java.sql.SQLException;
import net.sourceforge.squirrel_sql.fw.dialects.DialectFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
+
public class DatabaseObjectInfo implements IDatabaseObjectInfo, Serializable
{
/** Property names for this bean. */
@@ -226,7 +227,7 @@
}
- if (StringUtilities.isEmpty(catSep))
+ if (StringUtils.isEmpty(catSep))
{
catSep = ".";
}
@@ -252,7 +253,7 @@
StringBuilder buf = new StringBuilder();
if (supportsCatalogsInDataManipulation
- && !StringUtilities.isEmpty(_catalog))
+ && !StringUtils.isEmpty(_catalog))
{
if (identifierQuoteString != null)
{
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/SQLConnection.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/SQLConnection.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/sql/SQLConnection.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -32,10 +32,11 @@
import net.sourceforge.squirrel_sql.fw.util.PropertyChangeReporter;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
+import org.apache.commons.lang.StringUtils;
+
/**
* This represents a connection to an SQL server. it is basically a wrapper around
* <TT>java.sql.Connection</TT>.
@@ -297,7 +298,7 @@
final Connection conn = getConnection();
final String oldValue = conn.getCatalog();
final DialectType dialectType = DialectFactory.getDialectType(metaData);
- if (!StringUtilities.areStringsEqual(oldValue, catalogName))
+ if (!StringUtils.equals(oldValue, catalogName))
{
setDbSpecificCatalog(dialectType, catalogName);
getPropertyChangeReporter().firePropertyChange(IPropertyNames.CATALOG, oldValue, catalogName);
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/StringUtilities.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/StringUtilities.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/StringUtilities.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -19,60 +19,21 @@
*/
import java.util.ArrayList;
import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
/**
* String handling utilities.
- *
+ *
+ * This class contains additional methods, that not exists in commons-lang from apache.
+ * Methods, that are identical to commons-lang are removed. e.g. {@link StringUtils#isEmpty(String)}.
+ * Some other methods (e.g. {@link #join(String[], String)} are still available, because they have a slightly different behavior as the methods in commons-lang.
+ *
+ * @see StringUtils
* @author <A HREF="mailto:co...@us...">Colin Bell</A>
*/
public class StringUtilities
{
/**
- * Return <tt>true</tt> if the passed string is <tt>null</tt> or empty.
- *
- * @param str String to be tested.
- *
- * @return <tt>true</tt> if the passed string is <tt>null</tt> or empty.
- */
- public static boolean isEmpty(String str)
- {
- return str == null || str.length() == 0;
- }
-
- /**
- * Return <tt>true</tt> if the passed string is <tt>null</tt> or empty or contains only blanks.
- *
- * @param str String to be tested.
- *
- * @return <tt>true</tt> if the passed string is <tt>null</tt> or empty or contains only blanks.
- */
- public static boolean isBlank(String str)
- {
- return isEmpty(str) || str.trim().length() == 0;
- }
-
-
- /**
- * Return whether the 2 passed strings are equal. This function
- * allows for <TT>null</TT> strings. If <TT>s1</TT> and <TT>s1</TT> are
- * both <TT>null</TT> they are considered equal.
- *
- * @param str1 First string to check.
- * @param str2 Second string to check.
- */
- public static boolean areStringsEqual(String str1, String str2)
- {
- if (str1 == null && str2 == null)
- {
- return true;
- }
- if (str1 != null)
- {
- return str1.equals(str2);
- }
- return str2.equals(str1);
- }
-
- /**
* Clean the passed string. Replace whitespace characters with a single
* space. If a <TT>null</TT> string passed return an empty string. E.G.
* replace
@@ -126,7 +87,7 @@
*/
public static int countOccurences(String str, int ch)
{
- if (isEmpty(str))
+ if (StringUtils.isEmpty(str))
{
return 0;
}
@@ -151,7 +112,8 @@
*
* @param str The string to be split.
* @param delimiter Split string based on this delimiter.
- *
+ * <p />
+ * <b>Not compatible to {@link StringUtils#split(String)}<b>
* @return Array of split strings. Guaranteeded to be not null.
*/
public static String[] split(String str, char delimiter)
@@ -166,7 +128,8 @@
* @param str The string to be split.
* @param delimiter Split string based on this delimiter.
* @param removeEmpty If <tt>true</tt> then remove empty elements.
- *
+ * <p />
+ * <b>Not compatible to {@link StringUtils#split(String)}<b>
* @return Array of split strings. Guaranteeded to be not null.
*/
public static String[] split(String str, char delimiter,
@@ -199,6 +162,8 @@
* Joins the specified parts separating each from one another with the
* specified delimiter. If delim is null, then this merely returns the
* concatenation of all the parts.
+ * <p />
+ * <b>Could not be replaced by {@link StringUtils#join(Object[], char)} because the handling of <code>null</code> as value is different<b>
*
* @param parts the strings to be joined
* @param delim the char(s) that should separate the parts in the result
@@ -283,7 +248,8 @@
/**
* Chops off the very last character of the given string.
- *
+ * <p />
+ * <b>Could not be replaced by {@link StringUtils#chop(String)} because the handling of <code>\r\n</code> are different<b>
* @param aString a string to chop
* @return the specified string minus it's last character, or null for null
* or empty string for a string with length == 0|1.
Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/Utilities.java
===================================================================
--- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/Utilities.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/util/Utilities.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -17,14 +17,22 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
-import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
-
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.text.NumberFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
+import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
+
/**
* General purpose utilities functions.
*
@@ -197,19 +205,6 @@
}
/**
- * Return whether the 2 passed strings are equal. This function
- * allows for <TT>null</TT> strings. If <TT>s1</TT> and <TT>s1</TT> are
- * both <TT>null</TT> they are considered equal.
- *
- * @deprecated Use <tt>StringUtilities.areStringsEqual(String, String)</tt>
- * instead.
- */
- public static boolean areStringsEqual(String s1, String s2)
- {
- return StringUtilities.areStringsEqual(s1, s2);
- }
-
- /**
* Return the suffix of the passed file name.
*
* @param fileName File name to retrieve suffix for.
@@ -274,19 +269,6 @@
return fileName;
}
- /**
- * Return <tt>true</tt> if the passed string is <tt>null</tt> or empty.
- *
- * @deprecated Use <tt>StringUtilities.isEmpty(String)</tt> instead.
- *
- * @param str String to be tested.
- *
- * @return <tt>true</tt> if the passed string is <tt>null</tt> or empty.
- */
- public static boolean isStringEmpty(String str)
- {
- return StringUtilities.isEmpty(str);
- }
public static String formatSize(long longSize)
{
Modified: trunk/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/util/StringUtilitiesTest.java
===================================================================
--- trunk/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/util/StringUtilitiesTest.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/fw/src/test/java/net/sourceforge/squirrel_sql/fw/util/StringUtilitiesTest.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -17,8 +17,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-import org.junit.Test;
-
import net.sourceforge.squirrel_sql.BaseSQuirreLTestCase;
public class StringUtilitiesTest extends BaseSQuirreLTestCase {
@@ -84,13 +82,5 @@
String afterChop = StringUtilities.chop(toChop);
assertEquals(expAfterChop, afterChop);
}
-
- @Test
- public void testBlank(){
- assertFalse(StringUtilities.isBlank("1"));
- assertTrue(StringUtilities.isBlank(null));
- assertTrue(StringUtilities.isBlank(""));
- assertTrue(StringUtilities.isBlank(" "));
- assertFalse(StringUtilities.isBlank(" 1 "));
- }
+
}
Modified: trunk/sql12/plugins/i18n/pom.xml
===================================================================
--- trunk/sql12/plugins/i18n/pom.xml 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/plugins/i18n/pom.xml 2011-04-20 19:54:58 UTC (rev 6240)
@@ -89,6 +89,10 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
</dependencies>
<properties>
<pluginClassName>net.sourceforge.squirrel_sql.plugins.i18n.I18nPlugin</pluginClassName>
Modified: trunk/sql12/plugins/i18n/src/main/java/net/sourceforge/squirrel_sql/plugins/i18n/TranslatorsController.java
===================================================================
--- trunk/sql12/plugins/i18n/src/main/java/net/sourceforge/squirrel_sql/plugins/i18n/TranslatorsController.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/plugins/i18n/src/main/java/net/sourceforge/squirrel_sql/plugins/i18n/TranslatorsController.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -29,10 +29,11 @@
import net.sourceforge.squirrel_sql.fw.util.LocaleUtils;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
+import org.apache.commons.lang.StringUtils;
+
public class TranslatorsController
{
private static final StringManager s_stringMgr =
@@ -719,7 +720,7 @@
*/
private boolean isTranslationPropertyFile(String filename)
{
- if (StringUtilities.isEmpty(filename))
+ if (StringUtils.isEmpty(filename))
{
return false;
}
Modified: trunk/sql12/plugins/pom.xml
===================================================================
--- trunk/sql12/plugins/pom.xml 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/plugins/pom.xml 2011-04-20 19:54:58 UTC (rev 6240)
@@ -99,6 +99,6 @@
<module>sybase</module>
<module>syntax</module>
<module>userscript</module>
- </modules>
+ </modules>
</project>
Modified: trunk/sql12/plugins/refactoring/pom.xml
===================================================================
--- trunk/sql12/plugins/refactoring/pom.xml 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/plugins/refactoring/pom.xml 2011-04-20 19:54:58 UTC (rev 6240)
@@ -89,6 +89,10 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
</dependencies>
<properties>
<pluginClassName>net.sourceforge.squirrel_sql.plugins.refactoring.RefactoringPlugin</pluginClassName>
Modified: trunk/sql12/plugins/refactoring/src/main/java/net/sourceforge/squirrel_sql/plugins/refactoring/DBUtil.java
===================================================================
--- trunk/sql12/plugins/refactoring/src/main/java/net/sourceforge/squirrel_sql/plugins/refactoring/DBUtil.java 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/plugins/refactoring/src/main/java/net/sourceforge/squirrel_sql/plugins/refactoring/DBUtil.java 2011-04-20 19:54:58 UTC (rev 6240)
@@ -27,8 +27,9 @@
import net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect;
import net.sourceforge.squirrel_sql.fw.dialects.SqlGenerationPreferences;
import net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo;
-import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
+import org.apache.commons.lang.StringUtils;
+
public class DBUtil
{
@@ -109,7 +110,7 @@
{
return null;
}
- if (StringUtilities.isEmpty(oldComment) && StringUtilities.isEmpty(newComment)) {
+ if (StringUtils.isEmpty(oldComment) && StringUtils.isEmpty(newComment)) {
return null;
}
if (oldComment == null || !oldComment.equals(newComment))
Modified: trunk/sql12/pom.xml
===================================================================
--- trunk/sql12/pom.xml 2011-04-20 05:08:41 UTC (rev 6239)
+++ trunk/sql12/pom.xml 2011-04-20 19:54:58 UTC (rev 6240)
@@ -149,6 +149,11 @@
<version>${fest-version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
</dependencies>
</dependencyManagement>
<build>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|