Skip to content

Commit 516552e

Browse files
committed
resolve finding
1 parent 2ce808d commit 516552e

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

agent/src/main/java/com/teamscale/jacoco/agent/options/AgentOptionsParser.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,7 @@ public void throwOnCollectedErrors() throws Exception {
127127
AgentOptions options = new AgentOptions(logger);
128128
options.originalOptionsString = optionsString;
129129

130-
if (credentials != null) {
131-
options.teamscaleServer.url = credentials.url;
132-
options.teamscaleServer.userName = credentials.userName;
133-
options.teamscaleServer.userAccessToken = credentials.accessKey;
134-
}
135-
if (environmentAccessToken != null) {
136-
options.teamscaleServer.userAccessToken = environmentAccessToken;
137-
}
130+
presetCredentialOptions(options);
138131

139132
if (!StringUtils.isEmpty(optionsString)) {
140133
String[] optionParts = optionsString.split(",");
@@ -162,6 +155,17 @@ public void throwOnCollectedErrors() throws Exception {
162155
return options;
163156
}
164157

158+
private void presetCredentialOptions(AgentOptions options) {
159+
if (credentials != null) {
160+
options.teamscaleServer.url = credentials.url;
161+
options.teamscaleServer.userName = credentials.userName;
162+
options.teamscaleServer.userAccessToken = credentials.accessKey;
163+
}
164+
if (environmentAccessToken != null) {
165+
options.teamscaleServer.userAccessToken = environmentAccessToken;
166+
}
167+
}
168+
165169
/**
166170
* Stores the agent options for proxies in the {@link TeamscaleProxySystemProperties} and overwrites the password
167171
* with the password found in the proxy-password-file if necessary.

0 commit comments

Comments
 (0)