Friday, June 13, 2008

Major bug with Ohloh makes it almost useless?!

Apache Synapse became a Top Level Project (TLP) of the Apache Software Foundation (ASF) a few months back, and thus we had to change our SVN url. Although our SVN contains history spanning back to almost three (3) years back, Ohloh only sees the project as only 5 months old!

I have complained about this to Ohloh 4 months back, at which time they stated
..We are unable to follow development activity across branches or directory moves..As far as I can tell there is no workaround. This affects a lot of projects, and I desperately want to get this fixed, but it will take some time.


Like they claimed, this affects many many projects! For example check Apache HttpComponents, ServiceMix, MINA..etc! This list will go on and on, since each new project started at the ASF will first go through incubation and then graduation, followed optionally by a move to become a TLP, and at each of these stages, the SVN url could possibly change.

Since the code metrics reported for so many of thes open source projects are just plain wrong, how can any of the information presented by ohloh be useful to anyone?

I sure hope someone at ohloh recognises the importance of this, and fixes this ASAP!

Wednesday, June 11, 2008

Limiting permissions to Java programs with policies

I wanted to limit the permissions for a Java program to only connect to a certain host.. and the way to do this is by defining your own policy file, and passing this as an argument to the Java command as follows:

temp.policy
grant {
//permission java.net.SocketPermission "69.147.112.160:80","connect,resolve";
permission java.io.FilePermission "<>", "read, write, delete, execute";
permission java.util.PropertyPermission "*", "read, write";
permission java.lang.RuntimePermission "*";
permission java.lang.reflect.ReflectPermission "*";
};

The above policy will not grant the process any SocketPermissions, however, if you only wanted it to connect to a specific IP address or hostname, you can uncomment the first line, and edit it appropriately.

For more information refer to: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/appA.html

Now to start your program using the above policy file, use:

java -cp some.jar -Djava.security.manager -Djava.security.policy=temp.policy MainClass