{"record":{"id":"ee7dd5b0f7ae31d8","repo":"dbeaver/dbeaver","slug":"unsupported-geometry-value","errorCode":null,"errorMessage":"Unsupported geometry value: {}","messagePattern":"Unsupported geometry value: (.+?)","errorType":"exception","errorClass":"DBCException","httpStatus":null,"severity":"error","filePath":"plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/data/gis/handlers/GISGeometryValueHandler.java","lineNumber":155,"sourceCode":"                bytes = (byte[]) object;\n            }\n            if (bytes == null || bytes.length == 0) {\n                return new DBGeometry();\n            }\n            try {\n                geometry = new DBGeometry(convertGeometryFromBinaryFormat(session, bytes));\n            } catch (DBCException e) {\n                try {\n                    // Might be a WKT\n                    geometry = new DBGeometry(new WKTReader().read(new String(bytes)));\n                } catch (Exception ignored) {\n                    throw new DBCException(\"Error parsing geometry value from binary\", e);\n                }\n            }\n        } else if (object instanceof String) {\n            return WKGUtils.parseWKT((String) object);\n        } else {\n            throw new DBCException(\"Unsupported geometry value: \" + object);\n        }\n        if (geometry.getSRID() == 0) {\n            geometry.setSRID(defaultSRID);\n        }\n        return geometry;\n    }\n\n    @NotNull\n    protected Geometry convertGeometryFromBinaryFormat(@Nullable DBCSession session, @NotNull byte[] object) throws DBCException {\n        try (ByteArrayInputStream is = new ByteArrayInputStream(object)) {\n            int srid = 0;\n\n            if (leadingSRID) {\n                // Read SRID with little endian order (the least significant bytes come first)\n                srid |= is.read();\n                srid |= is.read() << 8;\n                srid |= is.read() << 16;\n                srid |= is.read() << 24;","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/dbeaver/dbeaver/blob/1e5ee1042bc61661368942aece126f3e67049955/plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/data/gis/handlers/GISGeometryValueHandler.java#L137-L173","documentation":"Thrown by GISGeometryValueHandler.getValueFromObject() when the supplied object is none of the supported types: null, DBGeometry, org.locationtech.jts.geom.Geometry, byte[], JDBCContentBytes, or String. Any other Java type reaching this handler is rejected as unsupported.","triggerScenarios":"getValueFromObject(session, type, object, ...) is called with an object of an unrecognized class — e.g. an Integer, Long, java.sql.SQLXML, a structured object, or a driver-specific custom type that the value handler was incorrectly registered to handle.","commonSituations":"A dataTypeProvider/valueHandler extension was registered for a column type that delivers a non-binary/non-string Java object; a driver returns an unexpected type for a column mapped to GISGeometryValueHandler; a misconfigured type binding routes the wrong column type to this handler.","solutions":["Confirm the column type actually delivers byte[], String, Geometry, or JDBCContentBytes; if it returns another type, register a different value handler.","Convert/pre-process the value into a supported type (bytes or WKT string) before passing it to getValueFromObject.","Review the dataTypeProvider / value handler registration in plugin.xml to ensure GISGeometryValueHandler is bound only to genuine geometry column types.","Inspect object.getClass() at the call site to identify the unexpected type and adjust the binding."],"exampleFix":"// before: an unhandled type reaches the geometry handler and throws\nObject v = resultSet.getObject(index);   // e.g. returns a SQLXML\ngeometry = handler.getValueFromObject(session, type, v, false, true);\n\n// after: coerce to a supported representation before parsing\nObject v = resultSet.getObject(index);\nif (v instanceof SQLXML xml) v = xml.getString();   // now a WKT/WKB string\ngeometry = handler.getValueFromObject(session, type, v, false, true);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Only route supported types into the geometry handler\nstatic boolean isSupportedGeometryValue(Object o) {\n    return o == null\n        || o instanceof DBGeometry\n        || o instanceof org.locationtech.jts.geom.Geometry\n        || o instanceof byte[]\n        || o instanceof JDBCContentBytes\n        || o instanceof String;\n}","tryCatchPattern":null,"preventionTips":["Register GISGeometryValueHandler only for column types that yield byte[]/String/Geometry/JDBCContentBytes.","Coerce unexpected types to a supported form before calling getValueFromObject.","Log object.getClass() at the boundary to catch misrouted types early."],"tags":["gis","geometry","type-mismatch","value-handler"],"backgroundTag":null,"analyzedSha":"1e5ee1042bc61661368942aece126f3e67049955","analyzedAt":"2026-08-13T23:31:13.467Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}