"java.lang.NumberFormatException: Illegal embedded sign character" exception when adding new file to attachments

Dear Tecnoteca,

in openMAINT-2.1_cmdbuild 3.3.1, I created a test process, with no attributes but the default Code and Description.

Then, in TWE I created a process with just three Human Tasks in sequence:

  1. Start (empty)
  2. Attachments Manager (with just one openAttachment widget)
  3. Verify attachments (empty)

When I run an instance of this process and go to the “Attachment Manager” step I use the button to open the attachments window, but when I try to upload a new document I receive the following message in the “generic error” popup:
java.lang.NumberFormatException: Illegal embedded sign character

I tried with PDF files, but the issue is present with other formats too, even with common text files.

I can then “Execute” this step, and the process stops to the last one “Verify attachments”, where I can confirm in the attachments tab that the document was correctly uploaded.

What may be the root cause of the Java Exception?

Following is the content of the cmdbuild_req.log file, in case it may help:

2021-02-03T16:53:30.641Z [req:63c0c5] ERROR o.c.s.r.v.p.ExceptionHandlerService - ws processing error
org.cmdbuild.utils.ws3.utils.Ws3Exception: error processing request =< ws3rest:get:processes/TestBottone/instances/16664869/attachments/CMDBuildUI.model.dmsmodel.BaseDocument-4/preview >
at org.cmdbuild.utils.ws3.servlet.Ws3RestRequestHandlerServlet.handleRequest(Ws3RestRequestHandlerServlet.java:31) ~[cmdbuild-utils-ws3-3.3.1.jar:na]
at org.cmdbuild.utils.ws3.servlet.Ws3AbstractHandlerServlet.service(Ws3AbstractHandlerServlet.java:97) ~[cmdbuild-utils-ws3-3.3.1.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.30]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.30]



at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:9.0.30]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: org.cmdbuild.utils.ws3.utils.Ws3Exception: error processing request with handler = Ws3RequestMethodHanlder{service=org.cmdbuild.service.rest.v3.endpoint.CardAttachmentWs, method=preview}
at org.cmdbuild.utils.ws3.inner.Ws3RequestHandlerImpl.handleRequest(Ws3RequestHandlerImpl.java:79) ~[cmdbuild-utils-ws3-3.3.1.jar:na]
at org.cmdbuild.utils.ws3.servlet.Ws3RestRequestHandlerServlet.handleRequest(Ws3RestRequestHandlerServlet.java:29) ~[cmdbuild-utils-ws3-3.3.1.jar:na]
… 83 common frames omitted
Caused by: org.cmdbuild.utils.ws3.utils.Ws3Exception: error processing ws3 request = Ws3RestRequest{uri=ws3rest:get:processes/TestBottone/instances/16664869/attachments/CMDBuildUI.model.dmsmodel.BaseDocument-4/preview}
at org.cmdbuild.utils.ws3.inner.Ws3RequestMethodHandler.handleRequest(Ws3RequestMethodHandler.java:83) ~[cmdbuild-utils-ws3-3.3.1.jar:na]
at org.cmdbuild.utils.ws3.inner.Ws3RequestHandlerImpl.handleRequest(Ws3RequestHandlerImpl.java:77) ~[cmdbuild-utils-ws3-3.3.1.jar:na]
… 84 common frames omitted
Caused by: java.lang.NumberFormatException: Illegal embedded sign character
at java.base/java.math.BigInteger.(BigInteger.java:492) ~[na:na]
at org.cmdbuild.utils.encode.CmEncodeUtils.ldecodeBytes(CmEncodeUtils.java:225) ~[cmdbuild-utils-crypto-3.3.1.jar:na]
at org.cmdbuild.utils.encode.CmEncodeUtils.ldecodeString(CmEncodeUtils.java:216) ~[cmdbuild-utils-crypto-3.3.1.jar:na]
at org.cmdbuild.utils.encode.CmEncodeUtils.decodeString(CmEncodeUtils.java:67) ~[cmdbuild-utils-crypto-3.3.1.jar:na]
at org.cmdbuild.dms.cmis.CmisDmsProviderService.preview(CmisDmsProviderService.java:178) ~[cmdbuild-dms-cmis-3.3.1.jar:na]
at org.cmdbuild.dms.core.DmsServiceImpl.preview(DmsServiceImpl.java:240) ~[cmdbuild-dms-core-3.3.1.jar:na]
at org.cmdbuild.service.rest.common.helpers.AttachmentWsHelper.preview(AttachmentWsHelper.java:160) ~[cmdbuild-services-rest-commons-3.3.1.jar:na]
at org.cmdbuild.service.rest.v3.endpoint.CardAttachmentWs.preview(CardAttachmentWs.java:109) ~[cmdbuild-services-rest-v3-3.3.1.jar:na]
at jdk.internal.reflect.GeneratedMethodAccessor474.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.cmdbuild.utils.ws3.inner.Ws3RequestMethodHandler.handleRequest(Ws3RequestMethodHandler.java:79) ~[cmdbuild-utils-ws3-3.3.1.jar:na]
… 85 common frames omitted
2021-02-03T16:53:30.642Z [req:63c0c5] WARN o.c.w.f.RequestTrackingFilter$$EnhancerBySpringCGLIB$$41d10168 - processed request, returned error for requestId = 63c0c5af2cfa413el3sstoi8

Regards,
Gerardo