This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new d82626974a Improved: Strip data to maximum column length for
initialRequest and (#526)
d82626974a is described below
commit d82626974add82fd1c403ba472ce1a6f7d25e3d1
Author: georg1312 <[email protected]>
AuthorDate: Mon Jul 25 09:14:08 2022 +0200
Improved: Strip data to maximum column length for initialRequest and (#526)
initialReferrer (OFBIZ-12672)
Analogous to the existing limitation of the "initialUserAgent" to 250
characters, installation of a limitation of 2000 characters for
initialRequest and initialReferrer, so as not to exit with
"MysqlDataTruncation: Data truncation: Data too long for column
'INITIAL_REFERRER' at row 1" in the case of very long requests.
---
.../main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 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 5df4bfd6ce..4109ade770 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
@@ -150,8 +150,14 @@ public class VisitHandler {
visit.set("fromDate", new
Timestamp(session.getCreationTime()));
visit.set("initialLocale", initialLocale);
- visit.set("initialRequest", initialRequest);
- visit.set("initialReferrer", initialReferrer);
+ if (initialRequest != null) {
+ visit.set("initialRequest",
initialRequest.length() > 2000 ? initialRequest.substring(0, 1999)
+ : initialRequest);
+ }
+ if (initialReferrer != null) {
+ visit.set("initialReferrer",
initialReferrer.length() > 2000 ? initialReferrer.substring(0, 1999)
+ : initialReferrer);
+ }
if (initialUserAgent != null) {
visit.set("initialUserAgent",
initialUserAgent.length() > 250 ? initialUserAgent.substring(0, 250)
: initialUserAgent);