Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using column span, the table must contains at least one row with non-null value #20

Open
andy176631 opened this issue Dec 15, 2017 · 0 comments

Comments

@andy176631
Copy link

When using column span, the table must contain at least one row with non-null value, otherwise exception happen. For example, I try...

final AsciiTable at = new AsciiTable();   
at.addRule();		
at.addRow("c_1_1", "c_1_2", "c_1_3");	
at.addRule();		
at.addRow("c_2_1", null, "c_2_3");		
at.addRule();
at.setTextAlignment(TextAlignment.CENTER);	
System.out.println(at.render());

The column spans are shown as expected:

┌──────────────────────────┬─────────────────────────┬─────────────────────────┐
│          c_1_1           │          c_1_2          │          c_1_3          │
├──────────────────────────┼─────────────────────────┴─────────────────────────┤
│          c_2_1           │                       c_2_3                       │
└──────────────────────────┴───────────────────────────────────────────────────┘

But if I removed the first row:

final AsciiTable at = new AsciiTable();   
at.addRule();		
at.addRow("c_2_1", null, "c_2_3");		
at.addRule();
at.setTextAlignment(TextAlignment.CENTER);	
System.out.println(at.render());

Exception occurred:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 80, Size: 80
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at de.vandermeer.asciithemes.TA_GridHelpers.adjustBorder(TA_GridHelpers.java:194)
	at de.vandermeer.asciithemes.TA_Grid.addGrid(TA_Grid.java:306)
	at de.vandermeer.asciitable.AT_Renderer.renderAsCollection(AT_Renderer.java:282)
	at de.vandermeer.asciitable.AT_Renderer.render(AT_Renderer.java:128)
	at de.vandermeer.asciitable.AT_Renderer.render(AT_Renderer.java:112)
	at de.vandermeer.asciitable.AsciiTable.render(AsciiTable.java:185)
	at test.Test.main(Test.java:44)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant