Skip to content
Snippets Groups Projects
Commit d2528bf8 authored by cramakri's avatar cramakri
Browse files

LMS-1564 Fixed bug in transmitting folders with the put command.

SVN: 16334
parent 32e5696c
No related branches found
No related tags found
No related merge requests found
...@@ -147,10 +147,19 @@ class PutDataSetExecutor ...@@ -147,10 +147,19 @@ class PutDataSetExecutor
new ConcatenatedFileOutputStreamWriter(inputStream); new ConcatenatedFileOutputStreamWriter(inputStream);
for (FileInfoDssDTO fileInfo : newDataSet.getFileInfos()) for (FileInfoDssDTO fileInfo : newDataSet.getFileInfos())
{ {
OutputStream output = getOutputStream(fileInfo); if (fileInfo.isDirectory())
imagesWriter.writeNextBlock(output); {
output.flush(); // Just make the directory
output.close(); File file = new File(dataSetDir, fileInfo.getPathInDataSet());
file.mkdir();
} else
{
// Download the file -- the directory should have already been made
OutputStream output = getOutputStream(fileInfo);
imagesWriter.writeNextBlock(output);
output.flush();
output.close();
}
} }
} }
......
...@@ -66,7 +66,7 @@ class CommandPut extends AbstractCommand ...@@ -66,7 +66,7 @@ class CommandPut extends AbstractCommand
public String getFilePath() public String getFilePath()
{ {
return getArguments().get(1); return getArguments().get(2);
} }
public File getFile() public File getFile()
...@@ -85,7 +85,7 @@ class CommandPut extends AbstractCommand ...@@ -85,7 +85,7 @@ class CommandPut extends AbstractCommand
try try
{ {
DataSetOwnerType.valueOf(getArguments().get(1).toString().toUpperCase()); getOwnerType();
} catch (IllegalArgumentException e) } catch (IllegalArgumentException e)
{ {
return false; return false;
...@@ -191,7 +191,16 @@ class CommandPut extends AbstractCommand ...@@ -191,7 +191,16 @@ class CommandPut extends AbstractCommand
for (FileInfoDssDTO fileInfo : fileInfos) for (FileInfoDssDTO fileInfo : fileInfos)
{ {
files.add(new File(parent, fileInfo.getPathInDataSet())); File file = new File(parent, fileInfo.getPathInDataSet());
if (false == file.exists())
{
throw new IllegalArgumentException("File does not exist " + file);
}
// Skip directories
if (false == file.isDirectory())
{
files.add(file);
}
} }
return files; return files;
...@@ -248,8 +257,8 @@ class CommandPut extends AbstractCommand ...@@ -248,8 +257,8 @@ class CommandPut extends AbstractCommand
parser.printUsage(out); parser.printUsage(out);
out.println(" Examples : "); out.println(" Examples : ");
out.println(" " + getCommandCallString() + parser.printExample(ExampleMode.ALL) out.println(" " + getCommandCallString() + parser.printExample(ExampleMode.ALL)
+ " HCS_IMAGE EXPERIMENT <experiment identifier> <path>"); + " EXPERIMENT <experiment identifier> <path>");
out.println(" " + getCommandCallString() + parser.printExample(ExampleMode.ALL) out.println(" " + getCommandCallString() + parser.printExample(ExampleMode.ALL)
+ " HCS_IMAGE SAMPLE <sample identifier> <path>"); + " SAMPLE <sample identifier> <path>");
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment