Revision: 15165
http://gate.svn.sourceforge.net/gate/?rev=15165&view=rev
Author: markagreenwood
Date: 2012-01-21 15:56:41 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
make some static fields final so they can't accidentally be changed, we had to
alter the initialization of the fields slightly to achieve this as well
Modified Paths:
--------------
gate/trunk/src/gate/Main.java
Modified: gate/trunk/src/gate/Main.java
===================================================================
--- gate/trunk/src/gate/Main.java 2012-01-21 15:30:10 UTC (rev 15164)
+++ gate/trunk/src/gate/Main.java 2012-01-21 15:56:41 UTC (rev 15165)
@@ -343,17 +343,25 @@
// find out the version and build numbers
static {
- // find out the version number
+
+ // we can't have the possibility of assigning to a final variable twice so
+ // we put the details into a temp variable and then once we are happy
assign
+ // it to the static final variable
+ String temp;
+
+ // find out the version number
try {
InputStream ver = Files.getGateResourceAsStream("version.txt");
if (ver==null) {
throw new IOException();
}
BufferedReader reader = new BomStrippingInputStreamReader(ver, "UTF-8");
- Main.version = reader.readLine();
+ temp = reader.readLine();
} catch(IOException ioe) {
- Main.version = "7.0";
+ temp = "7.0";
}
+
+ version = temp;
// find out the build number
try{
@@ -362,10 +370,12 @@
throw new IOException();
}
BufferedReader reader = new BomStrippingInputStreamReader(build,
"UTF-8");
- Main.build = reader.readLine();
+ temp = reader.readLine();
} catch(IOException ioe) {
- Main.build = "0000";
+ temp = "0000";
}
+
+ build = temp;
} // static initializer finding build and version
@@ -483,9 +493,9 @@
private static boolean runCorpusBenchmarkTool = false;
- public static String name = "GATE Developer";
- public static String version;
- public static String build;
+ public static final String name = "GATE Developer";
+ public static final String version;
+ public static final String build;
/** Process arguments and set up member fields appropriately.
* Will shut down the process (via System.exit) if there are
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs