freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [19/36] incubator-freemarker git commit: FREEMARKER-55: fixing NPE when there's no params
Date Wed, 13 Sep 2017 09:49:20 GMT
FREEMARKER-55: fixing NPE when there's no params


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/075bd887
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/075bd887
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/075bd887

Branch: refs/heads/3
Commit: 075bd88777888a12a194844f8b961c8bd7333a49
Parents: 8bdc5fd
Author: Woonsan Ko <woonsan@apache.org>
Authored: Mon Sep 11 15:51:01 2017 -0400
Committer: Woonsan Ko <woonsan@apache.org>
Committed: Mon Sep 11 15:51:01 2017 -0400

----------------------------------------------------------------------
 .../java/org/apache/freemarker/spring/model/UrlFunction.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/075bd887/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
index fe1b1fd..1e966a1 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/model/UrlFunction.java
@@ -21,6 +21,7 @@ package org.apache.freemarker.spring.model;
 
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -53,6 +54,9 @@ import org.springframework.web.util.UriUtils;
  * Some valid example(s):
  * </P>
  * <PRE>
+ * ${spring.url('/usereditaction.do')}
+ * ${spring.url('/usereditaction.do', param1='value1', param2='value2')}
+ * ${spring.url('/usereditaction.do', context='/othercontext', param1='value1', param2='value2')}
  * </PRE>
  * <P>
  * <EM>Note:</EM> Unlike Spring Framework's <code>&lt;spring:message
/&gt;</code> JSP Tag Library, this function
@@ -93,7 +97,7 @@ public class UrlFunction extends AbstractSpringTemplateFunctionModel {
         final String value = CallableUtils.getStringArgument(args, VALUE_PARAM_IDX, this);
         final String context = CallableUtils.getOptionalStringArgument(args, CONTEXT_PARAM_IDX,
this);
 
-        List<_KeyValuePair<String, String>> params = null;
+        List<_KeyValuePair<String, String>> params = Collections.emptyList();
         final TemplateHashModelEx2 paramsHashModel = (TemplateHashModelEx2) args[PARAMS_PARAM_IDX];
 
         if (!paramsHashModel.isEmptyHash()) {


Mime
View raw message