Skip to content

Commit 6fbbbe4

Browse files
committed
nullchecks
1 parent fd9d6d4 commit 6fbbbe4

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ publishing {
5151
}
5252

5353
group 'mil.army.usace.hec'
54-
version '0.0.46'
54+
version '0.0.47'
5555
}

src/main/java/usace/cc/plugin/Action.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ public Map<String,DataSource> getParameters(){
2121
return parameters;
2222
}
2323
public void UpdateActionPaths(){
24-
for(Map.Entry<String, DataSource> apb : parameters.entrySet()){
25-
parameters.replace(apb.getKey(),apb.getValue().UpdatePaths());
24+
if(parameters!=null){
25+
for(Map.Entry<String, DataSource> apb : parameters.entrySet()){
26+
parameters.replace(apb.getKey(),apb.getValue().UpdatePaths());
27+
}
2628
}
29+
2730
}
2831
}

src/main/java/usace/cc/plugin/DataSource.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@ public String getStoreName(){
2929
public DataSource UpdatePaths(){
3030
DataSource dest = this;
3131
PluginManager pm = PluginManager.getInstance();
32-
33-
for(int j=0; j<this.getPaths().length;j++){
34-
pm.LogMessage(new Message("incoming: " + this.getPaths()[j]));
35-
dest.getPaths()[j] = pm.SubstitutePath(this.getPaths()[j]);
36-
pm.LogMessage(new Message("outgoing: " + dest.getPaths()[j]));
32+
if(this.getPaths()!=null){
33+
for(int j=0; j<this.getPaths().length;j++){
34+
pm.LogMessage(new Message("incoming: " + this.getPaths()[j]));
35+
dest.getPaths()[j] = pm.SubstitutePath(this.getPaths()[j]);
36+
pm.LogMessage(new Message("outgoing: " + dest.getPaths()[j]));
37+
}
3738
}
38-
for(int j=0; j<this.getDataPaths().length;j++){
39-
dest.getDataPaths()[j] = pm.SubstitutePath(this.getDataPaths()[j]);
39+
40+
if (this.getDataPaths()!=null){
41+
for(int j=0; j<this.getDataPaths().length;j++){
42+
dest.getDataPaths()[j] = pm.SubstitutePath(this.getDataPaths()[j]);
43+
}
4044
}
45+
4146
return dest;
4247
}
4348
}

src/main/java/usace/cc/plugin/PluginManager.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,22 @@ private PluginManager(){
5353

5454
}
5555
private void substitutePathVariables() {
56-
for (int i= 0; i<_payload.getInputs().length; i++){
57-
_payload.getInputs()[i] = _payload.getInputs()[i].UpdatePaths();
56+
if (_payload.getInputs()!=null){
57+
for (int i= 0; i<_payload.getInputs().length; i++){
58+
_payload.getInputs()[i] = _payload.getInputs()[i].UpdatePaths();
59+
}
5860
}
59-
for (int i= 0; i<_payload.getOutputs().length; i++){
60-
_payload.getOutputs()[i] = _payload.getOutputs()[i].UpdatePaths();
61+
if (_payload.getOutputs()!=null){
62+
for (int i= 0; i<_payload.getOutputs().length; i++){
63+
_payload.getOutputs()[i] = _payload.getOutputs()[i].UpdatePaths();
64+
}
6165
}
62-
for (int i= 0; i<_payload.getActions().length; i++){
63-
_payload.getActions()[i].UpdateActionPaths();
66+
if(_payload.getActions()!=null){
67+
for (int i= 0; i<_payload.getActions().length; i++){
68+
_payload.getActions()[i].UpdateActionPaths();
69+
}
6470
}
71+
6572
}
6673
public String SubstitutePath(String path) {
6774
Matcher m = p.matcher(path);

0 commit comments

Comments
 (0)