We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose pdf sometimes raise error java.util.regex.PatternSyntaxException

Hello, experts.
We are facing some trouble in aspose pdf library.
Almost all case is good, but sometimes aspose pdf raise following exception in com.aspose.pdf.Document.save.

Do you have any idea what is root causes of this issue ?
(Masked our private library and functions in stack trace)

com.aspose.pdf.Document.save(svgFilePath, options)

exception:
java.util.regex.PatternSyntaxException: Dangling meta character ‘?’ near index 17
[A-Z]{6}+?l?r ???
^

stacktrace:
0 = {StackTraceElement@14205} “java.base/java.util.regex.Pattern.error(Pattern.java:2027)”
1 = {StackTraceElement@14206} “java.base/java.util.regex.Pattern.sequence(Pattern.java:2202)”
2 = {StackTraceElement@14207} “java.base/java.util.regex.Pattern.expr(Pattern.java:2068)”
3 = {StackTraceElement@14208} “java.base/java.util.regex.Pattern.compile(Pattern.java:1782)”
4 = {StackTraceElement@14209} “java.base/java.util.regex.Pattern.(Pattern.java:1428)”
5 = {StackTraceElement@14210} “java.base/java.util.regex.Pattern.compile(Pattern.java:1094)”
6 = {StackTraceElement@14211} “com.aspose.pdf.internal.l55f.lv.(Unknown Source)”
7 = {StackTraceElement@14212} “com.aspose.pdf.internal.l55f.lv.lt(Unknown Source)”
8 = {StackTraceElement@14213} “com.aspose.pdf.internal.l55f.lv.lb(Unknown Source)”
9 = {StackTraceElement@14214} “com.aspose.pdf.internal.l3j.lI.lI(Unknown Source)”
10 = {StackTraceElement@14215} “com.aspose.pdf.internal.l3j.lb.lI(Unknown Source)”
11 = {StackTraceElement@14216} “com.aspose.pdf.internal.l2h.lu.lj(Unknown Source)”
12 = {StackTraceElement@14217} “com.aspose.pdf.internal.l2h.lu.lb(Unknown Source)”
13 = {StackTraceElement@14218} “com.aspose.pdf.internal.l2h.lu.lf(Unknown Source)”
14 = {StackTraceElement@14219} “com.aspose.pdf.internal.l2h.lu.lf(Unknown Source)”
15 = {StackTraceElement@14220} “com.aspose.pdf.l12f.lI(Unknown Source)”
16 = {StackTraceElement@14221} “com.aspose.pdf.l12f.lb(Unknown Source)”
17 = {StackTraceElement@14222} “com.aspose.pdf.ApsUsingConverter.lI(Unknown Source)”
18 = {StackTraceElement@14223} “com.aspose.pdf.ApsUsingConverter.lf(Unknown Source)”
19 = {StackTraceElement@14224} “com.aspose.pdf.l16p.lI(Unknown Source)”
20 = {StackTraceElement@14225} “com.aspose.pdf.ADocument.lI(Unknown Source)”
21 = {StackTraceElement@14226} “com.aspose.pdf.ADocument.save(Unknown Source)”
22 = {StackTraceElement@14227} “com.aspose.pdf.Document.save(Unknown Source)”
23 = {StackTraceElement@14228} “com."
24 = {StackTraceElement@14229} "com.

25 = {StackTraceElement@14230} “org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)”
26 = {StackTraceElement@14231} “org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)”
27 = {StackTraceElement@14232} “com."
28 = {StackTraceElement@14233} "com.

29 = {StackTraceElement@14234} “java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)”
30 = {StackTraceElement@14235} “java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)”
31 = {StackTraceElement@14236} “java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)”
32 = {StackTraceElement@14237} “java.base/java.lang.reflect.Method.invoke(Method.java:566)”
33 = {StackTraceElement@14238} “org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)”
34 = {StackTraceElement@14239} “org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)”
35 = {StackTraceElement@14240} “org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)”
36 = {StackTraceElement@14241} “org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)”
37 = {StackTraceElement@14242} “org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)”
38 = {StackTraceElement@14243} “org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)”
39 = {StackTraceElement@14244} “org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)”
40 = {StackTraceElement@14245} “org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)”
41 = {StackTraceElement@14246} “org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)”
42 = {StackTraceElement@14247} “org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)”
43 = {StackTraceElement@14248} “javax.servlet.http.HttpServlet.service(HttpServlet.java:660)”
44 = {StackTraceElement@14249} “org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)”
45 = {StackTraceElement@14250} “javax.servlet.http.HttpServlet.service(HttpServlet.java:741)”
46 = {StackTraceElement@14251} “org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)”
47 = {StackTraceElement@14252} “org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)”
48 = {StackTraceElement@14253} “org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)”
49 = {StackTraceElement@14254} “org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)”
50 = {StackTraceElement@14255} “org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)”
51 = {StackTraceElement@14256} “org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)”
52 = {StackTraceElement@14257} “org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)”
53 = {StackTraceElement@14258} “org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)”
54 = {StackTraceElement@14259} “org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)”
55 = {StackTraceElement@14260} “org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)”
56 = {StackTraceElement@14261} “org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)”
57 = {StackTraceElement@14262} “org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)”
58 = {StackTraceElement@14263} “org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)”
59 = {StackTraceElement@14264} “org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)”
60 = {StackTraceElement@14265} “org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)”
61 = {StackTraceElement@14266} “org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)”
62 = {StackTraceElement@14267} “org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)”
63 = {StackTraceElement@14268} “org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)”
64 = {StackTraceElement@14269} “org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)”
65 = {StackTraceElement@14270} “org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)”
66 = {StackTraceElement@14271} “org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)”
67 = {StackTraceElement@14272} “org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)”
68 = {StackTraceElement@14273} “org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)”
69 = {StackTraceElement@14274} “org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)”
70 = {StackTraceElement@14275} “org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)”
71 = {StackTraceElement@14276} “org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)”
72 = {StackTraceElement@14277} “org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)”
73 = {StackTraceElement@14278} “org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)”
74 = {StackTraceElement@14279} “org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)”
75 = {StackTraceElement@14280} “org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)”
76 = {StackTraceElement@14281} “org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)”
77 = {StackTraceElement@14282} “org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)”
78 = {StackTraceElement@14283} “org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)”
79 = {StackTraceElement@14284} “java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)”
80 = {StackTraceElement@14285} “java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)”
81 = {StackTraceElement@14286} “org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)”
82 = {StackTraceElement@14287} “java.base/java.lang.Thread.run(Thread.java:834)”

@Misuda_Tomoya

Would you kindly share the minimal code snippet to replicate the issue in our environment. We will test the scenario and address it accordingly.

Thanks for your reply.
Here is our code, quite simple.
Some problem occurred at svgPdf.save.

val options = com.aspose.pdf.SvgSaveOptions()
options.CompressOutputToZipArchive = false
svgPdf = com.aspose.pdf.Document(bufFilePath)
svgPdf.save(svgFilePath, options)
svgFile = File(svgFilePath)

@Misuda_Tomoya

Thanks for sharing sample code.

Would also be kind to share sample PDF document with which the issue has been occurring at your end. This would help us replicating the issue in our environment and address it accordingly.

Thanks for your reply.
The issue occur only by customer PDF document, so we cannot share problematic PDF document.
Cloud you find any clue by these stack trace and code sample ?

I suspect some character corruption induces this issue.
Do you have some character list or document which aspose PDF library supports ?

@Misuda_Tomoya

There is no specified list of supported characters as API supports all characters which are supported by the fonts installed in the system. However, the issue seems related to specific input document. In case you do not want to share it publicly, you may please share it in a private message and only Aspose Staff will have access to it. You can send a private message by clicking over username and pressing Blue Message Button.