t8y2/dbx · error · IllegalArgumentException

Unsupported object type: null

Error message

Unsupported object type: null

What it means

YashanDB's normalizeObjectSourceType rejects a null objectType with a distinct message ("Unsupported object type: null") before normalization runs. YashanDB only supports FUNCTION and PROCEDURE source retrieval, so a null type can never be valid and is reported explicitly to distinguish it from merely unsupported non-null values.

Source

Thrown at agents/drivers/yashandb/src/main/java/com/dbx/agent/yashandb/YashandbAgent.java:134

                statement.setString(1, schema);
                statement.setString(2, name);
                statement.setString(3, normalizedObjectType);
                try (ResultSet resultSet = statement.executeQuery()) {
                    while (resultSet.next()) {
                        String line = resultSet.getString(1);
                        if (line != null) {
                            source.append(line);
                        }
                    }
                }
            }
            return new ObjectSource(name, normalizedObjectType, schema, source.toString(), false);
        });
    }

    static String normalizeObjectSourceType(String objectType) {
        if (objectType == null) {
            throw new IllegalArgumentException("Unsupported object type: null");
        }
        String normalized = objectType.trim().toUpperCase(Locale.ROOT);
        if (!"FUNCTION".equals(normalized) && !"PROCEDURE".equals(normalized)) {
            throw new IllegalArgumentException("Unsupported object type: " + objectType);
        }
        return normalized;
    }

    public static void main(String[] args) {
        new MultiSessionJsonRpcServer(YashandbAgent::new).run();
    }
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Ensure the caller supplies a real type string; default null to a sensible value or skip the object in the caller.
  2. Coalesce: normalizeObjectSourceType(objectType == null ? "" : objectType) only if downstream should report the normal unsupported-type message instead.
  3. Fix the metadata query so TYPE is never null for rows sent to source retrieval.

Example fix

// before
String t = normalizeObjectSourceType(row.getString("OBJECT_TYPE")); // NPE-prone null
// after
String raw = row.getString("OBJECT_TYPE");
if (raw == null) { skip(row); return; }
String t = normalizeObjectSourceType(raw);
Defensive patterns

Strategy: type-guard

Validate before calling

if (objectType == null) {
    // skip or default before calling normalizeObjectSourceType
}

Type guard

Optional<String> safeType(String t) {
    if (t == null) return Optional.empty();
    String n = t.trim().toUpperCase(Locale.ROOT);
    return (n.equals("FUNCTION") || n.equals("PROCEDURE")) ? Optional.of(n) : Optional.empty();
}

Try / catch

try {
    type = normalizeObjectSourceType(rawType);
} catch (IllegalArgumentException e) {
    if (e.getMessage().endsWith(": null")) {
        log.warn("Missing object type; skipping source retrieval");
        return;
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling normalizeObjectSourceType (via normalizedObjectType / getObjectSource) with objectType == null — typically when the metadata row's TYPE/OBJECT_TYPE column was NULL or the caller dropped the field.

Common situations: Dictionary queries return rows (e.g. indexes, sequences) whose type column is null; a UI passes through an unpopulated combo-box value; JSON payloads omit the type field and it deserializes to null.

Related errors


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