Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 576381

Summary: FileDialog is not able to deal with files containing &
Product: [RT] RAP Reporter: Christian Kloner <christian.kloner>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.19   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Christian Kloner CLA 2021-10-01 04:22:24 EDT
When you rename any file to have & in the name and upload the file with the FileDialog/FileUpload Widget, then the file dialog will crash - see below stack trace.

The problem is related to the UploadPanel as each created label, that displays a file name, has RWT.MARKUP_ENABLED. This allows to render html code properly in case of an error (see UploadPanel.prepareText) but hinders the usage of any xml specific processing/reserved character in a filename.

Maybe the solution is to simply html/xml escape the fileNames in the UploadPanel constructor and rename the fileNames variable to markupEscapedFileNames.


Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 289; The entity name must immediately follow the '&' in the entity reference.
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1471)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1782)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2985)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324)
	at org.eclipse.swt.internal.widgets.MarkupValidator.validate(MarkupValidator.java:57)
Comment 1 Ivan Furnadjiev CLA 2021-10-01 04:49:42 EDT
Are you sure that you are using latest RAP version? This issue has been resolved in RAP 3.14. Here is the corresponding bug report bug 565789. I can't reproduce it with latest RAP version. Please reopen if you disagree.

*** This bug has been marked as a duplicate of bug 565789 ***
Comment 2 Christian Kloner CLA 2021-10-02 02:48:10 EDT
(In reply to Ivan Furnadjiev from comment #1)
> Are you sure that you are using latest RAP version? This issue has been
> resolved in RAP 3.14. Here is the corresponding bug report bug 565789. I
> can't reproduce it with latest RAP version. Please reopen if you disagree.
> 
> *** This bug has been marked as a duplicate of bug 565789 ***

You are right. We are not at the latest version and will upgrade soon. Thanks for fixing.