src/solaris/classes/sun/nio/fs/UnixPath.java

Print this page

        

*** 66,76 **** this.path = path; } UnixPath(UnixFileSystem fs, String input) { // removes redundant slashes and checks for invalid characters ! this(fs, encode(normalizeAndCheck(input))); } // package-private // removes redundant slashes and check input for invalid characters static String normalizeAndCheck(String input) { --- 66,76 ---- this.path = path; } UnixPath(UnixFileSystem fs, String input) { // removes redundant slashes and checks for invalid characters ! this(fs, encode(fs, normalizeAndCheck(input))); } // package-private // removes redundant slashes and check input for invalid characters static String normalizeAndCheck(String input) {
*** 114,134 **** } return sb.toString(); } // encodes the given path-string into a sequence of bytes ! private static byte[] encode(String input) { SoftReference<CharsetEncoder> ref = encoder.get(); CharsetEncoder ce = (ref != null) ? ref.get() : null; if (ce == null) { ce = Charset.defaultCharset().newEncoder() .onMalformedInput(CodingErrorAction.REPORT) .onUnmappableCharacter(CodingErrorAction.REPORT); encoder.set(new SoftReference<CharsetEncoder>(ce)); } ! char[] ca = input.toCharArray(); // size output buffer for worse-case size byte[] ba = new byte[(int)(ca.length * (double)ce.maxBytesPerChar())]; // encode --- 114,134 ---- } return sb.toString(); } // encodes the given path-string into a sequence of bytes ! private static byte[] encode(UnixFileSystem fs, String input) { SoftReference<CharsetEncoder> ref = encoder.get(); CharsetEncoder ce = (ref != null) ? ref.get() : null; if (ce == null) { ce = Charset.defaultCharset().newEncoder() .onMalformedInput(CodingErrorAction.REPORT) .onUnmappableCharacter(CodingErrorAction.REPORT); encoder.set(new SoftReference<CharsetEncoder>(ce)); } ! char[] ca = fs.normalizeNativePath(input.toCharArray()); // size output buffer for worse-case size byte[] ba = new byte[(int)(ca.length * (double)ce.maxBytesPerChar())]; // encode
*** 755,766 **** } @Override public String toString() { // OK if two or more threads create a String ! if (stringValue == null) ! stringValue = new String(path); // platform encoding return stringValue; } // -- file operations -- --- 755,767 ---- } @Override public String toString() { // OK if two or more threads create a String ! if (stringValue == null) { ! stringValue = fs.normalizeJavaPath(new String(path)); // platform encoding ! } return stringValue; } // -- file operations --