forked from LibrePDF/OpenPDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bug with html parser class cast exception on empty content
- Loading branch information
nuviosoftware
committed
Jan 27, 2018
1 parent
251761c
commit 51255a1
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
pdf-html/src/test/java/com/lowagie/text/html/HtmlParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.lowagie.text.html; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.io.StringReader; | ||
|
||
import org.junit.Test; | ||
|
||
import com.lowagie.text.Document; | ||
import com.lowagie.text.TextElementArray; | ||
|
||
public class HtmlParserTest { | ||
|
||
/** | ||
* Bug fix scenario: a table with a space throws a {@link TextElementArray} | ||
* class cast Exception. A table without spaces is parsed correctly. | ||
*/ | ||
@Test | ||
public void testParse_tableWithNoSpaces() { | ||
Document doc1 = new Document(); | ||
doc1.open(); | ||
HtmlParser.parse(doc1, new StringReader("<table><tr><td>test</td></tr></table>")); // succeeds | ||
assertNotNull(doc1); | ||
} | ||
|
||
/** | ||
* Bug fix scenario: a table with a space throws a {@link TextElementArray} | ||
* class cast Exception. | ||
*/ | ||
@Test | ||
public void testParse_tableWithSpaces() { | ||
Document doc1 = new Document(); | ||
doc1.open(); | ||
HtmlParser.parse(doc1, new StringReader("<table> <tr><td>test</td></tr></table>")); // fails | ||
assertNotNull(doc1); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters