1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fix for [Bug 197654] NoSuchElementException during "CDT Startup"

This commit is contained in:
Mikhail Sennikovsky 2007-07-26 10:22:40 +00:00
parent 8f87510587
commit 333c7057fb
2 changed files with 19 additions and 18 deletions

View file

@ -47,7 +47,7 @@ public class EnvironmentVariableManager implements
private static EnvironmentVariableManager fInstance = null; private static EnvironmentVariableManager fInstance = null;
private EnvVarVariableSubstitutor fVariableSubstitutor; // private EnvVarVariableSubstitutor fVariableSubstitutor;
public static final UserDefinedEnvironmentSupplier fUserSupplier = new UserDefinedEnvironmentSupplier(); public static final UserDefinedEnvironmentSupplier fUserSupplier = new UserDefinedEnvironmentSupplier();
public static final BuildSustemEnvironmentSupplier fExternalSupplier = new BuildSustemEnvironmentSupplier(); public static final BuildSustemEnvironmentSupplier fExternalSupplier = new BuildSustemEnvironmentSupplier();
@ -404,18 +404,19 @@ public class EnvironmentVariableManager implements
} }
public IVariableSubstitutor getVariableSubstitutor(IVariableContextInfo info, String inexistentMacroValue, String listDelimiter){ public IVariableSubstitutor getVariableSubstitutor(IVariableContextInfo info, String inexistentMacroValue, String listDelimiter){
if(fVariableSubstitutor == null) return new EnvVarVariableSubstitutor(info,inexistentMacroValue,listDelimiter);
fVariableSubstitutor = new EnvVarVariableSubstitutor(info,inexistentMacroValue,listDelimiter); // if(fVariableSubstitutor == null)
else { // fVariableSubstitutor = new EnvVarVariableSubstitutor(info,inexistentMacroValue,listDelimiter);
try { // else {
fVariableSubstitutor.setMacroContextInfo(info); // try {
fVariableSubstitutor.setInexistentMacroValue(inexistentMacroValue); // fVariableSubstitutor.setMacroContextInfo(info);
fVariableSubstitutor.setListDelimiter(listDelimiter); // fVariableSubstitutor.setInexistentMacroValue(inexistentMacroValue);
} catch (CdtVariableException e){ // fVariableSubstitutor.setListDelimiter(listDelimiter);
fVariableSubstitutor = new EnvVarVariableSubstitutor(info,inexistentMacroValue,listDelimiter); // } catch (CdtVariableException e){
} // fVariableSubstitutor = new EnvVarVariableSubstitutor(info,inexistentMacroValue,listDelimiter);
} // }
return fVariableSubstitutor; // }
// return fVariableSubstitutor;
} }
public IContributedEnvironment getContributedEnvironment() { public IContributedEnvironment getContributedEnvironment() {

View file

@ -377,9 +377,9 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
String name = des.fName; String name = des.fName;
ResolvedMacro value = (ResolvedMacro)fResolvedMacros.get(name); ResolvedMacro value = (ResolvedMacro)fResolvedMacros.get(name);
if(value == null){ if(value == null){
if(fMacrosUnderResolution.add(name)) if(fMacrosUnderResolution.add(name)) {
fMacroDescriptors.push(des); fMacroDescriptors.push(des);
else { } else {
// the macro of the specified name is referenced from the other macros that // the macro of the specified name is referenced from the other macros that
// are referenced by the given macro // are referenced by the given macro
// e.g. ${macro1}="...${macro2}...", ${macro2}="...${macro1}..." // e.g. ${macro1}="...${macro2}...", ${macro2}="...${macro1}..."
@ -392,13 +392,13 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
// In the above example the ${macro1} reference will be expanded to the value of the ${macro1} macro of the // In the above example the ${macro1} reference will be expanded to the value of the ${macro1} macro of the
// parent context or to an empty string if there is no such macro defined in the parent contexts // parent context or to an empty string if there is no such macro defined in the parent contexts
MacroDescriptor last = (MacroDescriptor)fMacroDescriptors.lastElement(); MacroDescriptor last = (MacroDescriptor)fMacroDescriptors.lastElement();
if(last != null && last.fName.equals(name)){ if(last != null && last.fName.equals(name)) {
value = resolveParentMacro(last); value = resolveParentMacro(last);
if(value == null) if(value == null)
value = new ResolvedMacro(name,EMPTY_STRING,false); value = new ResolvedMacro(name,EMPTY_STRING,false);
}else if(fIncorrectlyReferencedMacroValue != null) } else if(fIncorrectlyReferencedMacroValue != null) {
value = new ResolvedMacro(name,fIncorrectlyReferencedMacroValue,false); value = new ResolvedMacro(name,fIncorrectlyReferencedMacroValue,false);
else{ } else{
ICdtVariableStatus status = new SupplierBasedCdtVariableStatus(ICdtVariableStatus.TYPE_MACRO_REFERENCE_INCORRECT, ICdtVariableStatus status = new SupplierBasedCdtVariableStatus(ICdtVariableStatus.TYPE_MACRO_REFERENCE_INCORRECT,
(String)null, (String)null,
null, null,