[
http://jira.nuxeo.org/browse/NXP-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Radu Darlea updated NXP-2044:
-----------------------------
Description:
Currently, when a file is uploaded, the FileManageActionsBean:
- calls createDocumentFromBlob() with the flag overwrite always true
- it doesn't always check the returned value (in the case of null returned
there are cases in which should appear a NPE)
- it doesn't properly check all the cases of failures. For instance, if the
overwrite wouldn't be required, the case of couldn't update the document
because already exists falls in the situation "wrong_document_type"
Moreover, the logic in default implementation (defaultCreate() in
FileManagerService) is somehow wrong: there are only 2 branches
if (overwrite && docModel != null) {
}else{
}
so the case: "do not overwrite and the document existing" is falling in the
second case, and a "new" document is created.
This fix could be dangerous, having impacts in other plugins, because until now
they were never been called with flag overwrite on false.
was:
Currently, when a file is uploaded, the FileManageActionsBean:
- calls createDocumentFromBlob() is the flag overwrite always on true
- it doesn't always check the return, in the case of null returned there should
be NPE
- it doesn't properly check all the cases of failures. For instance, if the
overwrite wouldn't be required, the case of couldn't update the document
because already exists falls in the case "wrong_document_type"
Moreover, the logic in default implementation of defaultCreate() in
FileManagerService is somehow wrong: there are only 2 branches
if (overwrite && docModel != null) {
}else{
}
so the case: "do not overwrite and the document existing" is falling in the
second case, and a "new" document is created.
This fix could be dangerous, having impacts in other plugins, because until now
they were never been called with flag overwrite on false.
> Improve the FileManageActionsBean
> ---------------------------------
>
> Key: NXP-2044
> URL: http://jira.nuxeo.org/browse/NXP-2044
> Project: Nuxeo Enterprise Platform 5
> Issue Type: Improvement
> Affects Versions: 5.1.3
> Reporter: Radu Darlea
> Assignee: Radu Darlea
> Fix For: 5.1.4
>
> Original Estimate: 4 hours
> Remaining Estimate: 4 hours
>
> Currently, when a file is uploaded, the FileManageActionsBean:
> - calls createDocumentFromBlob() with the flag overwrite always true
> - it doesn't always check the returned value (in the case of null returned
> there are cases in which should appear a NPE)
> - it doesn't properly check all the cases of failures. For instance, if the
> overwrite wouldn't be required, the case of couldn't update the document
> because already exists falls in the situation "wrong_document_type"
> Moreover, the logic in default implementation (defaultCreate() in
> FileManagerService) is somehow wrong: there are only 2 branches
> if (overwrite && docModel != null) {
> }else{
> }
> so the case: "do not overwrite and the document existing" is falling in the
> second case, and a "new" document is created.
> This fix could be dangerous, having impacts in other plugins, because until
> now they were never been called with flag overwrite on false.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets