"Applied fix from trunk for revision: 1866259"

------------------------------------------------------------------------
r1866259 | jleroux | 2019-09-02 09:32:48 +0200 (lun. 02 sept. 2019) | 10 lignes

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
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1866261 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2019-09-02 07:34:03 +00:00
parent 6af9a7719a
commit f421e7ced4
@@ -818,6 +818,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));