Skip to content

java.lang.StringIndexOutOfBoundsException at com.okta.commons.lang.ApplicationInfo.getWebSphereVersion #70

@BalusC

Description

@BalusC

Running an Okta API client (e.g. okta-sdk-impl and okta-jwt-verifier-impl) on an environment with WebSphere dependencies declared as runtime dependencies but with WebSphere server itself being physically shutdown (e.g. during local testing) throws the following exception (okta-commons-lang 1.3.0):

Caused by: java.lang.StringIndexOutOfBoundsException: begin -1, end 0, length 0
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4601)
	at java.base/java.lang.String.substring(String.java:2704)
	at java.base/java.lang.String.substring(String.java:2677)
	at com.okta.commons.lang.ApplicationInfo.getWebSphereVersion(ApplicationInfo.java:301)
	at com.okta.commons.lang.ApplicationInfo.getWebSphereEntryInfo(ApplicationInfo.java:190)
	at com.okta.commons.lang.ApplicationInfo.getWebServerInfo(ApplicationInfo.java:169)
	at com.okta.commons.lang.ApplicationInfo.createNameToVersionMap(ApplicationInfo.java:105)
	at com.okta.commons.lang.ApplicationInfo.<clinit>(ApplicationInfo.java:90)
	... 8 more

I propose to just return UNKNOWN_VERSION instead if the version variable is available but not substringable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions