java.lang.UnsupportedOperationException: null

JDK Bug System | Webbug Group | 4 months ago
  1. 0

    FULL PRODUCT VERSION : C:\Windows\System32>java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) ADDITIONAL OS VERSION INFORMATION : C:\Windows\System32>ver Microsoft Windows [Version 6.1.7601] A DESCRIPTION OF THE PROBLEM : This appears to be related to the fix for JDK bug https://bugs.openjdk.java.net/browse/JDK-8155076. The above seems to have been fixed but has caused this UnsupportedOperationException to occaisionally occur. We have not been able to firmly identify the root cause yet but believe it is due to the garbage collection of weak-references. java.lang.UnsupportedOperationException: null at java.util.Collections$UnmodifiableMap.remove(Unknown Source) ~[na:1.8.0_101] at java.util.jar.Attributes.remove(Unknown Source) ~[na:1.8.0_101] at com.sun.deploy.cache.CachedJarFile.getManifest(Unknown Source) ~[na:na] at com.sun.deploy.security.DeployURLClassPath$JarLoader$2.getManifest(Unknown Source) ~[na:na] at java.net.URLClassLoader.defineClass(Unknown Source) ~[na:1.8.0_101] at java.net.URLClassLoader.access$100(Unknown Source) ~[na:1.8.0_101] at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_101] at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_101] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_101] at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_101] at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source) ~[na:na] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_101] at com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source) ~[na:na] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_101] Has occurred once in QA (but has not been reproducible), and 2 customers have reported it too since upgrading to 8u101. REGRESSION. Last worked in version 8u91 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : We are still working to reproduce - will update this if/when we can. We believe the cause is related to garbage collection of the weak-reference (CachedJarFile.manifestRef). EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - CachedJarFile.getManifest should successfully return the manifest, not throw an exception. ACTUAL - java.lang.UnsupportedOperationException: null at java.util.Collections$UnmodifiableMap.remove(Unknown Source) ~[na:1.8.0_101] ERROR MESSAGES/STACK TRACES THAT OCCUR : See above. REPRODUCIBILITY : This bug can be reproduced occasionally. ---------- BEGIN SOURCE ---------- Still working on this. ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Looking at preventing the garbage collection of the manifestRef by establishing a hard-link to it.

    JDK Bug System | 4 months ago | Webbug Group
    java.lang.UnsupportedOperationException: null
  2. 0

    CNNProcessorTest::testCNNInputPreProcessorMnist - SubsamplingLayer params

    GitHub | 1 year ago | EronWright
    java.lang.UnsupportedOperationException: null
  3. 0

    Writing Protobuf as response body doesn't work with default settings because {{ProtobufHttpMessageConverter}} attempt to write HTTP header of read-only {{ServletServerHttpResponse}}. As the result, the following exeception is thrown after HTTP request: {code} java.lang.UnsupportedOperationException: null at java.util.Collections$UnmodifiableMap.put(Collections.java:1517) at org.springframework.http.HttpHeaders.set(HttpHeaders.java:869) at org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter.setProtoHeader(ProtobufHttpMessageConverter.java:196) at org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter.writeInternal(ProtobufHttpMessageConverter.java:182) at org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter.writeInternal(ProtobufHttpMessageConverter.java:60) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:208) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:153) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:202) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:71) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:122) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) {code} Current {{ProtobufHttpMessageConverter}} implementation is like: {code:java} @Override protected void writeInternal(Message message, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { // ... ommited OutputStreamWriter writer = new OutputStreamWriter(outputMessage.getBody(), charset); // <-- (1) if (MediaType.TEXT_HTML.isCompatibleWith(contentType)) { HtmlFormat.print(message, writer); } // ... ommited else if (PROTOBUF.isCompatibleWith(contentType)) { setProtoHeader(outputMessage, message); // <-- (2) FileCopyUtils.copy(message.toByteArray(), outputMessage.getBody()); } } private void setProtoHeader(HttpOutputMessage response, Message message) { response.getHeaders().set(X_PROTOBUF_SCHEMA_HEADER, message.getDescriptorForType().getFile().getName()); response.getHeaders().set(X_PROTOBUF_MESSAGE_HEADER, message.getDescriptorForType().getFullName()); } {code} At (1) {{outputMessage.getBody()}} makes {{headersWritten}} field {{true}} and {{headers}} field read-only in {{ServletServerHttpResponse}}. At (2) Header is set in spite of the {{headers}} is already read-only. Actually, customized {{ProtobufHttpMessageConverter}} works well like: {code:java} ProtobufHttpMessageConverter protobufHttpMessageConverter = new ProtobufHttpMessageConverter((registry) -> { }) { @Override protected void writeInternal(Message message, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { outputMessage.getHeaders().set(X_PROTOBUF_SCHEMA_HEADER, message.getDescriptorForType().getFile().getName()); outputMessage.getHeaders().set(X_PROTOBUF_MESSAGE_HEADER, message.getDescriptorForType().getFullName()); FileCopyUtils.copy(message.toByteArray(), outputMessage.getBody()); } }; {code}

    Spring JIRA | 2 years ago | Toshiaki Maki
    java.lang.UnsupportedOperationException: null
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Bash embedded jar as repackaging option

    GitHub | 2 years ago | aantono
    java.lang.UnsupportedOperationException: null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.UnsupportedOperationException

      null

      at java.util.Collections$UnmodifiableMap.remove()
    2. Java RT
      Attributes.remove
      1. java.util.Collections$UnmodifiableMap.remove(Unknown Source)[na:1.8.0_101]
      2. java.util.jar.Attributes.remove(Unknown Source)[na:1.8.0_101]
      2 frames
    3. com.sun.deploy
      DeployURLClassPath$JarLoader$2.getManifest
      1. com.sun.deploy.cache.CachedJarFile.getManifest(Unknown Source)[na:na]
      2. com.sun.deploy.security.DeployURLClassPath$JarLoader$2.getManifest(Unknown Source)[na:na]
      2 frames
    4. Java RT
      URLClassLoader.findClass
      1. java.net.URLClassLoader.defineClass(Unknown Source)[na:1.8.0_101]
      2. java.net.URLClassLoader.access$100(Unknown Source)[na:1.8.0_101]
      3. java.net.URLClassLoader$1.run(Unknown Source)[na:1.8.0_101]
      4. java.net.URLClassLoader$1.run(Unknown Source)[na:1.8.0_101]
      5. java.security.AccessController.doPrivileged(Native Method)[na:1.8.0_101]
      6. java.net.URLClassLoader.findClass(Unknown Source)[na:1.8.0_101]
      6 frames
    5. com.sun.jnlp
      JNLPClassLoader.findClass
      1. com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)[na:na]
      1 frame
    6. Java RT
      ClassLoader.loadClass
      1. java.lang.ClassLoader.loadClass(Unknown Source)[na:1.8.0_101]
      1 frame
    7. com.sun.jnlp
      JNLPClassLoader.loadClass
      1. com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)[na:na]
      1 frame
    8. Java RT
      ClassLoader.loadClass
      1. java.lang.ClassLoader.loadClass(Unknown Source)[na:1.8.0_101]
      1 frame