{"record":{"id":"51a79ddac0b0ec8d","repo":"apache/shardingsphere","slug":"0-51a79d","errorCode":"0","errorMessage":"Unsupported conversion data type '%s' for value '%s'.","messagePattern":"Unsupported conversion data type '(.+?)' for value '(.+?)'\\.","errorType":"exception","errorClass":"UnsupportedDataTypeConversionException","httpStatus":null,"severity":"error","filePath":"infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java","lineNumber":201,"sourceCode":"            return value.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();\n        }\n        if (LocalTime.class.equals(convertType)) {\n            return value.toInstant().atZone(ZoneId.systemDefault()).toLocalTime();\n        }\n        if (OffsetDateTime.class.equals(convertType)) {\n            return value.toInstant().atZone(ZoneId.systemDefault()).toOffsetDateTime();\n        }\n        if (String.class.equals(convertType)) {\n            return value.toString();\n        }\n        return value;\n    }\n    \n    private static Object convertURL(final Object value) {\n        try {\n            return new URL(value.toString());\n        } catch (final MalformedURLException ignored) {\n            throw new UnsupportedDataTypeConversionException(URL.class, value);\n        }\n    }\n    \n    private static Object convertNumberValue(final Object value, final Class<?> convertType) {\n        Number number = (Number) value;\n        switch (convertType.getName()) {\n            case \"boolean\":\n                return longToBoolean(number.longValue());\n            case \"byte\":\n            case \"java.lang.Byte\":\n                return number.byteValue();\n            case \"short\":\n            case \"java.lang.Short\":\n                return number.shortValue();\n            case \"int\":\n            case \"java.lang.Integer\":\n                return number.intValue();\n            case \"long\":","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java#L183-L219","documentation":"Thrown by ResultSetUtils.convertURL when a caller requests a column value as java.net.URL (rs.getObject(i, URL.class)) and the stored value's string form is not a parsable URL. The MalformedURLException from `new URL(value.toString())` is deliberately swallowed and re-raised as UnsupportedDataTypeConversionException naming the URL type and the offending value. ShardingSphere's JDBC result-set layer uses this utility to emulate the driver-level getObject-with-type contract.","triggerScenarios":"Calling getObject(index, java.net.URL.class) (or a driver path that maps to it) on a ShardingSphere ResultSet where the column text has no valid protocol, e.g. 'localhost:8080/path' without a scheme, 'not a url', or a value with embedded whitespace/control characters that makes java.net.URL constructor throw MalformedURLException.","commonSituations":"Columns typed as URL/DATALINK in metadata but holding free text or partially-qualified hosts; test fixtures and mock data with URL-shaped strings missing 'http://'; values copied from logs or user input that were never validated as URLs before being stored.","solutions":["Fix the stored data to be fully-qualified URLs (include scheme, e.g. 'http://host:port/path').","Read the column as String instead: rs.getString(i), then construct java.net.URL yourself with explicit error handling.","Catch UnsupportedDataTypeConversionException around the getObject call and degrade to the raw string value."],"exampleFix":"// before\nURL url = resultSet.getObject(1, java.net.URL.class);\n\n// after\nString raw = resultSet.getString(1);\nURL url = new URL(raw); // explicit MalformedURLException handling","handlingStrategy":"validation","validationCode":"String raw = resultSet.getString(1);\njava.net.URL url = null;\ntry { url = new java.net.URL(raw); } catch (java.net.MalformedURLException e) { /* handle bad data */ }","typeGuard":null,"tryCatchPattern":"try { URL u = rs.getObject(1, URL.class); } catch (UnsupportedDataTypeConversionException e) { URL u = fallbackParse(rs.getString(1)); }","preventionTips":["Store only fully-qualified URLs (scheme + host) in URL-typed columns.","Validate URL shape at write time, not read time."],"tags":["jdbc","result-set","type-conversion","url"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}