import java.io.FileOutputStream;
import java.io.IOException;
import java.net.InetAddress;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
FederationPullStatus is = registration.getLowestStatus();
if (is.ordinal() < was.ordinal()) {
// the status for this registration has downgraded
- logger.warn("Federation pull status of {0} is now {1}", registration.name,
- is.name());
+ logger.warn("Federation pull status of {} is now {}", registration.name, is.name());
if (registration.notifyOnError) {
String message = "Federation pull of " + registration.name + " @ "
+ registration.url + " is now at " + is.name();
}
}
} catch (Throwable t) {
- logger.error(MessageFormat.format(
- "Failed to pull from federated gitblit ({0} @ {1})", registration.name,
- registration.url), t);
+ logger.error("Failed to pull from federated gitblit ({} @ {})", registration.name, registration.url, t);
} finally {
reschedule(registration);
}
// confirm valid characters in server alias
Character c = StringUtils.findInvalidCharacter(registrationFolder);
if (c != null) {
- logger.error(MessageFormat
- .format("Illegal character ''{0}'' in folder name ''{1}'' of federation registration {2}!",
- c, registrationFolder, registration.name));
+ logger.error("Illegal character '{}' in folder name '{}' of federation registration {}!",
+ c, registrationFolder, registration.name);
return;
}
File repositoriesFolder = gitblit.getRepositoriesFolder();
String cloneUrl = entry.getKey();
RepositoryModel repository = entry.getValue();
if (!repository.hasCommits) {
- logger.warn(MessageFormat.format(
- "Skipping federated repository {0} from {1} @ {2}. Repository is EMPTY.",
- repository.name, registration.name, registration.url));
+ logger.warn("Skipping federated repository {} from {} @ {}. Repository is EMPTY.",
+ repository.name, registration.name, registration.url);
registration.updateStatus(repository, FederationPullStatus.SKIPPED);
continue;
}
Repository existingRepository = gitblit.getRepository(repositoryName);
if (existingRepository == null && gitblit.isCollectingGarbage(repositoryName)) {
- logger.warn(MessageFormat.format("Skipping local repository {0}, busy collecting garbage", repositoryName));
+ logger.warn("Skipping local repository {}, busy collecting garbage", repositoryName);
continue;
}
}
existingRepository.close();
if (!origin.startsWith(registration.url)) {
- logger.warn(MessageFormat
- .format("Skipping federated repository {0} from {1} @ {2}. Origin does not match, consider EXCLUDING.",
- repository.name, registration.name, registration.url));
+ logger.warn("Skipping federated repository {} from {} @ {}. Origin does not match, consider EXCLUDING.",
+ repository.name, registration.name, registration.url);
registration.updateStatus(repository, FederationPullStatus.SKIPPED);
continue;
}
// clone/pull this repository
CredentialsProvider credentials = new UsernamePasswordCredentialsProvider(
Constants.FEDERATION_USER, registration.token);
- logger.info(MessageFormat.format("Pulling federated repository {0} from {1} @ {2}",
- repository.name, registration.name, registration.url));
+ logger.info("Pulling federated repository {} from {} @ {}", repository.name, registration.name, registration.url);
CloneResult result = JGitUtils.cloneRepository(registrationFolderFile, repository.name,
cloneUrl, registration.bare, credentials);
repository.federationStrategy = FederationStrategy.EXCLUDE;
repository.isFrozen = registration.mirror;
repository.showRemoteBranches = !registration.mirror;
- logger.info(MessageFormat.format(" cloning {0}", repository.name));
+ logger.info(" cloning {}", repository.name);
registration.updateStatus(repository, FederationPullStatus.MIRRORED);
} else {
// fetch and update
String hash = ref.getReferencedObjectId().getName();
JGitUtils.setBranchRef(r, branch, hash);
- logger.info(MessageFormat.format(" resetting {0} of {1} to {2}", branch,
- repository.name, hash));
+ logger.info(" resetting {} of {} to {}", branch, repository.name, hash);
}
}
newHead = repository.HEAD;
}
JGitUtils.setHEADtoRef(r, newHead);
- logger.info(MessageFormat.format(" resetting HEAD of {0} to {1}",
- repository.name, newHead));
+ logger.info(" resetting HEAD of {} to {}", repository.name, newHead);
registration.updateStatus(repository, FederationPullStatus.MIRRORED);
} else {
// indicate no commits pulled
} catch (ForbiddenException e) {
// ignore forbidden exceptions
} catch (IOException e) {
- logger.warn(MessageFormat.format(
- "Failed to retrieve USERS from federated gitblit ({0} @ {1})",
- registration.name, registration.url), e);
+ logger.warn("Failed to retrieve USERS from federated gitblit ({} @ {})", registration.name, registration.url, e);
}
try {
} catch (ForbiddenException e) {
// ignore forbidden exceptions
} catch (IOException e) {
- logger.warn(MessageFormat.format(
- "Failed to retrieve TEAMS from federated gitblit ({0} @ {1})",
- registration.name, registration.url), e);
+ logger.warn("Failed to retrieve TEAMS from federated gitblit ({} @ {})", registration.name, registration.url, e);
}
try {
} catch (ForbiddenException e) {
// ignore forbidden exceptions
} catch (IOException e) {
- logger.warn(MessageFormat.format(
- "Failed to retrieve SETTINGS from federated gitblit ({0} @ {1})",
- registration.name, registration.url), e);
+ logger.warn("Failed to retrieve SETTINGS from federated gitblit ({} @ {})", registration.name, registration.url, e);
}
try {
} catch (ForbiddenException e) {
// ignore forbidden exceptions
} catch (IOException e) {
- logger.warn(MessageFormat.format(
- "Failed to retrieve SCRIPTS from federated gitblit ({0} @ {1})",
- registration.name, registration.url), e);
+ logger.warn("Failed to retrieve SCRIPTS from federated gitblit ({} @ {})", registration.name, registration.url, e);
}
}
federationName = addr.getHostName();
}
FederationUtils.acknowledgeStatus(addr.getHostAddress(), registration);
- logger.info(MessageFormat.format("Pull status sent to {0}", registration.url));
+ logger.info("Pull status sent to {}", registration.url);
}
}
\ No newline at end of file
*/\r
package com.gitblit.service;\r
\r
-import java.text.MessageFormat;\r
import java.util.Calendar;\r
import java.util.Date;\r
import java.util.Map;\r
break;\r
}\r
if (isCollectingGarbage(repositoryName)) {\r
- logger.warn(MessageFormat.format("Already collecting garbage from {0}?!?", repositoryName));\r
+ logger.warn("Already collecting garbage from {}?!?", repositoryName);\r
continue;\r
}\r
boolean garbageCollected = false;\r
model = repositoryManager.getRepositoryModel(repositoryName);\r
repository = repositoryManager.getRepository(repositoryName);\r
if (repository == null) {\r
- logger.warn(MessageFormat.format("GCExecutor is missing repository {0}?!?", repositoryName));\r
+ logger.warn("GCExecutor is missing repository {}?!?", repositoryName);\r
continue;\r
}\r
\r
if (!repositoryManager.isIdle(repository)) {\r
- logger.debug(MessageFormat.format("GCExecutor is skipping {0} because it is not idle", repositoryName));\r
+ logger.debug("GCExecutor is skipping {} because it is not idle", repositoryName);\r
continue;\r
}\r
\r
// disabling *all* access to this repository from Gitblit.\r
// Think of this as a clutch in a manual transmission vehicle.\r
if (!setGCStatus(repositoryName, GCStatus.COLLECTING)) {\r
- logger.warn(MessageFormat.format("Can not acquire GC lock for {0}, skipping", repositoryName));\r
+ logger.warn("Can not acquire GC lock for {}, skipping", repositoryName);\r
continue;\r
}\r
\r
- logger.debug(MessageFormat.format("GCExecutor locked idle repository {0}", repositoryName));\r
+ logger.debug("GCExecutor locked idle repository {}", repositoryName);\r
\r
Git git = new Git(repository);\r
GarbageCollectCommand gc = git.gc();\r
boolean hasGarbage = sizeOfLooseObjects > 0;\r
if (hasGarbage && (hasEnoughGarbage || shouldCollectGarbage)) {\r
long looseKB = sizeOfLooseObjects/1024L;\r
- logger.info(MessageFormat.format("Collecting {1} KB of loose objects from {0}", repositoryName, looseKB));\r
+ logger.info("Collecting {} KB of loose objects from {}", looseKB, repositoryName );\r
\r
// do the deed\r
gc.call();\r
garbageCollected = true;\r
}\r
} catch (Exception e) {\r
- logger.error("Error collecting garbage in " + repositoryName, e);\r
+ logger.error("Error collecting garbage in {}", repositoryName, e);\r
} finally {\r
// cleanup\r
if (repository != null) {\r
\r
// reset the GC lock\r
releaseLock(repositoryName);\r
- logger.debug(MessageFormat.format("GCExecutor released GC lock for {0}", repositoryName));\r
+ logger.debug("GCExecutor released GC lock for {}", repositoryName);\r
}\r
}\r
\r
Repository repository = repositoryManager.getRepository(model.name);\r
if (repository == null) {\r
if (repositoryManager.isCollectingGarbage(model.name)) {\r
- logger.info(MessageFormat.format("Skipping Lucene index of {0}, busy garbage collecting", repositoryName));\r
+ logger.info("Skipping Lucene index of {}, busy garbage collecting", repositoryName);\r
}\r
continue;\r
}\r
\r
if (result.success) {\r
if (result.commitCount > 0) {\r
- String msg = "Built {0} Lucene index from {1} commits and {2} files across {3} branches in {4} secs";\r
- logger.info(MessageFormat.format(msg, model.name, result.commitCount,\r
- result.blobCount, result.branchCount, result.duration()));\r
+ logger.info("Built {} Lucene index from {} commits and {} files across {} branches in {} secs",\r
+ model.name, result.commitCount, result.blobCount, result.branchCount, result.duration());\r
}\r
} else {\r
String msg = "Could not build {0} Lucene index!";\r
IndexResult result = updateIndex(model, repository);\r
if (result.success) {\r
if (result.commitCount > 0) {\r
- String msg = "Updated {0} Lucene index with {1} commits and {2} files across {3} branches in {4} secs";\r
- logger.info(MessageFormat.format(msg, model.name, result.commitCount,\r
- result.blobCount, result.branchCount, result.duration()));\r
+ logger.info("Updated {} Lucene index with {} commits and {} files across {} branches in {} secs",\r
+ model.name, result.commitCount, result.blobCount, result.branchCount, result.duration());\r
}\r
} else {\r
- String msg = "Could not update {0} Lucene index!";\r
- logger.error(MessageFormat.format(msg, model.name));\r
+ logger.error("Could not update {} Lucene index!", model.name);\r
}\r
}\r
} catch (Throwable t) {\r
- logger.error(MessageFormat.format("Lucene indexing failure for {0}", model.name), t);\r
+ logger.error("Lucene indexing failure for {}", model.name, t);\r
}\r
}\r
\r
searcher.getIndexReader().close();\r
}\r
} catch (Exception e) {\r
- logger.error("Failed to close index searcher for " + repositoryName, e);\r
+ logger.error("Failed to close index searcher for {}", repositoryName, e);\r
}\r
\r
try {\r
writer.close();\r
}\r
} catch (Exception e) {\r
- logger.error("Failed to close index writer for " + repositoryName, e);\r
+ logger.error("Failed to close index writer for {}", repositoryName, e);\r
}\r
}\r
\r
try {\r
writers.get(writer).close();\r
} catch (Throwable t) {\r
- logger.error("Failed to close Lucene writer for " + writer, t);\r
+ logger.error("Failed to close Lucene writer for {}", writer, t);\r
}\r
}\r
writers.clear();\r
try {\r
searchers.get(searcher).getIndexReader().close();\r
} catch (Throwable t) {\r
- logger.error("Failed to close Lucene searcher for " + searcher, t);\r
+ logger.error("Failed to close Lucene searcher for {}", searcher, t);\r
}\r
}\r
searchers.clear();\r
resetIndexSearcher(model.name);\r
result.success();\r
} catch (Exception e) {\r
- logger.error("Exception while reindexing " + model.name, e);\r
+ logger.error("Exception while reindexing {}", model.name, e);\r
}\r
return result;\r
}\r
result.commitCount++;\r
result.success = index(repositoryName, doc);\r
} catch (Exception e) {\r
- logger.error(MessageFormat.format("Exception while indexing commit {0} in {1}", commit.getId().getName(), repositoryName), e);\r
+ logger.error("Exception while indexing commit {} in {}", commit.getId().getName(), repositoryName, e);\r
}\r
return result;\r
}\r
writer.commit();\r
int numDocsAfter = writer.numDocs();\r
if (numDocsBefore == numDocsAfter) {\r
- logger.debug(MessageFormat.format("no records found to delete {0}", query.toString()));\r
+ logger.debug("no records found to delete {}", query.toString());\r
return false;\r
} else {\r
- logger.debug(MessageFormat.format("deleted {0} records with {1}", numDocsBefore - numDocsAfter, query.toString()));\r
+ logger.debug("deleted {} records with {}", numDocsBefore - numDocsAfter, query.toString());\r
return true;\r
}\r
}\r
}\r
result.success = true;\r
} catch (Throwable t) {\r
- logger.error(MessageFormat.format("Exception while updating {0} Lucene index", model.name), t);\r
+ logger.error("Exception while updating {} Lucene index", model.name, t);\r
}\r
return result;\r
}\r
resetIndexSearcher(repositoryName);\r
return true;\r
} catch (Exception e) {\r
- logger.error(MessageFormat.format("Exception while incrementally updating {0} Lucene index", repositoryName), e);\r
+ logger.error("Exception while incrementally updating {} Lucene index", repositoryName, e);\r
}\r
return false;\r
}\r
results.add(result);\r
}\r
} catch (Exception e) {\r
- logger.error(MessageFormat.format("Exception while searching for {0}", text), e);\r
+ logger.error("Exception while searching for {}", text, e);\r
}\r
return new ArrayList<SearchResult>(results);\r
}\r
\r
repository = repositoryManager.getRepository(repositoryName);\r
if (repository == null) {\r
- logger.warn(MessageFormat.format("MirrorExecutor is missing repository {0}?!?", repositoryName));\r
+ logger.warn("MirrorExecutor is missing repository {}?!?", repositoryName);\r
continue;\r
}\r
\r
}\r
}\r
} catch (Exception e) {\r
- logger.error("Error updating mirror " + repositoryName, e);\r
+ logger.error("Error updating mirror {}", repositoryName, e);\r
} finally {\r
// cleanup\r
if (repository != null) {\r
package com.gitblit.tickets;
import java.io.IOException;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
if (!ids.contains(ticketId)) {
ids.add(ticketId);
TicketModel ticket = getTicket(repository, ticketId);
- log.info(MessageFormat.format("indexing ticket #{0,number,0}: {1}",
- ticketId, ticket.title));
+ log.info("indexing ticket #{}: {}", ticketId, ticket.title);
indexer.index(ticket);
}
}
long end = System.nanoTime();
- log.info("incremental indexing of {0} ticket(s) completed in {1} msecs",
+ log.info("incremental indexing of {} ticket(s) completed in {} msecs",
ids.size(), TimeUnit.NANOSECONDS.toMillis(end - start));
} finally {
db.close();
}
break;
default:
- log.warn("Unexpected receive type {} in BranchTicketService.onRefsChanged" + cmd.getType());
+ log.warn("Unexpected receive type {} in BranchTicketService.onRefsChanged", cmd.getType());
break;
}
} catch (Exception e) {
Result res = cmd.rename();
switch (res) {
case RENAMED:
- log.info(db.getDirectory() + " " + cmd.getRefLogMessage());
+ log.info("{} {}", db.getDirectory(), cmd.getRefLogMessage());
return getTicketsBranch(db);
default:
- log.error("failed to rename " + oldRef.getName() + " => " + BRANCH + " (" + res.name() + ")");
+ log.error("failed to rename {} => {} ({})", oldRef.getName(), BRANCH, res.name());
}
} catch (IOException e) {
log.error("failed to rename tickets branch", e);
return JGitUtils.getStringContent(db, tree, file, Constants.ENCODING);
}
} catch (IOException e) {
- log.error("failed to read " + file, e);
+ log.error("failed to read {}", file, e);
} finally {
if (rw != null) {
rw.close();
}
}
} catch (Exception e) {
- log.error("failed to deserialize {}/{}\n{}",
- new Object [] { repository, path.path, e.getMessage()});
+ log.error("failed to deserialize {}/{}\n{}", repository, path.path, e.getMessage());
log.error(null, e);
}
}
success = commitIndex(db, index, deletedBy, "- " + ticket.number);
} catch (Throwable t) {
- log.error(MessageFormat.format("Failed to delete ticket {0,number,0} from {1}",
- ticket.number, db.getDirectory()), t);
+ log.error("Failed to delete ticket {} from {}", ticket.number, db.getDirectory(), t);
} finally {
// release the treewalk
if (treeWalk != null) {
success = commitIndex(db, index, change.author, "#" + ticketId);
} catch (Throwable t) {
- log.error(MessageFormat.format("Failed to commit ticket {0,number,0} to {1}",
- ticketId, db.getDirectory()), t);
+ log.error("Failed to commit ticket {} to {}", ticketId, db.getDirectory(), t);
} finally {
db.close();
}
import java.io.File;
import java.io.IOException;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
}
}
} catch (Exception e) {
- log.error("failed to deserialize {}/{}\n{}",
- new Object [] { repository, journal, e.getMessage()});
+ log.error("failed to deserialize {}/{}\n{}", repository, journal, e.getMessage());
log.error(null, e);
}
}
FileUtils.writeContent(file, journal);
success = true;
} catch (Throwable t) {
- log.error(MessageFormat.format("Failed to commit ticket {0,number,0} to {1}",
- ticketId, db.getDirectory()), t);
+ log.error("Failed to commit ticket {} to {}", ticketId, db.getDirectory(), t);
} finally {
db.close();
}
}
labelsCache.put(key, Collections.unmodifiableList(list));
} catch (Exception e) {
- log.error("invalid tickets settings for " + repository, e);
+ log.error("invalid tickets settings for {}", repository, e);
} finally {
db.close();
}
config.setString(LABEL, label, COLOR, lb.color);
config.save();
} catch (IOException e) {
- log.error("failed to create label " + label + " in " + repository, e);
+ log.error("failed to create label {} in {}", label, repository, e);
} finally {
if (db != null) {
db.close();
return true;
} catch (IOException e) {
- log.error("failed to update label " + label + " in " + repository, e);
+ log.error("failed to update label {} in {}", label, repository, e);
} finally {
if (db != null) {
db.close();
return true;
} catch (IOException e) {
- log.error("failed to rename label " + oldName + " in " + repository, e);
+ log.error("failed to rename label {} in {}", oldName, repository, e);
} finally {
if (db != null) {
db.close();
return true;
} catch (IOException e) {
- log.error("failed to delete label " + label + " in " + repository, e);
+ log.error("failed to delete label {} in {}", label, repository, e);
} finally {
if (db != null) {
db.close();
try {
milestone.due = new SimpleDateFormat(DUE_DATE_PATTERN).parse(due);
} catch (ParseException e) {
- log.error("failed to parse {} milestone {} due date \"{}\"",
- new Object [] { repository, name, due });
+ log.error("failed to parse {} milestone {} due date \"{}\"", repository, name, due, e);
}
}
list.add(milestone);
}
milestonesCache.put(key, Collections.unmodifiableList(list));
} catch (Exception e) {
- log.error("invalid tickets settings for " + repository, e);
+ log.error("invalid tickets settings for {}", repository, e);
} finally {
db.close();
}
milestonesCache.remove(repository.name);
} catch (IOException e) {
- log.error("failed to create milestone " + milestone + " in " + repository, e);
+ log.error("failed to create milestone {} in {}", milestone, repository, e);
} finally {
if (db != null) {
db.close();
milestonesCache.remove(repository.name);
return true;
} catch (IOException e) {
- log.error("failed to update milestone " + milestone + " in " + repository, e);
+ log.error("failed to update milestone {} in {}", milestone, repository, e);
} finally {
if (db != null) {
db.close();
return true;
} catch (IOException e) {
- log.error("failed to rename milestone " + oldName + " in " + repository, e);
+ log.error("failed to rename milestone {} in {}", oldName, repository, e);
} finally {
if (db != null) {
db.close();
}
return true;
} catch (IOException e) {
- log.error("failed to delete milestone " + milestone + " in " + repository, e);
+ log.error("failed to delete milestone {} in {}", milestone, repository, e);
} finally {
if (db != null) {
db.close();
TicketModel ticket = getTicket(repository, ticketId);
boolean success = deleteTicketImpl(repository, ticket, deletedBy);
if (success) {
- log.info(MessageFormat.format("Deleted {0} ticket #{1,number,0}: {2}",
- repository.name, ticketId, ticket.title));
+ log.info("Deleted {} ticket #{}: {}", repository.name, ticketId, ticket.title);
ticketsCache.invalidate(new TicketKey(repository, ticketId));
indexer.delete(ticket);
return true;
Boolean exists = jedis.exists(key(repository, KeyType.journal, ticketId));
return exists != null && exists;
} catch (JedisException e) {
- log.error("failed to check hasTicket from Redis @ " + getUrl(), e);
+ log.error("failed to check hasTicket from Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
ids.add(ticketId);
}
} catch (JedisException e) {
- log.error("failed to assign new ticket id in Redis @ " + getUrl(), e);
+ log.error("failed to assign new ticket id in Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
long ticketNumber = jedis.incr(key);
return ticketNumber;
} catch (JedisException e) {
- log.error("failed to assign new ticket id in Redis @ " + getUrl(), e);
+ log.error("failed to assign new ticket id in Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
// sort the tickets by creation
Collections.sort(list);
} catch (JedisException e) {
- log.error("failed to retrieve tickets from Redis @ " + getUrl(), e);
+ log.error("failed to retrieve tickets from Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
log.debug("rebuilt ticket {} from Redis @ {}", ticketId, getUrl());
return ticket;
} catch (JedisException e) {
- log.error("failed to retrieve ticket from Redis @ " + getUrl(), e);
+ log.error("failed to retrieve ticket from Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
}
return changes;
} catch (JedisException e) {
- log.error("failed to retrieve journal from Redis @ " + getUrl(), e);
+ log.error("failed to retrieve journal from Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
t.exec();
success = true;
- log.debug("deleted ticket {} from Redis @ {}", "" + ticket.number, getUrl());
+ log.debug("deleted ticket {} from Redis @ {}", ticket.number, getUrl());
} catch (JedisException e) {
- log.error("failed to delete ticket from Redis @ " + getUrl(), e);
+ log.error("failed to delete ticket from Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
t.rpush(key(repository, KeyType.journal, ticketId), journal);
t.exec();
- log.debug("updated ticket {} in Redis @ {}", "" + ticketId, getUrl());
+ log.debug("updated ticket {} in Redis @ {}", ticketId, getUrl());
return true;
} catch (JedisException e) {
- log.error("failed to update ticket cache in Redis @ " + getUrl(), e);
+ log.error("failed to update ticket cache in Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
}
success = true;
} catch (JedisException e) {
- log.error("failed to delete all tickets in Redis @ " + getUrl(), e);
+ log.error("failed to delete all tickets in Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
t.exec();
success = true;
} catch (JedisException e) {
- log.error("failed to rename tickets in Redis @ " + getUrl(), e);
+ log.error("failed to rename tickets in Redis @ {}", getUrl(), e);
pool.returnBrokenResource(jedis);
jedis = null;
} finally {
import java.io.File;
import java.io.IOException;
-import java.text.MessageFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
closeSearcher();
int numDocsAfter = writer.numDocs();
if (numDocsBefore == numDocsAfter) {
- log.debug(MessageFormat.format("no records found to delete in {0}", repository));
+ log.debug("no records found to delete in {}", repository);
return false;
} else {
- log.debug(MessageFormat.format("deleted {0} records in {1}", numDocsBefore - numDocsAfter, repository));
+ log.debug("deleted {} records in {}", numDocsBefore - numDocsAfter, repository);
return true;
}
} catch (Exception e) {
IndexWriter writer = getWriter();
return delete(ticket.repository, ticket.number, writer);
} catch (Exception e) {
- log.error("Failed to delete ticket " + ticket.number, e);
+ log.error("Failed to delete ticket {}", ticket.number, e);
}
return false;
}
closeSearcher();
int numDocsAfter = writer.numDocs();
if (numDocsBefore == numDocsAfter) {
- log.debug(MessageFormat.format("no records found to delete in {0}", repository));
+ log.debug("no records found to delete in {}", repository);
return false;
} else {
- log.debug(MessageFormat.format("deleted {0} records in {1}", numDocsBefore - numDocsAfter, repository));
+ log.debug("deleted {} records in {}", numDocsBefore - numDocsAfter, repository);
return true;
}
}
results.add(result);
}
} catch (Exception e) {
- log.error(MessageFormat.format("Exception while searching for {0}", text), e);
+ log.error("Exception while searching for {}", text, e);
}
return new ArrayList<QueryResult>(results);
}
results.add(result);
}
} catch (Exception e) {
- log.error(MessageFormat.format("Exception while searching for {0}", queryText), e);
+ log.error("Exception while searching for {}", queryText, e);
}
return new ArrayList<QueryResult>(results);
}
import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitblit.Constants;
private final String addPattern = "<span style=\"color:darkgreen;\">+{0}</span>";
private final String delPattern = "<span style=\"color:darkred;\">-{0}</span>";
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
public TicketNotifier(
IRuntimeManager runtimeManager,
INotificationManager notificationManager,
return mailing;
} catch (Exception e) {
- Logger.getLogger(getClass()).error("failed to queue mailing for #" + ticket.number, e);
+ log.error("failed to queue mailing for #{}", ticket.number, e);
}
return null;
}
diffstat = DiffUtils.getDiffStat(repo, base, patchset.tip);
commits = JGitUtils.getRevLog(repo, base, patchset.tip);
} catch (Exception e) {
- Logger.getLogger(getClass()).error("failed to get changed paths", e);
+ log.error("failed to get changed paths", e);
} finally {
if (repo != null) {
repo.close();
if (user.canView(repository)) {
toAddresses.add(user.emailAddress);
} else {
- LoggerFactory.getLogger(getClass()).warn(
- MessageFormat.format("ticket {0}-{1,number,0}: {2} can not receive notification",
- repository.name, ticket.number, user.username));
+ log.warn("ticket {}-{}: {} can not receive notification", repository.name, ticket.number, user.username);
}
}
}
if (user.canView(repository)) {
ccAddresses.add(user.emailAddress);
} else {
- LoggerFactory.getLogger(getClass()).warn(
- MessageFormat.format("ticket {0}-{1,number,0}: {2} can not receive notification",
- repository.name, ticket.number, user.username));
+ log.warn("ticket {}-{}: {} can not receive notification", repository.name, ticket.number, user.username);
}
}
}