Conversation
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
d9c9481 to
474a11f
Compare
| msg = key; | ||
| } | ||
|
|
||
| return msg; |
There was a problem hiding this comment.
i think this could be null - if msg = NLS_BUNDLE.getString(key); on line 55 gets a null back - could that cause an issue in the caller?
There was a problem hiding this comment.
Looking at the NLS_BUNDLE.getString() method, we actually should never get a null back. If the String object is null, that method throws an exception which we will catch and set the msg to the provided key. Given that, we probably dont need the null check afterwards either.
| if (msg != null && args != null) { | ||
| msg = MessageFormat.format(msg, args); | ||
| } | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
can we catch more specific exceptions here to give a finer grained reason for failure?
There was a problem hiding this comment.
I think in all cases, the reason is pretty much that there is an issue with that particular message property. Either the key being used is wrong, or the value in the properties file is wrong. In either case, it's a bug in our code and the failed message lookup should be enough to indicate that.
| try { | ||
| NLS_BUNDLE = ResourceBundle.getBundle("io.openliberty.tools.eclipse.messages.Messages", Locale.getDefault()); | ||
| } catch (Exception e) { | ||
| NLS_BUNDLE = ResourceBundle.getBundle("io.openliberty.tools.eclipse.messages.Messages"); |
There was a problem hiding this comment.
is there a chance that both of these inti's could fail? at that point NLS_BUNDLE would be null - should we initialize it to an empty ResourceBundle?
There was a problem hiding this comment.
No, there shouldnt be a chance of that since we are using the fully qualified classname for this class. If the class is running within the bundle, we should be able to lookup the bundle based on the class.
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
This PR: