diff --git a/src/main/java/com/samskivert/depot/PersistenceContext.java b/src/main/java/com/samskivert/depot/PersistenceContext.java index 78bdc4c..51f7193 100644 --- a/src/main/java/com/samskivert/depot/PersistenceContext.java +++ b/src/main/java/com/samskivert/depot/PersistenceContext.java @@ -267,7 +267,7 @@ public class PersistenceContext Class type, SchemaMigration migration) { DepotMarshaller marshaller = getRawMarshaller(type); - marshaller.requireInitialized( + marshaller.requireNotInitialized( "Migrations must be registered before initializeRepositories() is called."); marshaller.registerMigration(migration); } diff --git a/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java b/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java index 497b4e5..83e545d 100644 --- a/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java +++ b/src/main/java/com/samskivert/depot/impl/DepotMarshaller.java @@ -456,10 +456,11 @@ public class DepotMarshaller implements QueryMarshal } /** - * Throws {@link IllegalStateException} with {@code msg} if this marshaller is not initialized. + * Throws {@link IllegalStateException} with {@code msg} if this marshaller is already + * initialized. */ - public synchronized void requireInitialized (String msg) { - if (_meta == null) throw new IllegalStateException(msg); + public synchronized void requireNotInitialized (String msg) { + if (_meta != null) throw new IllegalStateException(msg); } /**