core icon indicating copy to clipboard operation
core copied to clipboard

Converted blocks failing to render- RefreshReferences is getting called even when the content is not json

Open wezell opened this issue 1 year ago • 10 comments

Parent Issue

No response

Problem Statement

I think this is happening when a field has been converted to a block from a wysiwyg but the content in the field is still HTML:

	at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: com.dotmarketing.exception.DotRuntimeException: An error occurred when refreshing Story Block Contentlet references in parent Content 'caa8601b-c6f4-49bc-814e-62b0b97f2551': Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]
	at com.dotcms.contenttype.business.StoryBlockAPIImpl.refreshStoryBlockValueReferences(StoryBlockAPIImpl.java:116) ~[classes/:?]
	at org.apache.jsp.html.portlet.ext.contentlet.edit_005fcontentlet_jsp._jspService(edit_005fcontentlet_jsp.java:3809) ~[?:?]
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) ~[jasper.jar:9.0.85]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) ~[servlet-api.jar:4.0.FR]
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466) ~[jasper.jar:9.0.85]
	... 154 more
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]
	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2481) ~[jackson-core-2.16.1.jar:2.16.1]
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:752) ~[jackson-core-2.16.1.jar:2.16.1]
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:676) ~[jackson-core-2.16.1.jar:2.16.1]
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:2088) ~[jackson-core-2.16.1.jar:2.16.1]

Steps to Reproduce

  1. Create a content type with a wysiwyg
  2. Add a piece of content to this type, add some html to the wysiwyg
  3. Go back to the content type and convert the wysiwyg to a block field
  4. try to edit the content. You will get a stack trace.

Acceptance Criteria

Important fix - Refresh references should not cause/throw an error. We can log a warning, but it should not prevent the content from rendering or api calls, etc.

Additionally - we should skip the refreshReferences if the block content is not json

dotCMS Version

24.06.x

Proposed Objective

Quality Assurance

Proposed Priority

Priority 1 - Show Stopper

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

wezell avatar Jun 19 '24 18:06 wezell

Not reproducible in LTS

erickgonzalez avatar Jun 19 '24 18:06 erickgonzalez

No, but the infinity relationships being stored in the block are, unless you backported the fix from last week.

wezell avatar Jun 19 '24 18:06 wezell

Are you referring to this one? https://github.com/dotCMS/core/issues/28659 If so, then yes, we will need to backport it, as it is currently queued for backporting.

erickgonzalez avatar Jun 19 '24 18:06 erickgonzalez

There are some videos in auth that can't be edited and seem related to this:

https://authoring.dotcms.com/dotAdmin/#/c/content/7c2fc123-dd3e-401b-812f-a8adab7b84ca

CleanShot 2024-06-21 at 09 57 00@2x

fmontes avatar Jun 21 '24 15:06 fmontes

Pass Internal QA: Works as expeceted

freddyDOTCMS avatar Jun 26 '24 22:06 freddyDOTCMS

Failed: Tested on trunk_2b6105d, Docker, macOS 14.5, FF v126.0.1

I'm getting this error when reproducing this issue.

Screenshot 2024-06-27 at 11 34 44 AM

josemejias11 avatar Jun 27 '24 17:06 josemejias11

Hi @josemejias11 not sure if it is related to block editor or even the issue reported here, may be we can see it in another issue

jdotcms avatar Jun 27 '24 20:06 jdotcms

Hi @jdotcms, lets make @wezell the decider here. If he says the error can be review in another card. there's no problem on my end whatsoever. thanks!

josemejias11 avatar Jun 27 '24 20:06 josemejias11

@josemejias11, this is a different issue - we should open a card for it and add the jackson optional mapper to our ObjectMapper code.

wezell avatar Jun 27 '24 20:06 wezell

Approved: Tested on trunk_2b6105d, Docker, macOS 14.5, FF v126.0.1

The reported issue above will be covered on the card https://github.com/dotCMS/core/issues/29041

josemejias11 avatar Jun 27 '24 21:06 josemejias11