From 255e7c2ebaa443b6655f1889c8da1b5968dbf7d1 Mon Sep 17 00:00:00 2001 From: Henrik Nordvik Date: Mon, 9 Mar 2020 16:16:42 -0700 Subject: [PATCH 1/2] Upgrade typesafe config version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 55ad4cc..fce9795 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ com.typesafe config - 1.2.0 + 1.4.0 From decadc0476b57ac8ac1082847f33f1f2c9d9b244 Mon Sep 17 00:00:00 2001 From: Henrik Nordvik Date: Mon, 9 Mar 2020 16:17:00 -0700 Subject: [PATCH 2/2] Fix resolution of references Resolve failed with the following exception when using references: Exception in thread "main" com.typesafe.config.ConfigException$BugOrBroken: replace in parent not possible The docs for resolveWith says: > Note that this method does NOT look in this instance for substitution values. Which means we can't refer to variabled in the same config. It also says: > If you want to do that, you could either merge this instance into > your value source using Config.withFallback, or you could resolve > multiple times with multiple sources (using setAllowUnresolved). I tried using withFallback, but the same error still occurred. This might be due to a bug in typesafe config: https://github.com/lightbend/config/issues/332 This works around that by resolving multiple times as suggested in the javadoc. --- src/main/java/com/github/okapies/hoc2js/Hoc2Js.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/okapies/hoc2js/Hoc2Js.java b/src/main/java/com/github/okapies/hoc2js/Hoc2Js.java index deb8b65..03cf0d2 100644 --- a/src/main/java/com/github/okapies/hoc2js/Hoc2Js.java +++ b/src/main/java/com/github/okapies/hoc2js/Hoc2Js.java @@ -30,6 +30,7 @@ public static void main(String[] args) { // resolve ConfigResolveOptions resolveOpts = loadResolveOpts(config); + obj = obj.resolve(resolveOpts.setAllowUnresolved(true)); obj = obj.resolveWith(config, resolveOpts); // render