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

Misc. fixes #257

Open
wants to merge 10 commits into
base: master
from

Fix some incorrect SLF4J logger calls

In some cases, there were an inconsistent number of formatting anchors.

In other cases, formatting anchors were used, but because the
trace/debug/info/warn/error(String, Throwable) variant was used, the
string is a message string rather than a format string.

These issues were found by SLF4J Helper for NetBeans IDE:
http://plugins.netbeans.org/plugin/72557/
  • Loading branch information...
Daniel Trebbien
Daniel Trebbien committed Jul 29, 2017
commit 3ecd1279f998c8e2500217143bcdfe083d9c342e
@@ -228,7 +228,7 @@ public void run() {
request.sync(closeTimeout, TimeUnit.MILLISECONDS);
}
} catch (IOException e) {
LOG.warn("Error caught while closing Provider: ", e.getMessage());
LOG.warn("Error caught while closing Provider: {}", e.getMessage());
} finally {
if (transport != null) {
try {
@@ -580,7 +580,7 @@ public Response processMessageAck(MessageAck ack) throws Exception {
if (consumerExchange != null) {
broker.acknowledge(consumerExchange, ack);
} else if (ack.isInTransaction()) {
LOG.warn("no matching consumer, ignoring ack {}", consumerExchange, ack);
LOG.warn("no matching consumer in {}, ignoring ack {}", consumerExchange, ack);
}
return null;
}
@@ -869,7 +869,7 @@ private void clearPendingAndDispatch(DurableTopicSubscription durableTopicSubscr
LOG.warn("After clear of pending, failed to dispatch to: {}, for: {}, pending: {}", new Object[]{
durableTopicSubscription,
destination,
durableTopicSubscription.pending }, exception);
durableTopicSubscription.pending, exception });
}
}
}
@@ -146,7 +146,7 @@ private void abortAllQualifiedSlowConsumers() {
if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() >= getMaxSlowDuration()) ||
getMaxSlowCount() > 0 && entry.getValue().slowCount >= getMaxSlowCount()) {
LOG.trace("Transferring consumer{} to the abort list: {} slow duration = {}, slow count = {}",
LOG.trace("Transferring consumer {} to the abort list: slow duration = {}, slow count = {}",
new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(),
entry.getValue().markCount * getCheckPeriod(),
entry.getValue().getSlowCount() });
@@ -1036,7 +1036,7 @@ private void fireFailedForwardAdvisory(MessageDispatch messageDispatch, Throwabl
}
} catch (Exception e) {
LOG.warn("failed to fire forward failure advisory, cause: {}", e);
LOG.warn("failed to fire forward failure advisory, cause: {}", (Object) e);
LOG.debug("detail", e);
}
}
@@ -149,7 +149,7 @@ public void onMessage(Message message) {
return;
} catch (Exception e) {
LOG.info("failed to forward message on attempt: {} reason: {} message: {}", new Object[]{ attempt, e, message }, e);
LOG.info("failed to forward message on attempt: {} reason: {} message: {}", new Object[]{ attempt, e, message, e });
}
}
}
@@ -258,9 +258,7 @@ public String toString() {
}
}
} else {
if (LOG.isTraceEnabled()) {
LOG.trace("Message received since last read check, resetting flag: ");
}
LOG.trace("Message received since last read check, resetting flag: {}", this);
}
commandReceived.set(false);
}
@@ -112,7 +112,7 @@ public void transportResumed() {
try {
((Suspendable)discoveryAgent).suspend();
} catch (Exception e) {
LOG.warn("Exception suspending discoverAgent: ", discoveryAgent);
LOG.warn("Exception suspending discoverAgent: {}", discoveryAgent, e);
}
}
super.transportResumed();
@@ -124,7 +124,7 @@ public void transportInterupted() {
try {
((Suspendable)discoveryAgent).resume();
} catch (Exception e) {
LOG.warn("Exception resuming discoverAgent: ", discoveryAgent);
LOG.warn("Exception resuming discoverAgent: {}", discoveryAgent, e);
}
}
super.transportInterupted();
@@ -133,7 +133,7 @@ protected Transport createTransport(URI location, WireFormat wf) throws UnknownH
String localString = location.getScheme() + ":/" + path;
localLocation = new URI(localString);
} catch (Exception e) {
LOG.warn("path isn't a valid local location for TcpTransport to use", e.getMessage());
LOG.warn("path isn't a valid local location for TcpTransport to use", e);
if(LOG.isDebugEnabled()) {
LOG.debug("Failure detail", e);
}
@@ -119,7 +119,7 @@ private void checkSecurity(Class clazz) throws ClassNotFoundException {
// check for simple types first
final Class<?> clazz = loadSimpleType(className);
if (clazz != null) {
LOG.trace("Loaded class: {} as simple type -> ", className, clazz);
LOG.trace("Loaded class: {} as simple type -> {}", className, clazz);
return clazz;
}
@@ -129,7 +129,7 @@ private void checkSecurity(Class clazz) throws ClassNotFoundException {
try {
Class<?> answer = Class.forName(className, false, loader);
if (LOG.isTraceEnabled()) {
LOG.trace("Loaded class: {} using classloader: {} -> ", new Object[]{className, cl, answer});
LOG.trace("Loaded class: {} using classloader: {} -> {}", new Object[]{className, cl, answer});
}
return answer;
} catch (ClassNotFoundException e) {
@@ -191,7 +191,7 @@ public void onWebSocketBinary(byte[] data, int offset, int length) {
try {
frame = (MQTTFrame)wireFormat.unmarshal(new ByteSequence(data, offset, length));
} catch (IOException e) {
LOG.error("Could not decode incoming MQTT Frame: ", e.getMessage());
LOG.error("Could not decode incoming MQTT Frame: {}", e.getMessage(), e);
connection.close();
}
@@ -245,7 +245,7 @@ public void onWebSocketBinary(byte[] data, int offset, int length) {
connection.close();
}
} catch (Exception e) {
LOG.error("Could not decode incoming MQTT Frame: ", e.getMessage());
LOG.error("Could not decode incoming MQTT Frame: {}", e.getMessage(), e);
connection.close();
}
}
@@ -54,7 +54,7 @@ public void tearDown() throws Exception {
brokerService.waitUntilStopped();
brokerService = null;
} catch (Exception ex) {
LOG.warn("Suppress error on shutdown: {}", ex);
LOG.warn("Suppress error on shutdown: {}", ex, ex);
}
}
@@ -748,8 +748,8 @@ ResponseHandler createResponseHandler(final PUBLISH command) {
public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException {
if (response.isException()) {
Throwable error = ((ExceptionResponse) response).getException();
LOG.warn("Failed to send MQTT Publish: ", command, error.getMessage());
LOG.trace("Error trace: {}", error);
LOG.warn("Failed to send MQTT Publish {}: {}", command, error.getMessage());
LOG.trace("Error trace: {}", (Object) error);
}
switch (command.qos()) {
@@ -288,7 +288,7 @@ public void commit(Xid xid, boolean onePhase) throws XAException {
try {
setConnection(newConnection());
super.commit(xid, onePhase);
LOG.trace("{}.commit({},{})", getConnection(), xid);
LOG.trace("{}.commit({},{})", getConnection(), xid, onePhase);
} catch (JMSException e) {
LOG.trace("{}.commit({},{}) failed", getConnection(), xid, onePhase, e);
ProTip! Use n and p to navigate between commits in a pull request.