protected void checkPath ( Path path ) { URI uri = path . toUri ( ) ; if ( uri . getScheme ( ) == null ) // fs is relative return ; String thisScheme = this . getUri ( ) . getScheme ( ) ; String thatScheme = uri . getScheme ( ) ; String thisAuthority = this . getUri ( ) . getAuthority ( ) ; String thatAuthority = uri . getAuthority ( ) ; //authority and scheme are not case sensitive if ( thisScheme . equalsIgnoreCase ( thatScheme ) ) { // schemes match if ( thisAuthority == thatAuthority || // & authorities match ( thisAuthority != null && thisAuthority . equalsIgnoreCase ( thatAuthority ) ) ) return ; if ( thatAuthority == null && // path's authority is null thisAuthority != null ) { // fs has an authority URI defaultUri = getDefaultUri ( getConf ( ) ) ; // & is the conf default if ( thisScheme . equalsIgnoreCase ( defaultUri . getScheme ( ) ) && thisAuthority . equalsIgnoreCase ( defaultUri . getAuthority ( ) ) ) return ; try { // or the default fs's uri defaultUri = get ( getConf ( ) ) . getUri ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } if ( thisScheme . equalsIgnoreCase ( defaultUri . getScheme ( ) ) && thisAuthority . equalsIgnoreCase ( defaultUri . getAuthority ( ) ) ) return ; } } throw new IllegalArgumentException ( "Wrong FS: " + path + ", expected: " + this . getUri ( ) ) ; }
Check that a Path belongs to this FileSystem .