Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Problem with environment variables

Hi

I wanted to let you know that there is a problem with the environment variables that is very unlikely to happen, but when it does happen is very hard to debug.

If you run following code in a cdt managed project you will no longer be able to build the project


IEnvironmentVariable var = new EnvironmentVariable("this will bite you", null);
    contribEnv.addVariable(var, confdesc);

the problem is that EnvVarMacro.loadValue (which is being called to extend macro's) assumes that the value is not null.

He passes it to isTextList(value,delimiter) who calls Pattern.matches(patternStr, str); (str is the value)

Which throws an exception which is caught way up in the call stack in CommonBuilder (line 1224 at my pc) which returns a very generic error.


off-course there is very little reason for putting a null in a environment variable. In my case I pass a string that was null when there is a network inconsistency. I changed it to an empty string and all works fine again.

Note that I did not see anything special about the null value in the gui (it looks like an empty string)

I have not found any documentation about: "EnvironmentVariable supporting null values or not".

IMHO adding a null test in EnvVarMacro.loadValue is the most pragmatic solution.


Thanks for the good work.

Jantje



Back to the top