question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StackOverflowError if property is missing

See original GitHub issue

Teh 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:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
lviggianocommented, Jun 5, 2018

@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.

0reactions
mariotruccocommented, Jun 5, 2018

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found