[jcifs] IntegraTUM WebDisk available

Michael B Allen mba2000 at ioplex.com
Fri Aug 12 06:08:16 GMT 2005


On Fri, 12 Aug 2005 07:54:00 +0200
Thomas Bley <thomas.bley at simple-groupware.de> wrote:

> Hi,
> 
> I'm using this code with a NetApp Filer:
> 
<snip>
>          System.out.println(file.getDiskFreeSpace());
> 
<snip>
> I get:
> 
> Exception in thread "main" jcifs.smb.SmbException: A device attached to
> the system is not functioning.
>          at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:453)
>          at jcifs.smb.SmbTransport.send(SmbTransport.java:530)
>          at jcifs.smb.SmbSession.send(SmbSession.java:226)
>          at jcifs.smb.SmbTree.send(SmbTree.java:95)
>          at jcifs.smb.SmbFile.send(SmbFile.java:688)
>          at jcifs.smb.SmbFile.queryFSInformation(SmbFile.java:2170)
>          at jcifs.smb.SmbFile.getDiskFreeSpace(SmbFile.java:2153)


a.k.a NT_STATUS_UNSUCCESSFUL

So instead of NT_STATUS_INVALID_INFO_CLASS NetApp Filer can return the
generic error NT_STATUS_UNSUCCESSFUL.

Well then the fix is the following:

    public long getDiskFreeSpace() throws SmbException {
        if( getType() == TYPE_SHARE || type == TYPE_FILESYSTEM ) {
            int level = Trans2QueryFSInformationResponse.SMB_FS_FULL_SIZE_INFORMATION;
            try {
                return queryFSInformation(level);
            } catch( SmbException ex ) {
				switch (ex.getNtStatus()) {
					case NtStatus.NT_STATUS_INVALID_INFO_CLASS:
					case NtStatus.NT_STATUS_UNSUCCESSFUL: // NetApp Filer
                    	// SMB_FS_FULL_SIZE_INFORMATION not supported by the server. 
                    	level = Trans2QueryFSInformationResponse.SMB_INFO_ALLOCATION;
                    	return queryFSInformation(level);
                }
                throw ex;
            }
        }
        return 0L;
    }

This has been added to The List.

Thanks,
Mike


More information about the jcifs mailing list