Bug 414159 - [Tree][Markup] "&" causes problem in tree item text that is no markup
Summary: [Tree][Markup] "&" causes problem in tree item text that is no markup
Status: NEW
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 2.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-31 12:48 EDT by Frank Appel CLA
Modified: 2013-09-04 07:20 EDT (History)
2 users (show)

See Also:


Attachments
Snippet to reproduce the problemt (1.23 KB, application/octet-stream)
2013-07-31 12:48 EDT, Frank Appel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Appel CLA 2013-07-31 12:48:00 EDT
Created attachment 233993 [details]
Snippet to reproduce the problemt

RWT version taken from: http://download.eclipse.org/rt/rap/nightly/runtime/20130726-1307

Steps to reproduce:

- launch the attached entry point snippet
- open the browser and connect with an appropriate URL of the given entry point

=> The following Stacktrace shows up:

java.lang.IllegalArgumentException : Failed to parse markup text
at org.eclipse.swt.internal.widgets.MarkupValidator.validate( MarkupValidator.java:57 )
at org.eclipse.swt.widgets.TreeItem.setText( TreeItem.java:975 )
at org.eclipse.swt.widgets.TreeItem.setText( TreeItem.java:954 )
at tree.link.problem.LinkProblemEP.createUI( LinkProblemEP.java:26 )
at org.eclipse.rap.rwt.internal.lifecycle.PrepareUIRoot.execute( PrepareUIRoot.java:39 )
at org.eclipse.rap.rwt.internal.lifecycle.PhaseExecutor.execute( PhaseExecutor.java:35 )
at org.eclipse.rap.rwt.internal.lifecycle.SimpleLifeCycle.execute( SimpleLifeCycle.java:51 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.runLifeCycle( LifeCycleServiceHandler.java:137 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.handlePostRequest( LifeCycleServiceHandler.java:123 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.synchronizedService( LifeCycleServiceHandler.java:76 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.service( LifeCycleServiceHandler.java:67 )
at org.eclipse.rap.rwt.engine.RWTServlet.handleValidRequest( RWTServlet.java:119 )
at org.eclipse.rap.rwt.engine.RWTServlet.handleRequest( RWTServlet.java:106 )
at org.eclipse.rap.rwt.engine.RWTServlet.doPost( RWTServlet.java:99 )
at javax.servlet.http.HttpServlet.service( HttpServlet.java:755 )
at javax.servlet.http.HttpServlet.service( HttpServlet.java:848 )
at org.eclipse.jetty.servlet.ServletHolder.handle( ServletHolder.java:669 )
at org.eclipse.jetty.servlet.ServletHandler.doHandle( ServletHandler.java:457 )
at org.eclipse.jetty.server.handler.ScopedHandler.handle( ScopedHandler.java:137 )
at org.eclipse.jetty.security.SecurityHandler.handle( SecurityHandler.java:557 )
at org.eclipse.jetty.server.session.SessionHandler.doHandle( SessionHandler.java:231 )
at org.eclipse.jetty.server.handler.ContextHandler.doHandle( ContextHandler.java:1075 )
at org.eclipse.jetty.servlet.ServletHandler.doScope( ServletHandler.java:384 )
at org.eclipse.jetty.server.session.SessionHandler.doScope( SessionHandler.java:193 )
at org.eclipse.jetty.server.handler.ContextHandler.doScope( ContextHandler.java:1009 )
at org.eclipse.jetty.server.handler.ScopedHandler.handle( ScopedHandler.java:135 )
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle( ContextHandlerCollection.java:255 )
at org.eclipse.jetty.server.handler.HandlerWrapper.handle( HandlerWrapper.java:116 )
at org.eclipse.jetty.server.Server.handle( Server.java:368 )
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest( AbstractHttpConnection.java:489 )
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest( BlockingHttpConnection.java:53 )
at org.eclipse.jetty.server.AbstractHttpConnection.content( AbstractHttpConnection.java:953 )
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content( AbstractHttpConnection.java:1014 )
at org.eclipse.jetty.http.HttpParser.parseNext( HttpParser.java:861 )
at org.eclipse.jetty.http.HttpParser.parseAvailable( HttpParser.java:235 )
at org.eclipse.jetty.server.BlockingHttpConnection.handle( BlockingHttpConnection.java:72 )
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run( SocketConnector.java:264 )
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob( QueuedThreadPool.java:608 )
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run( QueuedThreadPool.java:543 )
at java.lang.Thread.run(Unknown Source)
Caused by: 
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 10; Auf "&" in der Entitätsreferenz muss umgehend der Entitätsname folgen.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.eclipse.swt.internal.widgets.MarkupValidator.validate( MarkupValidator.java:53 )
at org.eclipse.swt.widgets.TreeItem.setText( TreeItem.java:975 )
at org.eclipse.swt.widgets.TreeItem.setText( TreeItem.java:954 )
at tree.link.problem.LinkProblemEP.createUI( LinkProblemEP.java:26 )
at org.eclipse.rap.rwt.internal.lifecycle.PrepareUIRoot.execute( PrepareUIRoot.java:39 )
at org.eclipse.rap.rwt.internal.lifecycle.PhaseExecutor.execute( PhaseExecutor.java:35 )
at org.eclipse.rap.rwt.internal.lifecycle.SimpleLifeCycle.execute( SimpleLifeCycle.java:51 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.runLifeCycle( LifeCycleServiceHandler.java:137 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.handlePostRequest( LifeCycleServiceHandler.java:123 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.synchronizedService( LifeCycleServiceHandler.java:76 )
at org.eclipse.rap.rwt.internal.service.LifeCycleServiceHandler.service( LifeCycleServiceHandler.java:67 )
at org.eclipse.rap.rwt.engine.RWTServlet.handleValidRequest( RWTServlet.java:119 )
at org.eclipse.rap.rwt.engine.RWTServlet.handleRequest( RWTServlet.java:106 )
at org.eclipse.rap.rwt.engine.RWTServlet.doPost( RWTServlet.java:99 )
at javax.servlet.http.HttpServlet.service( HttpServlet.java:755 )
at javax.servlet.http.HttpServlet.service( HttpServlet.java:848 )
at org.eclipse.jetty.servlet.ServletHolder.handle( ServletHolder.java:669 )
at org.eclipse.jetty.servlet.ServletHandler.doHandle( ServletHandler.java:457 )
at org.eclipse.jetty.server.handler.ScopedHandler.handle( ScopedHandler.java:137 )
at org.eclipse.jetty.security.SecurityHandler.handle( SecurityHandler.java:557 )
at org.eclipse.jetty.server.session.SessionHandler.doHandle( SessionHandler.java:231 )
at org.eclipse.jetty.server.handler.ContextHandler.doHandle( ContextHandler.java:1075 )
at org.eclipse.jetty.servlet.ServletHandler.doScope( ServletHandler.java:384 )
at org.eclipse.jetty.server.session.SessionHandler.doScope( SessionHandler.java:193 )
at org.eclipse.jetty.server.handler.ContextHandler.doScope( ContextHandler.java:1009 )
at org.eclipse.jetty.server.handler.ScopedHandler.handle( ScopedHandler.java:135 )
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle( ContextHandlerCollection.java:255 )
at org.eclipse.jetty.server.handler.HandlerWrapper.handle( HandlerWrapper.java:116 )
at org.eclipse.jetty.server.Server.handle( Server.java:368 )
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest( AbstractHttpConnection.java:489 )
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest( BlockingHttpConnection.java:53 )
at org.eclipse.jetty.server.AbstractHttpConnection.content( AbstractHttpConnection.java:953 )
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content( AbstractHttpConnection.java:1014 )
at org.eclipse.jetty.http.HttpParser.parseNext( HttpParser.java:861 )
at org.eclipse.jetty.http.HttpParser.parseAvailable( HttpParser.java:235 )
at org.eclipse.jetty.server.BlockingHttpConnection.handle( BlockingHttpConnection.java:72 )
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run( SocketConnector.java:264 )
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob( QueuedThreadPool.java:608 )
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run( QueuedThreadPool.java:543 )
at java.lang.Thread.run(Unknown Source)
Comment 1 Ivan Furnadjiev CLA 2013-07-31 13:09:24 EDT
When markup is enabled the provided item text must be a valid HTML. '&' character marks beginning of HTML entity. HTML named entities are not yet supported in RAP (see bug 379088). As a workaround use HTML number ( http://www.ascii.cl/htmlcodes.htm ) for '&' -> &. Can we consider this bug as invalid?
Comment 2 Frank Appel CLA 2013-08-01 02:29:07 EDT
(In reply to comment #1)
> When markup is enabled the provided item text must be a valid HTML. '&'
I guess you Meran XHTML?
> character marks beginning of HTML entity. HTML named entities are not yet
> supported in RAP (see bug 379088). As a workaround use HTML number (
> http://www.ascii.cl/htmlcodes.htm ) for '&' -> &. Can we consider this
> bug as invalid?

I consider this as a valid usecase so I think this issue is also valid. The values shown in the tree items come from RMI read by database requests. We do not have any influence of that values in the RMI. The label providers are generated item adapters and it would be very awkward to override each getText method of those. The latter is not really an option. In my opinion this issue might be a duplicate of 379088.
Comment 3 Ralf Sternberg CLA 2013-08-08 09:55:21 EDT
I had a discussion with Frank and understand their use case better now: some of their Tree items require markup, while other items are filled with plain text from a data source. Escaping the plain texts is problematic. So it's not about a bug in our implementation but about a use case that is not covered at the moment: mixing markup and plain text in a single Tree.

We need a way to distinguish between markup and plain text. This is done by the MARKUP_ENABLED flag. Guessing based on the presence of angle brackets or entities in the text is not an option. We could think about support for setting the MARKUP_ENABLED flag on TreeItems as well. Would that help?

As I understand it, implementing the entities as requested in bug 379088 would not solve this issue, because ampersands still need to be translated to & entities.
Comment 4 Markus Knauer CLA 2013-09-04 07:20:34 EDT
*** Bug 416451 has been marked as a duplicate of this bug. ***