Skip to content
Permalink
Browse files

[JENKINS-38831] refactored after PR review.

  • Loading branch information...
iwarapter committed Oct 31, 2016
1 parent be563fa commit 2a07412a7a6448efe0779206233fb39e0c3e4a96
@@ -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;
@@ -116,12 +119,13 @@ public Unbinder getUnbinder() {
*/
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());
@@ -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;

0 comments on commit 2a07412

Please sign in to comment.
You can’t perform that action at this time.