Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLF4J-related fixes #57

Open
wants to merge 13 commits into
base: trunk
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static Properties readConfig(String fileName) throws IOException {
private static void deleteIfPossible(final File file) {
boolean deleted = file.delete();
if (!deleted) {
LOG.warn("Could not delete " + file.getAbsolutePath());
LOG.warn("Could not delete {}", file.getAbsolutePath());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,11 @@ && minModifiedDate > getLastModified(identifier)) {
copReq.setNewObjectMetadata(new ObjectMetadata());
Copy copy = tmx.copy(s3ReqDecorator.decorate(copReq));
copy.waitForCompletion();
LOG.debug("[{}] touched. time taken [{}] ms ", new Object[] {
identifier, (System.currentTimeMillis() - start) });
LOG.debug("[{}] touched. time taken [{}] ms ",
identifier, System.currentTimeMillis() - start);
} else {
LOG.trace("[{}] touch not required. time taken [{}] ms ",
new Object[] { identifier,
(System.currentTimeMillis() - start) });
identifier, System.currentTimeMillis() - start);
}

} catch (Exception e) {
Expand Down Expand Up @@ -499,8 +498,8 @@ public void deleteRecord(DataIdentifier identifier)
Thread.currentThread().setContextClassLoader(
getClass().getClassLoader());
s3service.deleteObject(bucket, key);
LOG.debug("Identifier [{}] deleted. It took [{}]ms.", new Object[] {
identifier, (System.currentTimeMillis() - start) });
LOG.debug("Identifier [{}] deleted. It took [{}]ms.",
identifier, System.currentTimeMillis() - start);
} catch (AmazonServiceException e) {
throw new DataStoreException(
"Could not getLastModified of dataIdentifier " + identifier, e);
Expand Down Expand Up @@ -826,8 +825,8 @@ public void run() {
copy.waitForCopyResult();
LOG.debug("[{}] renamed to [{}] ", oldKey, newS3Key);
} catch (InterruptedException ie) {
LOG.error(" Exception in renaming [{}] to [{}] ",
new Object[] { ie, oldKey, newS3Key });
LOG.error("Exception in renaming [{}] to [{}]",
new Object[] { oldKey, newS3Key, ie });
}
} finally {
if (contextClassLoader != null) {
Expand Down Expand Up @@ -912,8 +911,8 @@ public void run() {
try {
write(identifier, file, true, callback);
} catch (DataStoreException e) {
LOG.error("Could not upload [" + identifier + "], file[" + file
+ "]", e);
LOG.error("Could not upload [{}], file[{}]",
new Object[] { identifier, file, e });
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TestAll extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite("S3 tests");
String config = System.getProperty(TestCaseBase.CONFIG);
LOG.info("config= " + config);
LOG.info("config= {}", config);
if (config != null && !"".equals(config.trim())) {
suite.addTestSuite(TestS3Ds.class);
suite.addTestSuite(TestS3DSAsyncTouch.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void deleteBucket() throws Exception {
}

public void deleteBucket(String bucket) throws Exception {
LOG.info("deleting bucket [" + bucket + "]");
LOG.info("deleting bucket [{}]", bucket);
Properties props = Utils.readConfig(config);
AmazonS3Client s3service = Utils.openService(props);
TransferManager tmx = new TransferManager(s3service);
Expand All @@ -132,10 +132,10 @@ public void deleteBucket(String bucket) throws Exception {
}
}
s3service.deleteBucket(bucket);
LOG.info("bucket [ " + bucket + "] deleted");
LOG.info("bucket [{}] deleted", bucket);

} else {
LOG.info("bucket [" + bucket + "] doesn't exists");
LOG.info("bucket [{}] doesn't exist", bucket);
}
tmx.shutdownNow();
s3service.shutdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ protected void buildPath(
try {
cache(((NodeState) state).getNodeId(), builder.getPath());
} catch (MalformedPathException mpe) {
log.warn("Failed to build path of " + state.getId());
log.warn("Failed to build path of {}", state.getId());
}
}
}
Expand Down Expand Up @@ -411,16 +411,15 @@ public void nodeAdded(NodeState state, Name name, int index, NodeId id) {
nodeAdded(state, path, id);
checkConsistency();
} catch (PathNotFoundException e) {
log.warn("Unable to get path of node " + state.getNodeId()
+ ", event ignored.");
log.warn("Unable to get path of node {}, event ignored.", state.getNodeId());
} catch (MalformedPathException e) {
log.warn("Unable to create path of " + id, e);
log.warn("Unable to create path of {}", id, e);
} catch (ItemNotFoundException e) {
log.warn("Unable to find item " + state.getNodeId(), e);
log.warn("Unable to find item {}", state.getNodeId(), e);
} catch (ItemStateException e) {
log.warn("Unable to find item " + id, e);
log.warn("Unable to find item {}", id, e);
} catch (RepositoryException e) {
log.warn("Unable to get path of " + state.getNodeId(), e);
log.warn("Unable to get path of {}", state.getNodeId(), e);
}
} else if (state.getParentId() == null && idCache.containsKey(id)) {
// A top level node was added
Expand Down Expand Up @@ -497,16 +496,15 @@ public void nodeRemoved(NodeState state, Name name, int index, NodeId id) {
nodeRemoved(state, path, id);
checkConsistency();
} catch (PathNotFoundException e) {
log.warn("Unable to get path of node " + state.getNodeId()
+ ", event ignored.");
log.warn("Unable to get path of node {}, event ignored.", state.getNodeId());
} catch (MalformedPathException e) {
log.warn("Unable to create path of " + id, e);
log.warn("Unable to create path of {}", id, e);
} catch (ItemStateException e) {
log.warn("Unable to find item " + id, e);
log.warn("Unable to find item {}", id, e);
} catch (ItemNotFoundException e) {
log.warn("Unable to get path of " + state.getNodeId(), e);
log.warn("Unable to get path of {}", state.getNodeId(), e);
} catch (RepositoryException e) {
log.warn("Unable to get path of " + state.getNodeId(), e);
log.warn("Unable to get path of {}", state.getNodeId(), e);
}
} else if (state.getParentId() == null && idCache.containsKey(id)) {
// A top level node was removed
Expand Down Expand Up @@ -1060,10 +1058,10 @@ public void log() {
long now = System.currentTimeMillis();
final String msg = "Cache id = {};size = {};max = {}";
if (log.isTraceEnabled()) {
log.trace(msg, new Object[]{id, this.cache.size(), upperLimit}, new Exception());
log.trace(msg, new Object[] { id, this.cache.size(), upperLimit, new Exception() });
} else if (now > timeStamp + CACHE_STATISTICS_LOG_INTERVAL_MILLIS) {
timeStamp = now;
log.debug(msg, new Object[]{id, this.cache.size(), upperLimit}, new Exception());
log.debug(msg, new Object[] { id, this.cache.size(), upperLimit, new Exception() });
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public synchronized void init(Repository repository, Session systemSession) thro
// build AuthContextProvider based on appName + optional LoginModuleConfig
authContextProvider = new AuthContextProvider(config.getAppName(), loginModConf);
if (authContextProvider.isLocal()) {
log.info("init: use Repository Login-Configuration for " + config.getAppName());
log.info("init: use Repository Login-Configuration for {}", config.getAppName());
} else if (authContextProvider.isJAAS()) {
log.info("init: use JAAS login-configuration for " + config.getAppName());
log.info("init: use JAAS login-configuration for {}", config.getAppName());
} else {
String msg = "Neither JAAS nor RepositoryConfig contained a valid configuration for " + config.getAppName();
log.error(msg);
Expand Down Expand Up @@ -359,9 +359,9 @@ public String getUserID(Subject subject, String workspaceName) throws Repository
}
}
// all principals found with the given p-Class were Group principals
log.debug("Only Group principals found with class '" + cl.getName() + "' -> Not used for UserID.");
log.debug("Only Group principals found with class '{}' -> Not used for UserID.", cl.getName());
} else {
log.debug("No principal found with class '" + cl.getName() + "'.");
log.debug("No principal found with class '{}'.", cl.getName());
}
}

Expand Down Expand Up @@ -624,7 +624,7 @@ static void createSystemUsers(UserManager userManager,
if (!userManager.isAutoSave()) {
session.save();
}
log.info("... created admin-user with id \'" + adminId + "\' ...");
log.info("... created admin-user with id '{}' ...", adminId);
}
}

Expand All @@ -636,7 +636,7 @@ static void createSystemUsers(UserManager userManager,
if (!userManager.isAutoSave()) {
session.save();
}
log.info("... created anonymous user with id \'" + anonymousId + "\' ...");
log.info("... created anonymous user with id '{}' ...", anonymousId);
} catch (RepositoryException e) {
// exception while creating the anonymous user.
// log an error but don't abort the repository start-up
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ NodeDefinitionImpl getDefinition(NodeState state)
def = ent.getApplicableChildNodeDef(
cne.getName(), state.getNodeTypeName(), ntReg);
log.warn("Fallback to nt:unstructured due to unknown child " +
"node definition for type '" + state.getNodeTypeName() + "'");
"node definition for type '{}'", state.getNodeTypeName());
}
return sessionContext.getNodeTypeManager().getNodeDefinition(def);
} catch (NodeTypeConflictException e) {
Expand Down Expand Up @@ -272,7 +272,7 @@ PropertyDefinitionImpl getDefinition(PropertyState state)
def = ent.getApplicablePropertyDef(state.getName(),
state.getType(), state.isMultiValued());
log.warn("Fallback to nt:unstructured due to unknown property " +
"definition for '" + state.getName() + "'");
"definition for '{}'", state.getName());
}
return sessionContext.getNodeTypeManager().getPropertyDefinition(def);
} catch (ItemStateException e) {
Expand Down Expand Up @@ -933,7 +933,7 @@ private void cacheItem(ItemData data) {
}
ItemId id = data.getId();
if (itemCache.containsKey(id)) {
log.debug("overwriting cached item " + id);
log.debug("overwriting cached item {}", id);
}
if (log.isDebugEnabled()) {
log.debug("caching item " + id);
Expand Down Expand Up @@ -993,7 +993,7 @@ String safeGetJCRPath(Path path) {
try {
return session.getJCRPath(path);
} catch (NamespaceException e) {
log.error("failed to convert " + path.toString() + " to JCR path.");
log.error("failed to convert {} to JCR path.", path);
// return string representation of internal path as a fallback
return path.toString();
}
Expand All @@ -1010,7 +1010,7 @@ String safeGetJCRPath(ItemId id) {
try {
return safeGetJCRPath(hierMgr.getPath(id));
} catch (RepositoryException re) {
log.error(id + ": failed to determine path to");
log.error("{}: failed to determine path to", id);
// return string representation if id as a fallback
return id.toString();
}
Expand Down Expand Up @@ -1261,7 +1261,7 @@ public void cache(AbstractNodeData data) {
}
Object old = map.put(data.getPrimaryParentId(), data);
if (old != null) {
log.debug("overwriting cached item: " + old);
log.debug("overwriting cached item: {}", old);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public Object perform(SessionContext context) throws RepositoryException {
}
} catch (ItemStateException ise) {
// should never get here
log.warn("failed to retrieve transient state: " + newParentId, ise);
log.warn("failed to retrieve transient state: {}", newParentId, ise);
}
}
}
Expand Down Expand Up @@ -330,8 +330,7 @@ private Collection<ItemState> getTransientStates(
+ "removed externally: " + this);

default:
log.warn("Unexpected item state status: "
+ transientState.getStatus() + " of " + this);
log.warn("Unexpected item state status: {} of {}", transientState.getStatus(), this);
// ignore
break;
}
Expand Down Expand Up @@ -360,8 +359,7 @@ private Collection<ItemState> getTransientStates(
+ " removed externally: " + this);

default:
log.warn("Unexpected item state status:"
+ state.getStatus() + " of " + this);
log.warn("Unexpected item state status:{} of {}", state.getStatus(), this);
// ignore
break;
}
Expand Down Expand Up @@ -896,7 +894,7 @@ private void restoreTransientItems(
String msg = itemMgr.safeGetJCRPath(id)
+ ": failed to restore transient state";
if (log.isDebugEnabled()) {
log.warn(msg, re);
log.debug(msg, re);
} else {
log.warn(msg);
}
Expand Down Expand Up @@ -936,4 +934,4 @@ public String toString() {
return "item.save()";
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public String safeGetJCRPath(ItemId id) {
// return string representation of id as a fallback
return id.toString();
} catch (RepositoryException e) {
log.error(id + ": failed to build path");
log.error("{}: failed to build path", id);
// return string representation of id as a fallback
return id.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void prefetchNext() {
next = itemMgr.getItem(id);
}
} catch (ItemNotFoundException e) {
log.debug("ignoring nonexistent item " + id);
log.debug("ignoring nonexistent item {}", id);
// remove invalid id
idList.remove(pos);

Expand All @@ -145,12 +145,12 @@ private void prefetchNext() {

// try next
} catch (AccessDeniedException e) {
log.debug("ignoring nonexistent item " + id);
log.debug("ignoring nonexistent item {}", id);
// remove invalid id
idList.remove(pos);
// try next
} catch (RepositoryException e) {
log.error("failed to fetch item " + id + ", skipping...", e);
log.error("failed to fetch item {}, skipping...", id, e);
// remove invalid id
idList.remove(pos);
// try next
Expand Down Expand Up @@ -222,7 +222,7 @@ public void skip(long skipNum) {
ItemId id = idList.get(pos);
// eliminate invalid items from this iterator
while (!itemMgr.itemExists(id)) {
log.debug("ignoring nonexistent item " + id);
log.debug("ignoring nonexistent item {}", id);
// remove invalid id
idList.remove(pos);
if (pos >= idList.size()) {
Expand Down
Loading