when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${baseDomain?replace(":443", "")} [in template "template.txt" at line 22, column 33] ---- Java stack trace (for programmers): ---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481) at freemarker.core.EvalUtil.coerceModelToStringOrUnsupportedMarkup(EvalUtil.java:434) at freemarker.core.Expression.evalAndCoerceToStringOrUnsupportedMarkup(Expression.java:139) at freemarker.core.BuiltInForString.getTargetString(BuiltInForString.java:34) at freemarker.core.BuiltInForString._eval(BuiltInForString.java:29) at freemarker.core.Expression.eval(Expression.java:101) at freemarker.core.MethodCall._eval(MethodCall.java:55) at freemarker.core.Expression.eval(Expression.java:101) at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100) at freemarker.core.DollarVariable.accept(DollarVariable.java:63) at freemarker.core.Environment.visit(Environment.java:334) at freemarker.core.Environment.visit(Environment.java:340) at freemarker.core.Environment.process(Environment.java:313) at freemarker.template.Template.process(Template.java:383) at com.tcs.ion.seo.service.SEOService.saveHtmlFile(SEOService.java:1232) at com.tcs.ion.seo.service.SEOService.generateHtmlForUrl(SEOService.java:284) at com.tcs.ion.seo.service.SEOService$$EnhancerByCGLIB$$7dfb60d9.CGLIB$generateHtmlForUrl$9() at com.tcs.ion.seo.service.SEOService$$EnhancerByCGLIB$$7dfb60d9$$FastClassByCGLIB$$59f94a3f.invoke() at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at com.tcs.ion.ngb.service.ServiceMethodInterceptor.intercept(ServiceMethodInterceptor.java:82) at com.tcs.ion.seo.service.SEOService$$EnhancerByCGLIB$$7dfb60d9.generateHtmlForUrl() at com.tcs.ion.seo.batchjob.SEOServiceBatchJob.generateHtmlForUrl(SEOServiceBatchJob.java:184) at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.tcs.ion.ngb.scheduler.BaseIONBatchJob.executeScheduler(BaseIONBatchJob.java:103) at com.tcs.ion.bizSchedular.Services.SubmitJob.run(SubmitJob.java:90) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)