@@ -104,7 +104,7 @@ public class ScriptApproval extends GlobalConfiguration implements RootAction {
104104
105105 @ Override
106106 protected XmlFile getConfigFile () {
107- return new XmlFile (XSTREAM2 , new File (Jenkins .getInstance ().getRootDir (),getUrlName () + ".xml" ));
107+ return new XmlFile (XSTREAM2 , new File (Jenkins .get ().getRootDir (),getUrlName () + ".xml" ));
108108 }
109109
110110 @ Override
@@ -435,7 +435,7 @@ static String hashClasspathEntry(URL entry) throws IOException {
435435 public synchronized String configuring (@ NonNull String script , @ NonNull Language language , @ NonNull ApprovalContext context ) {
436436 final String hash = hash (script , language .getName ());
437437 if (!approvedScriptHashes .contains (hash )) {
438- if (!Jenkins .getInstance ().isUseSecurity () || Jenkins .getAuthentication () != ACL .SYSTEM && Jenkins .getInstance ().hasPermission (Jenkins .ADMINISTER )) {
438+ if (!Jenkins .get ().isUseSecurity () || Jenkins .getAuthentication () != ACL .SYSTEM && Jenkins .get ().hasPermission (Jenkins .ADMINISTER )) {
439439 approvedScriptHashes .add (hash );
440440 } else {
441441 String key = context .getKey ();
@@ -507,7 +507,7 @@ public synchronized void configuring(@NonNull ClasspathEntry entry, @NonNull App
507507 if (!approvedClasspathEntries .contains (acp )) {
508508 boolean shouldSave = false ;
509509 PendingClasspathEntry pcp = new PendingClasspathEntry (hash , url , context );
510- if (!Jenkins .getInstance ().isUseSecurity () || (Jenkins .getAuthentication () != ACL .SYSTEM && Jenkins .getInstance ().hasPermission (Jenkins .ADMINISTER ))) {
510+ if (!Jenkins .get ().isUseSecurity () || (Jenkins .getAuthentication () != ACL .SYSTEM && Jenkins .get ().hasPermission (Jenkins .ADMINISTER ))) {
511511 LOG .log (Level .FINE , "Classpath entry {0} ({1}) is approved as configured with ADMINISTER permission." , new Object [] {url , hash });
512512 pendingClasspathEntries .remove (pcp );
513513 approvedClasspathEntries .add (acp );
@@ -538,7 +538,7 @@ public synchronized FormValidation checking(@NonNull ClasspathEntry entry) {
538538 }
539539 URL url = entry .getURL ();
540540 try {
541- if (!Jenkins .getInstance ().hasPermission (Jenkins .ADMINISTER ) && !approvedClasspathEntries .contains (new ApprovedClasspathEntry (hashClasspathEntry (url ), url ))) {
541+ if (!Jenkins .get ().hasPermission (Jenkins .ADMINISTER ) && !approvedClasspathEntries .contains (new ApprovedClasspathEntry (hashClasspathEntry (url ), url ))) {
542542 return FormValidation .error (Messages .ClasspathEntry_path_notApproved ());
543543 } else {
544544 return FormValidation .ok ();
@@ -587,7 +587,7 @@ public synchronized void using(@NonNull ClasspathEntry entry) throws IOException
587587 * @return a warning in case the script is not yet approved and this user lacks {@link Jenkins#ADMINISTER}, else {@link FormValidation#ok()}
588588 */
589589 public synchronized FormValidation checking (@ NonNull String script , @ NonNull Language language ) {
590- if (!Jenkins .getInstance ().hasPermission (Jenkins .ADMINISTER ) && !approvedScriptHashes .contains (hash (script , language .getName ()))) {
590+ if (!Jenkins .get ().hasPermission (Jenkins .ADMINISTER ) && !approvedScriptHashes .contains (hash (script , language .getName ()))) {
591591 return FormValidation .warningWithMarkup ("A Jenkins administrator will need to approve this script before it can be used." );
592592 } else {
593593 return FormValidation .ok ();
@@ -657,7 +657,7 @@ public static void popRegistrationCallback() {
657657
658658 @ DataBoundSetter
659659 public synchronized void setApprovedSignatures (String [] signatures ) throws IOException {
660- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
660+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
661661 approvedSignatures .clear ();
662662 List <String > goodSignatures = new ArrayList <>(signatures .length );
663663 for (String signature : signatures ) {
@@ -750,7 +750,7 @@ public Set<PendingScript> getPendingScripts() {
750750
751751 @ Restricted (NoExternalUse .class ) // for use from AJAX
752752 @ JavaScriptMethod public void approveScript (String hash ) throws IOException {
753- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
753+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
754754 synchronized (this ) {
755755 approvedScriptHashes .add (hash );
756756 removePendingScript (hash );
@@ -768,7 +768,7 @@ public Set<PendingScript> getPendingScripts() {
768768
769769 @ Restricted (NoExternalUse .class ) // for use from AJAX
770770 @ JavaScriptMethod public synchronized void denyScript (String hash ) throws IOException {
771- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
771+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
772772 approvedScriptHashes .remove (hash );
773773 removePendingScript (hash );
774774 save ();
@@ -786,7 +786,7 @@ private synchronized void removePendingScript(String hash) {
786786
787787 @ Restricted (NoExternalUse .class ) // for use from AJAX
788788 @ JavaScriptMethod public synchronized void clearApprovedScripts () throws IOException {
789- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
789+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
790790 approvedScriptHashes .clear ();
791791 save ();
792792 }
@@ -808,7 +808,7 @@ private String[][] reconfigure() throws IOException {
808808
809809 @ Restricted (NoExternalUse .class ) // for use from AJAX
810810 @ JavaScriptMethod public synchronized String [][] approveSignature (String signature ) throws IOException {
811- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
811+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
812812 pendingSignatures .remove (new PendingSignature (signature , false , ApprovalContext .create ()));
813813 approvedSignatures .add (signature );
814814 save ();
@@ -817,7 +817,7 @@ private String[][] reconfigure() throws IOException {
817817
818818 @ Restricted (NoExternalUse .class ) // for use from AJAX
819819 @ JavaScriptMethod public synchronized String [][] aclApproveSignature (String signature ) throws IOException {
820- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
820+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
821821 pendingSignatures .remove (new PendingSignature (signature , false , ApprovalContext .create ()));
822822 aclApprovedSignatures .add (signature );
823823 save ();
@@ -826,15 +826,15 @@ private String[][] reconfigure() throws IOException {
826826
827827 @ Restricted (NoExternalUse .class ) // for use from AJAX
828828 @ JavaScriptMethod public synchronized void denySignature (String signature ) throws IOException {
829- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
829+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
830830 pendingSignatures .remove (new PendingSignature (signature , false , ApprovalContext .create ()));
831831 save ();
832832 }
833833
834834 // TODO nicer would be to allow the user to actually edit the list directly (with syntax checks)
835835 @ Restricted (NoExternalUse .class ) // for use from AJAX
836836 @ JavaScriptMethod public synchronized String [][] clearApprovedSignatures () throws IOException {
837- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
837+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
838838 approvedSignatures .clear ();
839839 aclApprovedSignatures .clear ();
840840 save ();
@@ -844,7 +844,7 @@ private String[][] reconfigure() throws IOException {
844844
845845 @ Restricted (NoExternalUse .class ) // for use from AJAX
846846 @ JavaScriptMethod public synchronized String [][] clearDangerousApprovedSignatures () throws IOException {
847- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
847+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
848848
849849 Iterator <String > it = approvedSignatures .iterator ();
850850 while (it .hasNext ()) {
@@ -895,7 +895,7 @@ public JSON getClasspathRenderInfo() {
895895 @ Restricted (NoExternalUse .class ) // for use from AJAX
896896 @ JavaScriptMethod
897897 public JSON approveClasspathEntry (String hash ) throws IOException {
898- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
898+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
899899 URL url = null ;
900900 synchronized (this ) {
901901 final PendingClasspathEntry cp = getPendingClasspathEntry (hash );
@@ -922,7 +922,7 @@ public JSON approveClasspathEntry(String hash) throws IOException {
922922 @ Restricted (NoExternalUse .class ) // for use from AJAX
923923 @ JavaScriptMethod
924924 public JSON denyClasspathEntry (String hash ) throws IOException {
925- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
925+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
926926 PendingClasspathEntry cp = getPendingClasspathEntry (hash );
927927 if (cp != null ) {
928928 pendingClasspathEntries .remove (cp );
@@ -934,7 +934,7 @@ public JSON denyClasspathEntry(String hash) throws IOException {
934934 @ Restricted (NoExternalUse .class ) // for use from AJAX
935935 @ JavaScriptMethod
936936 public JSON denyApprovedClasspathEntry (String hash ) throws IOException {
937- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
937+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
938938 if (approvedClasspathEntries .remove (new ApprovedClasspathEntry (hash , null ))) {
939939 save ();
940940 }
@@ -944,7 +944,7 @@ public JSON denyApprovedClasspathEntry(String hash) throws IOException {
944944 @ Restricted (NoExternalUse .class ) // for use from AJAX
945945 @ JavaScriptMethod
946946 public synchronized JSON clearApprovedClasspathEntries () throws IOException {
947- Jenkins .getInstance ().checkPermission (Jenkins .ADMINISTER );
947+ Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
948948 approvedClasspathEntries .clear ();
949949 save ();
950950 return getClasspathRenderInfo ();
0 commit comments