private byte [ ] normalize ( byte [ ] path ) { if ( path . length == 0 ) return path ; byte prevC = 0 ; for ( int i = 0 ; i < path . length ; i ++ ) { byte c = path [ i ] ; if ( c == ' ' ) return normalize ( path , i ) ; if ( c == ( byte ) ' ' && prevC == ' ' ) return normalize ( path , i - 1 ) ; if ( c == ' ' ) throw new InvalidPathException ( this . hdfs . getString ( path ) , "Path: nul character not allowed" ) ; prevC = c ; } return path ; }
and check for invalid characters