Re: [PATCH JGIT] Compute the author/commiter name and email from the git configuration
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Feb 4, 2009, 00:59 UTC
- Message-ID
- <20090204005907.GA23383@spearce.org>
- In-Reply-To
- <alpine.DEB.1.00.0902040019030.9822@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 12 quoted lines
> On Tue, 3 Feb 2009, Shawn O. Pearce wrote: > > Yann Simon <yann.simon.fr@gmail.com> wrote: > > > + username = System.getProperty(gitVariableKey); > > > > Shouldn't that be System.getenv()? > > According to > > http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getenv(java.lang.String) > > getenv() is deprecated. However, in later editions (Java5 and later, to > be precise), that deprecation seems to be lifted...
Yea, funny thing about that. In 1.3 getenv() worked. In 1.4 they not only marked it deprecated, they changed the method to always throw a RuntimeException. Java developers were outraged, so in 1.5 (aka Java 5) they added it back in as a supported method.
JGit only runs on Java 5 and later. So we're safe, we don't have to worry about this #@(!@(! method and the 1.4 mistake.
Hell, Java 6 added an executable flag to java.io.File. This is a rather funny concept on Windows where executablity is based on file name and not a "mode bit", but its in the Java 6 S2SE API. At least even on Windows getenv makes sense and provides data.
-- Shawn.