Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-38831] refactored after PR review.
  • Loading branch information
iwarapter committed Oct 31, 2016
1 parent be563fa commit 2a07412
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Expand Up @@ -30,7 +30,10 @@
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.*;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.model.Run;
import hudson.model.TaskListener;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
Expand Down Expand Up @@ -116,12 +119,13 @@ protected static final class NullUnbinder implements Unbinder {
*/
protected final @Nonnull C getCredentials(@Nonnull Run<?,?> build) throws IOException {
IdCredentials cred = CredentialsProvider.findCredentialById(credentialsId, IdCredentials.class, build);
CredentialsProvider.track(build, cred);
if (cred==null)
throw new CredentialNotFoundException(credentialsId);

if (type().isInstance(cred))
if (type().isInstance(cred)) {
CredentialsProvider.track(build, cred);
return type().cast(cred);
}


Descriptor expected = Jenkins.getActiveInstance().getDescriptor(type());
Expand Down
Expand Up @@ -24,7 +24,13 @@

package org.jenkinsci.plugins.credentialsbinding.impl;

import com.cloudbees.plugins.credentials.*;
import com.cloudbees.plugins.credentials.Credentials;
import com.cloudbees.plugins.credentials.CredentialsParameterDefinition;
import com.cloudbees.plugins.credentials.CredentialsParameterValue;
import com.cloudbees.plugins.credentials.CredentialsProvider;
import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.CredentialsStore;
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.cloudbees.plugins.credentials.domains.Domain;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;

Expand Down

0 comments on commit 2a07412

Please sign in to comment.