diff --git a/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/JdbcModelReader.java b/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/JdbcModelReader.java index 63e98adf4d..f13010a0d2 100644 --- a/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/JdbcModelReader.java +++ b/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/JdbcModelReader.java @@ -63,20 +63,20 @@ public class JdbcModelReader private final Log _log = LogFactory.getLog(JdbcModelReader.class); /** The descriptors for the relevant columns in the table meta data. */ - private final List _columnsForTable; + private final List _columnsForTable; /** The descriptors for the relevant columns in the table column meta data. */ - private final List _columnsForColumn; + private final List _columnsForColumn; /** The descriptors for the relevant columns in the primary key meta data. */ - private final List _columnsForPK; + private final List _columnsForPK; /** The descriptors for the relevant columns in the foreign key meta data. */ - private final List _columnsForFK; + private final List _columnsForFK; /** The descriptors for the relevant columns in the index meta data. */ - private final List _columnsForIndex; + private final List _columnsForIndex; /** The platform that this model reader belongs to. */ private Platform _platform; /** Contains default column sizes (minimum sizes that a JDBC-compliant db must support). */ - private HashMap _defaultSizes = new HashMap(); + private HashMap _defaultSizes = new HashMap(); /** The default database catalog to read. */ private String _defaultCatalogPattern = "%"; /** The default database schema(s) to read. */ @@ -148,9 +148,9 @@ public PlatformInfo getPlatformInfo() * * @return The descriptors for the result set columns */ - protected List initColumnsForTable() + protected List initColumnsForTable() { - List result = new ArrayList(); + List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("TABLE_TYPE", Types.VARCHAR, "UNKNOWN")); @@ -169,9 +169,9 @@ protected List initColumnsForTable() * * @return The map column name -> descriptor for the result set columns */ - protected List initColumnsForColumn() + protected List initColumnsForColumn() { - List result = new ArrayList(); + List result = new ArrayList(); // As suggested by Alexandre Borgoltz, we're reading the COLUMN_DEF first because Oracle // has problems otherwise (it seemingly requires a LONG column to be the first to be read) @@ -198,9 +198,9 @@ protected List initColumnsForColumn() * * @return The map column name -> descriptor for the result set columns */ - protected List initColumnsForPK() + protected List initColumnsForPK() { - List result = new ArrayList(); + List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); // we're also reading the table name so that a model reader impl can filter manually @@ -219,9 +219,9 @@ protected List initColumnsForPK() * * @return The map column name -> descriptor for the result set columns */ - protected List initColumnsForFK() + protected List initColumnsForFK() { - List result = new ArrayList(); + List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("PKTABLE_NAME", Types.VARCHAR)); // we're also reading the table name so that a model reader impl can filter manually @@ -242,9 +242,9 @@ protected List initColumnsForFK() * * @return The map column name -> descriptor for the result set columns */ - protected List initColumnsForIndex() + protected List initColumnsForIndex() { - List result = new ArrayList(); + List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("INDEX_NAME", Types.VARCHAR)); // we're also reading the table name so that a model reader impl can filter manually @@ -363,7 +363,7 @@ public void setDefaultTableTypes(String[] types) * * @return The column descriptors */ - protected List getColumnsForTable() + protected List getColumnsForTable() { return _columnsForTable; } @@ -373,7 +373,7 @@ protected List getColumnsForTable() * * @return The column descriptors */ - protected List getColumnsForColumn() + protected List getColumnsForColumn() { return _columnsForColumn; } @@ -383,7 +383,7 @@ protected List getColumnsForColumn() * * @return The column descriptors */ - protected List getColumnsForPK() + protected List getColumnsForPK() { return _columnsForPK; } @@ -393,7 +393,7 @@ protected List getColumnsForPK() * * @return The column descriptors */ - protected List getColumnsForFK() + protected List getColumnsForFK() { return _columnsForFK; } @@ -403,7 +403,7 @@ protected List getColumnsForFK() * * @return The column descriptors */ - protected List getColumnsForIndex() + protected List getColumnsForIndex() { return _columnsForIndex; } @@ -493,7 +493,7 @@ public Database getDatabase(Connection connection, String name, String catalog, * @param tableTypes The table types to process; use null or an empty list for the default ones * @return The tables */ - protected Collection readTables(String catalog, String schemaPattern, String[] tableTypes) throws SQLException + protected Collection readTables(String catalog, String schemaPattern, String[] tableTypes) throws SQLException { ResultSet tableData = null; @@ -508,11 +508,11 @@ protected Collection readTables(String catalog, String schemaPattern, String[] t tableData = metaData.getTables(getDefaultTablePattern()); - List tables = new ArrayList(); + List
tables = new ArrayList
(); while (tableData.next()) { - Map values = readColumns(tableData, getColumnsForTable()); + Map values = readColumns(tableData, getColumnsForTable()); Table table = readTable(metaData, values); if (table != null) @@ -523,10 +523,10 @@ protected Collection readTables(String catalog, String schemaPattern, String[] t final Collator collator = Collator.getInstance(); - Collections.sort(tables, new Comparator() { - public int compare(Object obj1, Object obj2) + Collections.sort(tables, new Comparator
() { + public int compare(Table obj1, Table obj2) { - return collator.compare(((Table)obj1).getName().toUpperCase(), ((Table)obj2).getName().toUpperCase()); + return collator.compare(obj1.getName().toUpperCase(), obj2.getName().toUpperCase()); } }); return tables; @@ -547,7 +547,7 @@ public int compare(Object obj1, Object obj2) * @param values The table metadata values as defined by {@link #getColumnsForTable()} * @return The table or null if the result set row did not contain a valid table */ - protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException + protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException { String tableName = (String)values.get("TABLE_NAME"); Table table = null; @@ -809,9 +809,9 @@ protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws * @param tableName The name of the table from which to retrieve PK information * @return The primary key column names */ - protected Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException + protected Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException { - List pks = new ArrayList(); + List pks = new ArrayList(); ResultSet pkData = null; try @@ -819,7 +819,7 @@ protected Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, Strin pkData = metaData.getPrimaryKeys(tableName); while (pkData.next()) { - Map values = readColumns(pkData, getColumnsForPK()); + Map values = readColumns(pkData, getColumnsForPK()); pks.add(readPrimaryKeyName(metaData, values)); } @@ -853,9 +853,9 @@ protected String readPrimaryKeyName(DatabaseMetaDataWrapper metaData, Map values * @param tableName The name of the table from which to retrieve FK information * @return The foreign keys */ - protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException + protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException { - Map fks = new ListOrderedMap(); + Map fks = new ListOrderedMap(); ResultSet fkData = null; try @@ -864,7 +864,7 @@ protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String ta while (fkData.next()) { - Map values = readColumns(fkData, getColumnsForFK()); + Map values = readColumns(fkData, getColumnsForFK()); readForeignKey(metaData, values, fks); } @@ -998,13 +998,13 @@ protected void readIndex(DatabaseMetaDataWrapper metaData, Map values, Map known * @param columnDescriptors The dscriptors of the columns to read * @return The read values keyed by the column name */ - protected Map readColumns(ResultSet resultSet, List columnDescriptors) throws SQLException + protected Map readColumns(ResultSet resultSet, List columnDescriptors) throws SQLException { - HashMap values = new HashMap(); + HashMap values = new HashMap(); - for (Iterator it = columnDescriptors.iterator(); it.hasNext();) + for (Iterator it = columnDescriptors.iterator(); it.hasNext();) { - MetaDataColumnDescriptor descriptor = (MetaDataColumnDescriptor)it.next(); + MetaDataColumnDescriptor descriptor = it.next(); values.put(descriptor.getName(), descriptor.readColumn(resultSet)); } diff --git a/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/informix/InformixModelReader.java b/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/informix/InformixModelReader.java index 4b423a0393..f499dfe612 100644 --- a/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/informix/InformixModelReader.java +++ b/symmetric/symmetric-ddl/src/main/java/org/jumpmind/symmetric/ddl/platform/informix/InformixModelReader.java @@ -23,15 +23,15 @@ public InformixModelReader(Platform platform) { setDefaultSchemaPattern(null); } - @SuppressWarnings("unchecked") @Override - protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException { + protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException { Table table = super.readTable(metaData, values); - determineAutoIncrementFromResultSetMetaData(table, table.getColumns()); + if (table != null) { + determineAutoIncrementFromResultSetMetaData(table, table.getColumns()); + } return table; } - @SuppressWarnings("unchecked") @Override public Collection readIndices(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException { diff --git a/symmetric/symmetric-parent/pom.xml b/symmetric/symmetric-parent/pom.xml index db20d24d71..4175f63ad2 100644 --- a/symmetric/symmetric-parent/pom.xml +++ b/symmetric/symmetric-parent/pom.xml @@ -8,7 +8,7 @@ parent - 3.0.2.RELEASE + 3.0.3.RELEASE 2.1.0-SNAPSHOT 10.5.3.0_1 1.8.0.10