Streams streams = executor.executeCommand( "ls -FlA \"" + path + "\"", false );
List<String> ret = new LSParser().parseFiles( streams.getOut() );
if ( ret == null || ret.isEmpty() )
{
throw new ResourceDoesNotExistException( "No such file or directory" );
}
return ret;
}
catch ( CommandExecutionException e )
{
if ( e.getMessage().trim().endsWith( "No such file or directory" ) )
{
throw new ResourceDoesNotExistException( e.getMessage().trim(), e );
}
else if ( e.getMessage().trim().endsWith( "Not a directory" ) )
{
throw new ResourceDoesNotExistException( e.getMessage().trim(), e );
}
else
{
throw new TransferFailedException( "Error performing file listing.", e );
}