{"record":{"id":"a88e5adeb50d7017","repo":"pentaho/pentaho-kettle","slug":"connectionfilenameparser-connectionnameempty","errorCode":"ConnectionFileNameParser.ConnectionNameEmpty","errorMessage":"ConnectionFileNameParser.ConnectionNameEmpty","messagePattern":"ConnectionFileNameParser\\.ConnectionNameEmpty","errorType":"error_code","errorClass":"KettleVFSFileSystemException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/connections/vfs/provider/ConnectionFileNameParser.java","lineNumber":159,"sourceCode":"  }\n\n  @NonNull\n  public static ConnectionFileNameParser getInstance() {\n    if ( instance == null ) {\n      instance = new ConnectionFileNameParser();\n    }\n\n    return instance;\n  }\n\n  @NonNull\n  protected ConnectionFileNameUtils getConnectionFileNameUtils() {\n    return connectionFileNameUtils;\n  }\n\n  public void validateConnectionName( @Nullable String connectionName ) throws FileSystemException {\n    if ( StringUtils.isEmpty( connectionName ) ) {\n      throw new KettleVFSFileSystemException( \"ConnectionFileNameParser.ConnectionNameEmpty\" );\n    }\n\n    for ( char c : connectionName.toCharArray() ) {\n      if ( !isValidConnectionNameCharacter( c ) ) {\n        throw new KettleVFSFileSystemException(\n          \"ConnectionFileNameParser.ConnectionNameInvalidCharacter\",\n          connectionName,\n          c );\n      }\n    }\n  }\n\n  /**\n   * Determines if a given character is a valid in a connection name.\n   *\n   * @param c The character to test.\n   * @return {@code true} if the character is valid; {@code false}, otherwise.\n   */","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/connections/vfs/provider/ConnectionFileNameParser.java#L141-L177","documentation":"ConnectionFileNameParser.validateConnectionName rejects connection names that are null or empty, throwing a KettleVFSFileSystemException with code 'ConnectionFileNameParser.ConnectionNameEmpty'. Every pvfs:// URI requires a connection name as its authority segment; without one the URI cannot identify a connection.","triggerScenarios":"Parsing a URI like 'pvfs://' (no '//name') or 'pvfs:///' where the connection segment is absent; calling validateConnectionName(\"\") or validateConnectionName(null) directly.","commonSituations":"Users entering a VFS URL without the connection name; string concatenation producing 'pvfs://' when a variable holding the connection name is empty; template variables not substituted in connection paths.","solutions":["Include the connection name in the URI: 'pvfs://my-connection/path'.","Validate the connection name is non-empty before building the URI.","Check that the variable/parameter holding the connection name is populated at runtime.","Call parser.validateConnectionName(name) up front to fail early with a precise message."],"exampleFix":"// before\nString uri = \"pvfs://\" + connectionName + \"/data\"; // connectionName is \"\"\n// after\nif ( StringUtils.isEmpty( connectionName ) ) {\n  throw new IllegalArgumentException( \"connectionName is required\" );\n}\nString uri = \"pvfs://\" + connectionName + \"/data\";","handlingStrategy":"validation","validationCode":"if ( connectionName == null || connectionName.isEmpty() ) {\n  throw new IllegalArgumentException( \"Connection name is required in pvfs URIs\" );\n}","typeGuard":"boolean hasConnectionName( String uri ) {\n  int i = uri.indexOf( \"://\" );\n  return i >= 0 && uri.length() > i + 3 && uri.charAt( i + 3 ) != '/';\n}","tryCatchPattern":"try {\n  parser.parseUri( uri );\n} catch ( FileSystemException e ) {\n  if ( String.valueOf( e.getMessage() ).contains( \"ConnectionNameEmpty\" ) ) {\n    // rebuild uri with an explicit connection name\n  }\n}","preventionTips":["Check the connection-name variable is non-empty before building the URI","Fail configuration load when the connection segment is missing","Avoid naive concatenation like \"pvfs://\" + maybeEmptyName"],"tags":["vfs","uri-parsing","empty-name"],"backgroundTag":"empty-required-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}