标签:blog opera alt param 形式 报错 log string datetime
写测试时用占位符 MessageFormat.format 输出报错
仔细查看了一下我的语句
System.out.println(MessageFormat.format(
"{method:{0}.{1},params:{2},user:[id:{3},username:{4}],ip:{5},dateTime:{6},operationCode:{7},type:{8},creater:{9},requestUrl:{10}}"
,cla,method,json.toString(),userid,username,ip,new Date().getTime(),"ceshi",request.getMethod(),"ceshiCreater",request.getRequestURL()));
发现format不允许{..{0}...}这样的形式,然后我改成了...{0}...
System.out.println(MessageFormat.format(
"method:{0}.{1},params:{2},user:[id:{3},username:{4}],ip:{5},dateTime:{6},operationCode:{7},type:{8},creater:{9},requestUrl:{10}"
,cla,method,json.toString(),userid,username,ip,new Date().getTime(),"ceshi",request.getMethod(),"ceshiCreater",request.getRequestURL()));
运行成功了
像这一类的错误都是非常小的点,只能多经历才能避免了
java.lang.NumberFormatException: For input string: "method:{0}.{1}"处理
标签:blog opera alt param 形式 报错 log string datetime
原文地址:https://www.cnblogs.com/yzqrtop/p/13596357.html