wso2wso2-api-manageresbwso2-micro-integrator

WSO2 Error while building Passthrough stream java.lang.StringIndexOutOfBoundsException


I have Micro Integrator API exposed by API Manager. When client is testing it they get following error and request is not even logged (log is firt mediator in this API). When I try the same request with Postman everything works correctly. I cant recreate this error, client claims that they are sending request correctly, any ideas what this java.lang.StringIndexOutOfBoundsException error could mean?

 Error while building Passthrough stream java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 1025
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
        at java.base/java.lang.String.substring(String.java:1874)
        at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.extractParametersFromRequest(XFormURLEncodedBuilder.java:223)
        at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.processDocumentWrapper(XFormURLEncodedBuilder.java:128)
        at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.processDocument(XFormURLEncodedBuilder.java:52)
        at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:153)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:169)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:122)
        at org.apache.synapse.transport.util.PassThroughMessageHandler.buildMessage(PassThroughMessageHandler.java:103)
        at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:155)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:96)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
        at org.apache.synapse.api.Resource.process(Resource.java:342)
        at org.apache.synapse.api.API.process(API.java:477)
        at org.apache.synapse.api.AbstractApiHandler.apiProcessNonDefaultStrategy(AbstractApiHandler.java:107)
        at org.apache.synapse.api.AbstractApiHandler.identifyAPI(AbstractApiHandler.java:127)
        at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:54)
        at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90)
        at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344)
        at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:376)
        at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:435)
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

{api:v1.0.0} Error while building message. Error while building Passthrough stream org.apache.axis2.AxisFault: Error while building Passthrough stream
        at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:453)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:216)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:122)
        at org.apache.synapse.transport.util.PassThroughMessageHandler.buildMessage(PassThroughMessageHandler.java:103)
        at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:155)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:96)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
        at org.apache.synapse.api.Resource.process(Resource.java:342)
        at org.apache.synapse.api.API.process(API.java:477)
        at org.apache.synapse.api.AbstractApiHandler.apiProcessNonDefaultStrategy(AbstractApiHandler.java:107)
        at org.apache.synapse.api.AbstractApiHandler.identifyAPI(AbstractApiHandler.java:127)
        at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:54)
        at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90)
        at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344)
        at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:376)
        at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:435)
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 1025
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
        at java.base/java.lang.String.substring(String.java:1874)
        at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.extractParametersFromRequest(XFormURLEncodedBuilder.java:223)
        at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.processDocumentWrapper(XFormURLEncodedBuilder.java:128)
        at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.processDocument(XFormURLEncodedBuilder.java:52)
        at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:153)
        at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:169)
        ... 24 more

{api:v1.0.0} ERROR_CODE = 0, ERROR_MESSAGE = Error while building message. Error while building Passthrough stream, ERROR_DETAILS = null

Solution

  • This is failing in the message builder before it reached your integration. I'm assuming you are sending a message with the content type application/x-www-form-urlencoded, the error is thrown from this line in the code. The only possibility to get this error is, you are sending a parameter that doesn't have a separator =.