Saturday, August 28, 2010

Important task completed – lessons learnt II

Recently I've been involved in a change request that modified some data that is returned to a web service client.

There was a bug that occurred whenever the stub made a remote service call, there was a conflict in the security algorithms being used. Even after googling, I still couldn't figure out what the problem was.

After some futile investigation, my colleague advised me to print out the security providers as additional providers may have been loaded during the remote service call.

So I did something like

Provider[] providers = Security.getProviders();
for (Provider p: providers)
{
System.out.println(p);
}


before and after the call, and true enough, there are security providers being dynamically added! So I called Security.remove(providerName) for those additional ones and lo and behold, it works! This is something totally new to me as I've not done much work on this aspect of Java programming before.

While debugging the problem, I realized it's sometimes more convenient to check the existence of environment variables rather than playing around with the program arguments.


#To get the environment variable in Unix
echo $PATH

#To get the environment variable in DOS/Windows
echo $PATH

#To set the environment variable in Unix
export VARIABLE=value # for Bourne, bash, and related shells
setenv VARIABLE value # for csh and related shells

#To set the environment variable in DOS/Windows
set VARIABLE=value

More info can be found at this Wiki.

No comments:

Post a Comment