This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit a9a198511df5a0fb57282990aec045019fa35c54
Author: Julian Hyde <[email protected]>
AuthorDate: Mon Jul 13 10:08:17 2020 -0700

    Resources: When a resource is missing, output the line to add to .properties
---
 core/src/main/java/org/apache/calcite/runtime/Resources.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/calcite/runtime/Resources.java 
b/core/src/main/java/org/apache/calcite/runtime/Resources.java
index 371b65e..17dc7ef 100644
--- a/core/src/main/java/org/apache/calcite/runtime/Resources.java
+++ b/core/src/main/java/org/apache/calcite/runtime/Resources.java
@@ -308,9 +308,19 @@ public class Resources {
         switch (validation) {
         case BUNDLE_HAS_RESOURCE:
           if (!bundle.containsKey(key)) {
+            String suggested = null;
+            final BaseMessage annotation =
+                method.getAnnotation(BaseMessage.class);
+            if (annotation != null) {
+              final String message = annotation.value();
+              suggested = "; add the following line to "
+                  + bundle.getBaseBundleName() + ".properties:\n"
+                  + key + '=' + message + "\n";
+            }
             throw new AssertionError("key '" + key
                 + "' not found for resource '" + method.getName()
-                + "' in bundle '" + bundle + "'");
+                + "' in bundle '" + bundle + "'"
+                + (suggested == null ? "" : suggested));
           }
           break;
         case MESSAGE_SPECIFIED:

Reply via email to