Don't try to index empty documentation txt files
If a documentation txt file has no content, parsing the document title from it in the DocIndexer fails with a NullPointerException: Exception in thread "main" java.lang.NullPointerException at java.util.regex.Matcher.getTextLength(Matcher.java:1234) at java.util.regex.Matcher.reset(Matcher.java:308) at java.util.regex.Matcher.<init>(Matcher.java:228) at java.util.regex.Pattern.matcher(Pattern.java:1088) at DocIndexer.index(DocIndexer.java:117) at DocIndexer.invoke(DocIndexer.java:86) at DocIndexer.main(DocIndexer.java:163) Change-Id: Idb4b808847d326ba49c9a2494a95b1cad8eb9406 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
parent
a1e08c9e04
commit
1f7782e8ec
@ -104,6 +104,9 @@ public class DocIndexer {
|
||||
IndexWriter iwriter = new IndexWriter(directory, config);
|
||||
for (String inputFile : inputFiles) {
|
||||
File file = new File(inputFile);
|
||||
if (file.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BufferedReader titleReader = new BufferedReader(
|
||||
new InputStreamReader(new FileInputStream(file), "UTF-8"));
|
||||
|
Loading…
Reference in New Issue
Block a user