Skip to content

Commit

Permalink
Fix deprecation warnings + Update ArtifactArchiver to no longer consu…
Browse files Browse the repository at this point in the history
…lt with environment variables injected by EnvironmentContributingActions during the build (#4933)

* fixed deprecation warnings

* reverted changes

* fixed typeo in javadoc

* Update core/src/main/java/hudson/tasks/ArtifactArchiver.java

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>

* Update core/src/main/java/hudson/cli/BuildCommand.java

Co-authored-by: Jesse Glick <jglick@cloudbees.com>

* fixed imports

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
  • Loading branch information
3 people committed Oct 14, 2020
1 parent 7602cf3 commit 93428a4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ public static List<Descriptor<Publisher>> getPublisherDescriptors(AbstractProjec
}

public static List<SCMDescriptor<?>> getSCMDescriptors(AbstractProject<?,?> project) {
return SCM._for(project);
return SCM._for((Job) project);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/cli/BuildCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.Option;

import java.util.Collections;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -252,7 +253,7 @@ public CLICause(String startedBy){

@Override
public String getShortDescription() {
User user = User.get(startedBy, false);
User user = User.getById(startedBy, false);
String userName = user != null ? user.getDisplayName() : startedBy;
return Messages.BuildCommand_CLICause_ShortDescription(userName);
}
Expand All @@ -274,4 +275,3 @@ public int hashCode() {
}
}
}

2 changes: 1 addition & 1 deletion core/src/main/java/hudson/tasks/ArtifactArchiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public void perform(Run<?,?> build, FilePath ws, EnvVars environment, Launcher l
f.setExcludes(excludes);
f.setDefaultExcludes(defaultExcludes);
f.setCaseSensitive(caseSensitive);
f.perform(build, ws, launcher, listener);
f.perform(build, ws, environment, launcher, listener);
}
} else {
result = build.getResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ public String getMessage() {
}

public URL getWhereAntIsLoaded() throws IOException {
return Which.jarURL(antClass);
return Which.classFileUrl(antClass);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public IncompatibleServletVersionDetected(Class servletClass) {
}

public URL getWhereServletIsLoaded() throws IOException {
return Which.jarURL(servletClass);
return Which.classFileUrl(servletClass);
}
}
3 changes: 1 addition & 2 deletions core/src/main/java/jenkins/util/JSONSignatureValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.sf.json.JSONObject;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.io.output.TeeOutputStream;
import org.jvnet.hudson.crypto.CertificateUtil;
Expand Down Expand Up @@ -184,7 +183,7 @@ private FormValidation checkSpecificSignature(JSONObject json, JSONObject signat
//
// Jenkins should ignore "digest"/"signature" pair. Accepting it creates a vulnerability that allows
// the attacker to inject a fragment at the end of the json.
json.writeCanonical(new OutputStreamWriter(new TeeOutputStream(dos,sos), Charsets.UTF_8)).close();
json.writeCanonical(new OutputStreamWriter(new TeeOutputStream(dos,sos), StandardCharsets.UTF_8)).close();

// did the digest match? this is not a part of the signature validation, but if we have a bug in the c14n
// (which is more likely than someone tampering with update center), we can tell
Expand Down

0 comments on commit 93428a4

Please sign in to comment.