Skip to content

Commit 3def122

Browse files
author
jasper-schneider
committed
Update string parameter validation
1 parent 5005f18 commit 3def122

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/ResourceManager/Batch/Commands.Batch/Models/BatchClient.Jobs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public IEnumerable<PSCloudJob> ListJobs(ListJobOptions options)
3535
throw new ArgumentNullException("options");
3636
}
3737

38-
if (string.IsNullOrEmpty(options.WorkItemName) && options.WorkItem == null)
38+
if (string.IsNullOrWhiteSpace(options.WorkItemName) && options.WorkItem == null)
3939
{
4040
throw new ArgumentNullException(Resources.GBJ_NoWorkItem);
4141
}
@@ -89,7 +89,7 @@ public void DeleteJob(RemoveJobParameters parameters)
8989
{
9090
throw new ArgumentNullException("parameters");
9191
}
92-
if ((string.IsNullOrEmpty(parameters.WorkItemName) || string.IsNullOrEmpty(parameters.JobName)) && parameters.Job == null)
92+
if ((string.IsNullOrWhiteSpace(parameters.WorkItemName) || string.IsNullOrWhiteSpace(parameters.JobName)) && parameters.Job == null)
9393
{
9494
throw new ArgumentException(Resources.RBJ_NoJobSpecified);
9595
}

src/ResourceManager/Batch/Commands.Batch/Models/BatchClient.Pools.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public IEnumerable<PSCloudPool> ListPools(ListPoolOptions options)
3737
}
3838

3939
// Get the single Pool matching the specified name
40-
if (!string.IsNullOrEmpty(options.PoolName))
40+
if (!string.IsNullOrWhiteSpace(options.PoolName))
4141
{
4242
WriteVerbose(string.Format(Resources.GBP_GetByName, options.PoolName));
4343
using (IPoolManager poolManager = options.Context.BatchOMClient.OpenPoolManager())
@@ -83,7 +83,7 @@ public void CreatePool(NewPoolParameters parameters)
8383
{
8484
throw new ArgumentNullException("parameters");
8585
}
86-
if (string.IsNullOrEmpty(parameters.PoolName))
86+
if (string.IsNullOrWhiteSpace(parameters.PoolName))
8787
{
8888
throw new ArgumentNullException("PoolName");
8989
}
@@ -156,7 +156,7 @@ public void CreatePool(NewPoolParameters parameters)
156156
/// <param name="additionBehaviors">Additional client behaviors to perform</param>
157157
public void DeletePool(BatchAccountContext context, string poolName, IEnumerable<BatchClientBehavior> additionBehaviors = null)
158158
{
159-
if (string.IsNullOrEmpty(poolName))
159+
if (string.IsNullOrWhiteSpace(poolName))
160160
{
161161
throw new ArgumentNullException("poolName");
162162
}

src/ResourceManager/Batch/Commands.Batch/Models/BatchClient.Tasks.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public IEnumerable<PSCloudTask> ListTasks(ListTaskOptions options)
3636
throw new ArgumentNullException("options");
3737
}
3838

39-
if ((string.IsNullOrEmpty(options.WorkItemName) || string.IsNullOrEmpty(options.JobName)) && options.Job == null)
39+
if ((string.IsNullOrWhiteSpace(options.WorkItemName) || string.IsNullOrWhiteSpace(options.JobName)) && options.Job == null)
4040
{
4141
throw new ArgumentNullException(Resources.GBT_NoJob);
4242
}
@@ -98,11 +98,11 @@ public void CreateTask(NewTaskParameters parameters)
9898
{
9999
throw new ArgumentNullException("parameters");
100100
}
101-
if ((string.IsNullOrEmpty(parameters.WorkItemName) || string.IsNullOrEmpty(parameters.JobName)) && parameters.Job == null)
101+
if ((string.IsNullOrWhiteSpace(parameters.WorkItemName) || string.IsNullOrWhiteSpace(parameters.JobName)) && parameters.Job == null)
102102
{
103103
throw new ArgumentException(Resources.NBT_NoJobSpecified);
104104
}
105-
if (string.IsNullOrEmpty(parameters.TaskName))
105+
if (string.IsNullOrWhiteSpace(parameters.TaskName))
106106
{
107107
throw new ArgumentNullException("TaskName");
108108
}
@@ -164,7 +164,7 @@ public void DeleteTask(RemoveTaskParameters parameters)
164164
{
165165
throw new ArgumentNullException("parameters");
166166
}
167-
if ((string.IsNullOrEmpty(parameters.WorkItemName) || string.IsNullOrEmpty(parameters.JobName) || string.IsNullOrEmpty(parameters.TaskName)) && parameters.Task == null)
167+
if ((string.IsNullOrWhiteSpace(parameters.WorkItemName) || string.IsNullOrWhiteSpace(parameters.JobName) || string.IsNullOrWhiteSpace(parameters.TaskName)) && parameters.Task == null)
168168
{
169169
throw new ArgumentException(Resources.RBT_NoTaskSpecified);
170170
}

src/ResourceManager/Batch/Commands.Batch/Models/BatchClient.WorkItems.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public IEnumerable<PSCloudWorkItem> ListWorkItems(ListWorkItemOptions options)
3838
}
3939

4040
// Get the single WorkItem matching the specified name
41-
if (!string.IsNullOrEmpty(options.WorkItemName))
41+
if (!string.IsNullOrWhiteSpace(options.WorkItemName))
4242
{
4343
WriteVerbose(string.Format(Resources.GBWI_GetByName, options.WorkItemName));
4444
using (IWorkItemManager wiManager = options.Context.BatchOMClient.OpenWorkItemManager())
@@ -84,7 +84,7 @@ public void CreateWorkItem(NewWorkItemParameters parameters)
8484
{
8585
throw new ArgumentNullException("parameters");
8686
}
87-
if (string.IsNullOrEmpty(parameters.WorkItemName))
87+
if (string.IsNullOrWhiteSpace(parameters.WorkItemName))
8888
{
8989
throw new ArgumentNullException("WorkItemName");
9090
}
@@ -132,7 +132,7 @@ public void CreateWorkItem(NewWorkItemParameters parameters)
132132
/// <param name="additionBehaviors">Additional client behaviors to perform</param>
133133
public void DeleteWorkItem(BatchAccountContext context, string workItemName, IEnumerable<BatchClientBehavior> additionBehaviors = null)
134134
{
135-
if (string.IsNullOrEmpty(workItemName))
135+
if (string.IsNullOrWhiteSpace(workItemName))
136136
{
137137
throw new ArgumentNullException("workItemName");
138138
}

0 commit comments

Comments
 (0)