Skip to content

Commit cbe6adf

Browse files
committed
Delay loading the error message until the check fails.
1 parent 1eb460d commit cbe6adf

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main/java/com/github/fge/jsonschema/core/util/URIUtils.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,10 @@ public URI apply(@Nullable final URI input)
157157
@Override
158158
public void check(final String argument)
159159
{
160-
final String errmsg = BUNDLE.printf("loadingCfg.illegalScheme",
161-
argument);
162-
if (argument.isEmpty())
163-
throw new IllegalArgumentException(errmsg);
164-
if (!ALPHA.matches(argument.charAt(0)))
165-
throw new IllegalArgumentException(errmsg);
166-
if (!SCHEME_LEGAL.matchesAllOf(argument))
167-
throw new IllegalArgumentException(errmsg);
160+
if (argument.isEmpty() || !ALPHA.matches(argument.charAt(0))
161+
|| !SCHEME_LEGAL.matchesAllOf(argument))
162+
throw new IllegalArgumentException(
163+
BUNDLE.printf("loadingCfg.illegalScheme", argument));
168164
}
169165
};
170166

0 commit comments

Comments
 (0)