Use commandDescription if no commandDescriptionKey
When obtaining the description of a command, if a resourcebundle is
configured, but commandDescriptionKey is missing, use the provided
commandDescription instead of failing with MissingResourceException.
@@ -944,7 +944,10 @@ public class JCommander {
}
if (bundle != null) {
- result = getI18nString(bundle, p.commandDescriptionKey(), p.commandDescription());
+ String descriptionKey = p.commandDescriptionKey();
+ if (!"".equals(descriptionKey)) {
+ result = getI18nString(bundle, descriptionKey, p.commandDescription());
+ }
}
}
