Author: damjan Date: Sun Sep 17 01:03:04 2017 New Revision: 1808599 URL: http://svn.apache.org/viewvc?rev=1808599&view=rev Log: There is no need to use Any.VOID when Java's null gets translated to it automatically.
Patch by: me Modified: openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SqlTableHelper.java openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DbTools.java Modified: openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java URL: http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java?rev=1808599&r1=1808598&r2=1808599&view=diff ============================================================================== --- openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java (original) +++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java Sun Sep 17 01:03:04 2017 @@ -31,7 +31,6 @@ import com.sun.star.sdbc.XRow; import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper; import com.sun.star.sdbcx.comp.postgresql.sdbcx.OCatalog; import com.sun.star.sdbcx.comp.postgresql.sdbcx.OContainer; -import com.sun.star.uno.Any; import com.sun.star.uno.UnoRuntime; public class PostgresqlCatalog extends OCatalog { @@ -44,7 +43,7 @@ public class PostgresqlCatalog extends O XResultSet results = null; try { // Using { "VIEW", "TABLE", "%" } shows INFORMATION_SCHEMA and others, but it also shows indexes :-( - results = metadata.getTables(Any.VOID, "%", "%", new String[] { "VIEW", "TABLE" }); + results = metadata.getTables(null, "%", "%", new String[] { "VIEW", "TABLE" }); XRow row = UnoRuntime.queryInterface(XRow.class, results); List<String> names = new ArrayList<>(); while (results.next()) { @@ -64,7 +63,7 @@ public class PostgresqlCatalog extends O public OContainer refreshViews() { XResultSet results = null; try { - results = metadata.getTables(Any.VOID, "%", "%", new String[] { "VIEW" }); + results = metadata.getTables(null, "%", "%", new String[] { "VIEW" }); XRow row = UnoRuntime.queryInterface(XRow.class, results); List<String> names = new ArrayList<>(); while (results.next()) { Modified: openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java URL: http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java?rev=1808599&r1=1808598&r2=1808599&view=diff ============================================================================== --- openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java (original) +++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java Sun Sep 17 01:03:04 2017 @@ -41,7 +41,6 @@ import com.sun.star.sdbcx.comp.postgresq import com.sun.star.sdbcx.comp.postgresql.util.DbTools.NameComponents; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.sdbcx.comp.postgresql.util.StandardSQLState; -import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; @@ -58,7 +57,7 @@ public class PostgresqlTables extends OC @Override public XPropertySet createObject(String name) throws SQLException { NameComponents nameComponents = DbTools.qualifiedNameComponents(metadata, name, ComposeRule.InDataManipulation); - Object queryCatalog = nameComponents.getCatalog().isEmpty() ? Any.VOID : nameComponents.getCatalog(); + Object queryCatalog = nameComponents.getCatalog().isEmpty() ? null : nameComponents.getCatalog(); XPropertySet ret = null; XResultSet results = null; try { Modified: openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SqlTableHelper.java URL: http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SqlTableHelper.java?rev=1808599&r1=1808598&r2=1808599&view=diff ============================================================================== --- openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SqlTableHelper.java (original) +++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SqlTableHelper.java Sun Sep 17 01:03:04 2017 @@ -39,7 +39,6 @@ import com.sun.star.sdbcx.comp.postgresq import com.sun.star.sdbcx.comp.postgresql.util.DbTools; import com.sun.star.sdbcx.comp.postgresql.util.Osl; import com.sun.star.sdbcx.comp.postgresql.util.StandardSQLState; -import com.sun.star.uno.Any; import com.sun.star.uno.UnoRuntime; public class SqlTableHelper { @@ -143,7 +142,7 @@ public class SqlTableHelper { private OKey readPrimaryKey(XDatabaseMetaData metadata, String catalogName, String schemaName, String tableName, boolean isCaseSensitive, OTable table) throws SQLException { - Object catalog = Any.VOID; + Object catalog = null; if (!catalogName.isEmpty()) { catalog = catalogName; } @@ -176,7 +175,7 @@ public class SqlTableHelper { private void readForeignKeys(XDatabaseMetaData metadata, String catalogName, String schemaName, String tableName, boolean isCaseSensitive, Map<String, OKey> keys, OTable table) throws SQLException { - Object catalog = Any.VOID; + Object catalog = null; if (!catalogName.isEmpty()) { catalog = catalogName; } @@ -233,7 +232,7 @@ public class SqlTableHelper { } public ArrayList<String> readIndexes(XDatabaseMetaData metadata, String catalogName, String schemaName, String tableName, OTable table) throws SQLException { - Object catalog = Any.VOID; + Object catalog = null; if (!catalogName.isEmpty()) { catalog = catalogName; } Modified: openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DbTools.java URL: http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DbTools.java?rev=1808599&r1=1808598&r2=1808599&view=diff ============================================================================== --- openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DbTools.java (original) +++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DbTools.java Sun Sep 17 01:03:04 2017 @@ -55,7 +55,6 @@ import com.sun.star.sdbcx.XColumnsSuppli import com.sun.star.sdbcx.XKeysSupplier; import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper; import com.sun.star.sdbcx.comp.postgresql.sdbcx.OColumnContainer.ExtraColumnInfo; -import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; @@ -302,7 +301,7 @@ public class DbTools { } return nameComponents; } catch (IllegalArgumentException | WrappedTargetException | UnknownPropertyException exception) { - throw new SQLException("Error", Any.VOID, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); + throw new SQLException("Error", null, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); } } @@ -444,7 +443,7 @@ public class DbTools { return String.format("CREATE TABLE %s (%s", composedName, columnText.toString()); } catch (IllegalArgumentException | WrappedTargetException | UnknownPropertyException | IndexOutOfBoundsException exception) { - throw new SQLException("Error", Any.VOID, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); + throw new SQLException("Error", null, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); } } @@ -567,7 +566,7 @@ public class DbTools { return sql.toString(); } catch (IllegalArgumentException | WrappedTargetException | UnknownPropertyException exception) { - throw new SQLException("Error", Any.VOID, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); + throw new SQLException("Error", null, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); } } @@ -646,7 +645,7 @@ public class DbTools { } return sql.toString(); } catch (IllegalArgumentException | WrappedTargetException | UnknownPropertyException | IndexOutOfBoundsException exception) { - throw new SQLException("Error", Any.VOID, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); + throw new SQLException("Error", null, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); } } @@ -706,7 +705,7 @@ public class DbTools { } return columns; } catch (IllegalArgumentException | WrappedTargetException | UnknownPropertyException | PropertyVetoException exception) { - throw new SQLException("Error", Any.VOID, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); + throw new SQLException("Error", null, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); } finally { CompHelper.disposeComponent(statement); } @@ -738,7 +737,7 @@ public class DbTools { } return keyColumns; } catch (IndexOutOfBoundsException | IllegalArgumentException | WrappedTargetException | UnknownPropertyException exception) { - throw new SQLException("Error", Any.VOID, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); + throw new SQLException("Error", null, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); } } @@ -755,7 +754,7 @@ public class DbTools { XPropertySet columnProperties = AnyConverter.toObject(XPropertySet.class, sourceColumns.getByIndex(i)); destinationAppend.appendByDescriptor(columnProperties); } catch (WrappedTargetException | IndexOutOfBoundsException | IllegalArgumentException | ElementExistException exception) { - throw new SQLException("Error", Any.VOID, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); + throw new SQLException("Error", null, StandardSQLState.SQL_GENERAL_ERROR.text(), 0, exception); } } }