# HG changeset patch # User timkelly # Date 1280172358 18000 # Node ID 659fdb7ee7012ed16a91c4751e2638f8447c674b # Parent 2ee63cbf206afc322ab11722fe783242afbe1ba6 simplify building of filtered alias lists from sbsv2 filtering prefs. Fix NPE when creating a build config that has errors and not platform or target. diff -r 2ee63cbf206a -r 659fdb7ee701 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Mon Jul 26 12:02:37 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Mon Jul 26 14:25:58 2010 -0500 @@ -40,8 +40,17 @@ public BuildContextSBSv2(ISymbianSDK sdk, String platform, String target, String alias, String displayString, String configID) { this.sdk = sdk; - this.platform = platform.toUpperCase(); - this.target = target.toUpperCase(); + if (platform == null){ + this.platform = "unknown_platform"; + } else { + this.platform = platform.toUpperCase(); + } + + if (target == null){ + this.target = "unknown_target"; + } else { + this.target = target.toUpperCase(); + } this.sbsv2Alias = alias; this.displayString = displayString; this.configID = configID; diff -r 2ee63cbf206a -r 659fdb7ee701 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Mon Jul 26 12:02:37 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Mon Jul 26 14:25:58 2010 -0500 @@ -99,92 +99,16 @@ } } List allowedConfigs = SBSv2Utils.getSBSv2FilteredConfigPreferences(); // From global prefs - if ((sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) - && SBSv2Utils.enableSBSv2Support()){ + if (SBSv2Utils.enableSBSv2Support()){ try { initSBSv2BuildContextList(allowedConfigs); } catch (SBSv2MinimumVersionException e) { // igore, would be caught above } - } else if (SBSv2Utils.enableSBSv2Support()){ - - try { - updateSBSv2BuildContextList(allowedConfigs); - } catch (SBSv2MinimumVersionException e) { - // igore, would be caught above - } - } - - - return sbsv2FilteredConetxts; - } - - private void updateSBSv2BuildContextList(List allowedConfigs) throws SBSv2MinimumVersionException { - - // Check and see if the filtered list has changed - boolean contextExists = false; - List newContextsToQuery = new ArrayList(); - for (String aliasName : allowedConfigs){ - for (ISymbianBuildContext context : sbsv2FilteredConetxts){ - ISBSv2BuildContext sbsv2Context = (ISBSv2BuildContext)context; - if (sbsv2Context.getSBSv2Alias().equals(aliasName)){ - contextExists = true; - continue; - } - } - if (!contextExists){ - newContextsToQuery.add(aliasName); - } - contextExists = false; - } + } - // Get the list of configs that have already been queried. If they have not been queried - // we'll save them off in a list to run an actual query. - // TODO: If a config has an error condition should we try to scan it again? - List processedAliasList = new ArrayList(); - for (String alias : newContextsToQuery) { - SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias); - if (configQueryData != null) { - ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); - sbsv2FilteredConetxts.add(sbsv2Context); - processedAliasList.add(alias); - } - } - - if (!processedAliasList.isEmpty()) { - newContextsToQuery.removeAll(processedAliasList); // No need to qeury anything - } - - // Query any contextst that don't have configQueryData and add them to the filtered list - // We do this separately b/c it can be a slow operation so we don't want to do it often - if (!newContextsToQuery.isEmpty()) { - String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, newContextsToQuery); - for (String alias : newContextsToQuery){ - if (!isValidConfigForSDK(alias)){ - continue; - } - - ISBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(alias, aliasToMeaningMap.get(alias), configQueryXML); - ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData); - sbsv2FilteredConetxts.add(sbsv2Context); - } - } - - // Now remove any contexts that don't fit - List contextListCopy = new ArrayList(sbsv2FilteredConetxts); - for (ISymbianBuildContext currentContext : contextListCopy){ - boolean match = false; - for (String allowedAlias : allowedConfigs){ - if (allowedAlias.equals(((ISBSv2BuildContext)currentContext).getSBSv2Alias())){ - match = true; - break; - } - } - if (!match) - sbsv2FilteredConetxts.remove(currentContext); - } - + return sbsv2FilteredConetxts; } private boolean isValidConfigForSDK(String alias) { @@ -235,6 +159,7 @@ } List processedAliasList = new ArrayList(); + sbsv2FilteredConetxts.clear(); for (String alias : filteredAliasList) { SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias); if (configQueryData != null) {