Not sure if this is Lucee or Coldbox? Starting in ...
# lucee
l
Not sure if this is Lucee or Coldbox? Starting in 5.3.9.95 (up through 108), we are having trouble displaying PDFs in browser. It's tough to get a stacktrace, but getting a
java.lang.NullPointerException
in Coldbox here:
coldbox\system\core\conversion\DataMarshaller.cfc
This is in a simple handler that just does:
Copy code
var theBinary = fileReadBinary( file );
event.renderData( data=theBinary, type="PDF" );
Has anyone else experienced same? Dropping back to 5.3.9.92 fixes.
b
@leftbower Need to see the full java stack trace
or at least the part of the java stack trace above the top .cfc line
There are some PDF fixes, so this may be a regression in cfdocument
d
I do know there were some changes with binary detection in a recent ticket, so that could be the root cause.
l
FWIW, not using cfdocument, just the renderData method above. The PDF opens fine on its own nor is it generated by the app
b
@leftbower render data uses cfdocument to render PDFs
Instead of guessing what is being called, provide the stack trace and then we'll know 🙂
l
Copy code
lucee.runtime.exp.NativeException: java.lang.NullPointerException at lucee.runtime.tag.Content._doStartTag(Content.java:185) at lucee.runtime.tag.Content.doStartTag(Content.java:156) at system.core.conversion.datamarshaller_cfc$cf.udfCall(/coldbox/system/core/conversion/DataMarshaller.cfc:151) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:661) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:582) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1948) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1768) at system.bootstrap_cfc$cf.udfCall2(/coldbox/system/Bootstrap.cfc:742) at system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:804) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1768) at system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:394) at system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223) at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1749) at system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:519) at system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:660) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:582) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1929) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1749) at application_cfc$cf$6.udfCall(/Application.cfc:34) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:660) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:582) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1929) at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:437) at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:133) at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44) at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2462) at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2452) at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2423) at lucee.runtime.engine.Request.exe(Request.java:45) at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1194) at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1140) at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97) at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:590) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:47) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:262) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:187) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:227) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:149) at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111) at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:45) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:262) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:187) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:227) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:149) at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111) at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:215) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:405) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at runwar.Server$1.handleRequest(Server.java:510) at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:280) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:260) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449) at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.NullPointerException ... 129 more
b
@leftbower
Copy code
lucee.runtime.exp.NativeException: java.lang.NullPointerException 
 atlucee.runtime.tag.Content._doStartTag(Content.java:185) 
 atlucee.runtime.tag.Content.doStartTag(Content.java:156) 
 atsystem.core.conversion.datamarshaller_cfc$cf.udfCall(/coldbox/system/core/conversion/DataMarshaller.cfc:151)
Looks like the error is coming from the CFContent tag https://github.com/ColdBox/coldbox-platform/blob/development/system/core/conversion/DataMarshaller.cfc#L151
The CFDocument tag is being used in the marshaller to create PDFs, but it would appear that part worked and it errored later on
The line of Java code that is erroring has changed recently and is this
Copy code
if (!HTTPUtil.isTextMimeType(type) == Boolean.TRUE) {
I don't see an import for
Boolean
in that class, but I actually would expect just not to compile 🤔
Unless
Boolean
doesn't need imported
The only other thing that could be null would be HTTPUtil which is a static import to the class
that line of code was changed 2 weeks ago for LDEV-3679
MIcha changed the
isTextMimeType()
to return a
Boolean
class instance instead of a
boolean
primitive (lowercase)
Primitves can't be null, but class instances can
So the new code path he added to return a
null
gives us an
NPE
when he checks the value of it
@zackster ☝️ 5.3.9 regression
@leftbower
If Micha is going to return a
Boolean
type from that method and sometimes that return will be null, every place that checks the return value of that method needs to check for
null
AS WELL AS a boolean value
My guess is the mime type ColdBox is passing to the CFContent tag isn't one Lucee recognizes
a
MIcha changed the
isTextMimeType()
to return a
Boolean
class instance instead of a
boolean
primitive (lowercase)
Amazing his tests didn't flag that up before he made the change [cough]
b
heh
I can reproduce with this
Copy code
content type="foobar";
I created a ticket since I did the research and was familiar with the issue. https://luceeserver.atlassian.net/browse/LDEV-3910
l
thx for that thorough follow through!
👍 3
z
snarky comments about test cases are extremely welcome via constructive PRs! HELP WANTED and REALLY APPRECIATED https://github.com/lucee/Lucee/commit/4494de11f281c9245fb8916b8744ca69c41d82ec
Obviously there's plenty more cfcontent functionality which needs tests...
s
we see something very similar using this test:
Copy code
<cfdocument format="pdf" name="pdf_test">
	<html style="height: 99%">
	<body style="font-family: Helvetica, Arial, sans-serif; height: 90%">
		<div>hello</div>
	</body>
	</html>
</cfdocument>

<cfcontent type="application/pdf" variable="#pdf_test#">
this is our basic setup:
Copy code
System Information
Version	Lucee 5.3.9.108-RC
Version Name	Gelert
Release date	Mar 14, 2022	
Servlet Container	Apache Tomcat/8.5.61
Java	11.0.10 (AdoptOpenJDK) 64bit
OS	Windows Server 2016 (10.0) 64bit
Architecture	64bit
z
fixed in 5.3.9.109
👍 1
there's a problem with _internalRequest which prevents us from adding test cases using cfcontent https://luceeserver.atlassian.net/browse/LDEV-3761
s
I can confirm 5.3.9.109 works for us ! Thanks @zackster
z
awesome