You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oodt.apache.org by "Starch, Michael D (388L)" <Mi...@jpl.nasa.gov> on 2013/01/15 19:58:11 UTC

Environment Variables in OODT

Hi All,

Why does the OODT Commons code for reading environment variables run the command line utility "env" instead of calling System.getEnvironment()?

http://svn.apache.org/repos/asf/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java

We are running into transient problems in our version where environment variables are sometimes being set to null.  I am wondering if this is a problem with the added complexity of running env over and over again getting env variables, instead of using the built in java mechanisms for getting this info.

-Michael

Re: Environment Variables in OODT

Posted by "Mattmann, Chris A (388J)" <ch...@jpl.nasa.gov>.
Thanks Mike!

Cheers,
Chris

On 1/17/13 8:24 AM, "Starch, Michael D (388L)"
<Mi...@jpl.nasa.gov> wrote:

>Sounds good.   I tested the code and it does return environment variables
>as expected.  Looks like this is something I can improve for our next
>software delivery on PEATE (v9.0.1).  If so, a patch for apache should be
>easy.
>
>-Michael
>
>
>On Jan 15, 2013, at 11:05 PM, Mattmann, Chris A (388J) wrote:
>
>> +1, BFost :)
>> 
>> Mike?
>> 
>> Cheers,
>> Chris
>> 
>> On 1/15/13 10:24 PM, "Brian Foster" <ho...@me.com> wrote:
>> 
>>> 
>>> hey michael,
>>> 
>>> System.getenv() didn't exist in jdk 1.4 when the code was initially
>>> written and System.getenv(String) was deprecated in jdk 1.4... i
>>>believe
>>> it was rewritten and undeprecated in jdk 1.5 and System.getenv() was
>>> added... so ya it probably should be using System.getenv()... a patch
>>> with several unit-tests would be welcomed as far as i'm concerned...
>>> chris?
>>> 
>>> -brian
>>> 
>>> On Jan 15, 2013, at 10:58 AM, Starch, Michael D (388L) wrote:
>>> 
>>>> Hi All,
>>>> 
>>>> Why does the OODT Commons code for reading environment variables run
>>>> the command line utility "env" instead of calling
>>>> System.getEnvironment()?
>>>> 
>>>> 
>>>> 
>>>>http://svn.apache.org/repos/asf/oodt/trunk/commons/src/main/java/org/ap
>>>>ac
>>>> he/oodt/commons/exec/EnvUtilities.java
>>>> 
>>>> We are running into transient problems in our version where
>>>>environment
>>>> variables are sometimes being set to null.  I am wondering if this is
>>>>a
>>>> problem with the added complexity of running env over and over again
>>>> getting env variables, instead of using the built in java mechanisms
>>>>for
>>>> getting this info.
>>>> 
>>>> -Michael
>>> 
>> 
>


Re: Environment Variables in OODT

Posted by "Starch, Michael D (388L)" <Mi...@jpl.nasa.gov>.
Sounds good.   I tested the code and it does return environment variables as expected.  Looks like this is something I can improve for our next software delivery on PEATE (v9.0.1).  If so, a patch for apache should be easy.

-Michael


On Jan 15, 2013, at 11:05 PM, Mattmann, Chris A (388J) wrote:

> +1, BFost :)
> 
> Mike?
> 
> Cheers,
> Chris
> 
> On 1/15/13 10:24 PM, "Brian Foster" <ho...@me.com> wrote:
> 
>> 
>> hey michael,
>> 
>> System.getenv() didn't exist in jdk 1.4 when the code was initially
>> written and System.getenv(String) was deprecated in jdk 1.4... i believe
>> it was rewritten and undeprecated in jdk 1.5 and System.getenv() was
>> added... so ya it probably should be using System.getenv()... a patch
>> with several unit-tests would be welcomed as far as i'm concerned...
>> chris?
>> 
>> -brian
>> 
>> On Jan 15, 2013, at 10:58 AM, Starch, Michael D (388L) wrote:
>> 
>>> Hi All,
>>> 
>>> Why does the OODT Commons code for reading environment variables run
>>> the command line utility "env" instead of calling
>>> System.getEnvironment()?
>>> 
>>> 
>>> http://svn.apache.org/repos/asf/oodt/trunk/commons/src/main/java/org/apac
>>> he/oodt/commons/exec/EnvUtilities.java
>>> 
>>> We are running into transient problems in our version where environment
>>> variables are sometimes being set to null.  I am wondering if this is a
>>> problem with the added complexity of running env over and over again
>>> getting env variables, instead of using the built in java mechanisms for
>>> getting this info.
>>> 
>>> -Michael
>> 
> 


Re: Environment Variables in OODT

Posted by "Mattmann, Chris A (388J)" <ch...@jpl.nasa.gov>.
+1, BFost :)

Mike?

Cheers,
Chris

On 1/15/13 10:24 PM, "Brian Foster" <ho...@me.com> wrote:

>
>hey michael,
>
>System.getenv() didn't exist in jdk 1.4 when the code was initially
>written and System.getenv(String) was deprecated in jdk 1.4... i believe
>it was rewritten and undeprecated in jdk 1.5 and System.getenv() was
>added... so ya it probably should be using System.getenv()... a patch
>with several unit-tests would be welcomed as far as i'm concerned...
>chris?
>
>-brian
>
>On Jan 15, 2013, at 10:58 AM, Starch, Michael D (388L) wrote:
>
>> Hi All,
>> 
>> Why does the OODT Commons code for reading environment variables run
>>the command line utility "env" instead of calling
>>System.getEnvironment()?
>> 
>> 
>>http://svn.apache.org/repos/asf/oodt/trunk/commons/src/main/java/org/apac
>>he/oodt/commons/exec/EnvUtilities.java
>> 
>> We are running into transient problems in our version where environment
>>variables are sometimes being set to null.  I am wondering if this is a
>>problem with the added complexity of running env over and over again
>>getting env variables, instead of using the built in java mechanisms for
>>getting this info.
>> 
>> -Michael
>


Re: Environment Variables in OODT

Posted by Brian Foster <ho...@me.com>.
hey michael,

System.getenv() didn't exist in jdk 1.4 when the code was initially written and System.getenv(String) was deprecated in jdk 1.4... i believe it was rewritten and undeprecated in jdk 1.5 and System.getenv() was added... so ya it probably should be using System.getenv()... a patch with several unit-tests would be welcomed as far as i'm concerned... chris?

-brian

On Jan 15, 2013, at 10:58 AM, Starch, Michael D (388L) wrote:

> Hi All,
> 
> Why does the OODT Commons code for reading environment variables run the command line utility "env" instead of calling System.getEnvironment()?
> 
> http://svn.apache.org/repos/asf/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java
> 
> We are running into transient problems in our version where environment variables are sometimes being set to null.  I am wondering if this is a problem with the added complexity of running env over and over again getting env variables, instead of using the built in java mechanisms for getting this info.
> 
> -Michael


Re: Environment Variables in OODT

Posted by "Mattmann, Chris A (388J)" <ch...@jpl.nasa.gov>.
Hi Mike,

Basically this is a legacy decision as when the system was written we were
in the midst of JDK4, which didn't have Environment variable support.
Nowadays, we could probably update this. Would you like to file a JIRA
issue and provide a patch?

Cheers,
Chris

On 1/15/13 10:58 AM, "Starch, Michael D (388L)"
<Mi...@jpl.nasa.gov> wrote:

>Hi All,
>
>Why does the OODT Commons code for reading environment variables run the
>command line utility "env" instead of calling System.getEnvironment()?
>
>http://svn.apache.org/repos/asf/oodt/trunk/commons/src/main/java/org/apach
>e/oodt/commons/exec/EnvUtilities.java
>
>We are running into transient problems in our version where environment
>variables are sometimes being set to null.  I am wondering if this is a
>problem with the added complexity of running env over and over again
>getting env variables, instead of using the built in java mechanisms for
>getting this info.
>
>-Michael