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 8 months 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