pinpoint-apm/pinpoint · error · OracleConnectionStringException

parsing error. expected token:'EOF' token

Error message

parsing error. expected token:'EOF' token:<eof>

What it means

After the parser consumes the descriptor structure, checkEof() requires the next token to be the singleton EOF token object. Here a real token ('<eof>'-like trailing content, i.e. leftover characters after the balanced descriptor) remains, so the parser throws. The descriptor parses but has trailing garbage after it.

Solutions

  1. Remove any characters after the final closing ')' of the connection descriptor
  2. Move extra parameters out of the descriptor — pass them as separate connection properties (Properties object) instead
  3. If whitespace/newlines are present, trim and normalize the URL before passing it to the driver
  4. Validate the URL by running it through the parser or a connection test in a staging config first

Example fix

// before
String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=svc)))extra";
// after
String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=svc)))";
Defensive patterns

Strategy: validation

Validate before calling

// after '(' balance check, ensure nothing trails the descriptor
static boolean hasTrailingGarbage(String url) {
    int idx = url.lastIndexOf(')');
    return idx != -1 && idx != url.length() - 1;
}
// reject when hasTrailingGarbage(jdbcUrl) is true

Type guard

boolean isCleanDescriptor(String url) {
    return url != null && url.startsWith("jdbc:oracle:thin:@(") && url.trim().endsWith(")");
}

Try / catch

try {
    parseDescriptor(url);
} catch (OracleConnectionStringException e) {
    log.error("Oracle descriptor has trailing content after final ')': {}", url, e);
    throw new ConfigurationException("Trailing characters in jdbc url", e);
}

Prevention

When it happens

Trigger: Parsing a driver URL that contains extra characters after a syntactically complete (DESCRIPTION=...) descriptor — checkEof() sees token != TOKEN_EOF_OBJECT and throws with the offending token text.

Common situations: Appending parameters like ?internal_logon=sysdba or stray whitespace/comments inside the descriptor; concatenating two descriptors; YAML/config quoting leaving stray brackets or quotes after the last ')'.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/7390cab0246b65ce. Report an issue: GitHub.

Appendix: source

Thrown at agent-module/plugins/oracle-jdbc/src/main/java/com/navercorp/pinpoint/plugin/jdbc/oracle/parser/OracleNetConnectionDescriptorParser.java:72

        // skip thin string
        this.tokenizer.setPosition(position);

        this.tokenizer.parse();
        KeyValue<?> keyValue = parseKeyValue();

        checkEof();

        return keyValue;
    }

    private void checkEof() {
        Token eof = this.tokenizer.nextToken();
        if (eof == null) {
            throw new OracleConnectionStringException("parsing error. expected token:'EOF' token:null");
        }
        if (eof != OracleNetConnectionDescriptorTokenizer.TOKEN_EOF_OBJECT) {
            throw new OracleConnectionStringException("parsing error. expected token:'EOF' token:" + eof);
        }
    }

    public DriverType getDriverType() {
        return driverType;
    }

    private int nextPosition(String driverUrl) {
        final int thinLength = driverUrl.length();
        if (normalizedUrl.startsWith(":@", thinLength)) {
            return thinLength + 2;
        } else if(normalizedUrl.startsWith("@", thinLength)) {
            return thinLength + 1;
        } else {
            throw new OracleConnectionStringException("invalid oracle jdbc url:" + driverUrl);
        }
    }

View on GitHub (pinned to 744c3d3075)