Skip to content

Commit

Permalink
- clean up formatting
Browse files Browse the repository at this point in the history
 - add test for non-GA version (1.7.0_65-b19)
  • Loading branch information
ritzalam committed Jul 18, 2014
1 parent 70f4aba commit e854928
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public static boolean validateMinJREVersion(String runtimeVersion, String minVer
return true;
else{
// Checking Java version
if(Integer.parseInt(clientVersioning[1]) > Integer.parseInt(requestedVersioning[1]))
if (Integer.parseInt(clientVersioning[1]) > Integer.parseInt(requestedVersioning[1]))
return true;

// Checking update
else if(Integer.parseInt(clientVersioning[1]) == Integer.parseInt(requestedVersioning[1])){
else if (Integer.parseInt(clientVersioning[1]) == Integer.parseInt(requestedVersioning[1])){
// non-GA or non-FCS release won't be supported
if(clientVersioning[2].indexOf("-") != -1)
return false;
Expand All @@ -45,35 +45,34 @@ else if(Integer.parseInt(clientVersioning[1]) == Integer.parseInt(requestedVersi
int rUpdatePart2 = 0;

int underbar = requestedVersioning[2].indexOf("_");
if( underbar == -1){
if ( underbar == -1){
rUpdatePart1 = Integer.parseInt(requestedVersioning[2]);
}else{
rUpdatePart1 = Integer.parseInt(requestedVersioning[2].substring(0,underbar));
rUpdatePart2 = Integer.parseInt(requestedVersioning[2].substring(underbar+1,requestedVersioning[2].length()));
} else {
rUpdatePart1 = Integer.parseInt(requestedVersioning[2].substring(0, underbar));
rUpdatePart2 = Integer.parseInt(requestedVersioning[2].substring(underbar + 1, requestedVersioning[2].length()));
}

int cUpdatePart1 = 0;
int cUpdatePart2 = 0;

underbar = clientVersioning[2].indexOf("_");
if( underbar == -1){
if ( underbar == -1) {
cUpdatePart1 = Integer.parseInt(clientVersioning[2]);
}else{
cUpdatePart1 = Integer.parseInt(clientVersioning[2].substring(0,underbar));
cUpdatePart2 = Integer.parseInt(clientVersioning[2].substring(underbar+1,clientVersioning[2].length()));
} else {
cUpdatePart1 = Integer.parseInt(clientVersioning[2].substring(0, underbar));
cUpdatePart2 = Integer.parseInt(clientVersioning[2].substring(underbar + 1, clientVersioning[2].length()));
}

if(cUpdatePart1 > rUpdatePart1)
if (cUpdatePart1 > rUpdatePart1)
return true;
else if(cUpdatePart1 == rUpdatePart1)
{
if(cUpdatePart2 > rUpdatePart2 || cUpdatePart2 == rUpdatePart2)
else if (cUpdatePart1 == rUpdatePart1) {
if (cUpdatePart2 > rUpdatePart2 || cUpdatePart2 == rUpdatePart2)
return true;
else
return false;
}else
} else
return false;
}else
} else
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ public void testJava7u65Version() {
boolean passed = VersionCheckUtil.validateMinJREVersion("1.7.0_65", "1.7.0_51");
Assert.assertTrue(passed, "The version check should pass.");
}

@Test
public void testJava7u65BetaVersion() {
boolean fail = VersionCheckUtil.validateMinJREVersion("1.7.0_65-b19", "1.7.0_51");
Assert.assertFalse(fail, "Non GS release is unsupported.");
}
}

0 comments on commit e854928

Please sign in to comment.