This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch release22.01 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release22.01 by this push: new 8ad211bb15 Fixed: Fix some bugs SpotBugs reports (OFBIZ-12386) 8ad211bb15 is described below commit 8ad211bb1537574fcc6ed7766db5f19895d96403 Author: Jacques Le Roux <jacques.le.r...@les7arts.com> AuthorDate: Wed Sep 28 19:18:15 2022 +0200 Fixed: Fix some bugs SpotBugs reports (OFBIZ-12386) Fixes the error below that returns a HTTP 500 code when "cookies" is null Sep 28, 2022 1:57:20 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [ControlServlet] in context with path [/catalog] threw exception java.lang.ArrayStoreException: javax.servlet.http.Cookie at java.base/java.util.stream.Nodes$FixedNodeBuilder.accept(Nodes.java:1230) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:517) at org.apache.ofbiz.webapp.stats.VisitHandler.getVisitor(VisitHandler.java:231) It breaks OFBiz when Debug.verbose is on and in serverstats.properties these defaults are used: # Specify whether to use the visit history feature or not stats.persist.visit=true stats.persist.visitor=true I found this error in stable demo console log after the demo was broken. I must say I'm not very proud of what I did with https://github.com/apache/ofbiz-framework/commit/f126bae It was obviously wrong :) --- .../src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java index 4109ade770..a357a905c8 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java @@ -233,10 +233,10 @@ public class VisitHandler { // first try to get the current ID from the visitor cookie String cookieVisitorId = null; Cookie[] cookies = request.getCookies(); - if (Debug.verboseOn()) { - Debug.logVerbose("Cookies:" + String.join(",", Arrays.stream(cookies).toArray(String[]::new)), MODULE); - } if (cookies != null) { + if (Debug.verboseOn()) { + Debug.logVerbose("Cookies:" + String.join(",", Arrays.stream(cookies).toArray(String[]::new)), MODULE); + } for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(VISITOR_COOKIE_NAME)) { cookieVisitorId = cookies[i].getValue();