Skip to content

Commit 105e333

Browse files
committed
Code review feedback
1 parent c529ce3 commit 105e333

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

signalData/src/org/labkey/signaldata/pipeline/SignalDataImportTask.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.labkey.signaldata.pipeline;
22

33
import org.apache.commons.lang3.StringUtils;
4+
import org.apache.commons.logging.Log;
5+
import org.apache.commons.logging.LogFactory;
46
import org.apache.logging.log4j.Logger;
57
import org.jetbrains.annotations.NotNull;
68
import org.jetbrains.annotations.Nullable;
@@ -97,6 +99,13 @@ public RecordedActionSet run()
9799
return new RecordedActionSet();
98100
}
99101

102+
AssayProvider provider = AssayService.get().getProvider(protocol);
103+
if (provider == null)
104+
{
105+
log.error("No Assay provider found for protocol name : {}", protocolName);
106+
return new RecordedActionSet();
107+
}
108+
100109
// guaranteed to only have a single file
101110
if (support.getInputFiles().size() != 1)
102111
{
@@ -118,10 +127,16 @@ public RecordedActionSet run()
118127
for (Map<String, Object> row : dataRows)
119128
{
120129
// parse out the name and datafile properties
121-
String name = Objects.toString(row.get(INPUT_NAME), "");
130+
String name = Objects.toString(row.get(INPUT_NAME), "").trim();
122131
String dataFilePath = Objects.toString(row.get(INPUT_DATA_FILE), "").trim();
123132

124-
// validate the existence of the datafile property and make a copy to the run root
133+
// validate the existence of the name and datafile property and make a copy to the run root
134+
if (StringUtils.isBlank(name))
135+
{
136+
log.warn("Skipping row with blank Name property");
137+
continue;
138+
}
139+
125140
if (StringUtils.isBlank(dataFilePath))
126141
{
127142
log.warn("Skipping row '{}' with blank DataFile property", name);
@@ -207,12 +222,15 @@ public RecordedActionSet run()
207222
String dataFileUrl = URLDecoder.decode(url, StandardCharsets.UTF_8);
208223
row.replace(INPUT_DATA_FILE, dataFileUrl.replace("file:", ""));
209224
}
225+
else
226+
log.warn("Unable to locate the webdav resource at {}", uri.getPath());
210227
}
228+
else
229+
log.warn("Unable to resolve a webdav URL for {}", destFile.getName());
211230
}
212231

213232
// create and save the run
214-
AssayProvider provider = AssayService.get().getProvider(protocol);
215-
if (provider != null && !dataRows.isEmpty())
233+
if (!dataRows.isEmpty())
216234
{
217235
AssayRunUploadContext.Factory<?,?> runFactory = provider.createRunUploadFactory(protocol, job.getUser(), container);
218236

0 commit comments

Comments
 (0)