[ofbiz-framework] branch release17.12 updated (972401b -> 41737ad)

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

[ofbiz-framework] branch release17.12 updated (972401b -> 41737ad)

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

jleroux pushed a change to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git.


    from 972401b  Fixed: Incorrect value in entity-auto invoke for removeProductFeatureDataResource. (OFBIZ-11614)
     new 45535e3  Fixed: PartyProfileContent.js does not work
     new 27c9180  Improved: Improve ObjectInputStream class
     new 41737ad  Improved: enough of stash issues, adds upload to runtime/.gitignore

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:
 .../party/template/party/profileblocks/Content.ftl | 11 +++++++
 .../ofbiz/base/util/SafeObjectInputStream.java     |  4 +++
 .../org/apache/ofbiz/base/util/UtilObject.java     |  4 +++
 .../common/groovyScripts/CommonServices.groovy     | 35 +++++++++-------------
 .../ofbiz/webapp/control/RequestHandler.java       |  4 ---
 runtime/.gitignore                                 |  1 +
 6 files changed, 34 insertions(+), 25 deletions(-)
 copy applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareException.java => framework/common/groovyScripts/CommonServices.groovy (57%)

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 01/03: Fixed: PartyProfileContent.js does not work

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

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 45535e34cb6b2308960fb0e16d6731068225f773
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat May 2 09:31:41 2020 +0200

    Fixed: PartyProfileContent.js does not work
   
    (OFBIZ-11633)
    When you upload a content from the party profile page you don't see a progress
    bar. The PartyProfileContent.js is loaded but for some reason is unused or wrong
   
    Mohammad Kathawala mentionned that it was removed with OFBIZ-9299
    It was also broken with OFBIZ-11402
   
    Thanks: Mohammad for the track
   
    Conflicts handled by hand
     applications/party/template/party/profileblocks/Content.ftl
     framework/common/groovyScripts/CommonServices.groovy
---
 .../party/template/party/profileblocks/Content.ftl | 11 +++++++
 .../common/groovyScripts/CommonServices.groovy     | 36 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/applications/party/template/party/profileblocks/Content.ftl b/applications/party/template/party/profileblocks/Content.ftl
index 4e4aeaf..72bdb53 100644
--- a/applications/party/template/party/profileblocks/Content.ftl
+++ b/applications/party/template/party/profileblocks/Content.ftl
@@ -54,5 +54,16 @@ under the License.
         </select>
         <input type="submit" value="${uiLabelMap.CommonUpload}" />
       </form>
+      <div id='progress_bar'><div></div></div>
     </div>
   </div>
+  <script type="application/javascript">
+    jQuery("#uploadPartyContent").validate({
+        submitHandler: function(form) {
+            <#-- call upload scripts - functions defined in PartyProfileContent.js -->
+            uploadPartyContent();
+            getUploadProgressStatus();
+            form.submit();
+        }
+    });
+  </script>
diff --git a/framework/common/groovyScripts/CommonServices.groovy b/framework/common/groovyScripts/CommonServices.groovy
new file mode 100644
index 0000000..8afd19e
--- /dev/null
+++ b/framework/common/groovyScripts/CommonServices.groovy
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.ofbiz.webapp.event.FileUploadProgressListener
+
+/**
+ * Look up progress made in File Upload process
+ */
+def getFileUploadProgressStatus() {
+    FileUploadProgressListener uploadProgressListener = parameters.uploadProgressListener
+    Map result = success()
+    if (uploadProgressListener) {
+        result.contentLength = uploadProgressListener.getContentLength()
+        result.bytesRead = uploadProgressListener.getBytesRead()
+        result.hasStarted = uploadProgressListener.hasStarted()
+
+        result.readPercent = (result.bytesRead * 100) / result.contentLength
+    }
+    return result
+}

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 02/03: Improved: Improve ObjectInputStream class

jleroux@apache.org
In reply to this post by jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 27c91802fcd83ef8b466d189fe8a7cbad22cc8e3
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat May 2 12:32:07 2020 +0200

    Improved: Improve ObjectInputStream class
   
    (OFBIZ-10837)
   
    While working on OFBIZ-11633 I crossed an issue in R18 (not in trunk) where
    objects from org.apache.commons.fileupload (namely DiskFileItem and
    FileItemHeadersImpl) are not serializable.
   
    While at it I decided to handle at the SafeObjectInputStream level
    the "fileItems" case I already crossed with, OFBIZ-11534, in RequestHandler
   
    It has an inconvenient in R18 (not in trunk) where ObjectInputStream can't
    handle a null class (of course) and so return a benign exception in log (only).
   
    I believe it's better to handle these specific cases at the lower possible
    level in all supported branches.
---
 .../main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java   | 4 ++++
 .../base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java     | 4 ++++
 .../src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java | 4 ----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
index 2aebcde..d50cfbf 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
@@ -64,6 +64,10 @@ public final class SafeObjectInputStream extends ObjectInputStream {
     @Override
     protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
         if (!whitelistPattern.matcher(classDesc.getName()).find()) {
+            // DiskFileItem, FileItemHeadersImpl are not serializable.
+            if (classDesc.getName().contains("org.apache.commons.fileupload")) {
+                return null;
+            }
             Debug.logWarning("***Incompatible class***: "
                     + classDesc.getName()
                     + ". Please see OFBIZ-10837.  Report to dev ML if you use OFBiz without changes. "
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
index eb7666a..e194a2c 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
@@ -93,6 +93,10 @@ public final class UtilObject {
         Object obj = null;
         try {
             obj = getObjectException(bytes);
+            // DiskFileItem, FileItemHeadersImpl are not serializable. So SafeObjectInputStream::resolveClass return null
+            if (obj == null) {
+                return null;
+            }
         } catch (ClassNotFoundException | IOException e) {
             Debug.logError(e, module);
         }
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 f239f20..52fa77f 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
@@ -835,10 +835,6 @@ 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));

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 03/03: Improved: enough of stash issues, adds upload to runtime/.gitignore

jleroux@apache.org
In reply to this post by jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 41737adca3baebcb176f3e468b37683288b7d4af
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat May 2 12:49:49 2020 +0200

    Improved: enough of stash issues, adds upload to runtime/.gitignore
---
 runtime/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/runtime/.gitignore b/runtime/.gitignore
index f4a9877..290c994 100644
--- a/runtime/.gitignore
+++ b/runtime/.gitignore
@@ -6,3 +6,4 @@
 /tmp
 /tempfiles
 /output
+/uploads/