{"record":{"id":"288180126f478eca","repo":"alibaba/DataX","slug":"class-x","errorCode":null,"errorMessage":"class={x}","messagePattern":"class=(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/ads/ColumnDataType.java","lineNumber":296,"sourceCode":"            return BYTE;\n        } else if (Short.class == x) {\n            return SHORT;\n        } else if (Float.class == x) {\n            return FLOAT;\n            // } else if (Void.class == x) {\n            // return NULL;\n        } else if (BigDecimal.class.isAssignableFrom(x)) {\n            return DECIMAL;\n        } else if (Date.class.isAssignableFrom(x)) {\n            return DATE;\n        } else if (Time.class.isAssignableFrom(x)) {\n            return TIME;\n        } else if (Timestamp.class.isAssignableFrom(x)) {\n            return TIMESTAMP;\n        } else if (java.util.Date.class.isAssignableFrom(x)) {\n            return TIMESTAMP;\n        } else {\n            throw new IllegalArgumentException(\"class=\" + x);\n        }\n    }\n\n    /**\n     * Convert primitive class names to java.lang.* class names.\n     * \n     * @param clazz the class (for example: int)\n     * @return the non-primitive class (for example: java.lang.Integer)\n     */\n    public static Class<?> getNonPrimitiveClass(Class<?> clazz) {\n        if (!clazz.isPrimitive()) {\n            return clazz;\n        } else if (clazz == boolean.class) {\n            return Boolean.class;\n        } else if (clazz == byte.class) {\n            return Byte.class;\n        } else if (clazz == char.class) {\n            return Character.class;","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/ads/ColumnDataType.java#L278-L314","documentation":"Thrown by ColumnDataType.getTypeFromClass(Class<?> x) when the Java class of a value being written is not any of the recognized classes (String, numeric wrappers, BigDecimal, Date/Time/Timestamp). The final else branch raises IllegalArgumentException('class=' + x), i.e. the writer received a Java object type it cannot map to an ADS value type.","triggerScenarios":"Calling setObject-style paths (or column conversion logic that reflects on value classes) with instances whose class is outside the supported set - e.g. byte[], Boolean is fine but arrays, Calendar, java.time.LocalDate, enums, or custom classes are not.","commonSituations":"A reader plugin produces java.time.* values or byte arrays that the adswriter version predates, or user code in a transformer returns an arbitrary object which is forwarded to the insert proxy.","solutions":["Read the class name from the exception message and find which column/reader emits that type.","Convert the value upstream to a supported type (String, java.util.Date, BigDecimal, numeric wrappers) before it reaches the writer.","Exclude the offending column or cast it to string in the reader's column configuration.","If the class is a legit new type (e.g. java.time.LocalDate), add a branch mapping it and rebuild the plugin."],"exampleFix":"// before\nObject v = java.time.LocalDate.now(); // class=java.time.LocalDate -> throw\n// after\nObject v = java.sql.Date.valueOf(java.time.LocalDate.now()); // supported","handlingStrategy":"type-guard","validationCode":"boolean isSupportedValueClass(Object v) {\n    return v == null || v instanceof String || v instanceof Boolean\n        || v instanceof Byte || v instanceof Short || v instanceof Integer || v instanceof Long\n        || v instanceof Float || v instanceof Double || v instanceof BigDecimal\n        || v instanceof java.util.Date;\n}","typeGuard":"Class<?> normalizeClass(Object v) {\n    if (v instanceof java.time.LocalDate) return java.sql.Date.class;\n    if (v instanceof java.time.Instant) return java.sql.Timestamp.class;\n    return v == null ? null : v.getClass();\n}","tryCatchPattern":"try {\n    int vt = ColumnDataType.getTypeFromClass(x);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException(\"unsupported column value class \" + e.getMessage()\n        + \" - convert to String/Date/BigDecimal/boxed primitive first\", e);\n}","preventionTips":["Convert java.time.* and byte[] values to JDBC-supported types at the reader/transformer boundary.","Do not pass domain objects through to the insert proxy - stringify them first.","Log the value class for each column type once during development to catch unsupported classes early."],"tags":["adswriter","type-mapping","data-conversion"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}