Commits

Anonymous committed 9aa5afb

XW-655 DefaultTextProvider : nullpointer if defaultMessage is null

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1889e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits cb4e9d3

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork2/DefaultTextProvider.java

 
     public String getText(String key, String defaultValue, List<Object> args) {
         String text = getText(key, args);
-        if (text == null) {
+        if(text == null && defaultValue == null) {
+            defaultValue = key;
+        }
+        if (text == null && defaultValue != null) {
+
             MessageFormat format = new MessageFormat(defaultValue);
             format.setLocale(ActionContext.getContext().getLocale());
             format.applyPattern(defaultValue);
 
             return format.format(params);
         }
-        return text;
+        return text;        
     }
 
     public String getText(String key, String defaultValue, String[] args) {