Generating PDF file throws NumberFormatException

Description

To throw an NFE:
1. Add the RWiki tool to a site.
2. Click on the Info button.
3. Under Views and Feeds, click on the PDF link.

I get the following stack trace whenever I click on that link:

2014-11-19 08:27:58,855 ERROR ajp-bio-8009-exec-7 org.apache.fop.fo.FOTreeBuilder - javax.xml.transform.TransformerException: java.lang.NumberFormatException: For input string: ":0"
java.lang.RuntimeException: java.lang.NumberFormatException: For input string: ":0"
at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3418)
at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:389)
at uk.ac.cam.caret.sakai.rwiki.component.service.impl.XSLTEntityHandler.outputContent(XSLTEntityHandler.java:435)
at uk.ac.cam.caret.sakai.rwiki.component.service.impl.RWikiObjectServiceImpl$2.handleAccess(RWikiObjectServiceImpl.java:1507)
at uk.ac.cam.caret.sakai.rwiki.access.WikiAccessServlet.dispatch(WikiAccessServlet.java:164)
at uk.ac.cam.caret.sakai.rwiki.access.WikiAccessServlet.doGet(WikiAccessServlet.java:117)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:695)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
2014-11-19 08:27:58,858 WARN ajp-bio-8009-exec-7 uk.ac.cam.caret.sakai.rwiki.component.service.impl.RWikiObjectServiceImpl - Error getting wiki page via access :/wiki/site/2fdf8f24-2bd2-48a7-81a8-98d0c8c8d88f/home.pdf
2014-11-19 08:27:58,858 WARN ajp-bio-8009-exec-7 uk.ac.cam.caret.sakai.rwiki.access.WikiAccessServlet - dispatch(): exception:
java.lang.RuntimeException: /wiki/site/2fdf8f24-2bd2-48a7-81a8-98d0c8c8d88f/home.pdf
at uk.ac.cam.caret.sakai.rwiki.component.service.impl.RWikiObjectServiceImpl$2.handleAccess(RWikiObjectServiceImpl.java:1572)
at uk.ac.cam.caret.sakai.rwiki.access.WikiAccessServlet.dispatch(WikiAccessServlet.java:164)
at uk.ac.cam.caret.sakai.rwiki.access.WikiAccessServlet.doGet(WikiAccessServlet.java:117)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:695)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: Failed to serialise java.lang.NumberFormatException: For input string: ":0"
at uk.ac.cam.caret.sakai.rwiki.component.service.impl.XSLTEntityHandler.outputContent(XSLTEntityHandler.java:442)
at uk.ac.cam.caret.sakai.rwiki.component.service.impl.RWikiObjectServiceImpl$2.handleAccess(RWikiObjectServiceImpl.java:1507)
... 23 more
Caused by: java.lang.RuntimeException: java.lang.NumberFormatException: For input string: ":0"
at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3418)
at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:389)
at uk.ac.cam.caret.sakai.rwiki.component.service.impl.XSLTEntityHandler.outputContent(XSLTEntityHandler.java:435)
... 24 more

Activity

Show:

Brian J. July 17, 2017 at 8:03 AM

, please feel free to create another ticket that describes the problem you're seeing more accurately. The general workflow in the Sakai community is not to re-open a ticket once it's been closed. Thanks!

Austin July 14, 2017 at 8:34 PM

Also, here's another way to reproduce this problem:

  • in any site, go to Site Info

  • click on the participant list's "Printable Version"

Austin July 14, 2017 at 8:29 PM

I noticed that this problem still happens in my local build of 11.4

Taking a closer look at https://issues.apache.org/jira/browse/XGC-52 it mentions

"When you have a negative GMT indication and when the negative number is less or equal to -10 then there is a problem"

We are located in GMT -10 (Hawaii), which I believe is why we are seeing this problem here, but the Sakai nightly qa servers do not have the problem.

I was able to confirm that my time zone was causing the issue by setting my computer's system time ahead to an Eastern Time Zone and the problem went away.  (and I would guess you can reproduce the issue by setting your timezone to anything <= GMT -10)

So I think the patch proposed above is worthwhile.  Also, I've seen this problem in several tools besides rwiki mentioned above.  These tools in 11.4 are still using the affected xmlgraphics-commons jar

 

 

The proposed patch would make those tools use 1.5.

 

Also, sorry, I don't have permission in JIRA to re-open this issue, so all I can do for now is comment on it.

Brian J. November 15, 2016 at 1:27 PM
Edited

I was not able to reproduce this in either 11/master nightlies. Is there some specific content needed in the Wiki page to trigger the NFE? Please try replicating on any of the nightly servers, and if you are able to reproduce please create a new ticket and provide detailed steps to reproduce.

BJ Peter DeLaCruz November 26, 2014 at 12:39 PM

I fixed this issue by adding version 1.5 of Apache's XML Graphics library.

<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>xmlgraphics-commons</artifactId>
<version>1.5</version>
</dependency>

I checked the pom.xml file for RWiki for the latest version of Sakai, and it looks like the tool still uses the same old library (version 1.0).

The problem with the old library is that there's a bug in the code related to formatting the date and time. More information here: https://issues.apache.org/jira/browse/XGC-52

It looks like this problem wasn't fixed until version 1.5.

Cannot Reproduce

Details

Priority

Affects versions

Components

Assignee

Reporter

Created November 19, 2014 at 12:29 PM
Updated July 17, 2017 at 3:33 PM
Resolved November 15, 2016 at 1:27 PM