Author: tolusha
Date: 2011-12-01 04:05:19 -0500 (Thu, 01 Dec 2011)
New Revision: 5250
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
Log:
EXOJCR-1662: Ensure using equalsIgnoreCase when checking database dialect
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2011-11-30
14:02:46 UTC (rev 5249)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2011-12-01
09:05:19 UTC (rev 5250)
@@ -270,7 +270,7 @@
ResultSet tableMetaData = null;
// switch table name to lower case
- if (dialect.equals(DBConstants.DB_DIALECT_PGSQL))
+ if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_PGSQL))
{
tableName = tableName.toLowerCase();
}
@@ -328,9 +328,8 @@
columnType.add(restoreRule.getNewColumnIndex(),
restoreRule.getNewColumnType());
String newColumnName =
- dialect.equals(DBConstants.DB_DIALECT_PGSQL) ?
restoreRule.getNewColumnName().toLowerCase()
- : restoreRule
- .getNewColumnName();
+ dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_PGSQL) ?
restoreRule.getNewColumnName().toLowerCase()
+ : restoreRule.getNewColumnName();
columnName.add(restoreRule.getNewColumnIndex(), newColumnName);
}
@@ -470,7 +469,7 @@
ba.read(readBuffer);
String value = new String(readBuffer);
- if (dialect.equals(DBConstants.DB_DIALECT_PGSQL))
+ if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_PGSQL))
{
insertNode.setBoolean(targetIndex + 1,
value.equalsIgnoreCase("t"));
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-11-30
14:02:46 UTC (rev 5249)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-12-01
09:05:19 UTC (rev 5250)
@@ -170,7 +170,8 @@
String dialect =
repoEntry.getWorkspaceEntries().get(0).getContainer()
.getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT,
DBConstants.DB_DIALECT_AUTO);
- if (DBConstants.DB_DIALECT_GENERIC.equals(dialect) ||
DBConstants.DB_DIALECT_AUTO.equalsIgnoreCase(dialect))
+ if (DBConstants.DB_DIALECT_GENERIC.equalsIgnoreCase(dialect)
+ || DBConstants.DB_DIALECT_AUTO.equalsIgnoreCase(dialect))
{
dialect = DialectDetecter.detect(jdbcConn.getMetaData());
}
@@ -840,7 +841,8 @@
String dialect =
wsEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT,
DBConstants.DB_DIALECT_AUTO);
- if (DBConstants.DB_DIALECT_GENERIC.equals(dialect) ||
DBConstants.DB_DIALECT_AUTO.equalsIgnoreCase(dialect))
+ if (DBConstants.DB_DIALECT_GENERIC.equalsIgnoreCase(dialect)
+ || DBConstants.DB_DIALECT_AUTO.equalsIgnoreCase(dialect))
{
dialect = DialectDetecter.detect(jdbcConn.getMetaData());
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2011-11-30
14:02:46 UTC (rev 5249)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2011-12-01
09:05:19 UTC (rev 5250)
@@ -277,40 +277,43 @@
String charType = "VARCHAR(512)";
String timeStampType = "BIGINT";
// HSSQL
- if (dialect.equals(DBConstants.DB_DIALECT_HSQLDB))
+ if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_HSQLDB))
{
blobType = "VARBINARY(65535)";
}
// MYSQL
- else if (dialect.equals(DBConstants.DB_DIALECT_MYSQL) ||
dialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8) ||
- dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM) ||
dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
blobType = "LONGBLOB";
}
// ORACLE
- else if (dialect.equals(DBConstants.DB_DIALECT_ORACLE) ||
dialect.equals(DBConstants.DB_DIALECT_ORACLEOCI))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLE)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLEOCI))
{
// Oracle suggests the use VARCHAR2 instead of VARCHAR while declaring data
type.
charType = "VARCHAR2(512)";
timeStampType = "NUMBER(19, 0)";
}
// POSTGRE SQL
- else if (dialect.equals(DBConstants.DB_DIALECT_PGSQL))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_PGSQL))
{
blobType = "bytea";
}
// Microsoft SQL
- else if (dialect.equals(DBConstants.DB_DIALECT_MSSQL))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MSSQL))
{
blobType = "VARBINARY(MAX)";
}
// SYBASE
- else if (dialect.equals(DBConstants.DB_DIALECT_SYBASE))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_SYBASE))
{
blobType = "IMAGE";
}
// INGRES
- else if (dialect.equals(DBConstants.DB_DIALECT_INGRES))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_INGRES))
{
blobType = "long byte";
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2011-11-30
14:02:46 UTC (rev 5249)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2011-12-01
09:05:19 UTC (rev 5250)
@@ -379,39 +379,42 @@
String blobType = "BLOB";
String charType = "VARCHAR(512)";
// HSSQL
- if (dialect.equals(DBConstants.DB_DIALECT_HSQLDB))
+ if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_HSQLDB))
{
blobType = "VARBINARY(65535)";
}
// MYSQL
- else if (dialect.equals(DBConstants.DB_DIALECT_MYSQL) ||
dialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8) ||
- dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM) ||
dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
blobType = "LONGBLOB";
}
// ORACLE
- else if (dialect.equals(DBConstants.DB_DIALECT_ORACLE) ||
dialect.equals(DBConstants.DB_DIALECT_ORACLEOCI))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLE)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLEOCI))
{
// Oracle suggests the use VARCHAR2 instead of VARCHAR while declaring data
type.
charType = "VARCHAR2(512)";
}
// POSTGRE SQL
- else if (dialect.equals(DBConstants.DB_DIALECT_PGSQL))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_PGSQL))
{
blobType = "bytea";
}
// Microsoft SQL
- else if (dialect.equals(DBConstants.DB_DIALECT_MSSQL))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MSSQL))
{
blobType = "VARBINARY(MAX)";
}
// SYBASE
- else if (dialect.equals(DBConstants.DB_DIALECT_SYBASE))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_SYBASE))
{
blobType = "IMAGE";
}
// INGRES
- else if (dialect.equals(DBConstants.DB_DIALECT_INGRES))
+ else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_INGRES))
{
blobType = "long byte";
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-11-30
14:02:46 UTC (rev 5249)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-12-01
09:05:19 UTC (rev 5250)
@@ -318,7 +318,7 @@
this.isManaged = false;
LOG.info("Connect to JCR database as user '" + this.dbUserName +
"'");
- if (DBConstants.DB_DIALECT_GENERIC.equals(pDbDialect)
+ if (DBConstants.DB_DIALECT_GENERIC.equalsIgnoreCase(pDbDialect)
|| DBConstants.DB_DIALECT_AUTO.equalsIgnoreCase(pDbDialect))
{
// try to detect via JDBC metadata
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2011-11-30
14:02:46 UTC (rev 5249)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2011-12-01
09:05:19 UTC (rev 5250)
@@ -159,13 +159,17 @@
// The differences in the queries by DB dialect.
// Oracle doesn't work correct with default query because empty value stored as
null value.
String statement;
- if (jdbcDataContainer.dbDialect.equals(DBConstants.DB_DIALECT_SYBASE)) {
+ if (jdbcDataContainer.dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_SYBASE))
+ {
statement = jdbcDataContainer.multiDb
? "select * from JCR_MVALUE where (STORAGE_DESC is null and DATA like
null) or (STORAGE_DESC is not null and not DATA like null)"
: "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID
and I.CONTAINER_NAME='"
+ jdbcDataContainer.containerName
+ "' AND ((STORAGE_DESC is null and DATA like null) or
(STORAGE_DESC is not null and not DATA like null))";
- } else if (jdbcDataContainer.dbDialect.equals(DBConstants.DB_DIALECT_ORACLE) ||
jdbcDataContainer.dbDialect.equals(DBConstants.DB_DIALECT_ORACLEOCI)) {
+ }
+ else if
(jdbcDataContainer.dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLE)
+ ||
jdbcDataContainer.dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLEOCI))
+ {
statement = jdbcDataContainer.multiDb
? "select * from JCR_MVALUE where (STORAGE_DESC is not null and DATA is not
null)"
: "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID and
I.CONTAINER_NAME='"