66import java .io .FileOutputStream ;
77import java .io .IOException ;
88import java .net .InetAddress ;
9- import java .text .MessageFormat ;
109import java .util .ArrayList ;
1110import java .util .Arrays ;
1211import java .util .Collection ;
@@ -99,8 +98,7 @@ public void run() {
9998 FederationPullStatus is = registration .getLowestStatus ();
10099 if (is .ordinal () < was .ordinal ()) {
101100 // the status for this registration has downgraded
102- logger .warn ("Federation pull status of {0} is now {1}" , registration .name ,
103- is .name ());
101+ logger .warn ("Federation pull status of {} is now {}" , registration .name , is .name ());
104102 if (registration .notifyOnError ) {
105103 String message = "Federation pull of " + registration .name + " @ "
106104 + registration .url + " is now at " + is .name ();
@@ -110,9 +108,7 @@ public void run() {
110108 }
111109 }
112110 } catch (Throwable t ) {
113- logger .error (MessageFormat .format (
114- "Failed to pull from federated gitblit ({0} @ {1})" , registration .name ,
115- registration .url ), t );
111+ logger .error ("Failed to pull from federated gitblit ({} @ {})" , registration .name , registration .url , t );
116112 } finally {
117113 reschedule (registration );
118114 }
@@ -133,9 +129,8 @@ private void pull(FederationModel registration) throws Exception {
133129 // confirm valid characters in server alias
134130 Character c = StringUtils .findInvalidCharacter (registrationFolder );
135131 if (c != null ) {
136- logger .error (MessageFormat
137- .format ("Illegal character ''{0}'' in folder name ''{1}'' of federation registration {2}!" ,
138- c , registrationFolder , registration .name ));
132+ logger .error ("Illegal character '{}' in folder name '{}' of federation registration {}!" ,
133+ c , registrationFolder , registration .name );
139134 return ;
140135 }
141136 File repositoriesFolder = gitblit .getRepositoriesFolder ();
@@ -147,9 +142,8 @@ private void pull(FederationModel registration) throws Exception {
147142 String cloneUrl = entry .getKey ();
148143 RepositoryModel repository = entry .getValue ();
149144 if (!repository .hasCommits ) {
150- logger .warn (MessageFormat .format (
151- "Skipping federated repository {0} from {1} @ {2}. Repository is EMPTY." ,
152- repository .name , registration .name , registration .url ));
145+ logger .warn ("Skipping federated repository {} from {} @ {}. Repository is EMPTY." ,
146+ repository .name , registration .name , registration .url );
153147 registration .updateStatus (repository , FederationPullStatus .SKIPPED );
154148 continue ;
155149 }
@@ -181,7 +175,7 @@ private void pull(FederationModel registration) throws Exception {
181175 Repository existingRepository = gitblit .getRepository (repositoryName );
182176
183177 if (existingRepository == null && gitblit .isCollectingGarbage (repositoryName )) {
184- logger .warn (MessageFormat . format ( "Skipping local repository {0 }, busy collecting garbage" , repositoryName ) );
178+ logger .warn ("Skipping local repository {}, busy collecting garbage" , repositoryName );
185179 continue ;
186180 }
187181
@@ -196,9 +190,8 @@ private void pull(FederationModel registration) throws Exception {
196190 }
197191 existingRepository .close ();
198192 if (!origin .startsWith (registration .url )) {
199- logger .warn (MessageFormat
200- .format ("Skipping federated repository {0} from {1} @ {2}. Origin does not match, consider EXCLUDING." ,
201- repository .name , registration .name , registration .url ));
193+ logger .warn ("Skipping federated repository {} from {} @ {}. Origin does not match, consider EXCLUDING." ,
194+ repository .name , registration .name , registration .url );
202195 registration .updateStatus (repository , FederationPullStatus .SKIPPED );
203196 continue ;
204197 }
@@ -207,8 +200,7 @@ private void pull(FederationModel registration) throws Exception {
207200 // clone/pull this repository
208201 CredentialsProvider credentials = new UsernamePasswordCredentialsProvider (
209202 Constants .FEDERATION_USER , registration .token );
210- logger .info (MessageFormat .format ("Pulling federated repository {0} from {1} @ {2}" ,
211- repository .name , registration .name , registration .url ));
203+ logger .info ("Pulling federated repository {} from {} @ {}" , repository .name , registration .name , registration .url );
212204
213205 CloneResult result = JGitUtils .cloneRepository (registrationFolderFile , repository .name ,
214206 cloneUrl , registration .bare , credentials );
@@ -220,7 +212,7 @@ private void pull(FederationModel registration) throws Exception {
220212 repository .federationStrategy = FederationStrategy .EXCLUDE ;
221213 repository .isFrozen = registration .mirror ;
222214 repository .showRemoteBranches = !registration .mirror ;
223- logger .info (MessageFormat . format ( " cloning {0 }" , repository .name ) );
215+ logger .info (" cloning {}" , repository .name );
224216 registration .updateStatus (repository , FederationPullStatus .MIRRORED );
225217 } else {
226218 // fetch and update
@@ -240,8 +232,7 @@ private void pull(FederationModel registration) throws Exception {
240232 String hash = ref .getReferencedObjectId ().getName ();
241233
242234 JGitUtils .setBranchRef (r , branch , hash );
243- logger .info (MessageFormat .format (" resetting {0} of {1} to {2}" , branch ,
244- repository .name , hash ));
235+ logger .info (" resetting {} of {} to {}" , branch , repository .name , hash );
245236 }
246237 }
247238
@@ -252,8 +243,7 @@ private void pull(FederationModel registration) throws Exception {
252243 newHead = repository .HEAD ;
253244 }
254245 JGitUtils .setHEADtoRef (r , newHead );
255- logger .info (MessageFormat .format (" resetting HEAD of {0} to {1}" ,
256- repository .name , newHead ));
246+ logger .info (" resetting HEAD of {} to {}" , repository .name , newHead );
257247 registration .updateStatus (repository , FederationPullStatus .MIRRORED );
258248 } else {
259249 // indicate no commits pulled
@@ -401,9 +391,7 @@ private void pull(FederationModel registration) throws Exception {
401391 } catch (ForbiddenException e ) {
402392 // ignore forbidden exceptions
403393 } catch (IOException e ) {
404- logger .warn (MessageFormat .format (
405- "Failed to retrieve USERS from federated gitblit ({0} @ {1})" ,
406- registration .name , registration .url ), e );
394+ logger .warn ("Failed to retrieve USERS from federated gitblit ({} @ {})" , registration .name , registration .url , e );
407395 }
408396
409397 try {
@@ -422,9 +410,7 @@ private void pull(FederationModel registration) throws Exception {
422410 } catch (ForbiddenException e ) {
423411 // ignore forbidden exceptions
424412 } catch (IOException e ) {
425- logger .warn (MessageFormat .format (
426- "Failed to retrieve TEAMS from federated gitblit ({0} @ {1})" ,
427- registration .name , registration .url ), e );
413+ logger .warn ("Failed to retrieve TEAMS from federated gitblit ({} @ {})" , registration .name , registration .url , e );
428414 }
429415
430416 try {
@@ -441,9 +427,7 @@ private void pull(FederationModel registration) throws Exception {
441427 } catch (ForbiddenException e ) {
442428 // ignore forbidden exceptions
443429 } catch (IOException e ) {
444- logger .warn (MessageFormat .format (
445- "Failed to retrieve SETTINGS from federated gitblit ({0} @ {1})" ,
446- registration .name , registration .url ), e );
430+ logger .warn ("Failed to retrieve SETTINGS from federated gitblit ({} @ {})" , registration .name , registration .url , e );
447431 }
448432
449433 try {
@@ -463,9 +447,7 @@ private void pull(FederationModel registration) throws Exception {
463447 } catch (ForbiddenException e ) {
464448 // ignore forbidden exceptions
465449 } catch (IOException e ) {
466- logger .warn (MessageFormat .format (
467- "Failed to retrieve SCRIPTS from federated gitblit ({0} @ {1})" ,
468- registration .name , registration .url ), e );
450+ logger .warn ("Failed to retrieve SCRIPTS from federated gitblit ({} @ {})" , registration .name , registration .url , e );
469451 }
470452 }
471453
@@ -487,6 +469,6 @@ private void sendStatusAcknowledgment(FederationModel registration) throws Excep
487469 federationName = addr .getHostName ();
488470 }
489471 FederationUtils .acknowledgeStatus (addr .getHostAddress (), registration );
490- logger .info (MessageFormat . format ( "Pull status sent to {0 }" , registration .url ) );
472+ logger .info ("Pull status sent to {}" , registration .url );
491473 }
492474}
0 commit comments