enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
202 stars 34 forks source link

Debugging XSLT render almost impossible #4931

Closed Bellfalasch closed 5 years ago

Bellfalasch commented 7 years ago

We need to improve how errors in XSLT parsing from the lib-xslt is propagated in XP. As of now we are shooting in the blind when debugging apps like sitemap.xml and RSS on Market. They depend on XML and therefore the XSLT-lib. However, when errors occur (usually because some input data contains odd characters) it just crashes without any indication on why.

Example error message that more or less says "Good luck in finding what caused this", and five hours later and many things tried, you finally find that one little data that caused it.

Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createElement(CoreDocumentImpl.java:665) ~[na:1.8.0_121] at com.enonic.xp.xml.DomBuilder.createElement(DomBuilder.java:33) ~[na:na] at com.enonic.xp.xml.DomBuilder.start(DomBuilder.java:39) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeMap(MapToXmlConverter.java:24) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:38) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeMap(MapToXmlConverter.java:25) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:38) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeList(MapToXmlConverter.java:51) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:34) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeMap(MapToXmlConverter.java:25) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:38) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeMap(MapToXmlConverter.java:25) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:38) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeMap(MapToXmlConverter.java:25) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:38) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeMap(MapToXmlConverter.java:25) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:38) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeList(MapToXmlConverter.java:51) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeObject(MapToXmlConverter.java:34) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.serializeMap(MapToXmlConverter.java:25) ~[na:na] at com.enonic.xp.lib.xslt.MapToXmlConverter.toSource(MapToXmlConverter.java:16) ~[na:na] at com.enonic.xp.lib.xslt.XsltProcessor.setModel(XsltProcessor.java:59) ~[na:na] at jdk.nashorn.internal.scripts.Script$Recompilation$287$609AA$xslt.L:1#render(com.enonic.app.sitemapxml:/site/lib/xp/xslt.js:24)

Bellfalasch commented 5 years ago

This is fixed in lib-xslt.