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 2015/11/25 14:23:07 UTC

isis git commit: ISIS-1247: could not reproduce. Have improved the error handling to provide better diagnostics, though.

Repository: isis
Updated Branches:
  refs/heads/master c6c3066e3 -> d4083e8b2


ISIS-1247: could not reproduce.  Have improved the error handling to provide better diagnostics, though.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d4083e8b
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d4083e8b
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d4083e8b

Branch: refs/heads/master
Commit: d4083e8b220dcc2883007df20e7e25f8d94c91ce
Parents: c6c3066
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Nov 25 13:22:57 2015 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Nov 25 13:22:57 2015 +0000

----------------------------------------------------------------------
 .../isis/core/commons/lang/ClassExtensions.java |  7 +++-
 .../json/LayoutMetadataReaderFromJson.java      |  8 +++--
 ...ppAppManifestWithFixturesBypassSecurity.java | 35 ++++++++++++++++++++
 .../java/domainapp/dom/simple/SimpleObject.java |  1 -
 4 files changed, 47 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/d4083e8b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
index 1d05155..3f4a3b9 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
@@ -166,7 +166,12 @@ public final class ClassExtensions {
     }
 
     public static String resourceContent(final Class<?> cls, final String suffix) throws IOException {
-        final URL url = Resources.getResource(cls, cls.getSimpleName()+suffix);
+        final String resourceName = cls.getSimpleName() + suffix;
+        return resourceContentOf(cls, resourceName);
+    }
+
+    public static String resourceContentOf(final Class<?> cls, final String resourceName) throws IOException {
+        final URL url = Resources.getResource(cls, resourceName);
         return Resources.toString(url, Charset.defaultCharset());
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/d4083e8b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
index e2946b7..1d896ab 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
@@ -410,12 +410,16 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader2 {
         if(blacklisted.contains(domainClass)) {
             return null;
         }
+
+        final String resourceName = domainClass.getSimpleName() + ".layout.json";
         try {
-            content = ClassExtensions.resourceContent(domainClass, ".layout.json");
+            content = ClassExtensions.resourceContentOf(domainClass, resourceName);
         } catch (IOException | IllegalArgumentException ex) {
 
             blacklisted.add(domainClass);
-            final String message = "Failed to locate " + domainClass.getName() + ".layout.json file (" + ex.getMessage() + ")";
+            final String message = String .format(
+                    "Failed to locate file %s (relative to %s.class); ex: %s)",
+                    resourceName, domainClass.getName(), ex.getMessage());
 
             LOG.debug(message);
             return null;

http://git-wip-us.apache.org/repos/asf/isis/blob/d4083e8b/example/application/simpleapp/app/src/main/java/domainapp/app/DomainAppAppManifestWithFixturesBypassSecurity.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/app/src/main/java/domainapp/app/DomainAppAppManifestWithFixturesBypassSecurity.java b/example/application/simpleapp/app/src/main/java/domainapp/app/DomainAppAppManifestWithFixturesBypassSecurity.java
new file mode 100644
index 0000000..5ca4214
--- /dev/null
+++ b/example/application/simpleapp/app/src/main/java/domainapp/app/DomainAppAppManifestWithFixturesBypassSecurity.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package domainapp.app;
+
+/**
+ * Bypasses security, meaning any user/password combination can be used to login.
+ */
+public class DomainAppAppManifestWithFixturesBypassSecurity extends DomainAppAppManifestWithFixtures {
+
+    @Override
+    public String getAuthenticationMechanism() {
+        return "bypass";
+    }
+
+    @Override
+    public String getAuthorizationMechanism() {
+        return "bypass";
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/d4083e8b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
index 4f6c5a6..98a485d 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
@@ -32,7 +32,6 @@ import org.apache.isis.applib.annotation.Parameter;
 import org.apache.isis.applib.annotation.ParameterLayout;
 import org.apache.isis.applib.annotation.Property;
 import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.annotation.Title;
 import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
 import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
 import org.apache.isis.applib.services.i18n.TranslatableString;