Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.jdesktop.swingx.JXTaskPane;
import org.jdesktop.swingx.decorator.ColorHighlighter;
Expand Down Expand Up @@ -132,6 +134,7 @@
import net.miginfocom.swing.MigLayout;

public class ChannelPanel extends AbstractFramePanel {
private static Logger logger = LogManager.getLogger(ChannelPanel.class);

public static final String STATUS_COLUMN_NAME = "Status";
public static final String DATA_TYPE_COLUMN_NAME = "Data Type";
Expand Down Expand Up @@ -3130,7 +3133,7 @@ public void run() {
}
});
} catch (Exception e) {
e.printStackTrace();
logger.error("Error importing file " + file.getAbsolutePath(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.mirth.connect.client.core.ClientException;
import com.mirth.connect.client.ui.util.DisplayUtil;
import com.mirth.connect.model.User;
Expand All @@ -36,6 +39,7 @@
* A dialog for creating a new user or editing a current user
*/
public class FirstLoginDialog extends javax.swing.JDialog implements UserDialogInterface {
private static Logger logger = LogManager.getLogger(FirstLoginDialog.class);

private Frame parent;
private boolean result = false;
Expand Down Expand Up @@ -192,7 +196,7 @@ public void hyperlinkUpdate(HyperlinkEvent evt) {
BareBonesBrowserLaunch.openURL(evt.getURL().toString());
}
} catch (Exception e) {
e.printStackTrace();
logger.error("Error opening hyperlink " + evt.getURL(), e);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/main/java/com/mirth/connect/client/ui/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1484,8 +1484,8 @@ public void alertThrowable(Component parentComponent, Throwable t, String custom
boolean showDialog = true;

if (t != null) {
// Always print the stacktrace for troubleshooting purposes
t.printStackTrace();
// Always log the stacktrace for troubleshooting purposes
logger.error("Error alert: " + message, t);

if (t instanceof ExecutionException && t.getCause() != null) {
t = t.getCause();
Expand Down Expand Up @@ -3099,7 +3099,7 @@ public void deployChannel(final Set<String> selectedChannelIds, DebugOptions deb

} catch (ChannelDependencyException e) {
// Should never happen
e.printStackTrace();
logger.error("Error resolving channel dependencies", e);
}
}

Expand Down Expand Up @@ -3205,7 +3205,7 @@ private boolean getStatusesWithDependencies(Set<DashboardStatus> selectedDashboa
}
} catch (ChannelDependencyException e) {
// Should never happen
e.printStackTrace();
logger.error("Error resolving channel dependencies", e);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.mirth.connect.client.core.Client;
import com.mirth.connect.client.core.ClientException;
Expand All @@ -38,6 +40,7 @@
import com.mirth.connect.util.MirthSSLUtil;

public class LoginPanel extends javax.swing.JFrame {
private static Logger logger = LogManager.getLogger(LoginPanel.class);

private Client client;
private static final String ERROR_MESSAGE = "There was an error connecting to the server at the specified address. Please verify that the server is up and running.";
Expand Down Expand Up @@ -433,7 +436,7 @@ public Void doInBackground() {
customHeaders.put(UserServletInterface.LOGIN_SERVER_URL_HEADER, Collections.singletonList(PlatformUI.SERVER_URL));
loginStatus = client.getServlet(UserServletInterface.class, null, customHeaders).login(username.getText(), String.valueOf(password.getPassword()));
} catch (ClientException ex) {
ex.printStackTrace();
logger.error("Error logging in", ex);

if (ex instanceof UnauthorizedException) {
UnauthorizedException e2 = (UnauthorizedException) ex;
Expand Down Expand Up @@ -485,7 +488,7 @@ public Void doInBackground() {
} catch (Throwable t) {
errorOccurred = true;
errorTextArea.setText(ERROR_MESSAGE);
t.printStackTrace();
logger.error("Error logging in", t);
}

if (errorOccurred) {
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/java/com/mirth/connect/client/ui/Mirth.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static void initUIManager() {
OSXAdapter.setQuitHandler(Mirth.class, Mirth.class.getDeclaredMethod("quitMac", (Class[]) null));
}
} catch (Exception e) {
e.printStackTrace();
LogManager.getLogger(Mirth.class).error("Error initializing look and feel", e);
}

// keep the tooltips from disappearing
Expand Down Expand Up @@ -244,7 +244,7 @@ public static void initUIManager() {
try {
UIManager.put("wizard.sidebar.image", ImageIO.read(com.mirth.connect.client.ui.Frame.class.getResource("images/wizardsidebar.png")));
} catch (IOException e) {
e.printStackTrace();
LogManager.getLogger(Mirth.class).error("Error loading wizard sidebar image", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.mirth.connect.client.core.ClientException;
import com.mirth.connect.client.core.ConnectServiceUtil;
Expand All @@ -60,6 +62,7 @@
import com.mirth.connect.model.notification.Notification;

public class NotificationDialog extends MirthDialog {
private static Logger logger = LogManager.getLogger(NotificationDialog.class);

private NotificationModel notificationModel = new NotificationModel();
private Notification currentNotification;
Expand Down Expand Up @@ -225,7 +228,7 @@ public void hyperlinkUpdate(HyperlinkEvent evt) {
BareBonesBrowserLaunch.openURL(evt.getURL().toString());
}
} catch (Exception e) {
e.printStackTrace();
logger.error("Error opening hyperlink " + evt.getURL(), e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@
import java.util.List;

import org.apache.commons.lang3.math.NumberUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.glassfish.jersey.internal.util.ReflectionHelper;

public class OSXAdapter implements InvocationHandler {
private static Logger logger = LogManager.getLogger(OSXAdapter.class);

protected Object targetObject;
protected Method targetMethod;
Expand Down Expand Up @@ -88,8 +91,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
setHandler(new OSXAdapter("handleQuit", target, quitHandler));
}
} catch (Exception ex) {
System.err.println("OSXAdapter could not set quit handler");
ex.printStackTrace();
logger.error("OSXAdapter could not set quit handler", ex);
}
}

Expand All @@ -115,8 +117,7 @@ public static void setAboutHandler(Object target, Method aboutHandler) {
Boolean.valueOf(enableAboutMenu) });
}
} catch (Exception ex) {
System.err.println("OSXAdapter could not access the About Menu");
ex.printStackTrace();
logger.error("OSXAdapter could not access the About Menu", ex);
}
}

Expand All @@ -141,8 +142,7 @@ public static void setPreferencesHandler(Object target, Method prefsHandler) {
Boolean.valueOf(enablePrefsMenu) });
}
} catch (Exception ex) {
System.err.println("OSXAdapter could not set preferences handler");
ex.printStackTrace();
logger.error("OSXAdapter could not set preferences handler", ex);
}
}

Expand Down Expand Up @@ -187,8 +187,7 @@ public boolean callTarget(Object appleEvent) {
});
}
} catch (Exception ex) {
System.err.println("OSXAdapter could not set open files handler");
ex.printStackTrace();
logger.error("OSXAdapter could not set open files handler", ex);
}
}

Expand All @@ -206,8 +205,7 @@ public static void setHandler(OSXAdapter adapter) {
} catch (ClassNotFoundException cnfe) {
System.err.println("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")");
} catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods
System.err.println("Mac OS X Adapter could not talk to EAWT:");
ex.printStackTrace();
logger.error("Mac OS X Adapter could not talk to EAWT", ex);
}
}

Expand Down Expand Up @@ -257,8 +255,7 @@ protected void setApplicationEventHandled(Object event, boolean handled) {
// If the target method returns a boolean, use that as a hint
setHandledMethod.invoke(event, new Object[] { Boolean.valueOf(handled) });
} catch (Exception ex) {
System.err.println("OSXAdapter was unable to handle an ApplicationEvent: " + event);
ex.printStackTrace();
logger.error("OSXAdapter was unable to handle an ApplicationEvent: " + event, ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.syntax.jedit.SyntaxDocument;
import org.syntax.jedit.tokenmarker.HL7TokenMarker;
import org.syntax.jedit.tokenmarker.TokenMarker;
Expand All @@ -41,6 +43,7 @@
import com.mirth.connect.plugins.DataTypeClientPlugin;

public class TemplatePanel extends javax.swing.JPanel implements DropTargetListener {
private static Logger logger = LogManager.getLogger(TemplatePanel.class);
public final String DEFAULT_TEXT = "Paste a sample message here.";

private static final String MESSAGE_TEMPLATES_BOLD = "<html><b>Message Templates</b></html>";
Expand Down Expand Up @@ -200,7 +203,7 @@ public void run() {
try {
treePanel.setMessage(dataProperties, (String) dataTypeComboBox.getSelectedItem(), message, DEFAULT_TEXT);
} catch (Exception e) {
e.printStackTrace();
logger.error("Error parsing message template", e);
}
PlatformUI.MIRTH_FRAME.stopWorking(workingId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public void setMessage(DataTypeProperties dataTypeProperties, String messageType

jsonDoc = mapper.readTree(message);
} catch (Exception e) {
e.printStackTrace();
logger.error("Error converting message to JSON", e);
}

if (jsonDoc != null) {
Expand Down Expand Up @@ -464,7 +464,7 @@ public void setMessage(DataTypeProperties dataTypeProperties, String messageType

xmlDoc = docBuilder.parse(new InputSource(new StringReader(message)));
} catch (Exception e) {
e.printStackTrace();
logger.error("Error converting message to XML", e);
}

if (xmlDoc != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

import javax.swing.tree.TreeNode;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.mirth.connect.client.ui.components.MirthTree;
import com.mirth.connect.client.ui.editors.BaseEditorPane;
import com.mirth.connect.client.ui.editors.MessageTreePanel;
Expand All @@ -22,6 +25,7 @@
* Package TreeNodes for movement.
*/
public class TreeTransferable implements Transferable {
private static Logger logger = LogManager.getLogger(TreeTransferable.class);

public static final DataFlavor MAPPER_DATA_FLAVOR = new DataFlavor(MapperDropData.class, "MapperDropData");
public static final DataFlavor MESSAGE_BUILDER_DATA_FLAVOR = new DataFlavor(MessageBuilderDropData.class, "MessageBuilderDropData");
Expand Down Expand Up @@ -55,7 +59,7 @@ private void init(DataFlavor supportedDropFlavor) {
flavors[1] = supportedDropFlavor;
flavors[2] = RULE_DATA_FLAVOR;
} catch (Exception e) {
e.printStackTrace();
logger.error("Error initializing data flavors", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
import java.util.Map;
import java.util.regex.Pattern;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.mirth.connect.client.ui.VariableListHandler.TransferMode;

/**
* Package Database Variables for movement.
*/
public class VariableTransferable implements Transferable {
private static Logger logger = LogManager.getLogger(VariableTransferable.class);

private static DataFlavor[] flavors = null;
private static final Pattern VALID_VELOCITY_VARIABLE_PATTERN = Pattern.compile("[a-zA-Z][a-zA-Z0-9_-]*");
Expand Down Expand Up @@ -57,7 +61,7 @@ private void init() {
flavors = new DataFlavor[1];
flavors[0] = DataFlavor.stringFlavor;
} catch (Exception e) {
e.printStackTrace();
logger.error("Error initializing data flavors", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ public Object[][] updateAttachmentList(String channelId, Long messageId) {
}
return temp;
} catch (Exception e) {
e.printStackTrace();
logger.error("Error retrieving attachment data", e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,7 @@ private void updateCodeTemplateNode(CodeTemplateTreeTableNode codeTemplateNode)
try {
contextSet.add(pair.getRight());
} catch (ClassCastException e) {
e.printStackTrace();
logger.error("Unexpected context type in code template library tree", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
package com.mirth.connect.client.ui.components.rsta;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class AutoCompleteProperties {
private static Logger logger = LogManager.getLogger(AutoCompleteProperties.class);

private boolean activateAfterLetters;
private String activateAfterOthers;
Expand Down Expand Up @@ -111,7 +114,7 @@ static AutoCompleteProperties fromJSON(String autoCompleteJSON) {
activationDelay = node.asInt();
}
} catch (Exception e) {
e.printStackTrace();
logger.error("Error parsing auto-complete preferences", e);
}
}

Expand Down
Loading
Loading