Skip to content
Permalink
Browse files
8267481: Make sure table row has correct number of cells
Reviewed-by: jjg
  • Loading branch information
hns committed May 20, 2021
1 parent f67847f commit b7b6acd9b1cafb791827e151712836c4e7140db5
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java
@@ -295,6 +295,9 @@ public void addRow(Element element, List<Content> contents) {
if (tabMap != null && element == null) {
throw new NullPointerException();
}
if (contents.size() != columnStyles.size()) {
throw new IllegalArgumentException("row content size does not match number of columns");
}

Content row = new ContentBuilder();

@@ -323,9 +326,7 @@ public void addRow(Element element, List<Content> contents) {
}
int colIndex = 0;
for (Content c : contents) {
HtmlStyle cellStyle = (columnStyles == null || colIndex > columnStyles.size())
? null
: columnStyles.get(colIndex);
HtmlStyle cellStyle = columnStyles.get(colIndex);
// Replace invalid content with HtmlTree.EMPTY to make sure the cell isn't dropped
HtmlTree cell = HtmlTree.DIV(cellStyle, c.isValid() ? c : HtmlTree.EMPTY);
if (rowStyle != null) {

0 comments on commit b7b6acd

Please sign in to comment.