You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed an issue with the proxyNameAndBasePath() method in StringUtils.java class that can cause an IndexOutOfBoundsException. This exception is thrown if the URL does not contain the / character. For example when creating a bundle from a wsdl file in the same directory.
Feb 21, 2024 9:12:36 AM com.apigee.proxywriter.GenerateProxy begin
SEVERE: begin -1, end 2, length 7
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin -1, end 2, length 7
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
at java.base/java.lang.String.substring(String.java:1874)
at com.apigee.utils.StringUtils.proxyNameAndBasePath(StringUtils.java:41)
at com.apigee.proxywriter.GenerateProxy.getWSDLDetails(GenerateProxy.java:2358)
at com.apigee.proxywriter.GenerateProxy.begin(GenerateProxy.java:2889)
at com.apigee.proxywriter.GenerateProxy.main(GenerateProxy.java:3206)
The proxyNameAndBasePath() method can be updated to handle cases where the "/" character does not exist in the provided URL. When the lastIndexOf("/") method returns -1, beginIndex should be set to 0.
publicstaticKeyValue<String, String> proxyNameAndBasePath(Stringurl) {
...
intbeginIndex = lowercaseUrl.lastIndexOf("/");
if (beginIndex == -1) {
beginIndex = 0; // Set to 0 if "/" is not found
} else {
beginIndex++; // Skipping "/"
}
...
}
This will prevent the IndexOutOfBoundsException from being thrown by the substring() method.
The text was updated successfully, but these errors were encountered:
I've noticed an issue with the proxyNameAndBasePath() method in StringUtils.java class that can cause an IndexOutOfBoundsException. This exception is thrown if the URL does not contain the / character. For example when creating a bundle from a wsdl file in the same directory.
Here the code in question:
Steps to Reproduce
The issue occurs when the provided URL does not contain a "/", such as: "my_fille.wsdl"
Suggested Solution
The
proxyNameAndBasePath()
method can be updated to handle cases where the "/" character does not exist in the provided URL. When thelastIndexOf("/")
method returns-1
, beginIndex should be set to0
.This will prevent the
IndexOutOfBoundsException
from being thrown by thesubstring()
method.The text was updated successfully, but these errors were encountered: