Report a better error message if a bogus rename is attempted. Some formatting

cleanup.
This commit is contained in:
Michael Bayne
2008-08-20 00:22:41 +00:00
parent 22fb614f34
commit 64d186d08b
@@ -101,9 +101,15 @@ public abstract class EntityMigration extends Modifier
return true; return true;
} }
@Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) { @Override
protected void init (String tableName, Map<String, FieldMarshaller<?>> marshallers) {
super.init(tableName, marshallers); super.init(tableName, marshallers);
_newColumnDef = marshallers.get(_newColumnName).getColumnDefinition(); FieldMarshaller<?> fm = marshallers.get(_newColumnName);
if (fm == null) {
throw new IllegalArgumentException(
_tableName + " does not contain '" + _newColumnName + "' field.");
}
_newColumnDef = fm.getColumnDefinition();
} }
protected String _oldColumnName, _newColumnName; protected String _oldColumnName, _newColumnName;
@@ -133,7 +139,8 @@ public abstract class EntityMigration extends Modifier
return false; return false;
} }
@Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) { @Override
protected void init (String tableName, Map<String, FieldMarshaller<?>> marshallers) {
super.init(tableName, marshallers); super.init(tableName, marshallers);
_columnName = marshallers.get(_fieldName).getColumnName(); _columnName = marshallers.get(_fieldName).getColumnName();
_newColumnDef = marshallers.get(_fieldName).getColumnDefinition(); _newColumnDef = marshallers.get(_fieldName).getColumnDefinition();
@@ -174,7 +181,7 @@ public abstract class EntityMigration extends Modifier
* migration has been determined to be runnable so one cannot rely on this method having been * migration has been determined to be runnable so one cannot rely on this method having been
* called in {@link #shouldRunMigration}. * called in {@link #shouldRunMigration}.
*/ */
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) protected void init (String tableName, Map<String, FieldMarshaller<?>> marshallers)
{ {
_tableName = tableName; _tableName = tableName;
} }