JPASupport.edit() handle FileAttachment incorrectly
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
play framework | Status tracked in 1.0 | |||||
1.0 |
Fix Released
|
Undecided
|
Unassigned | |||
1.1 |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Use "Job Board" sample as Test Case:
1. Visit admin page: http://
2. Click Companies link and add a new Company with uploading a new logo.
3. Return to the Company list page.
4. Click the link of new add Company.
5. Leave nothing change and click "Save". (Alternativly can change other fileds, to trigger "saveFileAttach
6. Return to Company list page.
7. Click the link of new add Company and observer the logo field.
Except Result:
- The logo filed is not changed.
Actual Result:
- The logo is empty.
Bug analysis:
In step 5, when save object, the line 66 in JPASupport.edit()
will flush "logo" field to null. And in the following if-else closure from line 124-141 cannot find upload file attributes from params.
Proposed solution:
1. in BeanWrapper.bind() method, add a check of fileds, if its type is FileAttachment and it's not null, don't set value of it. If the FileAttachment filed is changed, it would be updated in the JPASupport.edit() handle fileAttachment closure(124-141).
2. There is a potential problem: FileAttachment.
Changed in play: | |
status: | New → Fix Committed |
The bug is still out there.