{"record":{"id":"9f6c296dffc8a911","repo":"pentaho/pentaho-kettle","slug":"url-cannot-be-null","errorCode":null,"errorMessage":"URL cannot be null","messagePattern":"URL cannot be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/repo/RepositoryClient.java","lineNumber":89,"sourceCode":"    public RepositoryClientException( String msg ) {\n      super( msg );\n    }\n\n    public RepositoryClientException( ClientResponse response ) {\n      super( \"Failed with status: \" + response.getStatus() );\n      this.response = Optional.of( response );\n    }\n\n    public RepositoryClientException( String msg, Exception e ) {\n      super( msg, e );\n    }\n  }\n\n  public RepositoryClient( JCRSolutionConfig cfg,\n                           String url,\n                           BasicAuthentication auth ) {\n    if ( url == null ) {\n      throw new IllegalArgumentException( \"URL cannot be null\" );\n    }\n    this.url = url;\n    this.cfg = cfg;\n\n    CookieHandler.setDefault( new CookieManager( null, CookiePolicy.ACCEPT_ALL ) );\n\n    this.client = createClient( cfg, auth );\n  }\n\n  private static Client createClient( JCRSolutionConfig cfg, BasicAuthentication auth ) {\n    ClientConfig config = new ClientConfig();\n    config.property( ClientProperties.FOLLOW_REDIRECTS, true );\n    config.property( ClientProperties.READ_TIMEOUT, cfg.getTimeOut() );\n    config.register( MultiPartWriter.class );\n    config.register( JacksonFeature.class );\n    Client client = ClientBuilder.newClient( config );\n    auth.applyToClient( client );\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/repo/RepositoryClient.java#L71-L107","documentation":"Constructor guard in RepositoryClient: the JCR solution configuration was supplied with a null URL, so no endpoint can be addressed. The IllegalArgumentException fires immediately, before any connection is attempted.","triggerScenarios":"Constructing RepositoryClient with url == null, typically because ConfigReader produced no value, the caller passed an uninitialized variable, or the JCRSolutionConfig lacked a URL and code passed null onward.","commonSituations":"Missing mandatory property in repo-vfs-ws configuration; config file not loaded; refactoring that stopped defaulting the URL; environment variable/profile not set in the deployment.","solutions":["Supply a valid server URL (e.g. http://host:port/pentaho) when constructing RepositoryClient","Read the URL via getMandatoryProperty from ConfigReader so a missing value fails earlier with a clear key name","Validate/normalize the URL (non-null, correct scheme) before constructing the client"],"exampleFix":"// before\nRepositoryClient client = new RepositoryClient( cfg, config.getUrl(), auth ); // url null\n// after\nString url = reader.getMandatoryProperty( \"repovfs.ws.url\" );\nObjects.requireNonNull( url );\nRepositoryClient client = new RepositoryClient( cfg, url, auth );","handlingStrategy":"validation","validationCode":"// Guard before construction\nString url = reader.getMandatoryProperty( \"repovfs.ws.url\" );\nif ( url == null || url.trim().isEmpty() || !( url.startsWith( \"http://\" ) || url.startsWith( \"https://\" ) ) ) {\n  throw new IllegalArgumentException( \"repovfs.ws.url must be a non-empty http(s) URL\" );\n}","typeGuard":"boolean isValidUrl( String u ) {\n  return u != null && !u.trim().isEmpty() && u.startsWith( \"http\" );\n}","tryCatchPattern":"try {\n  RepositoryClient c = new RepositoryClient( cfg, url, auth );\n} catch ( IllegalArgumentException e ) {\n  log.error( \"Server URL not configured: {}\", e.getMessage() );\n}","preventionTips":["Load the URL via getMandatoryProperty so absence fails with a key name","Validate scheme and non-emptiness before constructing the client","Keep the URL in a single config location, not scattered literals"],"tags":["illegal-argument","null","url","configuration"],"backgroundTag":"null-argument","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"}