This is an automated email from the ASF dual-hosted git repository.
tballison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/main by this push:
new 0a8a39ff1e TIKA-4798: Don't overwrite dcterms:modified with
PR_LAST_MODIFICATION_TIME for MSG files (#2987)
0a8a39ff1e is described below
commit 0a8a39ff1ecec1d8e433e8f3789b54f9f2b94bc3
Author: Nicholas DiPiazza <[email protected]>
AuthorDate: Fri Sep 18 10:18:36 2026 -0500
TIKA-4798: Don't overwrite dcterms:modified with PR_LAST_MODIFICATION_TIME
for MSG files (#2987)
---
.../org/apache/tika/parser/microsoft/OutlookExtractor.java | 12 +++++-------
.../org/apache/tika/parser/microsoft/OutlookParserTest.java | 7 +++++++
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OutlookExtractor.java
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OutlookExtractor.java
index 7c813c5085..13a42c5e13 100644
---
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OutlookExtractor.java
+++
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/OutlookExtractor.java
@@ -575,13 +575,11 @@ public class OutlookExtractor extends
AbstractPOIFSExtractor {
}
}
}
- //try to overwrite the modified property if the actual
LAST_MODIFICATION_TIME property exists.
- List<PropertyValue> timeProp =
msg.getMainChunks().getProperties().get(MAPIProperty.LAST_MODIFICATION_TIME);
- if (timeProp != null && ! timeProp.isEmpty()) {
- Calendar cal =
((PropertyValue.TimePropertyValue)timeProp.get(0)).getValue();
- metadata.set(TikaCoreProperties.MODIFIED, cal);
- }
-
+ //Note: PR_LAST_MODIFICATION_TIME is intentionally not used to
overwrite dcterms:modified here.
+ //For a .msg file, that MAPI property reflects when the message's
underlying storage was
+ //last written (e.g. when the item was saved/exported to disk), not
when its content was
+ //actually edited, and can be long after the message was
sent/received. It remains available,
+ //unmodified, as mapi:last-modification-time (see
handleMessageInfo/LITERAL_TIME_PROPERTIES).
}
private void handleBodyChunks(Chunk htmlChunk, Chunk rtfChunk, Chunk
textChunk,
diff --git
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java
index 15088f98fa..d7628d0f32 100644
---
a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java
+++
b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/java/org/apache/tika/parser/microsoft/OutlookParserTest.java
@@ -82,6 +82,13 @@ public class OutlookParserTest extends TikaTest {
// Stored as Thu, 5 Apr 2007 09:26:06 -0700
assertEquals("2007-04-05T16:26:06Z",
metadata.get(TikaCoreProperties.CREATED));
+ //TIKA-4798: dcterms:modified should reflect the message date, not
+ //PR_LAST_MODIFICATION_TIME, which for a .msg file records when the
file's
+ //underlying storage was last written (e.g. resaved/exported to disk),
and
+ //can be much later than when the message was actually sent/received.
+ assertEquals("2007-04-05T16:26:06Z",
metadata.get(TikaCoreProperties.MODIFIED));
+ assertEquals("2007-10-05T05:37:49Z",
metadata.get("mapi:last-modification-time"));
+
String content = handler.toString();
assertNotContained("Microsoft Outlook Express 6", content);
assertNotContained("L'\u00C9quipe Microsoft Outlook Express", content);