{"record":{"id":"8499e70641cf335a","repo":"t8y2/dbx","slug":"unsupported-object-type-objecttype-8499e7","errorCode":null,"errorMessage":"Unsupported object type: \" + objectType","messagePattern":"Unsupported object type: \" \\+ objectType","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/sundb/src/main/java/com/dbx/agent/sundb/SundbAgent.java","lineNumber":210,"sourceCode":"                MetadataSqlSupport.bind(stmt, args);\n                try (ResultSet rs = stmt.executeQuery()) {\n                    while (rs.next()) {\n                        result.add(new ObjectInfo(rs.getString(1), normalizeTableType(rs.getString(2)), schema, null));\n                    }\n                }\n            }\n            return constraints.withoutPaging().filterObjects(result);\n        });\n    }\n\n    @Override\n    public ObjectSource getObjectSource(String schema, String name, String objectType) {\n        return unchecked(() -> {\n            String sql = switch (objectType.toUpperCase(Locale.ROOT)) {\n                case \"VIEW\" -> \"SHOW CREATE VIEW `\" + name.replace(\"`\", \"``\") + \"`\";\n                case \"PROCEDURE\" -> \"SHOW CREATE PROCEDURE `\" + name.replace(\"`\", \"``\") + \"`\";\n                case \"FUNCTION\" -> \"SHOW CREATE FUNCTION `\" + name.replace(\"`\", \"``\") + \"`\";\n                default -> throw new IllegalArgumentException(\"Unsupported object type: \" + objectType);\n            };\n\n            String source = \"\";\n            try (var stmt = requireConnected().createStatement();\n                 ResultSet rs = stmt.executeQuery(sql)) {\n                if (rs.next()) {\n                    int index = \"VIEW\".equals(objectType.toUpperCase(Locale.ROOT)) ? 1 : 2;\n                    String value = rs.getString(index + 1);\n                    source = value == null ? \"\" : value;\n                }\n            }\n            return new ObjectSource(name, objectType, schema, source);\n        });\n    }\n\n    @Override\n    public List<ColumnInfo> getColumns(String schema, String table) {\n        return unchecked(() -> {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/sundb/src/main/java/com/dbx/agent/sundb/SundbAgent.java#L192-L228","documentation":"SundbAgent.getObjectSource builds SHOW CREATE statements for exactly three object types: VIEW, PROCEDURE and FUNCTION. Any other type has no SHOW CREATE equivalent in SunDB, so the switch's default arm throws IllegalArgumentException before executing SQL.","triggerScenarios":"Calling getObjectSource(schema, name, \"TRIGGER\"), \"SEQUENCE\", \"EVENT\", or any type other than VIEW/PROCEDURE/FUNCTION on SundbAgent; also a null objectType (NPE risk avoided by the failure, but the string is used unnormalized so null would NPE first).","commonSituations":"A multi-database UI reuses a shared 'get source' action across all object kinds; types copied from MySQL/Oracle listings include TRIGGER or SEQUENCE which SunDB cannot SHOW CREATE; type strings arrive with different casing and the code uppercases internally but the caller assumed other types existed.","solutions":["Call getObjectSource only for VIEW, PROCEDURE, or FUNCTION on SunDB.","In the caller, check Set.of(\"VIEW\",\"PROCEDURE\",\"FUNCTION\").contains(type.toUpperCase(Locale.ROOT)) before invoking and render 'source unavailable' otherwise.","If triggers are needed, query the SunDB information_schema directly rather than going through this API."],"exampleFix":"// before\nvar src = agent.getObjectSource(schema, name, \"TRIGGER\"); // throws\n// after\nString t = type == null ? \"\" : type.toUpperCase(Locale.ROOT);\nif (t.equals(\"VIEW\") || t.equals(\"PROCEDURE\") || t.equals(\"FUNCTION\")) {\n    var src = agent.getObjectSource(schema, name, type);\n}","handlingStrategy":"validation","validationCode":"String t = objectType == null ? \"\" : objectType.toUpperCase(Locale.ROOT);\nif (!t.equals(\"VIEW\") && !t.equals(\"PROCEDURE\") && !t.equals(\"FUNCTION\")) {\n    // skip: SunDB only supports SHOW CREATE for these\n}","typeGuard":"boolean sundbSupportsSource(String t) {\n    return t != null && Set.of(\"VIEW\",\"PROCEDURE\",\"FUNCTION\").contains(t.trim().toUpperCase(Locale.ROOT));\n}","tryCatchPattern":"try {\n    source = agent.getObjectSource(schema, name, objectType);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unsupported object type\")) {\n        source = \"\"; // no SHOW CREATE for this kind on SunDB\n    } else throw e;\n}","preventionTips":["Only call getObjectSource for VIEW, PROCEDURE or FUNCTION on SunDB.","Keep a per-driver capability map in multi-database UIs instead of assuming all types work everywhere.","Uppercase/trim the type before the call for clarity, even though the agent normalizes internally."],"tags":["sundb","show-create","source-retrieval","unsupported-type"],"backgroundTag":"unsupported-object-type","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}