• java.lang.UnsupportedOperationException: null


    很多情况会出现这中异常情况

    java.lang.UnsupportedOperationException: null
    	at java.util.Collections$UnmodifiableList.sort(Collections.java:1331)
    	at java.util.Collections.sort(Collections.java:175)
    	at com.fyh.service.track.service.SQGpsDataQueryService.GPSsort(SQGpsDataQueryService.java:1067)
    	at com.fyh.service.track.service.SQGpsDataQueryService.findGPSData(SQGpsDataQueryService.java:902)
    	at com.fyh.service.track.controller.SQGpsDataController.findGPSData(SQGpsDataController.java:138)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
    	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:870)
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:776)
    	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
    	... 57 common frames omitted

    在我这里出现这种异常是调用了Collections.sort(list,new Comparator(xx){})访问对集合排序,抛出了异常。简答的来说就是说这个集合是不可变得。

    然后在集合中我重新赋值定义

    List newList = new ArrayList(oldList);

    然后把新的list放进去即可

  • 相关阅读:
    重定向输出流实现程序日志
    为新员工分配部门
    从控制台接收输入的身份证号
    判断某一年是否为闰年
    linux重置mysql密码(root权限)
    mysql按照字符串类型的数值按数值进行排序
    android 下拉刷新
    android studio gradle 配置
    搭建自己的iOS内测分发平台
    http_range说明
  • 原文地址:https://www.cnblogs.com/liclBlog/p/15349557.html
Copyright © 2020-2023  润新知