Null Pointer Exception when using imageResize()

Hello,

I tried to do an image upload and resizing, but I keep getting a null
pointer exception when I include a call to imageResize within my code, even
though imageResize() will never be reached.
When I use the tag <cfimage action=“resize” …> it works without any
problems.

Here are both variants (of my test code):

myImage=ImageRead(“http://www.google.com/images/logo.gif”);
if(false) {
imageResize(myImage, “500”);
}
ImageWrite(myImage, “google-logo.gif”);

In the Original case the imageResize was within a component in a different
method, which wouldn’t be called at that time, but I still got the same
error.

And the stacktrace of the error message:
lucee.runtime.exp.NativeException: java.lang.NullPointerException at
lucee.transformer.bytecode.expression.var.VariableImpl._writeOutFirstBIF(VariableImpl.java:482)
at
lucee.transformer.bytecode.expression.var.VariableImpl._writeOutFirst(VariableImpl.java:395)
at
lucee.transformer.bytecode.expression.var.VariableImpl._writeOut(VariableImpl.java:258)
at
lucee.transformer.bytecode.expression.var.VariableImpl._writeOut(VariableImpl.java:239)
at
lucee.transformer.bytecode.expression.ExpressionBase.writeOut(ExpressionBase.java:51)
at
lucee.transformer.bytecode.statement.ExpressionAsStatement._writeOut(ExpressionAsStatement.java:60)
at
lucee.transformer.bytecode.statement.StatementBase.writeOut(StatementBase.java:82)
at
lucee.transformer.bytecode.util.ExpressionUtil.writeOut(ExpressionUtil.java:147)
at lucee.transformer.bytecode.BodyBase.writeOut(BodyBase.java:199) at
lucee.transformer.bytecode.BodyBase.writeOut(BodyBase.java:151) at
lucee.transformer.bytecode.BodyBase._writeOut(BodyBase.java:144) at
lucee.transformer.bytecode.statement.StatementBase.writeOut(StatementBase.java:82)
at
lucee.transformer.bytecode.statement.Condition._writeOut(Condition.java:118)
at
lucee.transformer.bytecode.statement.StatementBase.writeOut(StatementBase.java:82)
at
lucee.transformer.bytecode.util.ExpressionUtil.writeOut(ExpressionUtil.java:147)
at lucee.transformer.bytecode.BodyBase.writeOut(BodyBase.java:199) at
lucee.transformer.bytecode.BodyBase.writeOut(BodyBase.java:151) at
lucee.transformer.bytecode.BodyBase._writeOut(BodyBase.java:144) at
lucee.transformer.bytecode.FlowControlBody._writeOut(FlowControlBody.java:39)
at
lucee.transformer.bytecode.statement.StatementBase.writeOut(StatementBase.java:82)
at
lucee.transformer.bytecode.statement.tag.TagScript._writeOut(TagScript.java:42)
at
lucee.transformer.bytecode.statement.StatementBase.writeOut(StatementBase.java:82)
at
lucee.transformer.bytecode.util.ExpressionUtil.writeOut(ExpressionUtil.java:147)
at lucee.transformer.bytecode.BodyBase.writeOut(BodyBase.java:199) at
lucee.transformer.bytecode.BodyBase.writeOut(BodyBase.java:151) at
lucee.transformer.bytecode.Page.writeOutCallBody(Page.java:1671) at
lucee.transformer.bytecode.Page.writeOutCall(Page.java:1639) at
lucee.transformer.bytecode.Page.execute(Page.java:630) at
lucee.runtime.compiler.CFMLCompilerImpl._compile(CFMLCompilerImpl.java:129)
at
lucee.runtime.compiler.CFMLCompilerImpl.compile(CFMLCompilerImpl.java:74)
at lucee.runtime.PageSourceImpl._compile(PageSourceImpl.java:358) at
lucee.runtime.PageSourceImpl.compile(PageSourceImpl.java:325) at
lucee.runtime.PageSourceImpl.loadPhysical(PageSourceImpl.java:262) at
lucee.runtime.PageSourceImpl.loadPageThrowTemplateException(PageSourceImpl.java:178)
at lucee.runtime.PageSourceImpl.loadPage(PageSourceImpl.java:889) at
lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:905) at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:825) at
lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:820) at
lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:225)
at
lucee.runtime.listener.ModernAppListener.onRequest(ModernAppListener.java:103)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2267) at
lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2259) at
lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2227) at
lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:608) at
lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:103)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745) Caused by:
java.lang.NullPointerException … 63 more

When I move the imageResize into an comment it works (without the resizing
of cause)

I have updated the java from the OpenJDK JRE7 to Oracle JRE8, but I’m still
getting the same error.
I’m usung Ubuntu Jessie, Tomcat7, Lucee 5 (tried Lucee 4.5 previously).

I don’t know if it’s a bug or if I’m missing something. It would be great
if someone could help me. :slight_smile:

Hi

This is a known issue:

https://luceeserver.atlassian.net/browse/LDEV-585

To workaround it, specify the height as an empty string:

imageResize( myImage, “500”,"" );

Julian.On 1 November 2015 at 13:20, Blooddrunken <@Blooddrunken> wrote:

imageResize(myImage, “500”);