Skip to content

Commit

Permalink
Bug 1747079 - no longer dies when it can't evaluate a view
Browse files Browse the repository at this point in the history
  • Loading branch information
johncurrier committed Jul 3, 2007
1 parent 4cbcbfd commit e9f0304
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/net/sourceforge/schemaspy/model/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,18 @@ private void initViews(String schema, DatabaseMetaData metadata, Properties prop
if (rs.getString("TABLE_TYPE").equals("VIEW")) { // some databases (MySQL) return more than we wanted
System.out.print('.');

Table view = new View(this, rs, properties.getProperty("selectViewSql"));
if (include.matcher(view.getName()).matches())
views.put(view.getName().toUpperCase(), view);
try {
Table view = new View(this, rs, properties.getProperty("selectViewSql"));

if (include.matcher(view.getName()).matches())
views.put(view.getName().toUpperCase(), view);
} catch (SQLException exc) {
System.out.flush();
System.err.println();
System.err.println("Ignoring view due to exception:");
exc.printStackTrace();
System.err.println("Continuing analysis.");
}
}
}
} finally {
Expand Down
12 changes: 10 additions & 2 deletions src/net/sourceforge/schemaspy/model/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,16 @@ private void initColumns(Database db) throws SQLException {
while (rs.next())
addColumn(rs);
} catch (SQLException exc) {
System.err.println("Failed to collect column details for table '" + getName() + "' in schema '" + getSchema() + "'");
throw exc;
class ColumnInitializationFailure extends SQLException {
private static final long serialVersionUID = 1L;

public ColumnInitializationFailure(SQLException failure) {
super("Failed to collect column details for " + (isView() ? "view" : "table") + " '" + getName() + "' in schema '" + getSchema() + "'");
initCause(failure);
}
}

throw new ColumnInitializationFailure(exc);
} finally {
if (rs != null)
rs.close();
Expand Down

0 comments on commit e9f0304

Please sign in to comment.