java.lang.UnsupportedOperationException: null

grokbase.com | 6 months ago
  1. 0

    cli doesn't build on windows

    GitHub | 1 year ago | klauern
    java.lang.UnsupportedOperationException: null
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    CNNProcessorTest::testCNNInputPreProcessorMnist - SubsamplingLayer params

    GitHub | 1 year ago | EronWright
    java.lang.UnsupportedOperationException: null
  4. 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

    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.nio.ByteBuffer.arrayOffset()
    2. Java RT
      ByteBuffer.arrayOffset
      1. java.nio.ByteBuffer.arrayOffset(ByteBuffer.java:968)[na:1.6.0_31]
      1 frame
    3. Apache Avro
      BinaryEncoder.writeBytes
      1. org.apache.avro.io.BinaryEncoder.writeBytes(BinaryEncoder.java:61)[avro-1.6.3.jar:1.6.3]
      1 frame