Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the use of reflection in some rare circumstances #290

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@

@Override
public Void call() throws EnvInjectException {
if (EnvVars.masterEnvVars.equals(enVars)) {
// Nothing to update
return null;
} else if (EnvVars.masterEnvVars.keySet().equals(enVars.keySet())) {
/*
* Per the Javadoc, merely changing the value associated with an existing key is not a structural
* modification and thus does not require synchronization.
*/
EnvVars.masterEnvVars.putAll(enVars);
return null;

Check warning on line 55 in src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectMasterEnvVarsSetter.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 46-55 are not covered by tests
}

try {
Field platformField = EnvVars.class.getDeclaredField("platform");
platformField.setAccessible(true);
Expand Down
Loading