6
6
import java .io .FileOutputStream ;
7
7
import java .io .IOException ;
8
8
import java .net .InetAddress ;
9
- import java .text .MessageFormat ;
10
9
import java .util .ArrayList ;
11
10
import java .util .Arrays ;
12
11
import java .util .Collection ;
@@ -99,8 +98,7 @@ public void run() {
99
98
FederationPullStatus is = registration .getLowestStatus ();
100
99
if (is .ordinal () < was .ordinal ()) {
101
100
// 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 ());
104
102
if (registration .notifyOnError ) {
105
103
String message = "Federation pull of " + registration .name + " @ "
106
104
+ registration .url + " is now at " + is .name ();
@@ -110,9 +108,7 @@ public void run() {
110
108
}
111
109
}
112
110
} 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 );
116
112
} finally {
117
113
reschedule (registration );
118
114
}
@@ -133,9 +129,8 @@ private void pull(FederationModel registration) throws Exception {
133
129
// confirm valid characters in server alias
134
130
Character c = StringUtils .findInvalidCharacter (registrationFolder );
135
131
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 );
139
134
return ;
140
135
}
141
136
File repositoriesFolder = gitblit .getRepositoriesFolder ();
@@ -147,9 +142,8 @@ private void pull(FederationModel registration) throws Exception {
147
142
String cloneUrl = entry .getKey ();
148
143
RepositoryModel repository = entry .getValue ();
149
144
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 );
153
147
registration .updateStatus (repository , FederationPullStatus .SKIPPED );
154
148
continue ;
155
149
}
@@ -181,7 +175,7 @@ private void pull(FederationModel registration) throws Exception {
181
175
Repository existingRepository = gitblit .getRepository (repositoryName );
182
176
183
177
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 );
185
179
continue ;
186
180
}
187
181
@@ -196,9 +190,8 @@ private void pull(FederationModel registration) throws Exception {
196
190
}
197
191
existingRepository .close ();
198
192
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 );
202
195
registration .updateStatus (repository , FederationPullStatus .SKIPPED );
203
196
continue ;
204
197
}
@@ -207,8 +200,7 @@ private void pull(FederationModel registration) throws Exception {
207
200
// clone/pull this repository
208
201
CredentialsProvider credentials = new UsernamePasswordCredentialsProvider (
209
202
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 );
212
204
213
205
CloneResult result = JGitUtils .cloneRepository (registrationFolderFile , repository .name ,
214
206
cloneUrl , registration .bare , credentials );
@@ -220,7 +212,7 @@ private void pull(FederationModel registration) throws Exception {
220
212
repository .federationStrategy = FederationStrategy .EXCLUDE ;
221
213
repository .isFrozen = registration .mirror ;
222
214
repository .showRemoteBranches = !registration .mirror ;
223
- logger .info (MessageFormat . format ( " cloning {0 }" , repository .name ) );
215
+ logger .info (" cloning {}" , repository .name );
224
216
registration .updateStatus (repository , FederationPullStatus .MIRRORED );
225
217
} else {
226
218
// fetch and update
@@ -240,8 +232,7 @@ private void pull(FederationModel registration) throws Exception {
240
232
String hash = ref .getReferencedObjectId ().getName ();
241
233
242
234
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 );
245
236
}
246
237
}
247
238
@@ -252,8 +243,7 @@ private void pull(FederationModel registration) throws Exception {
252
243
newHead = repository .HEAD ;
253
244
}
254
245
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 );
257
247
registration .updateStatus (repository , FederationPullStatus .MIRRORED );
258
248
} else {
259
249
// indicate no commits pulled
@@ -401,9 +391,7 @@ private void pull(FederationModel registration) throws Exception {
401
391
} catch (ForbiddenException e ) {
402
392
// ignore forbidden exceptions
403
393
} 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 );
407
395
}
408
396
409
397
try {
@@ -422,9 +410,7 @@ private void pull(FederationModel registration) throws Exception {
422
410
} catch (ForbiddenException e ) {
423
411
// ignore forbidden exceptions
424
412
} 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 );
428
414
}
429
415
430
416
try {
@@ -441,9 +427,7 @@ private void pull(FederationModel registration) throws Exception {
441
427
} catch (ForbiddenException e ) {
442
428
// ignore forbidden exceptions
443
429
} 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 );
447
431
}
448
432
449
433
try {
@@ -463,9 +447,7 @@ private void pull(FederationModel registration) throws Exception {
463
447
} catch (ForbiddenException e ) {
464
448
// ignore forbidden exceptions
465
449
} 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 );
469
451
}
470
452
}
471
453
@@ -487,6 +469,6 @@ private void sendStatusAcknowledgment(FederationModel registration) throws Excep
487
469
federationName = addr .getHostName ();
488
470
}
489
471
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 );
491
473
}
492
474
}
0 commit comments