{"record":{"id":"65be9ce46a0a30a4","repo":"t8y2/dbx","slug":"unsupported-object-type-objecttype-65be9c","errorCode":null,"errorMessage":"Unsupported object type: \" + objectType","messagePattern":"Unsupported object type: \" \\+ objectType","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/oceanbase-oracle/src/main/java/com/dbx/agent/oceanbaseoracle/OceanBaseOracleAgent.java","lineNumber":408,"sourceCode":"    }\n\n    private String queryDictionarySource(String owner, String name, String objectType) throws SQLException {\n        if (\"VIEW\".equals(objectType)) {\n            String sql = \"SELECT TEXT FROM ALL_VIEWS WHERE OWNER = ? AND VIEW_NAME = ?\";\n            try (var stmt = requireConnection().prepareStatement(sql)) {\n                stmt.setString(1, owner);\n                stmt.setString(2, name);\n                try (ResultSet rs = stmt.executeQuery()) {\n                    return rs.next() ? rs.getString(1) : null;\n                }\n            }\n        }\n\n        String sourceType = switch (objectType) {\n            case \"PROCEDURE\", \"FUNCTION\", \"PACKAGE\", \"TRIGGER\", \"TYPE\" -> objectType;\n            case \"PACKAGE_BODY\" -> \"PACKAGE BODY\";\n            case \"TYPE_BODY\" -> \"TYPE BODY\";\n            default -> throw new IllegalArgumentException(\"Unsupported object type: \" + objectType);\n        };\n        String sql = \"SELECT TEXT FROM ALL_SOURCE WHERE OWNER = ? AND NAME = ? AND TYPE = ? ORDER BY LINE\";\n        StringBuilder source = new StringBuilder();\n        try (var stmt = requireConnection().prepareStatement(sql)) {\n            stmt.setString(1, owner);\n            stmt.setString(2, name);\n            stmt.setString(3, sourceType);\n            try (ResultSet rs = stmt.executeQuery()) {\n                while (rs.next()) {\n                    String line = rs.getString(1);\n                    if (line != null) {\n                        source.append(line);\n                    }\n                }\n            }\n        }\n        return editableOracleSource(source.toString());\n    }","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/oceanbase-oracle/src/main/java/com/dbx/agent/oceanbaseoracle/OceanBaseOracleAgent.java#L390-L426","documentation":"When fetching object source text from the OceanBase Oracle-mode data dictionary (ALL_SOURCE), queryDictionarySource maps the caller's object type to the dictionary TYPE value. Only PROCEDURE, FUNCTION, PACKAGE, TRIGGER, TYPE, PACKAGE_BODY and TYPE_BODY have dictionary source; anything else throws IllegalArgumentException because ALL_SOURCE would return nothing and the request is a programming error.","triggerScenarios":"Calling getObjectSource (via getObjectSource) for an OceanBase object whose type is not one of the seven dictionary-backed kinds — e.g. requesting source for a VIEW, SEQUENCE, MATERIALIZED_VIEW, or a misspelled/unnormalized type string.","commonSituations":"UI passes through a type label from a metadata listing that includes views or sequences; a caller forgets to normalize \"package body\" (with a space) to PACKAGE_BODY first; new object types appear in a metadata catalog version before this switch was updated.","solutions":["Only call getObjectSource for types that support dictionary source (check supportsDictionarySource first and show 'no source' for others).","Normalize the type (trim, uppercase, spaces to underscores) before calling, e.g. \"package body\" -> PACKAGE_BODY.","If a legitimate type is missing from the switch, add it to queryDictionarySource and the corresponding dictionary mapping."],"exampleFix":"// before\nsource = getObjectSource(schema, name, \"VIEW\"); // throws\n// after\nif (supportsDictionarySource(normalizedType)) {\n    source = getObjectSource(schema, name, normalizedType);\n} else {\n    source = \"\"; // views etc. have no ALL_SOURCE text\n}","handlingStrategy":"validation","validationCode":"Set<String> DICTIONARY_SOURCE_TYPES = Set.of(\"PROCEDURE\",\"FUNCTION\",\"PACKAGE\",\"TRIGGER\",\"TYPE\",\"PACKAGE_BODY\",\"TYPE_BODY\");\nif (!DICTIONARY_SOURCE_TYPES.contains(objectType)) {\n    // show \"no source\" instead of calling getObjectSource\n}","typeGuard":"boolean supportsDictionarySource(String t) {\n    return t != null && Set.of(\"PROCEDURE\",\"FUNCTION\",\"PACKAGE\",\"TRIGGER\",\"TYPE\",\"PACKAGE_BODY\",\"TYPE_BODY\")\n        .contains(t.trim().toUpperCase(Locale.ROOT).replace(' ', '_'));\n}","tryCatchPattern":"try {\n    source = getObjectSource(schema, name, type);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unsupported object type\")) {\n        source = \"\"; // no dictionary source for this kind\n    } else throw e;\n}","preventionTips":["Normalize types (trim/uppercase/spaces-to-underscores) before any dictionary call.","Check supportsDictionarySource before requesting source.","Keep the accepted-type list in sync across queryDictionarySource, normalizeObjectSourceType and UI filters."],"tags":["oceanbase","oracle","data-dictionary","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-14T00:17:10.932Z"}