Erikhht / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

StringIndexOutOfBoundsException when url() is empty #160

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Parsing a CSS file that contains an url with an empty parameter, e.g.:

background: transparent url() no-repeat scroll 3px 5px;

What is the expected output? What do you see instead?
The entire rendering process fails with a StringIndexOutOfBoundsException 
occuring in CSSParser.isRelativeURI(String uri) when charAt(0) is invoked on 
the empty 'uri' parameter. 

What version of the product are you using? On what operating system?
core-renderer R8pre2, Windows 7 64bit

Please provide any additional information below.
The complete stacktrace:

     [Java] org.xhtmlrenderer.util.XRRuntimeException: Failed on parsing CSS sheet at http://localhost:10080/web/cms/code/194/430/screen.css
     [Java]     at org.xhtmlrenderer.context.StylesheetFactoryImpl.parse(StylesheetFactoryImpl.java:104)
     [Java]     at org.xhtmlrenderer.context.StylesheetFactoryImpl.getStylesheet(StylesheetFactoryImpl.java:194)
     [Java]     at org.xhtmlrenderer.context.StyleReference.readAndParseAll(StyleReference.java:123)
     [Java]     at org.xhtmlrenderer.context.StyleReference.setDocumentContext(StyleReference.java:107)
     [Java]     at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:136)
     [Java]     at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:110)
     [Java]     at com.rwe.rwecom.pdffolder.portalintegration.PdfView.createPagePdf(PdfView.java:251)
     [Java]     at com.rwe.rwecom.pdffolder.portalintegration.PdfView.render(PdfView.java:161)
     [Java]     at com.coremedia.objectserver.web.ViewUtils.render(ViewUtils.java:99)
     [Java]     at com.coremedia.objectserver.web.ViewUtils.render(ViewUtils.java:67)
     [Java]     at com.coremedia.objectserver.web.BeanView.render(BeanView.java:64)
     [Java]     at com.coremedia.objectserver.web.BeanView.renderMergedOutputModel(BeanView.java:47)
     [Java]     at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:257)
     [Java]     at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)
     [Java]     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
     [Java]     at com.coremedia.objectserver.web.DispatcherServlet.doDispatch(DispatcherServlet.java:56)
     [Java]     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
     [Java]     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
     [Java]     at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
     [Java]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
     [Java]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     [Java]     at com.rwe.sbf.core.servlet.ClientAbortHandlingFilter.doFilter(ClientAbortHandlingFilter.java:28)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     [Java]     at com.rwe.rwecom.portal.rendering.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:45)
     [Java]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     [Java]     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
     [Java]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     [Java]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
     [Java]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
     [Java]     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
     [Java]     at org.jboss.web.tomcat.service.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:97)
     [Java]     at org.jboss.web.tomcat.service.session.JvmRouteValve.invoke(JvmRouteValve.java:84)
     [Java]     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
     [Java]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
     [Java]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
     [Java]     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
     [Java]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     [Java]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
     [Java]     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
     [Java]     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
     [Java]     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
     [Java]     at java.lang.Thread.run(Thread.java:619)
     [Java] Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
     [Java]     at java.lang.String.charAt(String.java:687)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.isRelativeURI(CSSParser.java:1882)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.getTokenValue(CSSParser.java:1854)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.getTokenValue(CSSParser.java:1819)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.term(CSSParser.java:1540)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.expr(CSSParser.java:1360)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.declaration(CSSParser.java:1262)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.declaration_list(CSSParser.java:726)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.ruleset(CSSParser.java:755)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.stylesheet(CSSParser.java:237)
     [Java]     at org.xhtmlrenderer.css.parser.CSSParser.parseStylesheet(CSSParser.java:88)
     [Java]     at org.xhtmlrenderer.context.StylesheetFactoryImpl.parse(StylesheetFactoryImpl.java:80)
     [Java]     at org.xhtmlrenderer.context.StylesheetFactoryImpl.parse(StylesheetFactoryImpl.java:97)

Original issue reported on code.google.com by jmabloe...@gmail.com on 12 Jul 2011 at 9:15

GoogleCodeExporter commented 9 years ago
I admit, that the cause of all this is a broken css, however, such case may 
happen sometime, especially when several designer amend a shared css. Even if 
this bug is not going to be fixed it would be very useful to get notified of 
the corresponding line the exception initially occured at.

Original comment by jmabloe...@gmail.com on 12 Jul 2011 at 9:44

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This issue is still there or fixed in latest release?

Original comment by kan...@gmail.com on 13 Dec 2012 at 8:54