mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
22.05.2008 0b47436fb3ad1a11e046111d959f7558a4610137
Fix for 2312.

Currently the lines are only wrapped when there is an space. If not it
has been decided to make the cell wider than what has been set in the
code. I guess that the reason for doing this is to avoid problems
grepping on whole words, however I think that the side effect is more
negative than the problem that we try to solve.

In general tables are printed to help humans to understand the output
(and not for scripts). Breaking the whole table structure goes against
this principle.
1 files modified
16 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/util/table/TextTablePrinter.java 16 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/table/TextTablePrinter.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.util.table;
@@ -188,16 +188,10 @@
            // boundary.
            int endIndex = contents.lastIndexOf(' ', width);
            if (endIndex == -1) {
              // Problem - we have a word which is too big to fit in
              // the cell. Display the word as it is (this will push
              // subsequent columns to the right).
              endIndex = contents.indexOf(' ');
              if (endIndex == -1) {
                head = contents;
              } else {
                head = contents.substring(0, endIndex);
                tail = contents.substring(endIndex + 1);
              }
              endIndex = width;
              head = contents.substring(0, endIndex);
              tail = contents.substring(endIndex);
            } else {
              head = contents.substring(0, endIndex);
              tail = contents.substring(endIndex + 1);