Skip to content

Commit 3d8716e

Browse files
duonglaiquangrbri
authored andcommitted
HtmlTableCell: treat rowspan/colspan that cannot be parsed to an integer as 1
1 parent 50de33e commit 3d8716e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ public int getColumnSpan() {
5252
if (spanString == null || spanString.isEmpty()) {
5353
return 1;
5454
}
55-
return Integer.parseInt(spanString);
55+
try {
56+
return Integer.parseInt(spanString);
57+
}
58+
catch (final NumberFormatException e) {
59+
return 1;
60+
}
5661
}
5762

5863
/**
@@ -64,7 +69,12 @@ public int getRowSpan() {
6469
if (spanString == null || spanString.isEmpty()) {
6570
return 1;
6671
}
67-
return Integer.parseInt(spanString);
72+
try {
73+
return Integer.parseInt(spanString);
74+
}
75+
catch (final NumberFormatException e) {
76+
return 1;
77+
}
6878
}
6979

7080
/**

0 commit comments

Comments
 (0)