Skip to content

Commit

Permalink
Wasn't corrently handling property file pseudo-inheritance when dumpi…
Browse files Browse the repository at this point in the history
…ng db usage hints
  • Loading branch information
johncurrier committed Jun 9, 2005
1 parent c82b0ea commit d05ce9a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/net/sourceforge/schemaspy/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,27 @@ private static void dumpUsage(String errorMessage, boolean detailed, boolean det
if (detailedDb) {
System.out.println("Built-in database types and their required connection parameters:");
Set datatypes = getBuiltInDatabaseTypes(getLoadedFromJar());
class DbPropLoader {
Properties load(String dbType) {
ResourceBundle bundle = ResourceBundle.getBundle(dbType);
Properties properties;
try {
String baseDbType = bundle.getString("extends");
int lastSlash = dbType.lastIndexOf('/');
if (lastSlash != -1)
baseDbType = dbType.substring(0, dbType.lastIndexOf("/") + 1) + baseDbType;
properties = load(baseDbType);
} catch (MissingResourceException doesntExtend) {
properties = new Properties();
}

return add(properties, bundle);
}
}

for (Iterator iter = datatypes.iterator(); iter.hasNext(); ) {
String dbType = iter.next().toString();
Properties properties = add(new Properties(), ResourceBundle.getBundle(dbType));
new ConnectionURLBuilder(dbType, null, properties).dumpUsage();
new ConnectionURLBuilder(dbType, null, new DbPropLoader().load(dbType)).dumpUsage();
}
System.out.println();
}
Expand Down

0 comments on commit d05ce9a

Please sign in to comment.