diff options
Diffstat (limited to 'connectivity')
12 files changed, 60 insertions, 59 deletions
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries.java index 42781d4a425a..db3d5f185ff8 100644 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries.java +++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries.java @@ -49,14 +49,14 @@ final class NativeLibraries { if (url != null) { try { System.load( - ((File) File.class.getConstructor( + File.class.getConstructor( new Class[] { ClassLoader.getSystemClassLoader(). loadClass("java.net.URI") }). newInstance( new Object[] { URL.class.getMethod("toURI", new Class[0]). - invoke(url, (java.lang.Object[])null) })). + invoke(url, (java.lang.Object[])null) }). getAbsolutePath()); } catch (Throwable t) { throw new UnsatisfiedLinkError( diff --git a/connectivity/qa/complex/connectivity/FlatFileAccess.java b/connectivity/qa/complex/connectivity/FlatFileAccess.java index 24faee4e80f4..ab7716ace303 100644 --- a/connectivity/qa/complex/connectivity/FlatFileAccess.java +++ b/connectivity/qa/complex/connectivity/FlatFileAccess.java @@ -224,6 +224,7 @@ public class FlatFileAccess extends ComplexTestCase } } + @SuppressWarnings("unchecked") private <T> void testRowSetResults( String i_command, RowSetValueGetter i_getter, T[] i_expectedValues, String i_context, String i_failureDesc ) { diff --git a/connectivity/qa/complex/connectivity/HsqlDriverTest.java b/connectivity/qa/complex/connectivity/HsqlDriverTest.java index 9bfbb02b9f4f..02892c5e84b6 100644 --- a/connectivity/qa/complex/connectivity/HsqlDriverTest.java +++ b/connectivity/qa/complex/connectivity/HsqlDriverTest.java @@ -63,7 +63,7 @@ public class HsqlDriverTest extends ComplexTestCase { } try{ - XDocumentSubStorageSupplier doc = (XDocumentSubStorageSupplier)UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class,ds); + XDocumentSubStorageSupplier doc = UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class,ds); XStorage stor = doc.getDocumentSubStorage("database",4); try{ if ( stor.isStreamElement("db.log") ) @@ -81,9 +81,9 @@ public class HsqlDriverTest extends ComplexTestCase { if ( stor.isStreamElement("db.script.new") ) stor.removeElement("db.script.new"); } catch(Exception e){} - XStorable mod = (XStorable)UnoRuntime.queryInterface(XStorable.class,ds); + XStorable mod = UnoRuntime.queryInterface(XStorable.class,ds); mod.store(); - XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class,stor); + XComponent xComp = UnoRuntime.queryInterface(XComponent.class,stor); if ( xComp != null ) xComp.dispose(); } catch(Exception e){} @@ -91,14 +91,14 @@ public class HsqlDriverTest extends ComplexTestCase { com.sun.star.beans.PropertyValue[] info = null; XDriver drv = null; try{ - XDocumentSubStorageSupplier doc = (XDocumentSubStorageSupplier)UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class,ds); - XModel mod = (XModel)UnoRuntime.queryInterface(XModel.class,ds); + XDocumentSubStorageSupplier doc = UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class,ds); + XModel mod = UnoRuntime.queryInterface(XModel.class,ds); XStorage stor = doc.getDocumentSubStorage("database",4); info = new com.sun.star.beans.PropertyValue[]{ new com.sun.star.beans.PropertyValue("Storage",0,stor,PropertyState.DIRECT_VALUE) ,new com.sun.star.beans.PropertyValue("URL",0,mod.getURL(),PropertyState.DIRECT_VALUE) }; - drv = (XDriver)UnoRuntime.queryInterface(XDriver.class,((XMultiServiceFactory)param.getMSF()).createInstance("com.sun.star.sdbcx.comp.hsqldb.Driver")); + drv = UnoRuntime.queryInterface(XDriver.class,((XMultiServiceFactory)param.getMSF()).createInstance("com.sun.star.sdbcx.comp.hsqldb.Driver")); TestCacheSize test = new TestCacheSize(((XMultiServiceFactory)param.getMSF()),info,drv); @@ -114,7 +114,7 @@ public class HsqlDriverTest extends ComplexTestCase { } catch(Exception e){} try{ - XStorable mod2 = (XStorable)UnoRuntime.queryInterface(XStorable.class,ds); + XStorable mod2 = UnoRuntime.queryInterface(XStorable.class,ds); mod2.store(); } catch(Exception e){} }catch(Exception e){} @@ -129,7 +129,7 @@ public class HsqlDriverTest extends ComplexTestCase { new com.sun.star.beans.PropertyValue("JavaDriverClass",0,"org.hsqldb.jdbcDriver",PropertyState.DIRECT_VALUE) ,new com.sun.star.beans.PropertyValue("ParameterNameSubstitution",0, false,PropertyState.DIRECT_VALUE) }; - drv = (XDriver)UnoRuntime.queryInterface(XDriver.class,((XMultiServiceFactory)param.getMSF()).createInstance("com.sun.star.comp.sdbc.JDBCDriver")); + drv = UnoRuntime.queryInterface(XDriver.class,((XMultiServiceFactory)param.getMSF()).createInstance("com.sun.star.comp.sdbc.JDBCDriver")); TestCacheSize test = new TestCacheSize(((XMultiServiceFactory)param.getMSF()),info,drv); test.setURL("jdbc:hsqldb:g:\\hsql\\db"); diff --git a/connectivity/qa/complex/connectivity/JdbcLongVarCharTest.java b/connectivity/qa/complex/connectivity/JdbcLongVarCharTest.java index 02dad0acdb69..7bc75d94b466 100644 --- a/connectivity/qa/complex/connectivity/JdbcLongVarCharTest.java +++ b/connectivity/qa/complex/connectivity/JdbcLongVarCharTest.java @@ -66,18 +66,18 @@ public class JdbcLongVarCharTest extends ComplexTestCase // get the remote office component context XMultiServiceFactory xServiceManager = (XMultiServiceFactory) param.getMSF(); Object x = xServiceManager.createInstance("com.sun.star.sdbc.DriverManager"); - com.sun.star.sdbc.XDriverAccess xDriverAccess = (XDriverAccess) UnoRuntime.queryInterface(XDriverAccess.class, x); + com.sun.star.sdbc.XDriverAccess xDriverAccess = UnoRuntime.queryInterface(XDriverAccess.class, x); com.sun.star.sdbc.XDriver xDriver = xDriverAccess.getDriverByURL(url); xConnection = xDriver.connect(url, prop); //Object prepStmnt = xConnection.prepareStatement("SELECT * FROM t1 WHERE t1.c1 = ?"); Object prepStmnt = xConnection.prepareStatement("SELECT * FROM i90114 WHERE i90114.c1 = ?"); - ((XParameters) UnoRuntime.queryInterface(XParameters.class, prepStmnt)).clearParameters(); - ((XParameters) UnoRuntime.queryInterface(XParameters.class, prepStmnt)).setInt(1, 1); + UnoRuntime.queryInterface(XParameters.class, prepStmnt).clearParameters(); + UnoRuntime.queryInterface(XParameters.class, prepStmnt).setInt(1, 1); XResultSet xResultSet = ((XPreparedStatement) prepStmnt).executeQuery(); - XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); + XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet); - XResultSetMetaDataSupplier xRsMetaSup = (XResultSetMetaDataSupplier) UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, xResultSet); + XResultSetMetaDataSupplier xRsMetaSup = UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, xResultSet); XResultSetMetaData xRsMetaData = xRsMetaSup.getMetaData(); int nColumnCount = xRsMetaData.getColumnCount(); diff --git a/connectivity/qa/complex/connectivity/dbase/DBaseDateFunctions.java b/connectivity/qa/complex/connectivity/dbase/DBaseDateFunctions.java index 7173a59aeaf7..471cf8a8c9c3 100644 --- a/connectivity/qa/complex/connectivity/dbase/DBaseDateFunctions.java +++ b/connectivity/qa/complex/connectivity/dbase/DBaseDateFunctions.java @@ -39,12 +39,12 @@ public class DBaseDateFunctions extends SubTestCase public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException { - final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, + final XRowSet xRowRes = UnoRuntime.queryInterface(XRowSet.class, m_xORB.createInstance("com.sun.star.sdb.RowSet")); getLog().println("starting DateTime function test!"); // set the properties needed to connect to a database - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("DataSourceName", "Bibliography"); xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND)); @@ -188,13 +188,13 @@ public class DBaseDateFunctions extends SubTestCase private XRow execute(final XRowSet xRowRes, final String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException { - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("Command", "SELECT " + sql + where); xRowRes.execute(); - final XResultSet xRes = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, xRowRes); + final XResultSet xRes = UnoRuntime.queryInterface(XResultSet.class, xRowRes); assure("No valid row! ", xRes.next()); - return (XRow) UnoRuntime.queryInterface(XRow.class, xRes); + return UnoRuntime.queryInterface(XRow.class, xRes); } private void dayofweek(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException diff --git a/connectivity/qa/complex/connectivity/dbase/DBaseNumericFunctions.java b/connectivity/qa/complex/connectivity/dbase/DBaseNumericFunctions.java index ebee9f2ac29d..178c33f7093f 100644 --- a/connectivity/qa/complex/connectivity/dbase/DBaseNumericFunctions.java +++ b/connectivity/qa/complex/connectivity/dbase/DBaseNumericFunctions.java @@ -38,12 +38,12 @@ public class DBaseNumericFunctions extends SubTestCase public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException { - final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, + final XRowSet xRowRes = UnoRuntime.queryInterface(XRowSet.class, m_xORB.createInstance("com.sun.star.sdb.RowSet")); getLog().println("starting Numeric function test"); // set the properties needed to connect to a database - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("DataSourceName", "Bibliography"); xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND)); @@ -242,13 +242,13 @@ public class DBaseNumericFunctions extends SubTestCase private XRow execute(final XRowSet xRowRes,final String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException { - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("Command", "SELECT " + sql + where); xRowRes.execute(); - final XResultSet xRes = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, xRowRes); + final XResultSet xRes = UnoRuntime.queryInterface(XResultSet.class, xRowRes); assure("No valid row! ", xRes.next()); - return (XRow) UnoRuntime.queryInterface(XRow.class, xRes); + return UnoRuntime.queryInterface(XRow.class, xRes); } private void abs(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException diff --git a/connectivity/qa/complex/connectivity/dbase/DBaseSqlTests.java b/connectivity/qa/complex/connectivity/dbase/DBaseSqlTests.java index a7d0043f4f5f..8ff5cc48ee84 100644 --- a/connectivity/qa/complex/connectivity/dbase/DBaseSqlTests.java +++ b/connectivity/qa/complex/connectivity/dbase/DBaseSqlTests.java @@ -36,12 +36,12 @@ public class DBaseSqlTests extends SubTestCase public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException { - final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, + final XRowSet xRowRes = UnoRuntime.queryInterface(XRowSet.class, m_xORB.createInstance("com.sun.star.sdb.RowSet")); getLog().println("starting SQL test"); // set the properties needed to connect to a database - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("DataSourceName", "Bibliography"); xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND)); @@ -69,7 +69,7 @@ public class DBaseSqlTests extends SubTestCase { try { - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("Command", "SELECT " + sql); xRowRes.execute(); } diff --git a/connectivity/qa/complex/connectivity/dbase/DBaseStringFunctions.java b/connectivity/qa/complex/connectivity/dbase/DBaseStringFunctions.java index 3d4e9c273394..d131e2aafb49 100644 --- a/connectivity/qa/complex/connectivity/dbase/DBaseStringFunctions.java +++ b/connectivity/qa/complex/connectivity/dbase/DBaseStringFunctions.java @@ -37,12 +37,12 @@ public class DBaseStringFunctions extends SubTestCase public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException { - final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, + final XRowSet xRowRes = UnoRuntime.queryInterface(XRowSet.class, m_xORB.createInstance("com.sun.star.sdb.RowSet")); getLog().println("starting String function test"); // set the properties needed to connect to a database - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("DataSourceName", "Bibliography"); xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND)); @@ -195,13 +195,13 @@ public class DBaseStringFunctions extends SubTestCase private XRow execute(final XRowSet xRowRes, String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException { - final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes); + final XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, xRowRes); xProp.setPropertyValue("Command", "SELECT " + sql + where); xRowRes.execute(); - final XResultSet xRes = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, xRowRes); + final XResultSet xRes = UnoRuntime.queryInterface(XResultSet.class, xRowRes); assure("No valid row! ", xRes.next()); - return (XRow) UnoRuntime.queryInterface(XRow.class, xRes); + return UnoRuntime.queryInterface(XRow.class, xRes); } private void upper(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException diff --git a/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java b/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java index ea01fbecadf0..a07b0e5d0c3b 100644 --- a/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java +++ b/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java @@ -47,7 +47,7 @@ public class DatabaseMetaData { m_TestCase.assurePublic(_sText,btest); } - protected void testMethod(String sName,Class[] params,Object[] objParams,int nCount){ + protected void testMethod(String sName,Class<?>[] params,Object[] objParams,int nCount){ try { System.out.println("test method " + sName); diff --git a/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java b/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java index 6d2c4a4798d6..3fd7388368fe 100644 --- a/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java +++ b/connectivity/qa/complex/connectivity/hsqldb/TestCacheSize.java @@ -293,7 +293,7 @@ public class TestCacheSize { XPreparedStatement ps = cConnection.prepareStatement( "INSERT INTO test (firstname,lastname,zip,filler) VALUES (?,?,?,?)"); - XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,ps); + XParameters para = UnoRuntime.queryInterface(XParameters.class,ps); para.setString(1, "Julia"); para.setString(2, "Clancy"); @@ -322,12 +322,12 @@ public class TestCacheSize { && i % deleteWhileInsertInterval == 0) { sStatement.execute("CALL IDENTITY();"); - XMultipleResults mrs = (XMultipleResults)UnoRuntime.queryInterface(XMultipleResults.class,sStatement); + XMultipleResults mrs = UnoRuntime.queryInterface(XMultipleResults.class,sStatement); XResultSet rs = mrs.getResultSet(); rs.next(); - XRow row = (XRow)UnoRuntime.queryInterface(XRow.class,rs); + XRow row = UnoRuntime.queryInterface(XRow.class,rs); int lastId = row.getInt(1); sStatement.execute( @@ -356,7 +356,7 @@ public class TestCacheSize { XPreparedStatement ps = cConnection.prepareStatement( "INSERT INTO test2 (id1, id2, firstname,lastname,zip,filler) VALUES (?,?,?,?,?,?)"); - XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,ps); + XParameters para = UnoRuntime.queryInterface(XParameters.class,ps); para.setString(3, "Julia"); para.setString(4, "Clancy"); @@ -422,9 +422,9 @@ public class TestCacheSize { // use primary index sStatement.execute("SELECT count(*) from TEST"); - XMultipleResults mrs = (XMultipleResults)UnoRuntime.queryInterface(XMultipleResults.class,sStatement); + XMultipleResults mrs = UnoRuntime.queryInterface(XMultipleResults.class,sStatement); rs = mrs.getResultSet(); - XRow row = (XRow)UnoRuntime.queryInterface(XRow.class,rs); + XRow row = UnoRuntime.queryInterface(XRow.class,rs); rs.next(); System.out.println("Row Count: " + row.getInt(1)); @@ -474,7 +474,7 @@ public class TestCacheSize { try { XPreparedStatement ps = cConnection.prepareStatement( "SELECT TOP 1 firstname,lastname,zip,filler FROM test WHERE zip = ?"); - XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,ps); + XParameters para = UnoRuntime.queryInterface(XParameters.class,ps); for (; i < bigrows; i++) { para.setInt(1, randomgen.nextInt(smallrows)); @@ -503,7 +503,7 @@ public class TestCacheSize { try { XPreparedStatement ps = cConnection.prepareStatement( "SELECT firstname,lastname,zip,filler FROM test WHERE id = ?"); - XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,ps); + XParameters para = UnoRuntime.queryInterface(XParameters.class,ps); for (i = 0; i < bigrows; i++) { para.setInt(1, randomgen.nextInt(bigrows - 1)); @@ -527,7 +527,7 @@ public class TestCacheSize { try { XPreparedStatement ps = cConnection.prepareStatement( "SELECT zip FROM zip WHERE zip = ?"); - XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,ps); + XParameters para = UnoRuntime.queryInterface(XParameters.class,ps); for (i = 0; i < bigrows; i++) { para.setInt(1, randomgen.nextInt(smallrows - 1)); @@ -559,7 +559,7 @@ public class TestCacheSize { try { XPreparedStatement ps = cConnection.prepareStatement( "UPDATE test SET filler = filler || zip WHERE zip = ?"); - XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,ps); + XParameters para = UnoRuntime.queryInterface(XParameters.class,ps); for (; i < smallrows; i++) { int random = randomgen.nextInt(smallrows - 1); @@ -586,7 +586,7 @@ public class TestCacheSize { try { XPreparedStatement ps = cConnection.prepareStatement( "UPDATE test SET zip = zip + 1 WHERE id = ?"); - XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,ps); + XParameters para = UnoRuntime.queryInterface(XParameters.class,ps); for (i = 0; i < bigrows; i++) { int random = randomgen.nextInt(bigrows - 1); diff --git a/connectivity/qa/connectivity/tools/HsqlDatabase.java b/connectivity/qa/connectivity/tools/HsqlDatabase.java index 06f78464a4ca..f2ad47b65669 100644 --- a/connectivity/qa/connectivity/tools/HsqlDatabase.java +++ b/connectivity/qa/connectivity/tools/HsqlDatabase.java @@ -64,14 +64,14 @@ public class HsqlDatabase extends AbstractDatabase documentFile.delete(); m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath(documentFile); - m_databaseDocument = (XOfficeDatabaseDocument) UnoRuntime.queryInterface( + m_databaseDocument = UnoRuntime.queryInterface( XOfficeDatabaseDocument.class, m_orb.createInstance("com.sun.star.sdb.OfficeDatabaseDocument")); m_dataSource = new DataSource(m_orb, m_databaseDocument.getDataSource()); - final XPropertySet dsProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_databaseDocument.getDataSource()); + final XPropertySet dsProperties = UnoRuntime.queryInterface(XPropertySet.class, m_databaseDocument.getDataSource()); dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb"); - final XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, m_databaseDocument); + final XStorable storable = UnoRuntime.queryInterface(XStorable.class, m_databaseDocument); storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[] { new PropertyValue( "PickListEntry", 0, false, PropertyState.DIRECT_VALUE ) } ); @@ -114,8 +114,8 @@ public class HsqlDatabase extends AbstractDatabase String primaryKeyList = ""; - final HashMap foreignKeys = new HashMap(); - final HashMap foreignKeyRefs = new HashMap(); + final HashMap<String, String> foreignKeys = new HashMap<String, String>(); + final HashMap<String, String> foreignKeyRefs = new HashMap<String, String>(); final HsqlColumnDescriptor[] columns = _tableDesc.getColumns(); for (int i = 0; i < columns.length; ++i) @@ -146,7 +146,7 @@ public class HsqlDatabase extends AbstractDatabase { final String foreignTable = columns[i].getForeignTable(); - String foreignKeysForTable = foreignKeys.containsKey(foreignTable) ? (String) foreignKeys.get(foreignTable) : ""; + String foreignKeysForTable = foreignKeys.containsKey(foreignTable) ? foreignKeys.get(foreignTable) : ""; if (foreignKeysForTable.length() > 0) { foreignKeysForTable += ", "; @@ -154,7 +154,7 @@ public class HsqlDatabase extends AbstractDatabase foreignKeysForTable += "\"" + columns[i].getName() + "\""; foreignKeys.put(foreignTable, foreignKeysForTable); - final StringBuffer foreignKeyRefsForTable = new StringBuffer(foreignKeyRefs.containsKey(foreignTable) ? (String) foreignKeyRefs.get(foreignTable) : ""); + final StringBuffer foreignKeyRefsForTable = new StringBuffer(foreignKeyRefs.containsKey(foreignTable) ? foreignKeyRefs.get(foreignTable) : ""); if (foreignKeyRefsForTable.length() > 0) { foreignKeyRefsForTable.append(", "); @@ -171,18 +171,18 @@ public class HsqlDatabase extends AbstractDatabase createStatement.append(')'); } - final Set foreignKeyTables = foreignKeys.keySet(); - for (final Iterator foreignKey = foreignKeyTables.iterator(); + final Set<String> foreignKeyTables = foreignKeys.keySet(); + for (final Iterator<String> foreignKey = foreignKeyTables.iterator(); foreignKey.hasNext();) { - final String foreignTable = (String) foreignKey.next(); + final String foreignTable = foreignKey.next(); createStatement.append(", FOREIGN KEY ("); - createStatement.append((String) foreignKeys.get(foreignTable)); + createStatement.append(foreignKeys.get(foreignTable)); createStatement.append(") REFERENCES \""); createStatement.append(foreignTable); createStatement.append("\"("); - createStatement.append((String) foreignKeyRefs.get(foreignTable)); + createStatement.append(foreignKeyRefs.get(foreignTable)); createStatement.append(')'); } diff --git a/connectivity/qa/connectivity/tools/RowSet.java b/connectivity/qa/connectivity/tools/RowSet.java index 752e5cff7b25..1a862f4f8b62 100644 --- a/connectivity/qa/connectivity/tools/RowSet.java +++ b/connectivity/qa/connectivity/tools/RowSet.java @@ -66,9 +66,9 @@ public class RowSet implements XRowSet, XRow // misc public int getColumnCount() { - XColumnsSupplier suppCols = (XColumnsSupplier)UnoRuntime.queryInterface( + XColumnsSupplier suppCols = UnoRuntime.queryInterface( XColumnsSupplier.class, m_rowSet ); - XIndexAccess columns = (XIndexAccess)UnoRuntime.queryInterface( + XIndexAccess columns = UnoRuntime.queryInterface( XIndexAccess.class, suppCols.getColumns() ); return columns.getCount(); } |