Use ows_Modified as "Last Modified" value.
b/13011522 Last modified date indexed by SP Adaptor doesn't match with actual last modified date in SharePoint site
https://codereview.appspot.com/110010044/
diff --git a/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java b/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
index cb5c1c7..8623707 100644
--- a/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
+++ b/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
@@ -200,8 +200,8 @@
/** Provides the number of attachments the list item has. */
private static final String OWS_ATTACHMENTS_ATTRIBUTE = "ows_Attachments";
/** The last time metadata or content was modified. */
- private static final String OWS_LAST_MODIFIED_ATTRIBUTE
- = "ows_Last_x0020_Modified";
+ private static final String OWS_MODIFIED_ATTRIBUTE
+ = "ows_Modified";
/**
* Matches a SP-encoded value that contains one or more values. See {@link
* SiteAdaptor.addMetadata}.
@@ -2007,12 +2007,10 @@
Element data = getFirstChildWithName(xml, DATA_ELEMENT);
Element row = getChildrenWithName(data, ROW_ELEMENT).get(0);
- String modifiedString = row.getAttribute(OWS_LAST_MODIFIED_ATTRIBUTE);
+ String modifiedString = row.getAttribute(OWS_MODIFIED_ATTRIBUTE);
if (modifiedString == null) {
log.log(Level.FINE, "No last modified information for list item");
} else {
- // This should be in the form of "1234;#DATE".
- modifiedString = modifiedString.split(";#", 2)[1];
try {
response.setLastModified(
modifiedDateFormat.get().parse(modifiedString));
diff --git a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
index 682b0e8..1d260d5 100644
--- a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
+++ b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
@@ -1452,7 +1452,7 @@
assertEquals(URI.create("http://localhost:1/sites/SiteCollection/Lists/"
+ "Custom%20List/DispForm.aspx?ID=2"),
response.getDisplayUrl());
- assertEquals(new Date(1335910446000L), response.getLastModified());
+ assertEquals(new Date(1336166672000L), response.getLastModified());
}
@Test