mirror of
https://github.com/apache/struts.git
synced 2026-08-31 19:35:40 +00:00
Replacing all usages of commons logging with xwork logging. Yay for closing memory leaks.
WW-1413 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@582626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -21,14 +21,20 @@
|
||||
|
||||
package mailreader2;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
import java.io.*;
|
||||
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase;
|
||||
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <p><code>ServletContextListener</code> that initializes and finalizes the
|
||||
@@ -94,7 +100,7 @@ public final class ApplicationListener implements ServletContextListener {
|
||||
/**
|
||||
* <p>Logging output for this plug in instance.</p>
|
||||
*/
|
||||
private Log log = LogFactory.getLog(this.getClass());
|
||||
private Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
@@ -21,18 +21,20 @@
|
||||
|
||||
package mailreader2;
|
||||
|
||||
import org.apache.struts2.interceptor.ApplicationAware;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException;
|
||||
import org.apache.struts.apps.mailreader.dao.Subscription;
|
||||
import org.apache.struts.apps.mailreader.dao.User;
|
||||
import org.apache.struts.apps.mailreader.dao.UserDatabase;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemorySubscription;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUser;
|
||||
import java.util.Map;
|
||||
import org.apache.struts2.interceptor.ApplicationAware;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* <p> Base Action for MailreaderSupport application. </p>
|
||||
@@ -386,7 +388,7 @@ public class MailreaderSupport extends ActionSupport
|
||||
/**
|
||||
* <p><code>Log</code> instance for this application. </p>
|
||||
*/
|
||||
protected Log log = LogFactory.getLog(Constants.PACKAGE);
|
||||
protected Logger log = LoggerFactory.getLogger(Constants.PACKAGE);
|
||||
|
||||
/**
|
||||
* <p> Persist the User object, including subscriptions, to the database.
|
||||
|
||||
+4
-4
@@ -21,20 +21,20 @@
|
||||
package org.apache.struts2.showcase.chat;
|
||||
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.dispatcher.SessionMap;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.Interceptor;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
public class ChatAuthenticationInterceptor implements Interceptor {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log _log = LogFactory.getLog(ChatAuthenticationInterceptor.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatAuthenticationInterceptor.class);
|
||||
|
||||
public static final String USER_SESSION_KEY = "chatUserSessionKey";
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ChatAuthenticationInterceptor implements Interceptor {
|
||||
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
|
||||
_log.debug("Authenticating chat user");
|
||||
LOG.debug("Authenticating chat user");
|
||||
|
||||
SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
|
||||
User user = (User) session.get(USER_SESSION_KEY);
|
||||
|
||||
@@ -22,20 +22,19 @@ package org.apache.struts2.showcase.chat;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.Interceptor;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Authenticate showcase chat example, make sure everyone have a username.
|
||||
*/
|
||||
public class ChatInterceptor implements Interceptor {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(ChatInterceptor.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatInterceptor.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -51,7 +50,7 @@ public class ChatInterceptor implements Interceptor {
|
||||
HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
|
||||
User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);
|
||||
if (chatUser == null) {
|
||||
_log.debug("Chat user not logged in");
|
||||
LOG.debug("Chat user not logged in");
|
||||
return Action.LOGIN;
|
||||
}
|
||||
return invocation.invoke();
|
||||
|
||||
+5
-4
@@ -24,14 +24,15 @@ import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.http.HttpSessionEvent;
|
||||
import javax.servlet.http.HttpSessionListener;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
public class ChatSessionListener implements HttpSessionListener {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(ChatSessionListener.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatSessionListener.class);
|
||||
|
||||
public void sessionCreated(HttpSessionEvent event) {
|
||||
}
|
||||
@@ -45,7 +46,7 @@ public class ChatSessionListener implements HttpSessionListener {
|
||||
ChatService service = (ChatService) context.getBean("chatService");
|
||||
service.logout(user.getName());
|
||||
|
||||
_log.info("session expired, logged user ["+user.getName()+"] out");
|
||||
LOG.info("session expired, logged user ["+user.getName()+"] out");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,14 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.util.StrutsTypeConverter;
|
||||
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
public class DateConverter extends StrutsTypeConverter {
|
||||
|
||||
private static final Log _log = LogFactory.getLog(DateConverter.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DateConverter.class);
|
||||
|
||||
public Object convertFromString(Map context, String[] values, Class toClass) {
|
||||
|
||||
@@ -41,7 +42,7 @@ public class DateConverter extends StrutsTypeConverter {
|
||||
return sdf.parse(values[0]);
|
||||
}
|
||||
catch(ParseException e) {
|
||||
_log.error("error converting value ["+values[0]+"] to Date ", e);
|
||||
LOG.error("error converting value ["+values[0]+"] to Date ", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user