Skip to content

Commit

Permalink
getColumnDesc returns unpaired square bracket when columns are empty (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Aug 24, 2021
1 parent 3a30855 commit d930a12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1456,10 +1456,9 @@ public Column column(String name, int probableIndex) {
public String getColumnDesc()
{
StringBuilder sb = new StringBuilder(100);
sb.append('[');
for (Column col : _columns) {
if (sb.length() == 0) {
sb.append('[');
} else {
if (sb.length() > 1) {
sb.append(',');
}
sb.append('"');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ public void testReorderWithComparator() throws Exception
_verifyLinks(schema);
}

public void testColumnDescForEmptyScheme() throws Exception
{
CsvSchema schema = CsvSchema.emptySchema();
assertEquals("[]", schema.getColumnDesc());
}

private void _verifyLinks(CsvSchema schema)
{
List<Column> all = new ArrayList<Column>();
Expand Down

0 comments on commit d930a12

Please sign in to comment.