[Schmitzm-commits] r1017 - in trunk: src/skrueger/versionnumber src_junit/skrueger/versionnumber

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 20 18:38:11 CEST 2010


Author: alfonx
Date: 2010-09-20 18:38:10 +0200 (Mon, 20 Sep 2010)
New Revision: 1017

Modified:
   trunk/src/skrueger/versionnumber/ReleaseUtil.java
   trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java
Log:
A patch to support release version number bigger than an int, e.g. 201002292359

Modified: trunk/src/skrueger/versionnumber/ReleaseUtil.java
===================================================================
--- trunk/src/skrueger/versionnumber/ReleaseUtil.java	2010-09-20 16:35:21 UTC (rev 1016)
+++ trunk/src/skrueger/versionnumber/ReleaseUtil.java	2010-09-20 16:38:10 UTC (rev 1017)
@@ -95,7 +95,7 @@
 	 * 
 	 * @Return the major part of the software version or 0 if a problem occurs.
 	 */
-	public static int getVersionBuild(Class<?> clazz) {
+	public static double getVersionBuild(Class<?> clazz) {
 		try {
 			final URL releasePropsURL = clazz
 					.getResource("/release.properties");
@@ -115,7 +115,7 @@
 				return 0;
 			}
 
-			return Integer.parseInt(str);
+			return Double.parseDouble(str);
 		} catch (final Exception e) {
 			log.error("/release.properties could not be read from "
 					+ clazz.getSimpleName(), e);

Modified: trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java
===================================================================
--- trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java	2010-09-20 16:35:21 UTC (rev 1016)
+++ trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java	2010-09-20 16:38:10 UTC (rev 1017)
@@ -13,5 +13,7 @@
 		assertEquals(0,ReleaseUtil.extractMinVersionFromString("0.0"));
 		assertEquals(5,ReleaseUtil.extractMinVersionFromString("1.5-SNAPSHOT"));
 		assertEquals(5,ReleaseUtil.extractMinVersionFromString("1.5r234"));
+		
+		assertEquals(5,ReleaseUtil.extractMinVersionFromString("1.5r201009221756"),0.01);
 	}
 }



More information about the Schmitzm-commits mailing list