Author: jleroux
Date: Mon Sep 2 07:32:48 2019
New Revision: 1866259
URL:
http://svn.apache.org/viewvc?rev=1866259&view=revLog:
Fixed: NotSerializableException after uploading images to an order
(OFBIZ-11123)
In a lot of services we use the ByteBuffer object to upload files.
When a such service is used with the redirect-parameter in a controller the
ByteBuffer needs to be serialized. Unfortunately ByteBuffer (in our case its
subclass HeapByteBuffer) is not serializable. So that can't work.
Fortunately no redirect-parameter concerns uploadedFile so we can safely remove
it from reqAttrMap in RequestHandler
Modified:
ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java?rev=1866259&r1=1866258&r2=1866259&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java Mon Sep 2 07:32:48 2019
@@ -875,6 +875,7 @@ public class RequestHandler {
}
if (reqAttrMap.size() > 0) {
reqAttrMap.remove("_REQUEST_HANDLER_"); // RequestHandler is not serializable and must be removed first. See
http://issues.apache.org/jira/browse/OFBIZ-750+ reqAttrMap.remove("uploadedFile"); // uploadedFileis not serializable (it's a HeapByteBuffer) and must be removed first. See
http://issues.apache.org/jira/browse/OFBIZ-11123 byte[] reqAttrMapBytes = UtilObject.getBytes(reqAttrMap);
if (reqAttrMapBytes != null) {
req.getSession().setAttribute("_REQ_ATTR_MAP_", StringUtil.toHexString(reqAttrMapBytes));