NullReferenceException is thrown while calling InsertHtml in FieldMerging

Hi there,

We are using Aspose.Words for Java (the newest version: 16.1.0) in our project to generate Word Documents from Word Templates using the Mustache Syntax. Most of the Word Templates work fine, but every so often a Template "randomly" throws Nullpointer Exceptions in our IFieldMergingCallback implementations when we try to insert html. It cannot be invalid html texts, since in most cases the texts do not include any html tags. The reason we choose html, is to provide additional formatting options for those who provide the texts to be inserted.

I have read a similar post in the .NET section, which to my knowledge has not been resolved yet.
Html insert unhandled exception

I have also added a code example with a Word Template, which throws 4 Exceptions out of 8 texts it tries to insert.

Looking forward to receiving help with my issue.

Best Regards
Gianluca


This is the stacktrace in the actual project for reference:

java.lang.NullPointerException:
com.aspose.words.zzZYJ.zzZYz(Unknown Source)
com.aspose.words.zzZYJ.handleText(Unknown Source)
com.aspose.words.zzZYJ.zzP(Unknown Source)
com.aspose.words.zzZYJ.zzQ(Unknown Source)
com.aspose.words.zzZYJ.zzP(Unknown Source)
com.aspose.words.zzZYJ.zzQ(Unknown Source)
com.aspose.words.zzZYJ.zzZ(Unknown Source)
com.aspose.words.DocumentBuilder.zzZ(Unknown Source)
com.aspose.words.DocumentBuilder.insertHtml(Unknown Source)
com.my.project.common.aspose.format.MyFieldMergingCallback.fieldMerging(MyFieldMergingCallback.java:94)
com.aspose.words.MailMerge.zzZ(Unknown Source)
com.aspose.words.zzZPC.zzZ(Unknown Source)
com.aspose.words.FieldMergeField.zz6K(Unknown Source)
com.aspose.words.zz4Z.zzD(Unknown Source)
com.aspose.words.zz4Z.zzE(Unknown Source)
com.aspose.words.zz4Z.zzR(Unknown Source)
com.aspose.words.zz4Z.zzW(Unknown Source)
com.aspose.words.zz4Z.zzZq(Unknown Source)
com.aspose.words.zz4Z.zzA(Unknown Source)
com.aspose.words.zzZPC.zzZ(Unknown Source)
com.aspose.words.MailMerge.zzZ(Unknown Source)
com.aspose.words.MailMerge.execute(Unknown Source)
com.my.project.common.aspose.AsposeDocumentHandler.insertMasterFields(AsposeDocumentHandler.java:249)
com.my.project.client.pages.frontend.prozess.ProzessPanel$9.onSubmit(ProzessPanel.java:538)
org.apache.wicket.ajax.markup.html.form.AjaxButton$1.onSubmit(AjaxButton.java:103)
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(AjaxFormSubmitBehavior.java:172)
org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1234)
org.apache.wicket.markup.html.form.Form.process(Form.java:912)
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:758)
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:158)
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:184)
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:369)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:497)
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:255)
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
com.my.project.platform.filter.RegelwerkContextFilter.doFilter(RegelwerkContextFilter.java:68)
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
com.my.project.platform.filter.RequestContextFilter.doFilter(RequestContextFilter.java:74)
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
com.my.project.platform.filter.LoggingContextFilter.doHttpFilter(LoggingContextFilter.java:91)
com.my.project.platform.filter.LoggingContextFilter.doFilter(LoggingContextFilter.java:64)
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:91)
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:91)
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119)
com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)
com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)
com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)
com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
Hi Gianluca,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13112. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,

Thank you for your reply. Looking forward to seeing this issue being resolved soon.

Best Regards,
Gianluca

The issues you have found earlier (filed as WORDSNET-13112) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Thank you for resolving the issue. Regards, Gianluca