Bug 1065234 - Seam Text parse error: expecting an opening angle bracket '<', found '&'
Summary: Seam Text parse error: expecting an opening angle bracket '<', found '&'
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-Logic
Version: 3.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.7
Assignee: Sean Flanigan
QA Contact: Zanata-QA Mailling List
URL:
Whiteboard:
Depends On: 1198433
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-14 07:37 UTC by Sean Flanigan
Modified: 2015-07-22 02:20 UTC (History)
2 users (show)

Fixed In Version: 3.7.0-SNAPSHOT (git-jenkins-zanata-server-github-pull-requests-3566)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-07-22 02:20:07 UTC
Embargoed:


Attachments (Terms of Use)
Groovy script to check project homeContent for invalid SeamText (1.20 KB, text/plain)
2014-04-24 08:04 UTC, Sean Flanigan
no flags Details

Description Sean Flanigan 2014-02-14 07:37:15 UTC
Description of problem:

We're getting quite a number of these errors on translate.zanata.org's server.log:

WARN  [org.jboss.seam.ui.component.UIFormattedText] Seam Text parse error: expecting an opening angle bracket '<', found '&'

We should write an ad-hoc Groovy script to trawl the database looking at all the Seam Text and run it through
    org.jboss.seam.ui.component.UIFormattedText.getFormattedText()
or
    org.jboss.seam.ui.validator.FormattedTextValidator
to work out what the problem is.  Then if we can work out how to reproduce it, we should report a bug upstream, because the RichFaces editor should not be generating illegal Seam Text.

However, we should try to find a way at least to avoid saving broken Seam Text when it has been generated.  We might be able to use s:validateFormattedText inside rich:editor for that.

Version-Release number of selected component (if applicable):
3.2, but (some of) the bad data may have been generated by an earlier version



Additional info:

These should be all the places in the JSF code which currently use Seam Text:

$ cd server/zanata-war
$ ack -A1 formattedText src/main/webapp

src/main/webapp/project/project.xhtml
21:        <s:formattedText id="project-home-content"
22-          value="#{projectHome.instance.homeContent}"/>
23:        <s:formattedText value="#{projectHome.instance.description}"
24-          rendered="#{empty projectHome.instance.homeContent}"/>
--
34:        <s:formattedText id="source-checkout-url"
35-          rendered="#{not empty projectHome.instance.sourceCheckoutURL}"

src/main/webapp/help/view.xhtml
16:    <s:formattedText id="project-home-content"
17:      value="#{applicationConfiguration.helpContent}"></s:formattedText>
18-  </ui:define>

src/main/webapp/home.xhtml
13:    <s:formattedText id="project-home-content"
14:      value="#{applicationConfiguration.homeContent}"></s:formattedText>
15-




$ ack -A1 'rich:editor|useSeamText=.true.' src/main/webapp # and then remove any which don't have useSeamText

src/main/webapp/WEB-INF/layout/project_edit_form.xhtml:94:      <rich:editor id="homeContent"
src/main/webapp/WEB-INF/layout/project_edit_form.xhtml-95-        width="412" height="300" style="width:412px;"
--
src/main/webapp/WEB-INF/layout/project_edit_form.xhtml:99:        useSeamText="true"
src/main/webapp/WEB-INF/layout/project_edit_form.xhtml-100-        configuration="richeditor"
--
src/main/webapp/WEB-INF/layout/project_edit_form.xhtml:102:      </rich:editor>
src/main/webapp/WEB-INF/layout/project_edit_form.xhtml-103-    </s:decorate>
--
src/main/webapp/help/edit_help_content.xhtml:20:        <rich:editor id="homeContent"
src/main/webapp/help/edit_help_content.xhtml-21-          width="500" height="600" style="width:500px;"
--
src/main/webapp/help/edit_help_content.xhtml:25:          useSeamText="true"
src/main/webapp/help/edit_help_content.xhtml-26-          configuration="richeditor"
--
src/main/webapp/help/edit_help_content.xhtml:28:        </rich:editor>
src/main/webapp/help/edit_help_content.xhtml-29-
--
src/main/webapp/edit_home_content.xhtml:19:        <rich:editor id="homeContent"
src/main/webapp/edit_home_content.xhtml-20-          height="600"
--
src/main/webapp/edit_home_content.xhtml:24:          useSeamText="true"
src/main/webapp/edit_home_content.xhtml-25-          configuration="richeditor"
--
src/main/webapp/edit_home_content.xhtml:28:        </rich:editor>
src/main/webapp/edit_home_content.xhtml-29-

Comment 1 Sean Flanigan 2014-04-24 08:04:08 UTC
Created attachment 889199 [details]
Groovy script to check project homeContent for invalid SeamText

The attached Groovy script can check all the projects in a Zanata database for invalid SeamText.  (It doesn't currently check Home or Help pages.)

Comment 2 Sean Flanigan 2014-04-24 08:11:11 UTC
From what I can see, about half the problems are caused by URLs which contain an odd number of underscores (underscores are used for _underlining_ in SeamText).  These can be handled by wrapping the URL in pipe characters, eg:

    |http://example.com/my_project_with_underscores|

These will then be rendered as-is in monospace (not clickable).  They could also be converted to SeamText links like this:

    [click me=>http://example.com/my_project_with_underscores]

Unfortunately, I didn't have any success constructing a working SeamText link whose link text was empty or the same as the URL.


In another case, a SeamText link was somehow corrupted, and the greater-than sign was encoded as '&gt;' which SeamText doesn't like.  Similarly, a quote character was converted to '&#39;'

Comment 3 Sean Flanigan 2015-05-15 05:02:23 UTC
Eliminating Seam Text should eliminate Seam Text parser errors: https://github.com/zanata/zanata-server/pull/732

Comment 4 Ding-Yi Chen 2015-05-18 08:14:18 UTC
VERIFIED with Zanata 3.7.0-SNAPSHOT (git-jenkins-zanata-server-github-pull-requests-3566)


Note You need to log in before you can comment on or make changes to this bug.