From fdff0c184814533005691c75383d7769e08be744 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Tue, 11 Feb 2014 19:57:58 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud) 57134: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 56917: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1) 56776: MNT-9790 Merged V4.1.3 (4.1.3.15) to V4.1-BUG-FIX (4.1.7) 56709: MNT-9763 : bulkimport fails when there is a very large LastModified timestamp. Was added the check for 'lastModifyDate' property of imported file. 56729: MNT-9763 : bulkimport fails when there is a very large LastModified timestamp. - Need to increment the number of unreadable entries git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61759 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../impl/DirectoryAnalyserImpl.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/repo/bulkimport/impl/DirectoryAnalyserImpl.java b/source/java/org/alfresco/repo/bulkimport/impl/DirectoryAnalyserImpl.java index 2b53113eef..aa10103aaf 100644 --- a/source/java/org/alfresco/repo/bulkimport/impl/DirectoryAnalyserImpl.java +++ b/source/java/org/alfresco/repo/bulkimport/impl/DirectoryAnalyserImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Alfresco Software Limited. + * Copyright (C) 2005-2013 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,6 +28,7 @@ package org.alfresco.repo.bulkimport.impl; import java.io.File; import java.io.FileFilter; import java.util.ArrayList; +import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; @@ -50,6 +51,8 @@ import org.alfresco.util.PropertyCheck; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.InitializingBean; +import org.springframework.extensions.surf.exception.PlatformRuntimeException; +import org.springframework.extensions.surf.util.ISO8601DateFormat; /** * This class provides the implementation for directory analysis, the process by @@ -179,6 +182,20 @@ public class DirectoryAnalyserImpl implements DirectoryAnalyser, InitializingBea // Build up the list of ImportableItems from the directory listing for (File file : result.getOriginalListing()) { + // MNT-9763 bulkimport fails when there is a very large LastModified timestamp. + String isoDate = null; + try + { + isoDate = ISO8601DateFormat.format(new Date(file.lastModified())); + ISO8601DateFormat.parse(isoDate); + } + catch (PlatformRuntimeException e) + { + log.warn("Failed to convert date " + isoDate + " to string for " + file.getName(), e); + importStatus.incrementNumberOfUnreadableEntries(); + continue; + } + if (log.isTraceEnabled()) { log.trace("Scanning file " + FileUtils.getFileName(file) + "...");