Browse Source

values = request.getParameterValues(name) 添加对 values 的 null 值判断

James 3 years ago
parent
commit
21972236ad
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/main/java/com/jfinal/core/ActionReporter.java

+ 5 - 0
src/main/java/com/jfinal/core/ActionReporter.java

@@ -30,6 +30,7 @@ import com.jfinal.aop.Interceptor;
 public class ActionReporter {
 	
 	protected static final String title = "\nJFinal-" + Const.JFINAL_VERSION + " action report -------- ";
+	protected static final String[] BLANK_STRING_ARRAY = {""};
 	protected static boolean reportAfterInvocation = true;
 	protected static int maxOutputLengthOfParaValue = 512;
 	protected static Writer writer = new SystemOutWriter();
@@ -107,6 +108,10 @@ public class ActionReporter {
 			while (e.hasMoreElements()) {
 				String name = e.nextElement();
 				String[] values = request.getParameterValues(name);
+				if (values == null) {
+					values = BLANK_STRING_ARRAY;
+				}
+				
 				if (values.length == 1) {
 					sb.append(name).append("=");
 					if (values[0] != null && values[0].length() > maxOutputLengthOfParaValue) {