{"record":{"id":"b961e83f120dcfc6","repo":"apache/pulsar","slug":"not-implemented","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java","lineNumber":143,"sourceCode":"        return decode(bytes);\n    }\n\n    /**\n     * Decode a ByteBuffer into an object using a given version. <br/>\n     *\n     * @param data\n     *            the ByteBuffer to decode\n     * @return the deserialized object\n     */\n    default T decode(ByteBuffer data) {\n        if (data == null) {\n            return null;\n        }\n        return decode(getBytes(data));\n    }\n\n    default T decode(String topic, ByteBuffer data, byte[] schemaId) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    default T decode(String topic, byte[] data, byte[] schemaId) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n\n    /**\n     * Decode a ByteBuffer into an object using a given version. <br/>\n     *\n     * @param data\n     *            the ByteBuffer to decode\n     * @param schemaVersion\n     *            the schema version to decode the object. null indicates using latest version.\n     * @return the deserialized object\n     */\n    default T decode(ByteBuffer data, byte[] schemaVersion) {\n        if (data == null) {\n            return null;","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java#L125-L161","documentation":"Schema.decode(String topic, ByteBuffer data, byte[] schemaId) is a default interface method that throws UnsupportedOperationException. Only schema implementations that support topic-aware decoding with an explicit schema id (e.g. MultiVersionSchema/protobuf-based schemas) override it. Calling it on a plain schema (AVRO, JSON, String, etc.) that inherited the default hits this stub.","triggerScenarios":"Invoking schema.decode(topic, byteBuffer, schemaId) on a schema instance whose class does not override the topic-aware overload — e.g. Schema.STRING or a SchemaInfo-built schema without reader-schema support.","commonSituations":"Generic framework code that always passes a topic and schemaId regardless of the schema type; custom Schema implementations that added the new method signature but never implemented it; code paths written against a richer schema type then reused with a basic one.","solutions":["Use the non-topic decode methods supported by all schemas: decode(byte[]), decode(ByteBuffer), or decode(byte[], byte[] schemaVersion).","Implement the topic-aware decode method in your custom Schema class if you genuinely need per-topic semantics.","Check schema.getSchemaInfo().getType() / supportSchemaVersioning capability before choosing the decode overload."],"exampleFix":"// before\nT value = schema.decode(topic, byteBuffer, schemaId); // UnsupportedOperationException on basic schemas\n// after\nT value = schema.decode(byteBuffer);","handlingStrategy":"try-catch","validationCode":"static <T> boolean supportsTopicDecode(Schema<T> schema) {\n    try {\n        schema.getClass().getMethod(\"decode\", String.class, ByteBuffer.class, byte[].class);\n        return true;\n    } catch (NoSuchMethodException e) { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n    value = schema.decode(topic, buffer, schemaId);\n} catch (UnsupportedOperationException e) {\n    value = schema.decode(buffer); // fall back to the universally-supported overload\n}","preventionTips":["Prefer the plain decode(byte[])/decode(ByteBuffer) overloads unless you specifically need topic-aware decoding.","Only pass topic+schemaId to schema types documented to support it (multi-version / protobuf-style schemas).","Implement the topic-aware overload in custom Schema classes you ship."],"tags":["schema","unsupported-operation","decoding","default-method"],"backgroundTag":"unsupported-operation","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}