/hg/icedtea-web: Revert behaviour of PluginParameterParser#isInt...
adomurad at icedtea.classpath.org
adomurad at icedtea.classpath.org
Fri Mar 22 07:31:07 PDT 2013
changeset e5b423479f99 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=e5b423479f99
author: Adam Domurad <adomurad at redhat.com>
date: Fri Mar 22 10:32:05 2013 -0400
Revert behaviour of PluginParameterParser#isInt to fail on overflow
diffstat:
ChangeLog | 5 +++++
plugin/icedteanp/java/sun/applet/PluginParameterParser.java | 7 ++++++-
tests/netx/unit/sun/applet/PluginParameterParserTest.java | 4 ++++
3 files changed, 15 insertions(+), 1 deletions(-)
diffs (43 lines):
diff -r 7543d0b4e502 -r e5b423479f99 ChangeLog
--- a/ChangeLog Fri Mar 22 10:13:34 2013 -0400
+++ b/ChangeLog Fri Mar 22 10:32:05 2013 -0400
@@ -1,3 +1,8 @@
+2013-03-22 Adam Domurad <adomurad at redhat.com>
+
+ * plugin/icedteanp/java/sun/applet/PluginParameterParser.java
+ (isInt): Revert behaviour to catching NumberFormatException
+
2013-03-22 Adam Domurad <adomurad at redhat.com>
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diff -r 7543d0b4e502 -r e5b423479f99 plugin/icedteanp/java/sun/applet/PluginParameterParser.java
--- a/plugin/icedteanp/java/sun/applet/PluginParameterParser.java Fri Mar 22 10:13:34 2013 -0400
+++ b/plugin/icedteanp/java/sun/applet/PluginParameterParser.java Fri Mar 22 10:32:05 2013 -0400
@@ -60,7 +60,12 @@
}
static boolean isInt(String s) {
- return s.matches("^-?\\d+$");
+ try {
+ Integer.parseInt(s);
+ return true;
+ } catch(NumberFormatException e) {
+ return false;
+ }
}
/**
diff -r 7543d0b4e502 -r e5b423479f99 tests/netx/unit/sun/applet/PluginParameterParserTest.java
--- a/tests/netx/unit/sun/applet/PluginParameterParserTest.java Fri Mar 22 10:13:34 2013 -0400
+++ b/tests/netx/unit/sun/applet/PluginParameterParserTest.java Fri Mar 22 10:32:05 2013 -0400
@@ -15,6 +15,10 @@
assertFalse(PluginParameterParser.isInt("1.0"));
assertFalse(PluginParameterParser.isInt("abc"));
assertTrue(PluginParameterParser.isInt("1"));
+
+ /* Numbers that overflow or underflow can cause problems if we
+ * consider them valid, and pass them to parseInt: */
+ assertFalse(PluginParameterParser.isInt("4294967295"));
}
@Test
More information about the distro-pkg-dev
mailing list