[RESPDAM-51] REST endpoint returns error on ressources created in previous Magnolia version Created: 22/Sep/21  Updated: 19/Oct/21  Resolved: 19/Oct/21

Status: Closed
Project: DAM Focal
Component/s: None
Affects Version/s: 2.0.6
Fix Version/s: None

Type: Bug Priority: High
Reporter: Simon Tourville Assignee: Adrien Manzoni
Resolution: Not an issue Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Capture1.PNG     XML File dam.jel.logos.ljdrujj-logo-en..svg (3).xml     XML File dam.jel.logos.ljdrujj-logo-en..svg.xml     XML File dam.jel.logos.ljdrujj-logo-fr..svg.xml     XML File dam.jel.test.ljdrujj-logo-fr..svg.xml     File jel_v1.yaml     Text File stack-trace.txt     Text File testing.txt    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Steps to reproduce

  1.  Import dam.jel.test.ljdrujj-logo-fr..svg.xml (works)
    1. Image created with version 6.2.11
  2.  Import dam.jel.logos.ljdrujj-logo-fr..svg.xml (does not work)
    1. Image created with a previous 6.2.x version
  3. Compare the two files (see Capture.png) The only difference is :
    <sv:property sv:name="mgnl:created" sv:type="Date">
    <sv:value>2021-09-22T08:12:30.341-04:00</sv:value>
    </sv:property>
    <sv:property sv:name="mgnl:createdBy" sv:type="String">
    <sv:value>superuser</sv:value>
    </sv:property>
  4. Config rest end point for "image"
    1.  implementationClass: info.magnolia.dam.focal.rest.reference.AssetFocalReferenceResolver

  5. Call REST endpoint with implementationClass
    1. Ex: https://www.espacejeux.local/magnoliaAuthor/.rest/delivery/pages/v1/jel/inscription/demo/main/0/row/0/column/0?lang=ff
    2. Pointing directly to the working image : WORKS
    3. Pointing directly to the pb image : FAILED
    4. Comment implementClass
    5. Pointing directly to the pb image : WORKS.
    6. See testing.txt result.

See Stacktrace.

Expected results

Should work with images that does not have thos lines:

<sv:property sv:name="mgnl:created" sv:type="Date">
<sv:value>2021-09-22T08:12:30.341-04:00</sv:value>
</sv:property>
<sv:property sv:name="mgnl:createdBy" sv:type="String">
<sv:value>superuser</sv:value>
</sv:property>

Actual results

Fail...

Workaround

We would have to re-create all our DAM resources (100+)

Development notes



 Comments   
Comment by Simon Tourville [ 24/Sep/21 ]

I'm now 100% sure that an image missing those properties creates the error:

<sv:property sv:name="mgnl:created" sv:type="Date">
<sv:value>2020-09-09T14:27:13.727-04:00</sv:value>
</sv:property>
<sv:property sv:name="mgnl:createdBy" sv:type="String">
<sv:value>superuser</sv:value>
</sv:property>

I do not know from which version of Magnolia 6.2.x those properties where added...

Hint: May be the probel still exist if we import resources from zip file or directy... May be not...

Looking at:

https://git.magnolia-cms.com/projects/INCUBATOR/repos/dam-focal/browse/magnolia-dam-focal-common/src/main/java/info/magnolia/rest/reference/dam/AssetFocalWriter.java

Lines 133 and 134:

this.writeNonEmptyKeyValue(jsonGenerator, "created", DateUtil.format(asset.getCreated().getTime(), DATE_TIME_PATTERN));
this.writeNonEmptyKeyValue(jsonGenerator, "modified", DateUtil.format(asset.getLastModified().getTime(), DATE_TIME_PATTERN));

DateUtil.format(null) -> returns errors.

Could you fix that please?

Comment by Simon Tourville [ 24/Sep/21 ]

I've just found the solution:

https://docs.magnolia-cms.com/product-docs/6.2/Releases/Release-notes-for-Magnolia-CMS-6.2.11.html#_notable_bug_fixes

Executing the Groovy scrips fix the issue.

Wow!

Comment by Simon Tourville [ 24/Sep/21 ]

https://jira.magnolia-cms.com/browse/MGNLDAM-969

Comment by Adrien Manzoni [ 19/Oct/21 ]

Fixed in DX Core 6.2.11

Generated at Mon Feb 12 00:42:03 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.