config
config copied to clipboard
null substitution in array with concatenation
library version: 1.4.1
I get a BugOrBroken exception on the following snippet:
val hocon =
"""
|tail = [ 2 ]
|front = [
| {
| foo = 1
| foo = ${?bar}
| }
|] ${tail}
|""".stripMargin
ConfigFactory.parseString(hocon).resolve()
Any of the following allow the snippet to complete without error:
- Removing
foo = 1. - Removing
foo = ${?bar}. - Inlining
tail(i.e.front = [ ... ] [ 2 ]).
Top of the stack trace:
[info] com.typesafe.config.ConfigException$BugOrBroken: SimpleConfigObject.replaceChild did not find SimpleConfigList([{"foo":1,"foo":${?bar}}]) in SimpleConfigObject({"front":[{"foo":1,"foo":${?bar}}]${tail},"tail":[2]})
[info] at com.typesafe.config.impl.SimpleConfigObject.replaceChild(SimpleConfigObject.java:216)
[info] at com.typesafe.config.impl.SimpleConfigObject.replaceChild(SimpleConfigObject.java:26)
[info] at com.typesafe.config.impl.ResolveSource.replace(ResolveSource.java:192)
[info] at com.typesafe.config.impl.ResolveSource.replace(ResolveSource.java:193)
[info] at com.typesafe.config.impl.ResolveSource.replaceCurrentParent(ResolveSource.java:209)
[info] at com.typesafe.config.impl.ResolveSource.replaceWithinCurrentParent(ResolveSource.java:240)
[info] at com.typesafe.config.impl.ConfigDelayedMerge.resolveSubstitutions(ConfigDelayedMerge.java:110)
[info] at com.typesafe.config.impl.ConfigDelayedMerge.resolveSubstitutions(ConfigDelayedMerge.java:59)
failed to reproduce the error with typesafe 1.3.4, it just works:
scala> import com.typesafe.config.ConfigFactory
import com.typesafe.config.ConfigFactory
scala> val hocon =
| """
| |tail = [ 2 ]
| |front = [
| | {
| | foo = 1
| | foo = ${?bar}
| | }
| |] ${tail}
| |""".stripMargin
hocon: String =
"
tail = [ 2 ]
front = [
{
foo = 1
foo = ${?bar}
}
] ${tail}
"
scala> ConfigFactory.parseString(hocon).resolve()
res0: com.typesafe.config.Config = Config(SimpleConfigObject({"front":[{"foo":1},2],"tail":[2]}))