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

ArrayIndexOutOfBoundsException on empty string environment variable #1099

Closed
rt-works opened this issue May 20, 2021 · 1 comment
Closed

Comments

@rt-works
Copy link

Describe the bug
When I'm using environmentProperties() in such code block:

startKoin {
        printLogger(Level.DEBUG)
        environmentProperties()

        modules(
            module {
                single { HelloService(getProperty("SOME_PROPERTY", "ssss")) }
            }
        )
    }

I'm getting following exception

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at org.koin.ext.StringExtKt.clearQuotes(StringExt.kt:21)
	at org.koin.core.registry.PropertyRegistryExtKt.saveProperties(PropertyRegistryExt.kt:20)
	at org.koin.core.registry.PropertyRegistryExtKt.loadEnvironmentProperties(PropertyRegistryExt.kt:58)
	at org.koin.KoinApplicationExtKt.environmentProperties(KoinApplicationExt.kt:24)

That happens when one of the environmental variables has empty string value.

Expected behavior
Environmental variables with empty values should get loaded as it is with empty value without throwing the exception.

Koin project used and used version (please complete the following information):
[e.g]: koin-core version 3.0.2

@arnaudgiuliani arnaudgiuliani added this to the 3.0.3 milestone May 24, 2021
gdude2002 added a commit to Kord-Extensions/kord-extensions that referenced this issue Jun 3, 2021
@arnaudgiuliani
Copy link
Member

Fixed in 9b9dec8792277b13341140a4c1cbd167e604e37b

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

2 participants