This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit 6caafeed07bf382d384f120bca631d8e8085f466 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Mar 24 18:59:19 2015 +0100 fixes #6859 gérer les deux types de path dans l'archive --- .../genericformat/GenericFormatArchive.java | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/GenericFormatArchive.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/GenericFormatArchive.java index 31de088..d3b553c 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/GenericFormatArchive.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/GenericFormatArchive.java @@ -63,12 +63,12 @@ public class GenericFormatArchive implements Serializable { /** Logger. */ private static final Log log = LogFactory.getLog(GenericFormatArchive.class); - private static enum ArchiveMode { + private enum ArchiveMode { IMPORT, EXPORT } - private static enum ArchiveFilePath { + private enum ArchiveFilePath { PROTOCOL(false, "protocol.tuttiProtocol"), REFERENTIAL_GEAR(false, "temporaryGears.csv"), @@ -377,7 +377,7 @@ public class GenericFormatArchive implements Serializable { fileObject = children[0]; - String prefix = fileObject.getName().getBaseName() + "/"; + String prefix = fileObject.getName().getBaseName(); return prefix; } @@ -394,8 +394,7 @@ public class GenericFormatArchive implements Serializable { try (ZipFile zipFile = new ZipFile(archiveFile)) { - String zipEntryPath = getZipEntryPath(archiveFilePath); - ZipEntry entry = zipFile.getEntry(zipEntryPath); + ZipEntry entry = getZipEntryPath(archiveFilePath, zipFile); Preconditions.checkState(!(archiveFilePath.isMandatory() && entry == null), "Must have entry " + filename); @@ -421,6 +420,16 @@ public class GenericFormatArchive implements Serializable { } + protected ZipEntry getZipEntryPath(ArchiveFilePath archiveFilePath, ZipFile zipFile ) { + String path = prefixPath + "/" + archiveFilePath.getFilename(); + ZipEntry entry = zipFile.getEntry(path); + if (entry==null) { + path = prefixPath + "\\" + archiveFilePath.getFilename(); + entry = zipFile.getEntry(path); + } + return entry; + } + protected String getZipEntryPath(ArchiveFilePath archiveFilePath) { String path = prefixPath + archiveFilePath.getFilename(); @@ -436,18 +445,16 @@ public class GenericFormatArchive implements Serializable { for (ArchiveFilePath archiveFilePath : ArchiveFilePath.values()) { - String zipEntryPath = getZipEntryPath(archiveFilePath); + ZipEntry zipEntry = getZipEntryPath(archiveFilePath, zipFile); if (log.isDebugEnabled()) { - log.debug("Check if entry " + zipEntryPath + " exists."); + log.debug("Check if entry " + archiveFilePath + " exists."); } - ZipEntry zipEntry = zipFile.getEntry(zipEntryPath); - if (zipEntry == null) { if (log.isInfoEnabled()) { - log.info("Entry " + zipEntryPath + " not found."); + log.info("Entry " + archiveFilePath + " not found."); } result.add(archiveFilePath); @@ -455,7 +462,7 @@ public class GenericFormatArchive implements Serializable { } else { if (log.isInfoEnabled()) { - log.info("Entry " + zipEntryPath + " found."); + log.info("Entry " + archiveFilePath + " found."); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.