Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>
Code:
public @ResponseBody Object getCommonInfo(HttpServletRequest request, HttpServletResponse response) {
Map<String, String[]> parameterMap = request.getParameterMap();
String[] timeArray = { System.currentTimeMillis() + "", };
parameterMap.put("timeStamp", timeArray);
fluentLogSender.sendLog2("Appstore", parameterMap);
ResponseUtils.writeResponse(response, ErrorResponse.getEmptyResult());
return null;
}
The exception thrown is:
java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap
at org.apache.catalina.util.ParameterMap.put(ParameterMap.java:164)
at com.hisense.hitv.appstoreapi.controller.AppAdversingController.getCommonInfo(AppAdversingController.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
…………
This is because the map obtained through request. Getparametermap() is not allowed to be modified( I don’t know why ~ ~)
The solution is to create a new map to receive the value of request. Getparametermap()
Direct assignment is an address reference, and no new memory space is allocated. You can apply for a new memory address by using the New method, and the value of map can be modified
Similar Posts:
- [Solved] Hadoop Error: Input path does not exist: hdfs://Master:9000/user/hadoop/input
- [Solved] Java Call Error: java.lang.IllegalArgumentException: wrong number of arguments
- Java – Stream has already been operated upon or closed
- Request processing failed; nested exception is java.lang.NullPointerException
- Java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument
- [Solved] org.apache.catalina.LifecycleException: Failed to start component
- Solution to JavaFX error caused by: Java.Lang.NullPointerException: location is required
- [Solved] Mybatis Codes Error: java.lang.ClassNotFoundException: Cannot find class: com.mysql.jdbc.Driver
- [Solved] flink web ui Submit Task Error: Server Respoonse Message-Internal server error
- Cannot resolve reference to bean ‘txPoint’ while setting bean property ‘pointcut’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘txPoint’