dev@glassfish.java.net

Re: pom change review request (long but simple)

From: Ken Cavanaugh <Ken.Cavanaugh_at_Sun.COM>
Date: Thu, 17 Sep 2009 15:38:07 -0700

Bill Shannon wrote:
> The copyright situation is a mess. I've complained about this to
> Abhijit several times, still no action.
>
> *Many* files have completely the wrong license, or worse yet no copyright
> or license at all.
>
> No one seems to update the copyright year when they modify a file,
> like they should.
>
And I think we all know that no one ever will, at least not consistently.
But this sort of problem is very amenable to a tools solution.

I already have a copyright header checking/updating tool that I use
in CORBA. A variant of the same tool is also used in Metro, and is
available as the license-tool project on java.net. The tool runs quickly:
on my current machine (3 Core AMD/2.8 GHz/8 GB RAM) it processes
around 1000 files/second.

It should be fairly easy in most revision control systems to extract the
year in which a file was last updated. For example, in mercurial using
CORBA as an example (this is in
src/share/classes/com/sun/corba/se/spi/transport):

> hg log CorbaAcceptor.java | grep changeset:

changeset: 324:34a977b07ae0
changeset: 300:e2b177d79942
changeset: 0:0fc818f2f9e5

> hg log -r 324 | grep date

date: Thu Aug 27 13:59:49 2009 -0700

So we can extract the year of the last change, and while updating the
file header,
insert the correct year. Gluing this together in a shell script is easy
enough, and I'd
imagine something similar is possible in svn.

Putting this all together, you could easily have a Hudson job that fixed
everything up
automatically that can be run whenever desired in the release cycle.
The tool
can also be run as a copyright header validator.

Ken.