You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/05/09 12:49:00 UTC

[isis] 02/03: ISIS-2116: avoid exception with metamodel download.

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 14aaef6623f9efafc41cfcd79b365b9c24f1209d
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Thu May 9 14:43:31 2019 +0200

    ISIS-2116: avoid exception with metamodel download.
---
 .../org/apache/isis/applib/annotation/CommandPersistence.java     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java
index 262f863..67c74f0 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandPersistence.java
@@ -45,17 +45,19 @@ public enum CommandPersistence {
         if(persistence == null) return null;
         if(persistence == Command.Persistence.PERSISTED) return PERSISTED;
         if(persistence == Command.Persistence.IF_HINTED) return IF_HINTED;
+        if(persistence != Command.Persistence.NOT_PERSISTED) return NOT_PERSISTED;
         // shouldn't happen
-        throw new IllegalArgumentException("Unrecognized : persistence" + persistence);
+        throw new IllegalArgumentException(String.format("Unrecognized : persistence '%s'", persistence));
     }
 
     @Deprecated
-    public static Command.Persistence from(final CommandPersistence commandPersistence) {
+    public static Command.Persistence from(final CommandPersistence commandPersistence)
+            throws IllegalArgumentException {
         if(commandPersistence == null) return null;
         if(commandPersistence == PERSISTED) return Command.Persistence.PERSISTED;
         if(commandPersistence == NOT_PERSISTED) return Command.Persistence.NOT_PERSISTED;
         if(commandPersistence == IF_HINTED) return Command.Persistence.IF_HINTED;
         // shouldn't happen
-        throw new IllegalArgumentException("Unrecognized : persistence" + commandPersistence);
+        throw new IllegalArgumentException(String.format("Unrecognized : persistence '%s'", commandPersistence));
     }
 }