You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Adam R. B. Jack" <aj...@trysybase.com> on 2004/05/03 22:12:15 UTC

[VFS] Crashing when trying to set username

When I run some VFS-using code (a few months old) using this code:

public static FileSystemManager createFSM(String name, String base)
throws FileSystemException {
    DefaultFileSystemManager fsm = new StandardFileSystemManager();
    fsm.init();
    // Set Base Directory for Resolving Relative To...
    fsm.setBaseFile(new java.io.File(base));
    return fsm;
}

it crashes in this code (saying you can't pass a null username) at this
point:

/**
* Returns the client for this file system.
*/
protected HttpClient getClient()
throws FileSystemException
{
    if (client == null)
    {
    // Create an Http client
    final GenericFileName rootName = (GenericFileName) getRootName();
    client = new HttpClient(new MultiThreadedHttpConnectionManager());
    final HostConfiguration config = new HostConfiguration();
    config.setHost(rootName.getHostName(), rootName.getPort());
    client.setHostConfiguration(config);
    final UsernamePasswordCredentials creds =
    new UsernamePasswordCredentials(rootName.getUserName(),
rootName.getPassword    ());
    client.getState().setCredentials(null, rootName.getHostName(), creds);
    }
    return client;
}

Any pointers on how I get past this? It would seem that somehow I need to
set a username on that rootName, but I'm not sure how.

Thanks in advance,

regards,

Adam
--
Experience the Unwired Enterprise:
http://www.sybase.com/unwiredenterprise
Try Sybase: http://www.try.sybase.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org