Apache Nutch is an extensible and scalable web crawler
NUTCH-2823 IllegalStateException in IndexWriters.describe() when validating url param for SolrIndexer
Sebastian Nagel96bd7577b727
diff --git a/src/java/org/apache/nutch/indexer/IndexWriters.java b/src/java/org/apache/nutch/indexer/IndexWriters.javaindex 5778997b4..04cc70a1e 100644--- a/src/java/org/apache/nutch/indexer/IndexWriters.java+++ b/src/java/org/apache/nutch/indexer/IndexWriters.java@@ -286,26 +286,27 @@ public class IndexWriters {// Building the tableAsciiTable at = new AsciiTable();at.getRenderer().setCWC((rows, colNumbers, tableWidth) -> {+ /*+ * first and third column (configuration param names and values) usually+ * require less width than the second column which contains the+ * description+ */int maxLengthFirstColumn = 0;- int maxLengthLastColumn = 0;+ int maxLengthThirdColumn = 0;for (AT_Row row : rows) {if (row.getType() == TableRowType.CONTENT) {- // First column- int lengthFirstColumn = row.getCells().get(0).toString().length();- if (lengthFirstColumn > maxLengthFirstColumn) {- maxLengthFirstColumn = lengthFirstColumn;- }-- // Last column- int lengthLastColumn = row.getCells().get(2).toString().length();- if (lengthLastColumn > maxLengthLastColumn) {- maxLengthLastColumn = lengthLastColumn;- }+ maxLengthFirstColumn = Math.max(row.getCells().get(0).toString().length(), maxLengthFirstColumn);+ maxLengthThirdColumn = Math.max(row.getCells().get(2).toString().length(), maxLengthThirdColumn);}}- return new int[] { maxLengthFirstColumn,- tableWidth - maxLengthFirstColumn - maxLengthLastColumn,- maxLengthLastColumn };+ // reset max. lengths if exceeding one third of the table width+ maxLengthFirstColumn = Math.min((tableWidth / 3), maxLengthFirstColumn);+ maxLengthThirdColumn = Math.min(+ ((tableWidth - maxLengthFirstColumn) / 2), maxLengthThirdColumn);+ int widthSecondColumn = tableWidth - maxLengthFirstColumn+ - maxLengthThirdColumn;+ return new int[] { maxLengthFirstColumn, widthSecondColumn,+ maxLengthThirdColumn };});// Getting the properties@@ -323,7 +324,7 @@ public class IndexWriters {at.addRule();// Rendering the table- builder.append(at.render(150)).append("\n\n");+ builder.append(at.render(120)).append("\n\n");}return builder.toString();