[ofbiz-framework] branch trunk updated: Fixed: Error in uploading very large files, ie >2MB

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: Error in uploading very large files, ie >2MB

jleroux@apache.org
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 4725ae6  Fixed: Error in uploading very large files, ie >2MB
4725ae6 is described below

commit 4725ae68d8f4afa58fa29fdd6bf977b95731b807
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Thu Apr 16 15:46:09 2020 +0200

    Fixed: Error in uploading very large files, ie >2MB
   
    (OFBIZ-11534)
   
    There is an issue in uploading large files, I am able to upload files up to 2 GB
    successfully but getting an error when trying to upload a file larger than 2GB.
   
    Example -
    1. Go to party profile -
    https://demo-trunk.ofbiz.apache.org/partymgr/control/viewprofile?partyId=admin
    2. Try to create a party content with a file larger than 2 GB
    3. Error on console
   
    jleroux:
    For a 2GB+ file you need to set Xmx to more than the double of the file size,
    eg: gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx5048M"
   
    You then get another small issue (only in log) when redirecting to send the
    partyId parameter.
   
    This is because, DiskFileItem is a temporary Object with a null value contained
    in "fileItems" attribute. It can't be detected by UtilMisc::makeMapSerializable
    and that makes "fileItems" not serializable. So it must be removed from
    reqAttrMap.
   
    Thanks: Chandan Khandelwal for report, Michael for suggesting a very large file
    to upload
---
 .../main/java/org/apache/ofbiz/webapp/control/RequestHandler.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
index 6e2a1c4..30f8a76 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
@@ -255,7 +255,7 @@ public class RequestHandler {
         Collection<RequestMap> rmaps = resolveURI(ccfg, request);
         if (rmaps.isEmpty()) {
             if (throwRequestHandlerExceptionOnMissingLocalRequest) {
-                if (path.contains("/checkLogin/")) {
+                if (path.contains("/checkLogin/") || path.contains("/viewprofile")) {
                     // Nested requests related with checkLogin uselessly clutter the log. There is nothing to worry about, better remove this wrong error message.
                     return;
                 } else if (path.contains("/images/") || path.contains("d.png")) {
@@ -883,6 +883,10 @@ public class RequestHandler {
             }
         }
         if (reqAttrMap.size() > 0) {
+            // fileItems is not serializable.
+            // It contains a temporary DiskFileItem with a null value than can't be detected by UtilMisc::makeMapSerializable
+            // So it must be removed from reqAttrMap. See OFBIZ-11534
+            reqAttrMap.remove("fileItems");
             byte[] reqAttrMapBytes = UtilObject.getBytes(reqAttrMap);
             if (reqAttrMapBytes != null) {
                 req.getSession().setAttribute("_REQ_ATTR_MAP_", StringUtil.toHexString(reqAttrMapBytes));