@@ -25,20 +25,26 @@ public record TorchProperties(
25
25
@ NotBlank (message = "DSE mapping tree file path is required" ) String dseMappingTreeFile ,
26
26
boolean useCql
27
27
) {
28
+ private static final String EMPTY_QUOTES = "\" \" " ;
29
+
30
+ private static boolean isNotSet (String variable ) {
31
+ return variable == null || variable .isBlank () || EMPTY_QUOTES .equals (variable );
32
+ }
33
+
28
34
public TorchProperties {
29
35
if (!useCql ) {
30
36
if (flare == null ) {
31
37
throw new IllegalArgumentException ("When useCql is false, flare.url must be a non-empty string" );
32
38
}
33
- if (flare . url () == null || flare .url (). isBlank ( )) {
39
+ if (isNotSet ( flare .url ())) {
34
40
throw new IllegalArgumentException ("When useCql is false, flare.url must be a non-empty string" );
35
41
}
36
42
}
37
43
38
44
if (fhir == null ) {
39
45
throw new IllegalArgumentException ("FHIR URL must not be null or empty" );
40
46
}
41
- if (fhir . url () == null || fhir .url (). isBlank ( )) {
47
+ if (isNotSet ( fhir .url ())) {
42
48
throw new IllegalArgumentException ("FHIR URL must not be null or empty" );
43
49
}
44
50
}
@@ -74,8 +80,8 @@ public record Fhir(
74
80
String password ) {
75
81
76
82
public Fhir {
77
- if (user == null ) user = "" ;
78
- if (password == null ) password = "" ;
83
+ if (isNotSet ( user ) ) user = "" ;
84
+ if (isNotSet ( password ) ) password = "" ;
79
85
if (oauth == null ) {
80
86
oauth = new Oauth (new Oauth .Issuer ("" ), new Oauth .Client ("" , "" ));
81
87
}
@@ -96,14 +102,14 @@ public record Oauth(@Valid Issuer issuer, @Valid Client client) {
96
102
97
103
public record Issuer (String uri ) {
98
104
public Issuer {
99
- if (uri == null ) uri = "" ;
105
+ if (isNotSet ( uri ) ) uri = "" ;
100
106
}
101
107
}
102
108
103
109
public record Client (String id , String secret ) {
104
110
public Client {
105
- if (id == null ) id = "" ;
106
- if (secret == null ) secret = "" ;
111
+ if (isNotSet ( id ) ) id = "" ;
112
+ if (isNotSet ( secret ) ) secret = "" ;
107
113
}
108
114
}
109
115
}
0 commit comments