From 875816ea9606a10872c4650eccafcdbc0cce6af2 Mon Sep 17 00:00:00 2001
From: anttil <anttil>
Date: Tue, 9 Aug 2016 08:36:35 +0000
Subject: [PATCH] SSDM-3996: New DSS FS: download of big files doesn't work via
 CIFS

SVN: 36883
---
 .../cisd/openbis/dss/generic/server/cifs/CifsFile.java      | 4 ++++
 .../generic/server/ftp/v3/V3FtpPathResolverRegistry.java    | 2 +-
 .../dss/generic/server/ftp/v3/file/V3FtpFileResponse.java   | 6 ++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/cifs/CifsFile.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/cifs/CifsFile.java
index a6a5072ee77..4886f977fcd 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/cifs/CifsFile.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/cifs/CifsFile.java
@@ -27,6 +27,7 @@ import ch.systemsx.cisd.base.io.IRandomAccessFile;
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
 import ch.systemsx.cisd.openbis.dss.generic.server.ftp.resolver.FtpFileImpl;
+import ch.systemsx.cisd.openbis.dss.generic.server.ftp.v3.file.V3FtpFileResponse;
 
 /**
  * @author Franz-Josef Elmer
@@ -108,6 +109,9 @@ final class CifsFile extends NetworkFile
             if (randomAccessFile == null && file instanceof FtpFileImpl)
             {
                 randomAccessFile = ((FtpFileImpl) file).getFileContent();
+            } else if (randomAccessFile == null && file instanceof V3FtpFileResponse)
+            {
+                randomAccessFile = ((V3FtpFileResponse) file).getFileContent();
             }
         }
     }
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/V3FtpPathResolverRegistry.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/V3FtpPathResolverRegistry.java
index 1b4b2c98b04..ff4da3517c5 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/V3FtpPathResolverRegistry.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/V3FtpPathResolverRegistry.java
@@ -97,7 +97,7 @@ public class V3FtpPathResolverRegistry implements IFtpPathResolverRegistry
             }
         } catch (Exception e)
         {
-            operationLog.warn(e);
+            operationLog.warn("Resolving "+path+" failed", e);
         }
         return new V3FtpNonExistingFile(path, "Error when retrieving path");
     }
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/file/V3FtpFileResponse.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/file/V3FtpFileResponse.java
index 403bab96a87..0dd4ef46f46 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/file/V3FtpFileResponse.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ftp/v3/file/V3FtpFileResponse.java
@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.apache.ftpserver.ftplet.FtpFile;
 
+import ch.systemsx.cisd.base.io.IRandomAccessFile;
 import ch.systemsx.cisd.openbis.common.io.hierarchical_content.HierarchicalContentUtils;
 import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContent;
 import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchicalContentNode;
@@ -40,6 +41,11 @@ public class V3FtpFileResponse extends AbstractFtpFile implements V3FtpFile
         this.content = content;
     }
 
+    public IRandomAccessFile getFileContent()
+    {
+        return node.getFileContent();
+    }
+
     @Override
     public boolean isFile()
     {
-- 
GitLab