Skip to content

Commit 189d333

Browse files
committed
add missing trim to the area polygon parsing impl
1 parent f075287 commit 189d333

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/main/java/org/htmlunit/html/HtmlArea.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,19 @@ public final String getRelAttribute() {
197197
}
198198

199199
/**
200-
* Returns the value of the attribute {@code ping}.
200+
* Returns the value of the attribute {@code ping} or an empty string if that attribute isn't defined.
201201
*
202-
* @return the value of the attribute {@code ping}
202+
* @return the value of the attribute {@code ping} or an empty string if that attribute isn't defined
203203
*/
204204
@Override
205205
public final String getPingAttribute() {
206206
return getAttributeDirect("ping");
207207
}
208208

209209
/**
210-
* Returns the value of the attribute {@code download}.
210+
* Returns the value of the attribute {@code download} or an empty string if that attribute isn't defined.
211211
*
212-
* @return the value of the attribute {@code download}
212+
* @return the value of the attribute {@code download} or an empty string if that attribute isn't defined
213213
*/
214214
@Override
215215
public final String getDownloadAttribute() {
@@ -337,10 +337,16 @@ private Shape2D parsePoly() {
337337

338338
try {
339339
if (coords.length > 1) {
340-
final Polygon2D path = new Polygon2D(Double.parseDouble(coords[0]), Double.parseDouble(coords[1]));
340+
double x = Double.parseDouble(coords[0].trim());
341+
double y = Double.parseDouble(coords[1].trim());
342+
343+
final Polygon2D path = new Polygon2D(x, y);
341344

342345
for (int i = 2; i + 1 < coords.length; i += 2) {
343-
path.lineTo(Double.parseDouble(coords[i]), Double.parseDouble(coords[i + 1]));
346+
x = Double.parseDouble(coords[i].trim());
347+
y = Double.parseDouble(coords[i + 1].trim());
348+
349+
path.lineTo(x, y);
344350
}
345351
return path;
346352
}

0 commit comments

Comments
 (0)