StringBuffer now resets every time the parser is called

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2817 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
octoate 19 years ago
parent ef912811f1
commit e4a3574b77

@ -64,8 +64,8 @@ import de.anomic.plasma.parser.ParserException;
public class xlsParser extends AbstractParser implements Parser, HSSFListener { public class xlsParser extends AbstractParser implements Parser, HSSFListener {
//StringBuffer which contains the found strings after parsing the XLS file //StringBuffer for parsed text
private StringBuffer sbFoundStrings = new StringBuffer(); private StringBuffer sbFoundStrings = null;
//sstrecord needed for event parsing //sstrecord needed for event parsing
private SSTRecord sstrec; private SSTRecord sstrec;
@ -106,6 +106,9 @@ public class xlsParser extends AbstractParser implements Parser, HSSFListener {
String charset, InputStream source) throws ParserException, String charset, InputStream source) throws ParserException,
InterruptedException { InterruptedException {
try { try {
//generate new StringBuffer for parsing
sbFoundStrings = new StringBuffer();
//create a new org.apache.poi.poifs.filesystem.Filesystem //create a new org.apache.poi.poifs.filesystem.Filesystem
POIFSFileSystem poifs = new POIFSFileSystem(source); POIFSFileSystem poifs = new POIFSFileSystem(source);
//get the Workbook (excel part) stream in a InputStream //get the Workbook (excel part) stream in a InputStream
@ -154,6 +157,8 @@ public class xlsParser extends AbstractParser implements Parser, HSSFListener {
String errorMsg = "Unable to parse the xls document '" + location + "':" + e.getMessage(); String errorMsg = "Unable to parse the xls document '" + location + "':" + e.getMessage();
this.theLogger.logSevere(errorMsg); this.theLogger.logSevere(errorMsg);
throw new ParserException(errorMsg, location); throw new ParserException(errorMsg, location);
} finally {
sbFoundStrings = null;
} }
} }

Loading…
Cancel
Save