Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-456 Parse msexcel plugin speedup contributed by Heiko Dietze

Sami Siren5921853252e1
diff --git a/CHANGES.txt b/CHANGES.txt
index 622c2f4b0..ebc88e5b0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,7 +10,8 @@ Unreleased changes (1.0-dev)
3. NUTCH-393 - Indexer should handle null documents returned by filters.
(Eelco Lempsink via ab)
-
+ 4. NUTCH-456 - Parse msexcel plugin speedup (Heiko Dietze via siren)
+
Release 0.9 - 2007-04-02
diff --git a/src/plugin/parse-msexcel/src/java/org/apache/nutch/parse/msexcel/ExcelExtractor.java b/src/plugin/parse-msexcel/src/java/org/apache/nutch/parse/msexcel/ExcelExtractor.java
index d1cac53fc..c571b3d0b 100644
--- a/src/plugin/parse-msexcel/src/java/org/apache/nutch/parse/msexcel/ExcelExtractor.java
+++ b/src/plugin/parse-msexcel/src/java/org/apache/nutch/parse/msexcel/ExcelExtractor.java
@@ -40,10 +40,10 @@ class ExcelExtractor extends MSExtractor {
protected String extractText(InputStream input) throws Exception {
- String resultText = "";
+ StringBuilder resultText = new StringBuilder();
HSSFWorkbook wb = new HSSFWorkbook(input);
if (wb == null) {
- return resultText;
+ return resultText.toString();
}
HSSFSheet sheet;
@@ -69,25 +69,24 @@ class ExcelExtractor extends MSExtractor {
for (int k=0; k<cNum; k++) {
if ((cell = row.getCell((short) k)) != null) {
/*if(HSSFDateUtil.isCellDateFormatted(cell) == true) {
- resultText += cell.getDateCellValue().toString() + " ";
+ resultText.append(cell.getDateCellValue().toString())
} else
*/
if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
- resultText += cell.getStringCellValue() + " ";
+ resultText.append(cell.getStringCellValue()).append(" ");
} else if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
- Double d = new Double(cell.getNumericCellValue());
- resultText += d.toString() + " ";
+ double d = cell.getNumericCellValue();
+ resultText.append(d).append(" ");
}
/* else if(cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA){
- resultText += cell.getCellFormula() + " ";
+ resultText.append(cell.getCellFormula());
}
*/
}
}
}
}
- return resultText;
+ return resultText.toString();
}
}
-