You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/03/03 19:30:29 UTC

[1/2] struts git commit: Improve LocalizedTextUtil.getMessage() defend NPE

Repository: struts
Updated Branches:
  refs/heads/master f9fb3549c -> 5bcdd3d9f


Improve LocalizedTextUtil.getMessage() defend NPE

Defend NPE if not ValueStack presented, for example non-struts request like static util method or backend thread.

Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/f2f5338d
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/f2f5338d
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/f2f5338d

Branch: refs/heads/master
Commit: f2f5338ded3c2256c878a9d7cb3a62c1b07ce2e7
Parents: 4cd9a74
Author: zhouyanming <zh...@gmail.com>
Authored: Mon Sep 14 08:50:43 2015 +0800
Committer: zhouyanming <zh...@gmail.com>
Committed: Mon Sep 14 08:50:43 2015 +0800

----------------------------------------------------------------------
 .../java/com/opensymphony/xwork2/util/LocalizedTextUtil.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/f2f5338d/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
index fa5a178..2277bec 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
@@ -736,9 +736,12 @@ public class LocalizedTextUtil {
         if (bundle == null) {
             return null;
         }
+        if (valueStack != null) 
             reloadBundles(valueStack.getContext());
         try {
-            String message = TextParseUtil.translateVariables(bundle.getString(key), valueStack);
+        	String message = bundle.getString(key);
+        	if (valueStack != null) 
+        		message = TextParseUtil.translateVariables(bundle.getString(key), valueStack);
             MessageFormat mf = buildMessageFormat(message, locale);
             return formatWithNullDetection(mf, args);
         } catch (MissingResourceException e) {


[2/2] struts git commit: WW-4464 Adds null checking

Posted by lu...@apache.org.
WW-4464 Adds null checking


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/5bcdd3d9
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/5bcdd3d9
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/5bcdd3d9

Branch: refs/heads/master
Commit: 5bcdd3d9f394c2692aaf9ebbef391fc01b561a80
Parents: f9fb354 f2f5338
Author: Lukasz Lenart <lu...@apache.org>
Authored: Thu Mar 3 19:30:00 2016 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Thu Mar 3 19:30:00 2016 +0100

----------------------------------------------------------------------
 .../java/com/opensymphony/xwork2/util/LocalizedTextUtil.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/5bcdd3d9/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java
----------------------------------------------------------------------