Skip to content
Snippets Groups Projects
Commit 30b1b207 authored by Fuentes Serna  Juan Mariano (ID SIS)'s avatar Fuentes Serna Juan Mariano (ID SIS)
Browse files

Merge branch 'master' of https://sissource.ethz.ch/sispub/openbis

parents 2c90d409 61ce562e
No related branches found
No related tags found
No related merge requests found
......@@ -274,26 +274,12 @@ public class PutDataSetService implements IPutDataSetService
doInitialization();
}
if (StringUtils.isBlank(sessionToken))
{
throw new UserFailureException("Session token cannot be null or empty");
}
if (sessionToken.contains("/"))
{
throw new UserFailureException("Session token must not contain '/'");
}
validateSessionToken(sessionToken);
validateUploadId(uploadId);
if (newDataSet == null)
{
throw new UserFailureException("New data set cannot be null");
}
if (StringUtils.isBlank(uploadId))
{
throw new UserFailureException("Upload id cannot be null or empty");
}
if (uploadId.contains("/"))
{
throw new UserFailureException("Upload id must not contain '/'");
}
ServiceProvider.getOpenBISService().checkSession(sessionToken);
......@@ -346,14 +332,8 @@ public class PutDataSetService implements IPutDataSetService
try
{
if (StringUtils.isBlank(sessionToken))
{
throw new UserFailureException("Session token cannot be null or empty");
}
if (sessionToken.contains("/"))
{
throw new UserFailureException("Session token must not contain '/'");
}
validateSessionToken(sessionToken);
validateUploadId(uploadId);
if (StringUtils.isBlank(filePath))
{
throw new UserFailureException("File path cannot be null or empty");
......@@ -370,14 +350,6 @@ public class PutDataSetService implements IPutDataSetService
{
throw new UserFailureException("Data set type cannot be null or empty");
}
if (StringUtils.isBlank(uploadId))
{
throw new UserFailureException("Upload id cannot be null or empty");
}
if (uploadId.contains("/"))
{
throw new UserFailureException("Upload id must not contain '/'");
}
if (inputStream == null)
{
throw new UserFailureException("Input stream cannot be null");
......@@ -613,14 +585,7 @@ public class PutDataSetService implements IPutDataSetService
doInitialization();
}
if (StringUtils.isBlank(sessionToken))
{
throw new IllegalArgumentException("Session token cannot be null or empty");
}
if (sessionToken.contains("/"))
{
throw new UserFailureException("Session token must not contain '/'");
}
validateSessionToken(sessionToken);
Collection<TopLevelDataSetRegistratorGlobalState> states = getThreadGlobalStates();
......@@ -646,6 +611,28 @@ public class PutDataSetService implements IPutDataSetService
}
}
private void validateSessionToken(String sessionToken)
{
validate(sessionToken, "Session token");
}
private void validateUploadId(String uploadId)
{
validate(uploadId, "Upload id");
}
private void validate(String uploadId, String name)
{
if (StringUtils.isBlank(uploadId))
{
throw new UserFailureException(name + " cannot be null or empty");
}
if (uploadId.contains("/"))
{
throw new UserFailureException(name + " must not contain '/'");
}
}
}
/**
......
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