You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/01/22 14:48:39 UTC

[isis] branch master updated (d305b8f -> a58669b)

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

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


    from d305b8f  ISIS-2270: IsisConf. is not serializable, sync adoc
     new b804ff2  ISIS-2158: don't NPE on collectionLayoutData not found
     new 96e6a4a  ISIS-2158: don't log 'connection abort' when request-url ends with .css
     new a58669b  ISIS-2158: smarter exception to message utility

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/internal/exceptions/_Exceptions.java   | 33 ++++++++++++++++++++++
 .../grid/bootstrap3/GridSystemServiceBS3.java      | 12 ++++++--
 .../diagnostics/IsisLogOnExceptionFilter.java      |  7 +++++
 .../wicket/model/models/EntityCollectionModel.java |  8 ++----
 4 files changed, 52 insertions(+), 8 deletions(-)


[isis] 02/03: ISIS-2158: don't log 'connection abort' when request-url ends with .css

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 96e6a4abdf953ef7057b67f84de854d564362443
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 22 14:38:03 2020 +0100

    ISIS-2158: don't log 'connection abort' when request-url ends with .css
---
 .../isis/core/webapp/diagnostics/IsisLogOnExceptionFilter.java    | 7 +++++++
 .../isis/viewer/wicket/model/models/EntityCollectionModel.java    | 8 +++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/core/webapp/src/main/java/org/apache/isis/core/webapp/diagnostics/IsisLogOnExceptionFilter.java b/core/webapp/src/main/java/org/apache/isis/core/webapp/diagnostics/IsisLogOnExceptionFilter.java
index 35e4269..24bc269 100644
--- a/core/webapp/src/main/java/org/apache/isis/core/webapp/diagnostics/IsisLogOnExceptionFilter.java
+++ b/core/webapp/src/main/java/org/apache/isis/core/webapp/diagnostics/IsisLogOnExceptionFilter.java
@@ -58,6 +58,13 @@ public class IsisLogOnExceptionFilter implements Filter {
         try {
             chain.doFilter(request, response);
         } catch (Exception ex) {
+            
+            if(ex instanceof IOException) {
+                if(((HttpServletRequest) request).getRequestURL().toString().endsWith(".css")) {
+                    throw ex; // don't log
+                }    
+            }
+            
             if(ex instanceof IOException
                     || ex instanceof ServletException
                     || ex instanceof RuntimeException) {
diff --git a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
index 7258f5b..f1ba9ec 100644
--- a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
+++ b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
@@ -36,8 +36,6 @@ import org.apache.isis.core.commons.internal.base._NullSafe;
 import org.apache.isis.core.commons.internal.collections._Lists;
 import org.apache.isis.core.commons.internal.collections._Maps;
 import org.apache.isis.core.commons.internal.factory.InstanceUtil;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.commons.ClassUtil;
 import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
 import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacet;
@@ -49,14 +47,14 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.webapp.context.IsisWebAppCommonContext;
+import org.apache.isis.core.webapp.context.memento.ObjectMemento;
+import org.apache.isis.core.webapp.context.memento.ObjectMementoService;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
 import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
 import org.apache.isis.viewer.wicket.model.links.LinksProvider;
 import org.apache.isis.viewer.wicket.model.mementos.CollectionMemento;
 import org.apache.isis.viewer.wicket.model.models.Util.LowestCommonSuperclassFinder;
-import org.apache.isis.core.webapp.context.IsisWebAppCommonContext;
-import org.apache.isis.core.webapp.context.memento.ObjectMemento;
-import org.apache.isis.core.webapp.context.memento.ObjectMementoService;
 
 import static org.apache.isis.core.commons.internal.base._NullSafe.stream;
 


[isis] 03/03: ISIS-2158: smarter exception to message utility

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a58669bc9f06e5612d5f4bdb61fb99913daf554a
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 22 15:48:30 2020 +0100

    ISIS-2158: smarter exception to message utility
---
 .../commons/internal/exceptions/_Exceptions.java   | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/internal/exceptions/_Exceptions.java b/core/commons/src/main/java/org/apache/isis/core/commons/internal/exceptions/_Exceptions.java
index fd1f314..b22e1e3 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/internal/exceptions/_Exceptions.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/internal/exceptions/_Exceptions.java
@@ -31,6 +31,7 @@ import java.util.stream.Stream;
 
 import javax.annotation.Nullable;
 
+import org.apache.isis.core.commons.collections.Can;
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.commons.internal.base._NullSafe;
 import org.apache.isis.core.commons.internal.base._Strings;
@@ -132,6 +133,38 @@ public final class _Exceptions {
         return new UnsupportedOperationException("unrecoverable error: method call not allowed/supported");
     }
     
+    // -- MESSAGE
+    
+    public static String getMessage(Exception ex) {
+        if(ex==null) {
+            return "no exception present";
+        }
+        if(_Strings.isNotEmpty(ex.getMessage())) {
+            return ex.getMessage();
+        }
+        val sb = new StringBuilder();
+        val nestedMsg = streamCausalChain(ex)
+                .peek(throwable->{
+                    sb.append(throwable.getClass().getSimpleName()).append("/");
+                })
+                .map(Throwable::getMessage)
+                .filter(_NullSafe::isPresent)
+                .findFirst();
+        
+        if(nestedMsg.isPresent()) {
+            sb.append(nestedMsg.get());
+        } else {
+            
+            Can.ofArray(ex.getStackTrace())
+            .stream()
+            .limit(20)
+            .forEach(trace->sb.append("\n").append(trace));
+        }
+                
+        return sb.toString();
+    }
+    
+    // -- THROWING
     
     /**
      * Used to hide from the compiler the fact, that this call always throws.


[isis] 01/03: ISIS-2158: don't NPE on collectionLayoutData not found

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b804ff2269ae589137fa30ef167e9199ed2baf01
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 22 13:25:22 2020 +0100

    ISIS-2158: don't NPE on collectionLayoutData not found
---
 .../services/grid/bootstrap3/GridSystemServiceBS3.java       | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridSystemServiceBS3.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridSystemServiceBS3.java
index cbe8f23..0c9d0d0 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridSystemServiceBS3.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridSystemServiceBS3.java
@@ -72,12 +72,14 @@ import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import static org.apache.isis.core.commons.internal.base._NullSafe.stream;
 
 import lombok.val;
+import lombok.extern.log4j.Log4j2;
 
 @Service
 @Named("isisMetaModel.GridSystemServiceBS3")
 @Order(OrderPrecedence.MIDPOINT)
 @Primary
 @Qualifier("BS3")
+@Log4j2
 public class GridSystemServiceBS3 extends GridSystemServiceAbstract<BS3Grid> {
 
     public static final String TNS = "http://isis.apache.org/applib/layout/grid/bootstrap3";
@@ -517,9 +519,13 @@ public class GridSystemServiceBS3 extends GridSystemServiceAbstract<BS3Grid> {
                 if(!(memberOrderFacet instanceof MemberOrderFacetAnnotation)) {
                     // if binding not via annotation, then explicitly bind this
                     // action to the property
-                    final CollectionLayoutData collectionLayoutData = collectionLayoutDataById.get(id);
-                    final ActionLayoutData actionLayoutData = new ActionLayoutData(actionId);
-                    addActionTo(collectionLayoutData, actionLayoutData);
+                    val collectionLayoutData = collectionLayoutDataById.get(id);
+                    if(collectionLayoutData==null) {
+                        log.warn("failed to lookup CollectionLayoutData by id '{}'", id);
+                    } else {
+                        val actionLayoutData = new ActionLayoutData(actionId);
+                        addActionTo(collectionLayoutData, actionLayoutData);
+                    }
                 }
                 continue;
             }