containable frame: fix parsing version strings with only a major number
This commit is contained in:
@@ -75,10 +75,22 @@ public class ContainableFrame extends JFrame
|
||||
javaVersion = javaVersion.substring(0, idx);
|
||||
}
|
||||
String[] s = javaVersion.split("\\.");
|
||||
int major = Integer.parseInt(s[0]), minor = Integer.parseInt(s[1]), patch = Integer.parseInt(s[2]);
|
||||
int major, minor, patch;
|
||||
if (s.length == 3)
|
||||
{
|
||||
major = Integer.parseInt(s[0]);
|
||||
minor = Integer.parseInt(s[1]);
|
||||
patch = Integer.parseInt(s[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
major = Integer.parseInt(s[0]);
|
||||
minor = -1;
|
||||
patch = -1;
|
||||
}
|
||||
if (major == 12 || major == 13 || major == 14)
|
||||
{
|
||||
// These versions are since EOL & do not include JDK-8231564
|
||||
// These versions are since EOL & do not include JDK-8231564, except for 13.0.4+
|
||||
return false;
|
||||
}
|
||||
return major > 11 || (major == 11 && minor > 0) || (major == 11 && minor == 0 && patch >= 8);
|
||||
@@ -138,6 +150,7 @@ public class ContainableFrame extends JFrame
|
||||
/**
|
||||
* Expand frame by specified value. If the frame is going to be expanded outside of screen push the frame to
|
||||
* the side.
|
||||
*
|
||||
* @param value size to expand frame by
|
||||
*/
|
||||
public void expandBy(final int value)
|
||||
@@ -197,6 +210,7 @@ public class ContainableFrame extends JFrame
|
||||
/**
|
||||
* Contract frame by specified value. If new frame size is less than it's minimum size, force the minimum size.
|
||||
* If the frame was pushed from side before, restore it's original position.
|
||||
*
|
||||
* @param value value to contract frame by
|
||||
*/
|
||||
public void contractBy(final int value)
|
||||
|
||||
@@ -39,5 +39,6 @@ public class ContainableFrameTest
|
||||
assertFalse(ContainableFrame.jdk8231564("12.0.0"));
|
||||
assertFalse(ContainableFrame.jdk8231564("13.0.0"));
|
||||
assertFalse(ContainableFrame.jdk8231564("14.0.0"));
|
||||
assertTrue(ContainableFrame.jdk8231564("15"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user