javax.servlet.ServletException: com.aspose.words.ParagraphFormat.setAlignment

Hi,
in our BEA application server, we keep receiving following exception:

<[ServletContext(id=4314720,name=merlin,context-path=/merlin)] Servlet failed with Exception
javax.servlet.ServletException: com.aspose.words.ParagraphFormat.setAlignment(B)V
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:469)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:322)
at com.documentum.web.formext.component.URLDispatchBridge.dispatch(Unknown Source)
at com.documentum.web.formext.component.ComponentDispatcher.mapRequestToComponent(Unknown Source)
at com.documentum.web.formext.component.ComponentDispatcher.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.documentum.web.formext.component.ComponentDispatcher.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6718)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

Can you please help me to find the reason for that and give a hint how to fix this problem?
Thanks,
Tibor

Hi
Thanks for your inquiry. Could you please attach your document for testing and provide me your code. I will try to reproduce the issue on my side and provide you more information.
Best regards.

Hi Alexey,

sorry for responding so late. Please find in the attached zip file my test documents and the source code of relevant Java classes as well as the relevant part of the log file nohup.out.

The original word document “cannot-view.doc” is first processed by the customizeFile method of CustomDownloadContentStream.java using Aspose. The resulting document “US-ACL-S025.doc” is further processed by the addReference method of CreateResponseDocument.java class. The method addReference is called by the method poulate in the same class (line 438). The method populate is called three times by the method updateTables of class CustomDownloadContentStream.java: for header, for footer and for body sections. The first two calls are successful, the exception is thrown after the third call in line 499 of CustomDownloadContentStream.java. The exception is probably thrown in method addReference, line 652 of CreateResponseDocument.java:

builder.getParagraphFormat().setAlignment(ParagraphAlignment.LEFT);

I guess, the problem is caused by the jpeg file inserted in the body of the Word document. The corresponding lines of the log file nohup.out are also attached.

Kind regards,
Tibor

Hi
Thank you for additional information. Could you please simplify your code so I can run it and reproduce the problem? I tried to run addReference method separately and it works fine.
Best regards.