# HG changeset patch # User Andrew Krasny # Date 1268317520 -10800 # Node ID dcfa2ce62e34cdddf047b9900fdf4b1275d92765 # Parent 4192f567bb0a9597d66ac0633db8b5f1a5fa6e28 Bug 181862 - Wrong order of toolCollectors initialization diff -r 4192f567bb0a -r dcfa2ce62e34 dlight.management/src/org/netbeans/modules/dlight/management/api/DLightSession.java --- a/dlight.management/src/org/netbeans/modules/dlight/management/api/DLightSession.java Thu Jan 28 14:55:05 2010 +0100 +++ b/dlight.management/src/org/netbeans/modules/dlight/management/api/DLightSession.java Thu Mar 11 17:25:20 2010 +0300 @@ -406,7 +406,7 @@ } - private final void addDataFilterImpl(final DataFilter filter, final boolean isAdjusting) { + private void addDataFilterImpl(final DataFilter filter, final boolean isAdjusting) { if (filter instanceof TimeIntervalDataFilter) { dataFiltersSupport.cleanAll(TimeIntervalDataFilter.class, false); } @@ -482,7 +482,7 @@ for (DLightTool tool : context.getTools()) { validTools.add(tool); - toolNames.append(tool.getName() + ServiceInfoDataStorage.DELIMITER); + toolNames.append(tool.getName()).append(ServiceInfoDataStorage.DELIMITER); } if (validTools.isEmpty()) { @@ -546,7 +546,7 @@ for (IndicatorNotificationsListener l : indicatorNotificationListeners) { IndicatorDataProviderAccessor.getDefault().addIndicatorDataProviderListener(idp, l); } - idpsNames.append(idp.getName() + ServiceInfoDataStorage.DELIMITER); + idpsNames.append(idp.getName()).append(ServiceInfoDataStorage.DELIMITER); List> indicators = DLightToolAccessor.getDefault().getIndicators(tool); for (Indicator i : indicators) { @@ -559,7 +559,7 @@ } target.addTargetListener(idp); if (log.isLoggable(Level.FINE)) { - log.fine("I have subscribed indicator " + i + " to indicatorDataProvider " + idp); // NOI18N + log.log(Level.FINE, "I have subscribed indicator {0} to indicatorDataProvider {1}", new Object[]{i, idp}); // NOI18N } } if (i instanceof DataFilterListener) { @@ -590,7 +590,7 @@ if (collectors != null && collectors.size() > 0) { for (DataCollector toolCollector : collectors) { - collectorNames.append(toolCollector.getName() + ServiceInfoDataStorage.DELIMITER); + collectorNames.append(toolCollector.getName()).append(ServiceInfoDataStorage.DELIMITER); Map currentStorages = DataStorageManager.getInstance().getDataStoragesFor(this, toolCollector); if (toolCollector instanceof DLightTarget.ExecutionEnvVariablesProvider) { @@ -608,22 +608,25 @@ storages.add(storage); } } - toolCollector.init(currentStorages, target); - addDataFilterListener(toolCollector); - if (toolCollector instanceof IndicatorDataProvider) { IndicatorDataProvider idp = (IndicatorDataProvider) toolCollector; idp.init(serviceInfoDataStorage); } + // do tool initialization _AFTER_ IndicatorDataProvider init + // because tool may (DTraceDataCollector does) expect that + // serviceInfoDataStorage is available for them if they + // do implement IndicatorDataProvider interface + toolCollector.init(currentStorages, target); + addDataFilterListener(toolCollector); if (notAttachableDataCollector == null && !toolCollector.isAttachable()) { notAttachableDataCollector = toolCollector; } } else { // Cannot find storage for this collector! - log.severe("Cannot find storage for collector " + toolCollector); // NOI18N + log.log(Level.SEVERE, "Cannot find storage for collector {0}", toolCollector); // NOI18N } target.addTargetListener(toolCollector); @@ -696,7 +699,7 @@ Collection providerFactories = DataProvidersManager.getInstance().getDataProviderFactories(dataModelScheme); // If not found - just return null - if (providerFactories.size() == 0) { + if (providerFactories.isEmpty()) { return null; }