diff --git a/src/java/com/samskivert/jdbc/depot/EntityMigration.java b/src/java/com/samskivert/jdbc/depot/EntityMigration.java index edf2267..41fc15c 100644 --- a/src/java/com/samskivert/jdbc/depot/EntityMigration.java +++ b/src/java/com/samskivert/jdbc/depot/EntityMigration.java @@ -101,9 +101,15 @@ public abstract class EntityMigration extends Modifier return true; } - @Override protected void init (String tableName, Map> marshallers) { + @Override + protected void init (String tableName, Map> 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; @@ -133,7 +139,8 @@ public abstract class EntityMigration extends Modifier return false; } - @Override protected void init (String tableName, Map> marshallers) { + @Override + protected void init (String tableName, Map> marshallers) { super.init(tableName, marshallers); _columnName = marshallers.get(_fieldName).getColumnName(); _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 * called in {@link #shouldRunMigration}. */ - protected void init (String tableName, Map> marshallers) + protected void init (String tableName, Map> marshallers) { _tableName = tableName; }