Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Gateway Error #1583

Closed
DaniduWijendra opened this issue Mar 9, 2023 · 2 comments
Closed

API Gateway Error #1583

DaniduWijendra opened this issue Mar 9, 2023 · 2 comments

Comments

@DaniduWijendra
Copy link

Description

When create an API with a malformed context eg: /testapi{version} using the publisher portal. In that case, it was deployed and published in the gateway without any error. We expecting that there should be a proper validation to check at all parameter levels while creating an API at the publisher portal and it should not save in case of an error.

Steps to Reproduce

  • Start the APIM server and create an API from the publisher which has the following context.

/testapi{version}
Screenshot from 2023-03-08 16-08-43

  • While creating the API you can see the following error trace.
INFO - API {api:TestAPI:v20} Initializing API: TestAPI:v20
Exception in thread "Thread-187" java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 10
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
	at java.base/java.lang.String.substring(String.java:1874)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData_aroundBody32(DataHolder.java:138)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData(DataHolder.java:130)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData_aroundBody40(DataHolder.java:200)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData(DataHolder.java:195)
	at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI_aroundBody0(InMemoryAPIDeployer.java:101)
	at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI(InMemoryAPIDeployer.java:86)
	at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener.lambda$0_aroundBody12(GatewayJMSMessageListener.java:170)
	at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener.lambda$0(GatewayJMSMessageListener.java:147)
	at java.base/java.lang.Thread.run(Thread.java:829)
  • However as you can see the API is deployed successfully in the gateway.

Screenshot from 2023-03-08 16-10-39

Therefore we believe that when there is a malformed context in the API, the API should not be created from the publisher portal and it should give a proper error message while creating the API.

Affected Component

APIM

Version

4.1.0

Environment Details (with versions)

No response

Relevant Log Output

INFO - API {api:TestAPI:v20} Initializing API: TestAPI:v20
Exception in thread "Thread-187" java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 10
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
	at java.base/java.lang.String.substring(String.java:1874)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData_aroundBody32(DataHolder.java:138)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData(DataHolder.java:130)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData_aroundBody40(DataHolder.java:200)
	at org.wso2.carbon.apimgt.gateway.internal.DataHolder.addAPIMetaData(DataHolder.java:195)
	at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI_aroundBody0(InMemoryAPIDeployer.java:101)
	at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAPI(InMemoryAPIDeployer.java:86)
	at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener.lambda$0_aroundBody12(GatewayJMSMessageListener.java:170)
	at org.wso2.carbon.apimgt.gateway.listeners.GatewayJMSMessageListener.lambda$0(GatewayJMSMessageListener.java:147)
	at java.base/java.lang.Thread.run(Thread.java:829)

Related Issues

No response

Suggested Labels

No response

@BLasan
Copy link

BLasan commented Apr 21, 2023

Tracked by #1758

@YasasRangika
Copy link

As marked in the linked internal issue, this does not apply to the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants