From 1d826d903fa3ccdd0930435737c91d9e7e351e7f Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 26 Jun 2014 11:50:45 -0700 Subject: [PATCH] Beans/frank. I should probably add a test for this. Ha! --- src/main/java/com/samskivert/depot/PersistenceContext.java | 2 +- .../java/com/samskivert/depot/impl/DepotMarshaller.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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); } /**