{"record":{"id":"c14aed6e927ff695","repo":"apache/seatunnel","slug":"unsupported-convert-value-getclass-to-boolean-c14aed","errorCode":null,"errorMessage":"Unsupported convert ${value.getClass()} to Boolean","messagePattern":"Unsupported convert (.+?) to Boolean","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java","lineNumber":1319,"sourceCode":"    default boolean convertBoolean(T typeDefine, Number value) {\n        return convertBoolean(value);\n    }\n\n    default boolean convertBoolean(T typeDefine, String value) {\n        return convertBoolean(value);\n    }\n\n    default boolean convertBoolean(Object value) throws UnsupportedOperationException {\n        if (value instanceof Boolean) {\n            return (Boolean) value;\n        }\n        if (value instanceof Number) {\n            return convertBoolean((Number) value);\n        }\n        if (value instanceof String) {\n            return convertBoolean((String) value);\n        }\n        throw new UnsupportedOperationException(\n                \"Unsupported convert \" + value.getClass() + \" to Boolean\");\n    }\n\n    default boolean convertBoolean(Number value) {\n        return value.intValue() != 0;\n    }\n\n    default boolean convertBoolean(String value) {\n        return Boolean.parseBoolean(value);\n    }\n}\n","sourceCodeStart":1301,"sourceCodeEnd":1331,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java#L1301-L1331","documentation":"The TypeDefine-less overload of convertBoolean in BasicDataConverter dispatches on Number and String only; any other runtime type reaches the terminal throw. The message includes the value's class so you can see what unexpected type arrived.","triggerScenarios":"Invoking BasicDataConverter.convertBoolean(Object) with a value whose class is not Number and not String.","commonSituations":"Deserialization producing byte[] or driver-specific objects (e.g. from CDC formats) fed into generic boolean conversion.","solutions":["Convert the value to Number or String before calling convertBoolean","Inspect the printed class and add a targeted pre-processing step or custom converter","If the value is actually valid boolean data, fix the upstream deserialization so it yields a standard type"],"exampleFix":"// before\nconverter.convertBoolean(byteArrayValue); // throws\n// after\nboolean b = byteArrayValue.length > 0 && byteArrayValue[0] != 0;\n// or pass a Number\nconverter.convertBoolean(byteArrayValue[0] != 0 ? 1 : 0);","handlingStrategy":"type-guard","validationCode":"if (!(value instanceof Number) && !(value instanceof String)) {\n    value = normalizeToNumber(value);\n}","typeGuard":"static boolean canConvertBoolean(Object v) {\n    return v instanceof Number || v instanceof String;\n}","tryCatchPattern":"try {\n    boolean b = converter.convertBoolean(value);\n} catch (UnsupportedOperationException e) {\n    throw new IllegalArgumentException(\"Unexpected boolean value type \" + value.getClass(), e);\n}","preventionTips":["Deserialize into SeaTunnel standard types before converting","Check the class named in the message and add handling for it","Prefer the TypeDefine-aware overload for richer diagnostics"],"tags":["java","type-conversion","unsupported-operation"],"backgroundTag":"type-mismatch","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}