{"record":{"id":"1a7036dc4927bfae","repo":"quarkusio/quarkus","slug":"reading-multibytehttpdata-as-string-is-not-support","errorCode":null,"errorMessage":"Reading MultiByteHttpData as String is not supported","messagePattern":"Reading MultiByteHttpData as String is not supported","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java","lineNumber":221,"sourceCode":"\n        ByteBuf result = VertxByteBufAllocator.DEFAULT.heapBuffer(toRead, toRead);\n\n        // finish if the whole buffer is filled\n        // or we hit the end, `done` && buffer.readableBytes == 0\n        while (toRead > 0 && !(buffer.readableBytes() == 0 && done)) {\n            int readBytes = Math.min(buffer.readableBytes(), toRead);\n            result.writeBytes(buffer.readBytes(readBytes));\n            buffer.discardReadBytes();\n            subscription.request(readBytes);\n\n            toRead -= readBytes;\n        }\n        return result;\n    }\n\n    @Override\n    public String getString() {\n        throw new IllegalStateException(\"Reading MultiByteHttpData as String is not supported\");\n    }\n\n    @Override\n    public String getString(Charset encoding) {\n        throw new IllegalStateException(\"Reading MultiByteHttpData as String is not supported\");\n    }\n\n    @Override\n    public boolean renameTo(File dest) {\n        throw new IllegalStateException(\"Renaming destination file for MultiByteHttpData is not supported\");\n    }\n\n    @Override\n    public boolean isInMemory() {\n        return true;\n    }\n\n    @Override","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/MultiByteHttpData.java#L203-L239","documentation":"getString() decodes the whole part content into a String in standard Netty HttpData. MultiByteHttpData is a streaming adapter that cannot (and must not) materialize all bytes into a String, so it always throws IllegalStateException. This is an intentional unsupported-operation guard, not a state error.","triggerScenarios":"Calling getString() on a MultiByteHttpData - typically from logging, debugging, or generic InterfaceHttpData iteration code that stringifies every part of a multipart request/response.","commonSituations":"Printing multipart parts for diagnostics (including MultiByteHttpData.toString users who then call getString); generic form-data decoders on the server or on response handling; test assertions that read part content as text.","solutions":["Read content incrementally via getChunk(int) after isReady(...) and decode chunks yourself if you truly need text.","If the body is textual, send a String part instead of a Multi<Byte> streaming part.","Collect the source Multi<Byte> upstream and decode from the collected bytes, not from the adapter.","Branch on concrete type before calling getString on InterfaceHttpData instances."],"exampleFix":"// before\nString text = httpData.getString();\n// after\nif (httpData instanceof MultiByteHttpData) {\n    // read via getChunk after isReady, decode chunk by chunk\n} else {\n    String text = httpData.getString();\n}","handlingStrategy":"type-guard","validationCode":"String safeGetString(InterfaceHttpData data) {\n    if (data instanceof MultiByteHttpData) {\n        throw new IllegalArgumentException(\"Read streaming parts via getChunk(); getString is unsupported\");\n    }\n    return data.getString();\n}","typeGuard":"boolean supportsString(InterfaceHttpData data) {\n    return !(data instanceof MultiByteHttpData);\n}","tryCatchPattern":"try {\n    String s = data.getString();\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not supported\")) {\n        // decode incrementally from getChunk() instead\n    } else {\n        throw e;\n    }\n}","preventionTips":["Don't stringify streaming multipart parts in logs; use toString().","Send String parts for textual bodies.","Decode chunks manually if text is required from a Multi<Byte> part.","Branch on concrete type before calling getString."],"tags":["multipart","unsupported-operation","resteasy-reactive","netty"],"backgroundTag":"unsupported-multipart-operation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}