[ARTEMIS-603] Remove e.printStackTrace() from code

This commit is contained in:
Dmitrii Tikhomirov 2016-06-28 13:29:54 +02:00
parent 57529ac042
commit 2170acc417
15 changed files with 30 additions and 22 deletions

View File

@ -109,6 +109,10 @@ public interface ActiveMQRALogger extends BasicLogger {
@Message(id = 152008, value = "Error interrupting handler on endpoint {0} handler = {1}", format = Message.Format.MESSAGE_FORMAT)
void errorInterruptingHandler(String endpoint, String handler, @Cause Throwable cause);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 152009, value = "Unable to validate properties", format = Message.Format.MESSAGE_FORMAT)
void unableToValidateProperties(@Cause Exception e);
@LogMessage(level = Logger.Level.ERROR)
@Message(id = 154000, value = "Error while creating object Reference.", format = Message.Format.MESSAGE_FORMAT)
void errorCreatingReference(@Cause Exception e);

View File

@ -716,7 +716,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
}
}
catch (IntrospectionException e) {
e.printStackTrace();
ActiveMQRALogger.LOGGER.unableToValidateProperties(e);
}
if (propsNotSet.size() > 0) {

View File

@ -40,6 +40,7 @@ import org.apache.activemq.artemis.utils.ConfigurationHelper;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.jboss.logging.Logger;
public final class InVMAcceptor extends AbstractAcceptor {
@ -69,6 +70,9 @@ public final class InVMAcceptor extends AbstractAcceptor {
private final String name;
private static final Logger logger = Logger.getLogger(InVMAcceptor.class);
public InVMAcceptor(final String name,
final ClusterConnection clusterConnection,
final Map<String, Object> configuration,
@ -164,8 +168,7 @@ public final class InVMAcceptor extends AbstractAcceptor {
notificationService.sendNotification(notification);
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.warn("failed to send notification",e.getMessage(),e);
}
}

View File

@ -77,6 +77,7 @@ import org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleLi
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.ConfigurationHelper;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.jboss.logging.Logger;
/**
* A Netty TCP Acceptor that is embedding Netty.
@ -171,6 +172,9 @@ public class NettyAcceptor extends AbstractAcceptor {
private Map<String, Object> extraConfigs;
private static final Logger logger = Logger.getLogger(NettyAcceptor.class);
public NettyAcceptor(final String name,
final ClusterConnection clusterConnection,
final Map<String, Object> configuration,
@ -520,8 +524,7 @@ public class NettyAcceptor extends AbstractAcceptor {
notificationService.sendNotification(notification);
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.warn("failed to send notification",e.getMessage(),e);
}
}

View File

@ -520,7 +520,7 @@ public final class ClusterManager implements ActiveMQComponent {
manager.stop();
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
}
@ -562,7 +562,7 @@ public final class ClusterManager implements ActiveMQComponent {
clusterConnection.stop();
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
}
clearClusterConnections();

View File

@ -70,8 +70,7 @@ public class ColocatedHAManager implements HAManager {
activeMQServer.stop();
}
catch (Exception e) {
e.printStackTrace();
//todo
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
}
backupServers.clear();

View File

@ -1478,7 +1478,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e);
}
}
@ -1492,7 +1492,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
}
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(),e);
}
}

View File

@ -933,7 +933,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
serverSession.close(true);
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.errorClosingSession(e);
}
}
}

View File

@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRequ
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupResponseMessage;
import org.apache.activemq.artemis.core.remoting.server.RemotingService;
import org.apache.activemq.artemis.core.replication.ReplicationManager;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedHAManager;
import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.HAManager;
@ -126,7 +127,7 @@ public class ColocatedActivation extends LiveActivation {
started = colocatedHAManager.activateBackup(backupRequestMessage.getBackupSize(), backupRequestMessage.getJournalDirectory(), backupRequestMessage.getBindingsDirectory(), backupRequestMessage.getLargeMessagesDirectory(), backupRequestMessage.getPagingDirectory(), backupRequestMessage.getNodeID());
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
channel.send(new BackupResponseMessage(started));
}
@ -222,8 +223,7 @@ public class ColocatedActivation extends LiveActivation {
}
}
catch (Exception e) {
e.printStackTrace();
//todo
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
}
else {

View File

@ -187,7 +187,7 @@ public class FileLockNodeManager extends NodeManager {
setLive();
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
}
};

View File

@ -23,6 +23,7 @@ import java.util.concurrent.Semaphore;
import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.ActivateCallback;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.utils.UUIDGenerator;
@ -126,7 +127,7 @@ public final class InVMNodeManager extends NodeManager {
state = LIVE;
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
}
};

View File

@ -142,7 +142,7 @@ public class RefsOperation extends TransactionOperationAbstract {
ackedTX.commit(true);
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
}
}
}

View File

@ -874,8 +874,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
storageManager.deleteHeuristicCompletion(id);
}
catch (Exception e) {
e.printStackTrace();
ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
throw new ActiveMQXAException(XAException.XAER_RMFAIL);
}
}

View File

@ -353,7 +353,6 @@ public final class SharedNothingBackupActivation extends Activation {
// do not log these errors if the server is being stopped.
return;
ActiveMQServerLogger.LOGGER.initializationError(e);
e.printStackTrace();
}
}

View File

@ -238,8 +238,8 @@ public final class SharedStoreBackupActivation extends Activation {
}
}
catch (Exception e) {
ActiveMQServerLogger.LOGGER.warn(e.getMessage(),e);
ActiveMQServerLogger.LOGGER.serverRestartWarning();
e.printStackTrace();
}
}
});