mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)
129111 adavis: Merged 5.0.2 (5.0.2.23) to 5.0.N (5.0.4) 120632 amorarasu: MNT-15367: Unable to bulk import filenames with portuguese characters in a linux environment. - Fixed empty catch blocks and added some comments as per review. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@129115 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
@@ -36,8 +36,11 @@ import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.alfresco.repo.bulkimport.impl.FileUtils;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* This class is a DTO that represents an "importable item" - a series of files
|
||||
@@ -55,6 +58,8 @@ public final class ImportableItem
|
||||
OTHER
|
||||
};
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(ImportableItem.class);
|
||||
|
||||
private ContentAndMetadata headRevision = new ContentAndMetadata();
|
||||
private SortedSet<VersionedContentAndMetadata> versionEntries = null;
|
||||
private NodeRef nodeRef;
|
||||
@@ -193,6 +198,7 @@ public final class ImportableItem
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
logger.error("Attributes for file '" + FileUtils.getFileName(contentFile) + "' could not be read.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,6 +275,10 @@ public final class ImportableItem
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("Size for the metadata file '" + FileUtils.getFileName(metadataFile) + "' could not be retrieved.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@@ -271,7 +272,7 @@ public class BulkImportTest extends AbstractBulkImportTests
|
||||
|
||||
System.out.println(bulkImporter.getStatus());
|
||||
|
||||
assertEquals("", 74, bulkImporter.getStatus().getNumberOfContentNodesCreated());
|
||||
assertEquals(74, bulkImporter.getStatus().getNumberOfContentNodesCreated());
|
||||
|
||||
checkFiles(folderNode, null, 2, 9, new ExpectedFile[] {
|
||||
new ExpectedFile("quickImg1.xls", MimetypeMap.MIMETYPE_EXCEL),
|
||||
@@ -627,8 +628,9 @@ public class BulkImportTest extends AbstractBulkImportTests
|
||||
NodeImporter nodeImporter = null;
|
||||
|
||||
File source = ResourceUtils.getFile("classpath:bulkimport4");
|
||||
|
||||
String fileName = new String("135 CarbonÔÇô13 NMR spectroscopy_DS_NS_final_cau.txt".getBytes("ISO-8859-1"), "UTF-8");
|
||||
//Simulate the name of the file with an invalid encoding.
|
||||
String fileName = new String("135 CarbonÔÇô13 NMR spectroscopy_DS_NS_final_cau.txt".getBytes(Charset.forName("ISO-8859-1")),
|
||||
Charset.forName("UTF-8"));
|
||||
Path dest = source.toPath().resolve("encoding");
|
||||
try
|
||||
{
|
||||
@@ -636,6 +638,7 @@ public class BulkImportTest extends AbstractBulkImportTests
|
||||
}
|
||||
catch (FileAlreadyExistsException ex)
|
||||
{
|
||||
//It is fine if the folder already exists, though it should not.
|
||||
}
|
||||
Path destFile = dest.resolve(fileName);
|
||||
|
||||
@@ -653,7 +656,7 @@ public class BulkImportTest extends AbstractBulkImportTests
|
||||
bulkImportParameters.setBatchSize(40);
|
||||
bulkImporter.bulkImport(bulkImportParameters, nodeImporter);
|
||||
|
||||
assertEquals("", 1, bulkImporter.getStatus().getNumberOfContentNodesCreated());
|
||||
assertEquals(1, bulkImporter.getStatus().getNumberOfContentNodesCreated());
|
||||
|
||||
checkFiles(folderNode, null, 0, 1,
|
||||
new ExpectedFile[] { new ExpectedFile(fileName, MimetypeMap.MIMETYPE_TEXT_PLAIN)},
|
||||
|
Reference in New Issue
Block a user