This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 242594
Collapse All | Expand All

(-)a/openide.filesystems/src/org/openide/filesystems/FileObject.java (-1 / +41 lines)
Lines 294-299 Link Here
294
    * @param sepChar separator character
294
    * @param sepChar separator character
295
    */
295
    */
296
    private void constructName(StringBuilder[] arr, char sepChar, int lengthSoFar) {
296
    private void constructName(StringBuilder[] arr, char sepChar, int lengthSoFar) {
297
        constructName(arr, sepChar, lengthSoFar, false, this);
298
    }
299
300
    /**
301
     * Constructs path of file.
302
     *
303
     * @param arr to place the string buffer
304
     * @param sepChar separator character
305
     * @param skipLongPathWarning True if the check for indirect loops in the
306
     * chain of parents has been performed. See bug 242594.
307
     * @param base The top object for which constructName was originally called.
308
     */
309
    private void constructName(StringBuilder[] arr, char sepChar,
310
            int lengthSoFar,
311
            boolean skipLongPathWarning, FileObject base) {
297
        String myName = getNameExt();
312
        String myName = getNameExt();
298
        int myLen = lengthSoFar + myName.length();
313
        int myLen = lengthSoFar + myName.length();
299
314
Lines 310-316 Link Here
310
        }
325
        }
311
326
312
        if ((parent != null) && !parent.isRoot()) {
327
        if ((parent != null) && !parent.isRoot()) {
313
            parent.constructName(arr, sepChar, myLen + 1);
328
            if (myLen > 1000 && !skipLongPathWarning) {
329
                informAboutLongPath(base);
330
                parent.constructName(arr, sepChar, myLen + 1, true, base);
331
            } else {
332
                parent.constructName(arr, sepChar, myLen + 1,
333
                        skipLongPathWarning, base);
334
            }
314
            arr[0].append(sepChar);
335
            arr[0].append(sepChar);
315
        } else {
336
        } else {
316
            assert arr[0] == null;
337
            assert arr[0] == null;
Lines 319-324 Link Here
319
        arr[0].append(getNameExt());
340
        arr[0].append(getNameExt());
320
    }
341
    }
321
342
343
    private void informAboutLongPath(FileObject base) {
344
345
        Object fs;
346
        try {
347
            fs = base.getFileSystem();
348
        } catch (FileStateInvalidException ex) {
349
            fs = "unknown"; // NOI18N
350
        }
351
        StringBuilder partialPath = new StringBuilder(base.getNameExt());
352
        for (FileObject p = base.getParent();
353
                p != this; p = p.getParent()) {
354
            partialPath.insert(0, "/"); //NOI18N
355
            partialPath.insert(0, p.getNameExt());
356
        }
357
        ExternalUtil.LOG.log(Level.INFO, "Constructing a long path: " //NOI18N
358
                + "{0} type: {1} fs: {2}", //NOI18N
359
                new Object[]{partialPath, base.getClass(), fs});
360
    }
361
322
    /** Get the filesystem containing this file.
362
    /** Get the filesystem containing this file.
323
    * <p>
363
    * <p>
324
    * Note that it may be possible for a stale file object to exist which refers to a now-defunct filesystem.
364
    * Note that it may be possible for a stale file object to exist which refers to a now-defunct filesystem.

Return to bug 242594