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 208779
Collapse All | Expand All

(-)a/openide.loaders/src/org/openide/loaders/DataShadow.java (+26 lines)
Lines 393-401 Link Here
393
    /**
393
    /**
394
     * Tries to load the original file from a shadow.
394
     * Tries to load the original file from a shadow.
395
     * Looks for file contents as well as the originalFile/originalFileSystem attributes.
395
     * Looks for file contents as well as the originalFile/originalFileSystem attributes.
396
     * Attempts to discover locations for migrated files in configuration.
397
     * 
396
     * @param fileObject a data shadow
398
     * @param fileObject a data shadow
397
     * @return the original <code>DataObject</code> referenced by the shadow
399
     * @return the original <code>DataObject</code> referenced by the shadow
398
     * @throws IOException error during load or broken link
400
     * @throws IOException error during load or broken link
401
     * 
402
     * @see Utilities#translate
399
     */
403
     */
400
    protected static DataObject deserialize(FileObject fileObject) throws IOException {
404
    protected static DataObject deserialize(FileObject fileObject) throws IOException {
401
        String[] fileAndFileSystem = readOriginalFileAndFileSystem(fileObject);
405
        String[] fileAndFileSystem = readOriginalFileAndFileSystem(fileObject);
Lines 411-416 Link Here
411
        String fsname = fileAndFileSystem[1];
415
        String fsname = fileAndFileSystem[1];
412
        if (u != null && u.isAbsolute()) {
416
        if (u != null && u.isAbsolute()) {
413
            target = URLMapper.findFileObject(u.toURL());
417
            target = URLMapper.findFileObject(u.toURL());
418
            if (target == null) {
419
                FileObject cfgRoot = FileUtil.getConfigRoot();
420
                String prefix = cfgRoot.toURI().toString();
421
                String urlText = u.toString();
422
                // try to recover a broken shadow by translation, but only for 
423
                // configuration
424
                if (urlText.startsWith(prefix)) {
425
                    String cfgPart = urlText.substring(prefix.length());
426
                    String translated = Utilities.translate(cfgPart);
427
                    // intentional - the parameter is returned unchanged if no translation is found
428
                    if (translated != cfgPart) {
429
                        try {
430
                            u = new URI(prefix + translated);
431
                        } catch (URISyntaxException ex) {
432
                            u = null;
433
                        }
434
                        if (u != null) {
435
                            target = URLMapper.findFileObject(u.toURL());
436
                        }
437
                    }
438
                }
439
            }
414
        } else {
440
        } else {
415
            FileSystem fs;
441
            FileSystem fs;
416
            if (SFS_NAME.equals(fsname)) {
442
            if (SFS_NAME.equals(fsname)) {
(-)a/openide.util/src/org/openide/util/Utilities.java (-1 / +10 lines)
Lines 2468-2474 Link Here
2468
    }
2468
    }
2469
2469
2470
    /** Provides support for parts of the system that deal with classnames
2470
    /** Provides support for parts of the system that deal with classnames
2471
     * (use <code>Class.forName</code>, <code>NbObjectInputStream</code>, etc.).
2471
     * (use <code>Class.forName</code>, <code>NbObjectInputStream</code>, etc.) or filenames
2472
     * in layers.
2472
     * <P>
2473
     * <P>
2473
     * Often class names (especially package names) changes during lifecycle
2474
     * Often class names (especially package names) changes during lifecycle
2474
     * of a module. When some piece of the system stores the name of a class
2475
     * of a module. When some piece of the system stores the name of a class
Lines 2513-2518 Link Here
2513
     * className is not listed as one that is to be renamed, the returned
2514
     * className is not listed as one that is to be renamed, the returned
2514
     * string == className, if the className is registered to be renamed
2515
     * string == className, if the className is registered to be renamed
2515
     * than the className != returned value, even in a case when className.equals (retValue)
2516
     * than the className != returned value, even in a case when className.equals (retValue)
2517
     * <p/>
2518
     * Similar behaviour applies to <b>filenames</b> provided by layers (system filesystem). Filenames
2519
     * can be also translated to adapt to location changes e.g. in action registrations.
2520
     *
2521
     * <pre>
2522
     * # registration ID has changed
2523
     * Actions/Refactoring/RefactoringWhereUsed.instance=Actions/Refactoring/org-netbeans-modules-refactoring-api-ui-WhereUsedAction
2524
     * </pre>
2516
     *
2525
     *
2517
     * @param className fully qualified name of a class to translate
2526
     * @param className fully qualified name of a class to translate
2518
     * @return new name of the class according to renaming rules.
2527
     * @return new name of the class according to renaming rules.

Return to bug 208779