t8y2/dbx · error · IllegalArgumentException

Unsupported object type: " + objectType

Error message

Unsupported object type: " + objectType

What it means

GoldendbAgent.getObjectSource builds a SHOW CREATE statement from the object type; only VIEW, PROCEDURE, and FUNCTION are accepted. Any other type reaches the switch default and throws IllegalArgumentException naming the offending type. Note the input is upper-cased but not trimmed.

Source

Thrown at agents/drivers/goldendb/src/main/java/com/dbx/agent/goldendb/GoldendbAgent.java:209

                try (ResultSet rs = stmt.executeQuery()) {
                    while (rs.next()) {
                        result.add(new ObjectInfo(rs.getString("OBJECT_NAME"), normalizeTableType(rs.getString("OBJECT_TYPE")), schema, emptyToNull(rs.getString("OBJECT_COMMENT"))));
                    }
                }
            }
            return constraints.withoutPaging().filterObjects(result);
        });
    }

    @Override
    public ObjectSource getObjectSource(String schema, String name, String objectType) {
        return unchecked(() -> {
            String quotedName = JdbcIdentifiers.INSTANCE.backtick(name);
            String sql = switch (objectType.toUpperCase(Locale.ROOT)) {
                case "VIEW" -> "SHOW CREATE VIEW " + quotedName;
                case "PROCEDURE" -> "SHOW CREATE PROCEDURE " + quotedName;
                case "FUNCTION" -> "SHOW CREATE FUNCTION " + quotedName;
                default -> throw new IllegalArgumentException("Unsupported object type: " + objectType);
            };

            String source = "";
            try (java.sql.Statement stmt = requireConnected().createStatement();
                 ResultSet rs = stmt.executeQuery(sql)) {
                if (rs.next()) {
                    int sourceIndex = "VIEW".equals(objectType.toUpperCase(Locale.ROOT)) ? 2 : 3;
                    String value = rs.getString(sourceIndex);
                    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

  1. Pass only VIEW, PROCEDURE, or FUNCTION (case-insensitive)
  2. Trim and normalize the type string before calling
  3. Route other object kinds to dedicated DDL APIs

Example fix

// before
agent.getObjectSource(schema, name, objectType); // "table"
// after
String t = objectType == null ? null : objectType.trim();
if (t != null && List.of("VIEW","PROCEDURE","FUNCTION").contains(t.toUpperCase(Locale.ROOT))) {
    agent.getObjectSource(schema, name, t);
} else {
    throw new IllegalArgumentException("GoldenDB source supports only VIEW/PROCEDURE/FUNCTION");
}
Defensive patterns

Strategy: validation

Validate before calling

if (objectType == null) throw new IllegalArgumentException("objectType required"); String t = objectType.trim().toUpperCase(Locale.ROOT); if (!List.of("VIEW","PROCEDURE","FUNCTION").contains(t)) throw new IllegalArgumentException("GoldenDB source supports only VIEW/PROCEDURE/FUNCTION");

Type guard

static boolean isSupportedGoldendbObjectType(String t) { return t != null && List.of("VIEW","PROCEDURE","FUNCTION").contains(t.trim().toUpperCase(Locale.ROOT)); }

Try / catch

try { src = agent.getObjectSource(schema, name, type); } catch (IllegalArgumentException e) { log.warn("Unsupported GoldenDB object type: {}", type); return null; }

Prevention

When it happens

Trigger: Calling getObjectSource with a type such as 'TABLE', 'TRIGGER', 'EVENT', or an untrimmed string; null type would also NPE here at objectType.toUpperCase.

Common situations: Passing metadata-derived types for tables; UI labels with trailing spaces; drivers shared across database flavors where more object kinds are legal elsewhere.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/2f1c172c6142f84e. Report an issue: GitHub.