BUG-3051: Fix error reporting string
authorRobert Varga <rovarga@cisco.com>
Mon, 8 Jun 2015 16:43:05 +0000 (18:43 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 9 Jun 2015 10:02:36 +0000 (10:02 +0000)
The exception thrown does not accurately describe what has happened. Be
more user-friendly and report the exact pattern which failed to match.

Change-Id: I0818c92c4a8cdf8c180234635c1efe059ff1c4e2
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 3680886f73ef87fb2818c57b12d3bc76525c3669)

code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/ClassTemplate.xtend

index cf6f3dd7de920c2c449598399f576a1a59d75361..f75299436645bde58056f18eaa925a2270751ef9 100644 (file)
@@ -277,7 +277,7 @@ class ClassTemplate extends BaseTemplate {
             «FOR c : consts»
                 «IF c.name == TypeConstants.PATTERN_CONSTANT_NAME && c.value instanceof List<?>»
                 for (Pattern p : patterns) {
-                    «Preconditions.importedName».checkArgument(p.matcher(_value).matches(), "Supplied value \"%s\" does not match any of the permitted patterns %s", _value, «TypeConstants.PATTERN_CONSTANT_NAME»);
+                    «Preconditions.importedName».checkArgument(p.matcher(_value).matches(), "Supplied value \"%s\" does not match required pattern \"%s\"", _value, p);
                 }
                 «ENDIF»
             «ENDFOR»