Remove the duplicate Version class

We had two different com.google.gerrit.common.Version classes which
meant that under the GWT debug environment the server didn't have
access to its own version number.

Fix that by using ClientVersion from within the GWT UI, and leave
the real Version name for the rest of the runtime.

Change-Id: I3b5af1a866fb1b4a6dbe25269962fe80d8d26436
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-12-30 10:12:27 -08:00
parent e43a80361c
commit db96816b81
5 changed files with 34 additions and 34 deletions

View File

@@ -14,9 +14,10 @@
package com.google.gerrit.common;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.io.InputStreamReader;
public class Version {
private static final String version;
@@ -30,18 +31,24 @@ public class Version {
}
private static String loadVersion() {
InputStream in = Version.class.getResourceAsStream("Version.properties");
InputStream in = Version.class.getResourceAsStream("Version");
if (in == null) {
return null;
}
try {
final Properties p = new Properties();
BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
try {
p.load(in);
String vs = r.readLine();
if (vs != null && vs.startsWith("v")) {
vs = vs.substring(1);
}
if (vs != null && vs.isEmpty()) {
vs = null;
}
return vs;
} finally {
in.close();
r.close();
}
return p.getProperty("version");
} catch (IOException e) {
return null;
}