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

WW-5458 Replaces e.printStackTrace() with proper logger #1043

Merged
merged 1 commit into from
Sep 10, 2024
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 @@ -21,6 +21,8 @@
import com.opensymphony.xwork2.conversion.ObjectTypeDeterminer;
import ognl.OgnlException;
import ognl.OgnlRuntime;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.Map;

Expand All @@ -31,6 +33,8 @@
*/
public class MockObjectTypeDeterminer implements ObjectTypeDeterminer {

private static final Logger LOG = LogManager.getLogger(MockObjectTypeDeterminer.class);

private Class keyClass;
private Class elementClass;
private String keyProperty;
Expand Down Expand Up @@ -69,10 +73,9 @@ public String getKeyProperty(Class parentClass, String property) {
public boolean shouldCreateIfNew(Class parentClass, String property,
Object target, String keyProperty, boolean isIndexAccessed) {
try {
System.out.println("ognl:"+OgnlRuntime.getPropertyAccessor(Map.class)+" this:"+this);
LOG.info("Ognl: {} this: {}", OgnlRuntime.getPropertyAccessor(Map.class), this);
} catch (OgnlException e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOG.error("Call to shouldCreateIfNew has failed!", e);
}
return isShouldCreateIfNew();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.opensymphony.xwork2.util;

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

import java.io.File;
Expand All @@ -41,6 +43,8 @@
*/
public class ClassPathFinder {

private static final Logger LOG = LogManager.getLogger(ClassPathFinder.class);

/**
* The String pattern to test against.
*/
Expand Down Expand Up @@ -106,7 +110,7 @@ public Vector<String> findMatches() {
}
}
} catch (IOException e) {
e.printStackTrace();
LOG.warn("Error reading zip file: {}", entry, e);
}
} else {
Vector<String> results = checkEntries(entry.list(), entry, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
package com.opensymphony.xwork2.util;

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

import java.io.IOException;
import java.io.LineNumberReader;
import java.io.Reader;
Expand All @@ -40,6 +43,9 @@
* </p>
*/
public class PropertiesReader extends LineNumberReader {

private static final Logger LOG = LogManager.getLogger(PropertiesReader.class);

/**
* Stores the comment lines for the currently processed property.
*/
Expand Down Expand Up @@ -451,7 +457,7 @@ public static String unescapeJava(String str) {
return writer.toString();
} catch (IOException ioe) {
// this should never ever happen while writing to a StringWriter
ioe.printStackTrace();
LOG.warn("Call to unescape java string failed!", ioe);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public String intercept(ActionInvocation inv) throws Exception {
ServletActionContext.getResponse().getWriter()) {
writer.print(stack.findValue(cmd));
} catch (IOException ex) {
ex.printStackTrace();
LOG.warn("Interceptor in: {} mode has failed!", COMMAND_MODE, ex);
}
cont = false;
} else if (BROWSER_MODE.equals(type)) {
Expand Down Expand Up @@ -286,7 +286,7 @@ protected void printContext() {
printContext(writer);
writer.close();
} catch (IOException ex) {
ex.printStackTrace();
LOG.warn("Call to PrettyPrintWriter failed!", ex);
}
}

Expand Down
Loading