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

(-)a/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstance.java (-1 / +1 lines)
Lines 657-663 Link Here
657
657
658
            for (int i = 0; i < instanceFOs.length; i++) {
658
            for (int i = 0; i < instanceFOs.length; i++) {
659
                if (url.equals(instanceFOs[i].getAttribute(GlassfishModule.URL_ATTR))
659
                if (url.equals(instanceFOs[i].getAttribute(GlassfishModule.URL_ATTR))
660
                        && !GlassfishInstanceProvider.GLASSFISH_AUTOREGISTERED_INSTANCE.equals(instanceFOs[i].getName())) {
660
                        && !instanceFOs[i].getName().startsWith(GlassfishInstanceProvider.GLASSFISH_AUTOREGISTERED_INSTANCE)) {
661
                    instanceFO = instanceFOs[i];
661
                    instanceFO = instanceFOs[i];
662
                }
662
                }
663
            }
663
            }
(-)a/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java (-12 / +10 lines)
Lines 438-445 Link Here
438
    // Persistence for server instances.
438
    // Persistence for server instances.
439
    // ------------------------------------------------------------------------
439
    // ------------------------------------------------------------------------
440
    private void loadServerInstances() {
440
    private void loadServerInstances() {
441
        FileObject installedInstance = null;
441
        List<FileObject> installedInstances = new LinkedList<>();
442
        int savedj = -1;
443
        for (int j = 0; j < instancesDirNames.length; j++) {
442
        for (int j = 0; j < instancesDirNames.length; j++) {
444
            FileObject dir
443
            FileObject dir
445
                    = ServerUtils.getRepositoryDir(instancesDirNames[j], false);
444
                    = ServerUtils.getRepositoryDir(instancesDirNames[j], false);
Lines 448-457 Link Here
448
                if (instanceFOs != null && instanceFOs.length > 0) {
447
                if (instanceFOs != null && instanceFOs.length > 0) {
449
                    for (int i = 0; i < instanceFOs.length; i++) {
448
                    for (int i = 0; i < instanceFOs.length; i++) {
450
                        try {
449
                        try {
451
                            if (GLASSFISH_AUTOREGISTERED_INSTANCE
450
                            if (instanceFOs[i].getName().startsWith(GLASSFISH_AUTOREGISTERED_INSTANCE)) {
452
                                    .equals(instanceFOs[i].getName())) {
451
                                installedInstances.add(instanceFOs[i]);
453
                                installedInstance = instanceFOs[i];
454
                                savedj = j;
455
                                continue;
452
                                continue;
456
                            }
453
                            }
457
                            GlassfishInstance si = GlassfishInstance
454
                            GlassfishInstance si = GlassfishInstance
Lines 470-481 Link Here
470
                }
467
                }
471
            }
468
            }
472
        }
469
        }
473
        if (null != installedInstance
470
        if (!installedInstances.isEmpty()
474
                && null == NbPreferences.forModule(this.getClass())
471
                && null == NbPreferences.forModule(this.getClass())
475
                .get(AUTOINSTANCECOPIED, null)) {
472
                .get(AUTOINSTANCECOPIED, null)) {
476
            try {
473
            try {
477
                GlassfishInstance igi = GlassfishInstance.
474
                for (FileObject installedInstance : installedInstances) {
478
                        readInstanceFromFile(installedInstance, true);
475
                    GlassfishInstance igi = GlassfishInstance.
476
                            readInstanceFromFile(installedInstance, true);
477
                    activeDisplayNames.add(igi.getDisplayName());
478
                }
479
                try {
479
                try {
480
                    NbPreferences.forModule(this.getClass())
480
                    NbPreferences.forModule(this.getClass())
481
                            .put(AUTOINSTANCECOPIED, "true"); // NOI18N
481
                            .put(AUTOINSTANCECOPIED, "true"); // NOI18N
Lines 484-490 Link Here
484
                    LOGGER.log(Level.INFO,
484
                    LOGGER.log(Level.INFO,
485
                            "auto-registered instance may reappear", ex); // NOI18N
485
                            "auto-registered instance may reappear", ex); // NOI18N
486
                }
486
                }
487
                activeDisplayNames.add(igi.getDisplayName());
488
            } catch (IOException ex) {
487
            } catch (IOException ex) {
489
                LOGGER.log(Level.INFO, null, ex);
488
                LOGGER.log(Level.INFO, null, ex);
490
            }
489
            }
Lines 512-519 Link Here
512
                    String val = ServerUtils.getStringAttribute(
511
                    String val = ServerUtils.getStringAttribute(
513
                            installedServers[i], GlassfishModule.URL_ATTR);
512
                            installedServers[i], GlassfishModule.URL_ATTR);
514
                    if(val != null && val.equals(url) &&
513
                    if(val != null && val.equals(url) &&
515
                            !GLASSFISH_AUTOREGISTERED_INSTANCE
514
                            !installedServers[i].getName().startsWith(GLASSFISH_AUTOREGISTERED_INSTANCE)) {
516
                            .equals(installedServers[i].getName())) {
517
                        return installedServers[i];
515
                        return installedServers[i];
518
                    }
516
                    }
519
                }
517
                }

Return to bug 246435