StackOverflowError if property is missing
See original GitHub issueTeh following code:
AppConfig appConfig = ConfigFactory.create(AppConfig.class); System.out.println(appConfig.myTestProperty());
Throws a StackOverflow error when AppConfig.java is this:
@Sources({ "classpath:app.properties" }) public interface AppConfig extends Config { @Key("my.test.property") public String myTestProperty(); }
And my.test.property is not present in the file app.properties.
On the other hand, I can succesfully get the property when it is defined within the properties file.
The error:
Exception in thread "main" java.lang.StackOverflowError
at java.util.regex.Pattern$Curly.match(Pattern.java:4229)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
at java.util.regex.Pattern$Slice.match(Pattern.java:3974)
at java.util.regex.Pattern$Start.match(Pattern.java:3463)
at java.util.regex.Matcher.search(Matcher.java:1248)
at java.util.regex.Matcher.find(Matcher.java:637)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:75)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:78)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:78)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:78)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:78)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:78)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:78)
at org.aeonbits.owner.StrSubstitutor.replace(StrSubstitutor.java:78)
Shouldn’t we throw some better Exception?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
StackOverflowError if property is missing · Issue #235 - GitHub
Teh following code: AppConfig appConfig = ConfigFactory.create(AppConfig.class); System.out.println(appConfig.
Read more >Property is missing in type error - reactjs - Stack Overflow
It's an error like having a function with arguments but calling it without passing any. Fix. Perhaps these properties are optional for you?...
Read more >The StackOverflowError in Java - Baeldung
Another interesting scenario that causes this error is if a class is being instantiated within the same class as an instance variable of...
Read more >java.lang.StackOverflowError error is thrown when "layout ...
java.lang.StackOverflowError error is thrown when "layout.friendly.url.page.not.found" is configured with a non existing page.
Read more >StackOverflowError in property resolution - Gradle Forums
StackOverflowError at sun.reflect. ... If you can output the missing property, then maybe I can find the issue myself.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@mariotrucco Thanks. I was sure there was some kind of loop in the string replacement. I think its not a bug, the string replacement become recoursive in this case, and the stack overflow is common in such cases.
@lviggiano I found the stack overwflow error being caused by this in the properties file:
my.test.property = ${my.test.property}In our case the right side variable was supposed to be replaced with a value via maven filtering, but we forgot to specify the value in the maven filter.
It should be quite an uncommon case: please let me know if you are interested in further investigation or if I should just close the issue.
Thank you