Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6481955

Uncanonicalized absolute filepath with length 248-260 no longer works (win)

XMLWordPrintable

    • b01
    • generic
    • generic

        Between 1.5.0_05 and 1.5.0_06 a length limit on 248 characters
        was introduced on relative paths which can cause severe grievances
        for people upgrading. Before the "fix" files of length 260 could be used.

        import java.io.*;

        public class TestPathLength {
        private static String longFilename = "C:\\tmp\\.\\";
        private static String padding = "1234567890123456789012345678901234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890";

        public static void main(String[] args) {
        for (int i = 230; i < 260; i++) {
        String tmpName = longFilename + padding.substring(0, i) + ".txt";
        try {
        FileWriter fw = new FileWriter(tmpName);
        fw.close();
        } catch (Exception e) {
        System.out.println("Failed at length: " + tmpName.length());
        break;
        }
        }
        }
        }

              sherman Xueming Shen
              sherman Xueming Shen
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: