From: <rb...@us...> - 2017-12-22 16:44:34
|
Revision: 15035 http://sourceforge.net/p/htmlunit/code/15035 Author: rbri Date: 2017-12-22 16:44:32 +0000 (Fri, 22 Dec 2017) Log Message: ----------- ignore areas with invalid poly definitions Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-12-22 15:44:24 UTC (rev 15034) +++ trunk/htmlunit/src/changes/changes.xml 2017-12-22 16:44:32 UTC (rev 15035) @@ -8,6 +8,12 @@ <body> <release version="2.29" date="xx, 2017" description="Bugfixes, Chrome 63, WebStart support"> + <action type="fix" dev="rbri" issue="1939 "> + If the coords of an image map entry are not valid ignore this entry. + </action> + <action type="fix" dev="rbri" issue="1939 "> + JavaScript: calling click() from js should always work even if the control is not visible. + </action> <action type="add" dev="rbri" issue="1936"> JavaScript: Crypto.subtle added </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java 2017-12-22 15:44:24 UTC (rev 15034) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java 2017-12-22 16:44:32 UTC (rev 15035) @@ -317,14 +317,21 @@ private GeneralPath parsePoly() { final String[] coords = StringUtils.split(getCoordsAttribute(), ','); final GeneralPath path = new GeneralPath(); - for (int i = 0; i + 1 < coords.length; i += 2) { - if (i == 0) { - path.moveTo(Float.parseFloat(coords[i]), Float.parseFloat(coords[i + 1])); + + try { + for (int i = 0; i + 1 < coords.length; i += 2) { + if (i == 0) { + path.moveTo(Float.parseFloat(coords[i]), Float.parseFloat(coords[i + 1])); + } + else { + path.lineTo(Float.parseFloat(coords[i]), Float.parseFloat(coords[i + 1])); + } } - else { - path.lineTo(Float.parseFloat(coords[i]), Float.parseFloat(coords[i + 1])); - } } + catch (final NumberFormatException e) { + LOG.warn("Invalid poly coords '" + coords + "'", e); + } + path.closePath(); return path; } |