tika-eval fix bug that stores parent file extension instead of embedded doc file extension
@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
@@ -210,15 +211,15 @@ public abstract class AbstractProfiler extends FileResourceConsumer {
//if the outer wrapper document
if (i == 0) {
-
data.put(Cols.IS_EMBEDDED, FALSE);
data.put(Cols.FILE_NAME, fps.getRelativeSourceFilePath().getFileName().toString());
} else {
data.put(Cols.IS_EMBEDDED, TRUE);
data.put(Cols.FILE_NAME, getFileName(m.get(RecursiveParserWrapper.EMBEDDED_RESOURCE_PATH)));
}
- data.put(Cols.FILE_EXTENSION,
- FilenameUtils.getExtension(fps.getRelativeSourceFilePath().getFileName().toString()));
+ String ext = FilenameUtils.getExtension(data.get(Cols.FILE_NAME));
+ ext = (ext == null) ? "" : ext.toLowerCase(Locale.US);
+ data.put(Cols.FILE_EXTENSION, ext);
long srcFileLen = getSourceFileLength(m);
if (srcFileLen > NON_EXISTENT_FILE_LENGTH) {
data.put(Cols.LENGTH, Long.toString(srcFileLen));
