t8y2/dbx · error · IllegalArgumentException
Unsupported object type: " + objectType
Error message
Unsupported object type: " + objectType
What it means
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.
Source
Thrown at agents/drivers/sundb/src/main/java/com/dbx/agent/sundb/SundbAgent.java:210
MetadataSqlSupport.bind(stmt, args);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
result.add(new ObjectInfo(rs.getString(1), normalizeTableType(rs.getString(2)), schema, null));
}
}
}
return constraints.withoutPaging().filterObjects(result);
});
}
@Override
public ObjectSource getObjectSource(String schema, String name, String objectType) {
return unchecked(() -> {
String sql = switch (objectType.toUpperCase(Locale.ROOT)) {
case "VIEW" -> "SHOW CREATE VIEW `" + name.replace("`", "``") + "`";
case "PROCEDURE" -> "SHOW CREATE PROCEDURE `" + name.replace("`", "``") + "`";
case "FUNCTION" -> "SHOW CREATE FUNCTION `" + name.replace("`", "``") + "`";
default -> throw new IllegalArgumentException("Unsupported object type: " + objectType);
};
String source = "";
try (var stmt = requireConnected().createStatement();
ResultSet rs = stmt.executeQuery(sql)) {
if (rs.next()) {
int index = "VIEW".equals(objectType.toUpperCase(Locale.ROOT)) ? 1 : 2;
String value = rs.getString(index + 1);
source = value == null ? "" : value;
}
}
return new ObjectSource(name, objectType, schema, source);
});
}
@Override
public List<ColumnInfo> getColumns(String schema, String table) {
return unchecked(() -> {View on GitHub (pinned to c0390bff16)
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.
Example fix
// before
var src = agent.getObjectSource(schema, name, "TRIGGER"); // throws
// after
String t = type == null ? "" : type.toUpperCase(Locale.ROOT);
if (t.equals("VIEW") || t.equals("PROCEDURE") || t.equals("FUNCTION")) {
var src = agent.getObjectSource(schema, name, type);
} Defensive patterns
Strategy: validation
Validate before calling
String t = objectType == null ? "" : objectType.toUpperCase(Locale.ROOT);
if (!t.equals("VIEW") && !t.equals("PROCEDURE") && !t.equals("FUNCTION")) {
// skip: SunDB only supports SHOW CREATE for these
} Type guard
boolean sundbSupportsSource(String t) {
return t != null && Set.of("VIEW","PROCEDURE","FUNCTION").contains(t.trim().toUpperCase(Locale.ROOT));
} Try / catch
try {
source = agent.getObjectSource(schema, name, objectType);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unsupported object type")) {
source = ""; // no SHOW CREATE for this kind on SunDB
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Unsupported object type: " + objectType
- Unsupported object type: " + objectType
- Unsupported object type: " + objectType
- Unsupported object type: null
- Unsupported object type: " + objectType
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/8499e70641cf335a.
Report an issue: GitHub.