[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17430412#comment-17430412 ] ASF subversion and git services commented on OFBIZ-12016: - Commit 5ddb2b267f8f2ec617b94c1575d9792a2155dbd6 in ofbiz-framework's branch refs/heads/release18.12 from Jacques Le Roux [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=5ddb2b2 ] Fixed: DiskFileItem as request attribute creates problems (OFBIZ-12016) With previous commit I removed UtilObject::getBytes but not UtilObjectTests::testGetBytes_Stream which is related (see OFBIZ-11140) > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-12016.patch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17430397#comment-17430397 ] Benjamin Jugl commented on OFBIZ-12016: --- I tested R18 with the patch you provided and it worked great. Trunk was ok already. OFBIZ-10837 resolves the Issue in RequestHandler. All is fine. Thank you very much. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-12016.patch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17430359#comment-17430359 ] ASF subversion and git services commented on OFBIZ-12016: - Commit b21dff75d845df3977e1d70e5d305145c843ec09 in ofbiz-framework's branch refs/heads/release18.12 from Jacques Le Roux [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=b21dff7 ] Fixed: DiskFileItem as request attribute creates problems (OFBIZ-12016) This was related to reques-redirect usage with a file upload in the request. More info at the Jira... Thanks: Sebastian Berg and Benjamin Jugl for report > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-12016.patch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17430356#comment-17430356 ] Jacques Le Roux commented on OFBIZ-12016: - Hi Benjamin, I had a new look. With [^OFBIZ-12016.patch] applied, both UtilObject and RequestHandler::callRedirect code are quite similar between R18 and trunk, and functionally identiqual. You said bq. The commit for trunk is just fine and you are absolutely correct, that it is the way it should be. Does this mean that you tested the trunk on your issue and it was correct and satisfying? If so I don't see a reason to do more than patching R18. You also said bq. We can indeed redo the removal of fileItems as in https://github.com/apache/ofbiz-framework/commit/4725ae6. It would actually not be enough, FileItemHeadersImpl would be missing and that leads to the reason I made refatorings in trunk (question I was asking to myself). Because with this way not only DiskFileItem and FileItemHeadersImpl are handled by any possible case not handled OOTB. You may want to remove DiskFileItem and FileItemHeadersImpl in your OFBIz instance. I suggest to do only the patching OOTB, except if there something worrying about an error shown that should not be. In general errors should be show to users in UI, or at least for technical ones to devs in log. HTH > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-12016.patch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17429963#comment-17429963 ] Jacques Le Roux commented on OFBIZ-12016: - Actually I don't remember why I did remove it in trunk. Surely apart that I'm a perfectionnist sometimes guided by my perfectionism. I'd say that it's better to get rid of ASAP in the code so yes. I'll even do it in trunk. There are no reasons to make the code diving deeper; as we know it's anyway useless because not serializable. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-12016.patch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17429909#comment-17429909 ] Benjamin Jugl commented on OFBIZ-12016: --- Works fine, as far as I can see. Error is handled. The Removal of the "fileItem" from the Attributes for callRedirect in EventHandler would get rid of the Error alltogether. Should we redo this also? > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-12016.patch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17428631#comment-17428631 ] Jacques Le Roux commented on OFBIZ-12016: - Hi Benjamin, Please try this patch (on R18, did not test R17): [^OFBIZ-12016.patch] > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-12016.patch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17428179#comment-17428179 ] Jacques Le Roux commented on OFBIZ-12016: - Ah right, the commits in R18 and R17 are different than in trunk, did not remember that. Note though that current code in R18 has changed since this commit (did not check R17, but I guess it's the same). Also the code of SafeObjectInputStream is the same in trunk and R18. It's not the case for UtilObject. Since I'm implied, for consistency sake and a bit peace of mind, I'll check why before confirming about the removal of fileItems in RequestHandler (which is safe anyway). > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17428128#comment-17428128 ] Benjamin Jugl commented on OFBIZ-12016: --- I do not know for sure it it can be reproduced ootb. I think there is just no use-case atm. There could be a file-upload leading into a request-redirect, that I am not aware of, yet. I had another look. There are indeed three commits. One for trunk, one for 17.12 and one for 18.12. The commit for trunk is just fine and you are absolutely correct, that it is the way it should be. The commits for the releases are quite different, though. That caused my confusion. In those the ClassCastException is not handled. We can indeed redo the removal of fileItems as in [https://github.com/apache/ofbiz-framework/commit/4725ae6]. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17428108#comment-17428108 ] Jacques Le Roux commented on OFBIZ-12016: - Hi Benjamin, TLDR; : look for "Now about" at the end of this comment. It took me some time (I wrote it just below) before being sure about my answer. I don't doubt you face an issue. Unfortunately, after Nicolas's request, it seems not reproductible OOTB? If I understand well, the problem is only reproductible when using a request-redirect. I'll try to understand the problem by following your comment. You say bq. In UtilObject.java (ll.99) the comment states that "DiskFileItem [...] are not serializable, so So SafeObjectInputStream::resolveClass return ClassNotFoundException". That is not true, SafeObjectInputStream::resolveClass returns ClassCastException. Actually the removed comment in https://github.com/apache/ofbiz-framework/commit/1bc8a20 for OFBIZ-12216 is bq. DiskFileItem, FileItemHeadersImpl are not serializable. So SafeObjectInputStream::resolveClass return null It has been removed, with the rest, for security and refactoring reasons (as the comment say in same commit <>). That's why indeed ClassCastException is throwed by SafeObjectInputStream::resolveClass and UtilObject::getObjectException which is its only caller. Then you say bq. In the actual version of UtilObject.java, ClassCastException ist not handled, but in the first version of OFBIZ-12216s resolution it had been. That's not clear to me getObject and getObjectException methods throw ClassCastException. So what do you mean by ClassCastException ist not handled. And what is "the first version of OFBIZ-12216s resolution"? There is only 1 commit there. Also you say bq. I cannot find an explanation anywhere, why it had been removed. If you speak about ClassCastException is has not be removed but added, as explained above ("rather than returning null") About bq. Although handling this error would at least solve the hard exception on the frontend, this alone is not a sufficial solution. Where would you handle "this error" and what is "this error"? Now about bq. Since Request-Redirects can not handle DiskFileItems, is anything contraindicative for removing them in the redirect (RequestHandler::callRedirect) and logging a warning, that it has been removed? Or are there other solutions that I am not aware of? This was done before with https://github.com/apache/ofbiz-framework/commit/4725ae6 and removed by https://github.com/apache/ofbiz-framework/commit/3f60efb I see no reasons to not do it again in this specific case (that we can't reproduce OOTB). I don't see any other solutions, though I wonder why it does not happen OOTB. Have you an idea about that? Anyway it's not serialisable so impossible to be deserialised by UtilObject::getBytes and don't introduce security issues. It was actually changed more as a refactoring trying to clean code, which was ultimately cleaned by using ClassCastException. You don't even need to log a warning, it's specific to file upload and I guess nobody care about DiskFileItem and FileItemHeadersImpl being removed there. Maybe you even want to use something like in {{"if (obj instanceof Serializable)"}} HTH > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17427758#comment-17427758 ] Benjamin Jugl commented on OFBIZ-12016: --- Hello all, I just had a look at this. The main issue here is, that there is no Caller that can handle the Exception. The exception is thrown on a request-redirect and thus the error is never handled. I had a look at OFBIZ-12216 and the version history and comments are quite confusing. In UtilObject.java (ll.99) the comment states that "DiskFileItem [...] are not serializable, so So SafeObjectInputStream::resolveClass return ClassNotFoundException" That is not true, SafeObjectInputStream::resolveClass returns ClassCastException. In the actual version of UtilObject.java, ClassCastException ist not handled, but in the first version of OFBIZ-12216s resolution it had been. I cannot find an explanation anywhere, why it had been removed. Although handling this error would at least solve the hard exception on the frontend, this alone is not a sufficial solution. Since Request-Redirects can not handle DiskFileItems, is anything contraindicative for removing them in the redirect (RequestHandler::callRedirect) and logging a warning, that it has been removed? Or are there other solutions that I am not aware of? If not, I would provide a patch that does this. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17417101#comment-17417101 ] Jacques Le Roux commented on OFBIZ-12016: - Hi Sebastian, About bq. I noticed, that in SafeObjectInputStream.java we throw a ClassCastException which isn't catched anywhere. I guess you speak about SafeObjectInputStream::getObjectException. Then that's not exactly true. It's indeed not cathed in UtilObject::getObjectException, and that's on purpose. ClassCastException, ClassNotFoundException, IOException are rather thrown and catched by callers (ie EntityCrypto::doDecrypt and SafeObjectInputStream::getObject, I don't consider tests here). As Nicolas mentionned there is an history there. The last instance you may refer is OFBIZ-12216. Anyway better use revisions informaiton to followinvestigate the past if necessary. I'm not sure what to say about your other remark. Please suggest changes that fit your needs :) bq. And there was a special code line for DiskFileItems where a ClassNotFound Exception was thrown, which was removed again. While this made it impossible to retrieve error messages from previous requests at least we don't have an Exception shown on the surface. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17416708#comment-17416708 ] Nicolas Malin commented on OFBIZ-12016: --- [~sberg] it's possible to reproduce on demo trunk or it detected on customer site on reproduce need adding some code ? I confess that after read the different issues, I'm on a fog to understand the chaining present and that raise the problem. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17403605#comment-17403605 ] Sebastian Berg commented on OFBIZ-12016: Hi Jacques, unfortunately we have to reopen this issue. I ran into this error again. I have a file upload in one request, which results in a request-redirect-noparam on success. I noticed, that in SafeObjectInputStream.java we throw a ClassCastException which isn't catched anywhere. And there was a special code line for DiskFileItems where a ClassNotFound Exception was thrown, which was removed again. While this made it impossible to retrieve error messages from previous requests at least we don't have an Exception shown on the surface. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Assignee: Jacques Le Roux >Priority: Major > Fix For: Upcoming Branch > > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17293458#comment-17293458 ] Sebastian Berg commented on OFBIZ-12016: Hi Jacques, seems to be working now. I couldn't reproduce an error doing a request redirect. > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Priority: Major > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (OFBIZ-12016) DiskFileItem as request attribute creates problems
[ https://issues.apache.org/jira/browse/OFBIZ-12016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17287619#comment-17287619 ] Jacques Le Roux commented on OFBIZ-12016: - Hi Sebastian, Is that still reproductible? I made several changes in this area since... > DiskFileItem as request attribute creates problems > -- > > Key: OFBIZ-12016 > URL: https://issues.apache.org/jira/browse/OFBIZ-12016 > Project: OFBiz > Issue Type: Bug >Affects Versions: 18.12.01, Trunk >Reporter: Sebastian Berg >Priority: Major > > Hi, > while working on a custom project based on the 18.12.01 version, I noticed a > problem with the request handling during a request-redirect-noparam if a > DiskFileItem was involved. > So the situation for me is as follows: during the first request a file is > uploaded. I choose a wrong format on purpose, which results in an error > respond for that event. Nevertheless the DiskFileItem is set as request > attribute together with the error message. > The request is finished and based on the controller configurations redirected > to a second request. > While handling the second request the previous request's attributes get > restored (RequestHandler.java line 733ff). This goes down into > SafeObjectInfo.resolveClass() where an Incompatible class exception is > thrown. I compared my custom project with the current development status and > worked in the changes from commit 3f60efb343a11723aa56c1bc1f5afac3a2f26e9f in > OFBIZ-10837. > While this fixes the issue with the incompatible class exception it also > makes it impossible to retrieve any attributes from the first request. > Therefore my error message cannot be shown. > Is there a way to fix it or is it otherwise necessary to always set > "fileItems" as request attribute as added in -OFBIZ-11246-? -- This message was sent by Atlassian Jira (v8.3.4#803005)