Ard Schrijvers pushed to branch feature/projectdocs at cms-community / hippo-cms


Commits:
1e02cd6d by Ard Schrijvers at 2017-10-18T13:51:19+02:00
CMS-10929 log error instead of debug

When the payload is empty or there is no requestCycle there is an
implementation issue and we need to log an error

- - - - -


1 changed file:

- 
builtin/src/main/java/org/hippoecm/frontend/plugins/standardworkflow/InitializationPayload.java


Changes:

=====================================
builtin/src/main/java/org/hippoecm/frontend/plugins/standardworkflow/InitializationPayload.java
=====================================
--- 
a/builtin/src/main/java/org/hippoecm/frontend/plugins/standardworkflow/InitializationPayload.java
+++ 
b/builtin/src/main/java/org/hippoecm/frontend/plugins/standardworkflow/InitializationPayload.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2009-2017 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2017 Hippo B.V. (http://www.onehippo.com)
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -28,6 +28,8 @@ import 
org.onehippo.cms7.services.cmscontext.CmsSessionContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static 
org.onehippo.cms7.services.cmscontext.CmsSessionContext.CMS_SESSION_CONTEXT_PAYLOAD_KEY;
+
 public class InitializationPayload {
 
     private static final Logger log = 
LoggerFactory.getLogger(InitializationPayload.class);
@@ -37,7 +39,6 @@ public class InitializationPayload {
 
     @SuppressWarnings({"unchecked"})
     public static Map<String, Serializable> get() {
-        Map<String, Serializable> result = Collections.emptyMap();
         final RequestCycle requestCycle = RequestCycle.get();
         if (requestCycle != null) {
             final ServletWebRequest request = (ServletWebRequest) 
requestCycle.getRequest();
@@ -45,20 +46,19 @@ public class InitializationPayload {
             final HttpSession session = containerRequest.getSession();
             final CmsSessionContext context = 
CmsSessionContext.getContext(session);
             if (context != null) {
-                final Map<String, Serializable> attribute = 
context.getContextPayload();
-                if (attribute != null) {
-                    result = attribute;
+                final Map<String, Serializable> payload = 
context.getContextPayload();
+                if (payload != null) {
+                    return payload;
                 } else {
-                    log.debug("No attribute with key {} found on 
CmsSessionContext. Please make sure an attribute " +
-                            "with this key is added", 
CmsSessionContext.CMS_SESSION_CONTEXT_PAYLOAD_KEY);
+                    log.error("No attribute with key '{}' found on 
CmsSessionContext.", CMS_SESSION_CONTEXT_PAYLOAD_KEY);
                 }
             }
 
         } else {
-            log.debug("Cannot get ServletWebRequest. No request cycle 
associated with current thread. " +
+            log.error("Cannot get ServletWebRequest. No request cycle 
associated with current thread. " +
                     "Only call this method from threads that have access.");
         }
-        return result;
+        return Collections.emptyMap();
     }
 
 



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/commit/1e02cd6d6af1c588115da3198cb712914656285c

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/commit/1e02cd6d6af1c588115da3198cb712914656285c
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to