Source:
public abstract URL getEc2EndpointUrl() throws IOException; public abstract URL getS3EndpointUrl() throws IOException; private Object readResolve() { this.slaveCountingLock = new ReentrantLock(); for (SlaveTemplate t : templates) t.parent = this; if (this.accessId != null && this.secretKey != null && credentialsId == null) { String secretKeyEncryptedValue = this.secretKey.getEncryptedValue(); SystemCredentialsProvider systemCredentialsProvider = SystemCredentialsProvider.getInstance(); for (Credentials credentials: systemCredentialsProvider.getCredentials()) { if (credentials instanceof AmazonWebServicesCredentials) { AmazonWebServicesCredentials awsCreds = (AmazonWebServicesCredentials) credentials; AWSCredentials awsCredentials = awsCreds.getCredentials(); if (accessId.equals(awsCredentials.getAWSAccessKeyId()) && Secret.toString(this.secretKey).equals(awsCredentials.getAWSSecretKey())) { this.credentialsId = awsCreds.getId(); this.accessId = null; this.secretKey = null; return this; } } } for (CredentialsStore credentialsStore: CredentialsProvider.lookupStores(Jenkins.get())) { if (credentialsStore instanceof SystemCredentialsProvider.StoreImpl) { try { String credsId = UUID.randomUUID().toString(); credentialsStore.addCredentials(Domain.global(), new AWSCredentialsImpl( CredentialsScope.SYSTEM, credsId, this.accessId, secretKeyEncryptedValue, "EC2 Cloud - " + getDisplayName())); this.credentialsId = credsId; this.accessId = null; this.secretKey = null; return this; } catch (IOException e) { this.credentialsId = null; LOGGER.log(Level.WARNING, "Exception converting legacy configuration to the new credentials API", e); } } } LOGGER.log(Level.WARNING, "EC2 Plugin could not migrate credentials to the Jenkins Global Credentials Store, EC2 Plugin for cloud {0} must be manually reconfigured", getDisplayName()); } return this; }

Target:
public abstract URL getEc2EndpointUrl() throws IOException; public abstract URL getS3EndpointUrl() throws IOException; protected Object readResolve() { this.slaveCountingLock = new ReentrantLock(); for (SlaveTemplate t : templates) t.parent = this; if (this.accessId != null && this.secretKey != null && credentialsId == null) { String secretKeyEncryptedValue = this.secretKey.getEncryptedValue(); SystemCredentialsProvider systemCredentialsProvider = SystemCredentialsProvider.getInstance(); for (Credentials credentials: systemCredentialsProvider.getCredentials()) { if (credentials instanceof AmazonWebServicesCredentials) { AmazonWebServicesCredentials awsCreds = (AmazonWebServicesCredentials) credentials; AWSCredentials awsCredentials = awsCreds.getCredentials(); if (accessId.equals(awsCredentials.getAWSAccessKeyId()) && Secret.toString(this.secretKey).equals(awsCredentials.getAWSSecretKey())) { this.credentialsId = awsCreds.getId(); this.accessId = null; this.secretKey = null; return this; } } } for (CredentialsStore credentialsStore: CredentialsProvider.lookupStores(Jenkins.get())) { if (credentialsStore instanceof SystemCredentialsProvider.StoreImpl) { try { String credsId = UUID.randomUUID().toString(); credentialsStore.addCredentials(Domain.global(), new AWSCredentialsImpl( CredentialsScope.SYSTEM, credsId, this.accessId, secretKeyEncryptedValue, "EC2 Cloud - " + getDisplayName())); this.credentialsId = credsId; this.accessId = null; this.secretKey = null; return this; } catch (IOException e) { this.credentialsId = null; LOGGER.log(Level.WARNING, "Exception converting legacy configuration to the new credentials API", e); } } } LOGGER.log(Level.WARNING, "EC2 Plugin could not migrate credentials to the Jenkins Global Credentials Store, EC2 Plugin for cloud {0} must be manually reconfigured", getDisplayName()); } return this; }