diff --git a/src/main/java/hudson/scm/SubversionChangeLogBuilder.java b/src/main/java/hudson/scm/SubversionChangeLogBuilder.java index a22cee281..f23af3429 100644 --- a/src/main/java/hudson/scm/SubversionChangeLogBuilder.java +++ b/src/main/java/hudson/scm/SubversionChangeLogBuilder.java @@ -29,7 +29,6 @@ import hudson.scm.SubversionSCM.ModuleLocation; import hudson.FilePath; import hudson.remoting.VirtualChannel; -import hudson.FilePath.FileCallable; import hudson.model.Run; import hudson.model.TaskListener; import org.kohsuke.accmod.Restricted; @@ -234,7 +233,7 @@ private static TransformerHandler createTransformerHandler() { private static final LocatorImpl DUMMY_LOCATOR = new LocatorImpl(); - @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "MS_SHOULD_BE_FINAL", + @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Debugging environment variable is made editable, so it can be modified through the groovy console.") public static boolean debug = false; diff --git a/src/main/java/hudson/scm/SubversionSCM.java b/src/main/java/hudson/scm/SubversionSCM.java index 8b859ab72..a5743f4d6 100755 --- a/src/main/java/hudson/scm/SubversionSCM.java +++ b/src/main/java/hudson/scm/SubversionSCM.java @@ -3130,7 +3130,7 @@ public String getDisplayName() { } public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String remote) { - if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || + if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } @@ -3194,7 +3194,7 @@ public FormValidation doCheckCredentialsId(StaplerRequest req, @AncestorInPath I @QueryParameter String remote, @QueryParameter String value) { // Test the connection only if we may use the credentials (cf. hudson.plugins.git.UserRemoteConfig.DescriptorImpl.doCheckUrl) - if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || + if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(CredentialsProvider.USE_ITEM)) { return FormValidation.ok(); } @@ -3417,7 +3417,7 @@ public String getDisplayName() { public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String realm) { - if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || + if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } diff --git a/src/main/java/hudson/scm/browsers/Sventon.java b/src/main/java/hudson/scm/browsers/Sventon.java index a0b42f698..958d0201b 100644 --- a/src/main/java/hudson/scm/browsers/Sventon.java +++ b/src/main/java/hudson/scm/browsers/Sventon.java @@ -100,7 +100,7 @@ public String getDisplayName() { public FormValidation doCheckUrl(@AncestorInPath Item project, @QueryParameter(fixEmpty=true) final String value) throws IOException, ServletException { - if (project == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || + if (project == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || project != null && !project.hasPermission(Item.EXTENDED_READ)) { return FormValidation.ok(); } diff --git a/src/main/java/hudson/scm/browsers/Sventon2.java b/src/main/java/hudson/scm/browsers/Sventon2.java index 4a1bd94d4..f2b6861bb 100644 --- a/src/main/java/hudson/scm/browsers/Sventon2.java +++ b/src/main/java/hudson/scm/browsers/Sventon2.java @@ -121,7 +121,7 @@ public String getDisplayName() { public FormValidation doCheckUrl(@AncestorInPath Item project, @QueryParameter(fixEmpty=true) final String value) throws IOException, ServletException { - if (project == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || + if (project == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || project != null && !project.hasPermission(Item.EXTENDED_READ)) { return FormValidation.ok(); } diff --git a/src/main/java/hudson/scm/subversion/UpdateUpdater.java b/src/main/java/hudson/scm/subversion/UpdateUpdater.java index da502169a..a65f7e4d2 100755 --- a/src/main/java/hudson/scm/subversion/UpdateUpdater.java +++ b/src/main/java/hudson/scm/subversion/UpdateUpdater.java @@ -30,7 +30,6 @@ import hudson.Extension; import hudson.scm.SubversionSCM.External; import hudson.scm.SubversionSCM.ModuleLocation; -import hudson.scm.SubversionSCM.SvnInfo; import hudson.triggers.SCMTrigger; import jenkins.model.Jenkins; import org.apache.commons.lang.time.FastDateFormat; @@ -200,7 +199,7 @@ public List perform() throws IOException, InterruptedException { } // trouble-shooting probe for #591 if (errorCode == SVNErrorCode.WC_NOT_LOCKED) { - Jenkins instance = Jenkins.getInstance(); + Jenkins instance = Jenkins.getInstanceOrNull(); if (instance != null) { listener.getLogger().println("Polled jobs are " + instance.getDescriptorByType(SCMTrigger.DescriptorImpl.class).getItemsBeingPolled()); } diff --git a/src/main/java/jenkins/scm/impl/subversion/SubversionSCMSource.java b/src/main/java/jenkins/scm/impl/subversion/SubversionSCMSource.java index ce6bcc995..c5244e372 100644 --- a/src/main/java/jenkins/scm/impl/subversion/SubversionSCMSource.java +++ b/src/main/java/jenkins/scm/impl/subversion/SubversionSCMSource.java @@ -800,7 +800,7 @@ public String getDisplayName() { public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String remoteBase, @QueryParameter String credentialsId) { - if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || + if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel().includeCurrentValue(credentialsId); } @@ -829,7 +829,7 @@ public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, public FormValidation doCheckCredentialsId(StaplerRequest req, @AncestorInPath Item context, @QueryParameter String remoteBase, @QueryParameter String value) { // TODO suspiciously similar to SubversionSCM.ModuleLocation.DescriptorImpl.checkCredentialsId; refactor into shared method? // Test the connection only if we may use the credentials - if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || + if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(CredentialsProvider.USE_ITEM)) { return FormValidation.ok(); } diff --git a/src/test/java/hudson/scm/SubversionRepositoryStatusTest.java b/src/test/java/hudson/scm/SubversionRepositoryStatusTest.java index 4c2ebf4b9..ab5635122 100644 --- a/src/test/java/hudson/scm/SubversionRepositoryStatusTest.java +++ b/src/test/java/hudson/scm/SubversionRepositoryStatusTest.java @@ -8,23 +8,16 @@ import hudson.model.Job; import hudson.scm.SubversionRepositoryStatus.JobProvider; -import java.io.BufferedReader; import java.io.IOException; -import java.io.StringReader; import java.util.Collections; -import java.util.List; import java.util.Set; import java.util.UUID; import javax.servlet.ServletException; import org.junit.Test; -import org.junit.After; import org.junit.Assert; -import org.junit.Before; -import org.jvnet.hudson.test.Bug; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; +import org.jvnet.hudson.test.Issue; /** * @author kutzi @@ -33,7 +26,7 @@ public class SubversionRepositoryStatusTest { @SuppressWarnings("rawtypes") @Test - @Bug(15794) + @Issue("JENKINS-15794") public void shouldIgnoreDisabledJobs() throws ServletException, IOException { SubversionRepositoryStatus.JobTriggerListenerImpl listener = new SubversionRepositoryStatus.JobTriggerListenerImpl(); diff --git a/src/test/java/hudson/scm/SubversionSCMUnitTest.java b/src/test/java/hudson/scm/SubversionSCMUnitTest.java index 5b9289740..a3e281124 100644 --- a/src/test/java/hudson/scm/SubversionSCMUnitTest.java +++ b/src/test/java/hudson/scm/SubversionSCMUnitTest.java @@ -20,7 +20,7 @@ import org.junit.Assert; import org.junit.Test; -import org.jvnet.hudson.test.Bug; +import org.jvnet.hudson.test.Issue; /** * Unit tests for {@link SubversionSCM}. @@ -32,7 +32,7 @@ public class SubversionSCMUnitTest { @Test - @Bug(12113) + @Issue("JENKINS-12113") public void testLocalDirectoryIsExpandedWithEnvVars() { FilePath root = new FilePath((VirtualChannel)null, "root"); diff --git a/src/test/java/hudson/scm/SvnHelperTest.java b/src/test/java/hudson/scm/SvnHelperTest.java index b53d030e6..a5cdb28c7 100644 --- a/src/test/java/hudson/scm/SvnHelperTest.java +++ b/src/test/java/hudson/scm/SvnHelperTest.java @@ -26,7 +26,7 @@ import hudson.scm.subversion.SvnHelper; import org.junit.Assert; import org.junit.Test; -import org.jvnet.hudson.test.Bug; +import org.jvnet.hudson.test.Issue; /** * Contains tests for {@link SvnHelper}. @@ -66,7 +66,7 @@ public void testGetUrlWithoutRevision_withEndingSlash() { } @Test - @Bug(20344) + @Issue("JENKINS-20344") public void testGetUrlWithoutRevision_withSlashAndSuffix() { testGetUrlWithoutRevision(URL_PREFIX+"/@HEAD"); testGetUrlWithoutRevision(URL_PREFIX+"//@HEAD"); diff --git a/src/test/java/hudson/scm/listtagsparameter/ListSubversionTagsParameterValueTest.java b/src/test/java/hudson/scm/listtagsparameter/ListSubversionTagsParameterValueTest.java index 7e579dfb1..a28546414 100644 --- a/src/test/java/hudson/scm/listtagsparameter/ListSubversionTagsParameterValueTest.java +++ b/src/test/java/hudson/scm/listtagsparameter/ListSubversionTagsParameterValueTest.java @@ -1,7 +1,7 @@ package hudson.scm.listtagsparameter; import org.junit.Test; -import org.jvnet.hudson.test.Bug; +import org.jvnet.hudson.test.Issue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -17,7 +17,7 @@ public class ListSubversionTagsParameterValueTest { * Since we are overriding the equals method, we should write a test unit. */ @Test - @Bug(18534) + @Issue("JENKINS-18534") public void testEquality() { ListSubversionTagsParameterValue parameterValue = new ListSubversionTagsParameterValue(expectedName, expectedTag, @@ -61,7 +61,7 @@ public void testEquality() { * Since we are overriding the hashcode method, we should write a test unit. */ @Test - @Bug(18534) + @Issue("JENKINS-18534") public void testHashCode() { ListSubversionTagsParameterValue parameterValue = new ListSubversionTagsParameterValue(expectedName, expectedTag,