{"record":{"id":"15e522fe56e04b15","repo":"apache/seatunnel","slug":"unsupported-convert-value-getclass-to-integer-15e522","errorCode":null,"errorMessage":"Unsupported convert ${value.getClass()} to Integer","messagePattern":"Unsupported convert (.+?) to Integer","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java","lineNumber":1149,"sourceCode":"        if (value instanceof String) {\n            return convertInt((String) value);\n        }\n        if (value instanceof Time) {\n            return convertInt((Time) value);\n        }\n        if (value instanceof LocalTime) {\n            return convertInt((LocalTime) value);\n        }\n        if (value instanceof Date) {\n            return convertInt((Date) value);\n        }\n        if (value instanceof LocalDate) {\n            return convertInt((LocalDate) value);\n        }\n        if (value instanceof LocalDateTime) {\n            return convertInt((LocalDateTime) value);\n        }\n        throw new UnsupportedOperationException(\n                \"Unsupported convert \" + value.getClass() + \" to Integer\");\n    }\n\n    default int convertInt(Number value) {\n        return value.intValue();\n    }\n\n    default int convertInt(String value) {\n        return Integer.parseInt(value);\n    }\n\n    default int convertInt(Time value) {\n        return value.toLocalTime().toSecondOfDay();\n    }\n\n    default int convertInt(LocalTime value) {\n        return value.toSecondOfDay();\n    }","sourceCodeStart":1131,"sourceCodeEnd":1167,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java#L1131-L1167","documentation":"Thrown by BasicDataConverter.convertInt(Object value) when the value is neither LocalDate, LocalDateTime, nor a Number/String handled by default branches. The message names the actual class received so the developer can see exactly which type reached the INT conversion point.","triggerScenarios":"Calling the convertInt(Object) overload with String, Boolean, byte[], java.util.Date or arbitrary POJOs when an int is expected.","commonSituations":"Custom transform code calling the convenience overload directly with unconverted objects; schema drift after a table migration; connectors deserializing fields into generic Object rows.","solutions":["Pre-convert the value to Number/String/LocalDate before calling convertInt","Align the source extraction so the field arrives as the declared catalog type","Override convertInt(Object) in a custom converter to add support for the offending class"],"exampleFix":"// before\nint i = converter.convertInt(row.getField(0)); // Boolean throws\n// after\nObject v = row.getField(0);\nint i = (v instanceof Boolean) ? ((Boolean) v ? 1 : 0) : converter.convertInt(v);","handlingStrategy":"type-guard","validationCode":"Object v = row.getField(0);\nif (!(v instanceof Number) && !(v instanceof String) && !(v instanceof LocalDate) && !(v instanceof LocalDateTime)) {\n    throw new IllegalArgumentException(\"Value \" + v.getClass() + \" cannot be converted to int\");\n}","typeGuard":"static boolean isIntConvertible(Object v) {\n    return v instanceof Number || v instanceof String || v instanceof LocalDate || v instanceof LocalDateTime;\n}","tryCatchPattern":"try {\n    i = converter.convertInt(value);\n} catch (UnsupportedOperationException e) {\n    LOG.warn(\"Cannot convert {} to int\", value.getClass());\n    i = 0;\n}","preventionTips":["Use convertInt(Number)/convertInt(String) overloads directly when the type is static","Box booleans to 0/1 before scalar conversion","Run a small sample job to validate schema mapping before production"],"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-14T05:17:10.506Z"}