diff --git a/config/src/main/java/com/typesafe/config/ConfigException.java b/config/src/main/java/com/typesafe/config/ConfigException.java index f781b3755..f35e8dbea 100644 --- a/config/src/main/java/com/typesafe/config/ConfigException.java +++ b/config/src/main/java/com/typesafe/config/ConfigException.java @@ -8,7 +8,6 @@ import java.lang.reflect.Field; import com.typesafe.config.impl.ConfigImplUtil; -import com.typesafe.config.impl.Path; /** * All exceptions thrown by the library are subclasses of @@ -127,8 +126,8 @@ public Missing(String path, Throwable cause) { cause); } - public Missing(ConfigOrigin origin, Path path) { - this(origin, "No configuration setting found for key '" + path.render() + "'"); + public Missing(ConfigOrigin origin, String path) { + this(origin, "No configuration setting found for key '" + path + "'", null); } public Missing(String path) { @@ -139,9 +138,6 @@ protected Missing(ConfigOrigin origin, String message, Throwable cause) { super(origin, message, cause); } - protected Missing(ConfigOrigin origin, String message) { - this(origin, message, null); - } } /** diff --git a/config/src/main/java/com/typesafe/config/impl/Path.java b/config/src/main/java/com/typesafe/config/impl/Path.java index 1e0fd7471..d39a57c68 100644 --- a/config/src/main/java/com/typesafe/config/impl/Path.java +++ b/config/src/main/java/com/typesafe/config/impl/Path.java @@ -7,7 +7,7 @@ import com.typesafe.config.ConfigException; -public final class Path { +final class Path { final private String first; final private Path remainder; @@ -216,7 +216,7 @@ public String toString() { * toString() is a debugging-oriented version while this is an * error-message-oriented human-readable one. */ - public String render() { + String render() { StringBuilder sb = new StringBuilder(); appendToStringBuilder(sb); return sb.toString(); diff --git a/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java b/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java index 308d14ca7..c0d6b65c7 100644 --- a/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java +++ b/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java @@ -153,7 +153,7 @@ static private AbstractConfigValue findKeyOrNull(AbstractConfigObject self, Stri ConfigValueType expected, Path originalPath) { AbstractConfigValue v = self.peekAssumingResolved(key, originalPath); if (v == null) - throw new ConfigException.Missing(self.origin(), originalPath); + throw new ConfigException.Missing(self.origin(), originalPath.render()); if (expected != null) v = DefaultTransformer.transform(v, expected);