if (credentials != null && !credentials.isEmpty()) {
SecurityContext oldContext = ACL.impersonate(ACL.SYSTEM);
try {
BulkChange bc = new BulkChange(this);
try {
<BUG>mayHaveLegacyPerJobCredentials = true;
for (Map.Entry<String, Credential> e : credentials.entrySet()) {
migrateCredentials(Jenkins.getInstance(), e.getKey(), e.getValue());
</BUG>
}

if (credentials != null && !credentials.isEmpty()) {
SecurityContext oldContext = ACL.impersonate(ACL.SYSTEM);
try {
BulkChange bc = new BulkChange(this);
try {
mayHaveLegacyPerJobCredentials = true;
CredentialsStore store = CredentialsProvider.lookupStores(Jenkins.getInstance()).iterator().next();
for (Map.Entry<String, Credential> e : credentials.entrySet()) {
migrateCredentials(store, e.getKey(), e.getValue());
}
