From: markt Date: Fri, 26 Dec 2008 19:00:35 +0000 (+0000) Subject: o.a.c.session generics changes X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=976cc7e504b398a11ae1dba1cb2adf27784207c1;p=tomcat7.0 o.a.c.session generics changes Deprecate methods that implement deprecated methods Fix assorted Eclipse warnings git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@729523 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/session/FileStore.java b/java/org/apache/catalina/session/FileStore.java index 9ce457cb5..7d571de0f 100644 --- a/java/org/apache/catalina/session/FileStore.java +++ b/java/org/apache/catalina/session/FileStore.java @@ -37,7 +37,6 @@ import org.apache.catalina.Context; import org.apache.catalina.Globals; import org.apache.catalina.Loader; import org.apache.catalina.Session; -import org.apache.catalina.Store; import org.apache.catalina.util.CustomObjectInputStream; @@ -50,8 +49,7 @@ import org.apache.catalina.util.CustomObjectInputStream; * @version $Revision$ $Date$ */ -public final class FileStore - extends StoreBase implements Store { +public final class FileStore extends StoreBase { // ----------------------------------------------------- Constants @@ -219,14 +217,14 @@ public final class FileStore } // Build and return the list of session identifiers - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); int n = FILE_EXT.length(); for (int i = 0; i < files.length; i++) { if (files[i].endsWith(FILE_EXT)) { list.add(files[i].substring(0, files[i].length() - n)); } } - return ((String[]) list.toArray(new String[list.size()])); + return list.toArray(new String[list.size()]); } @@ -283,7 +281,7 @@ public final class FileStore try { ois.close(); } catch (IOException f) { - ; + // Ignore } ois = null; } @@ -302,7 +300,7 @@ public final class FileStore try { ois.close(); } catch (IOException f) { - ; + // Ignore } } } @@ -362,7 +360,7 @@ public final class FileStore try { oos.close(); } catch (IOException f) { - ; + // Ignore } } throw e; diff --git a/java/org/apache/catalina/session/JDBCStore.java b/java/org/apache/catalina/session/JDBCStore.java index e7ce2cd6b..c32e356ad 100644 --- a/java/org/apache/catalina/session/JDBCStore.java +++ b/java/org/apache/catalina/session/JDBCStore.java @@ -21,7 +21,6 @@ import org.apache.catalina.Container; import org.apache.catalina.LifecycleException; import org.apache.catalina.Loader; import org.apache.catalina.Session; -import org.apache.catalina.Store; import org.apache.catalina.util.CustomObjectInputStream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -48,8 +47,7 @@ import java.util.Properties; * @version $Revision$, $Date$ */ -public class JDBCStore - extends StoreBase implements Store { +public class JDBCStore extends StoreBase { /** * The descriptive information about this implementation. @@ -461,13 +459,13 @@ public class JDBCStore preparedKeysSql.setString(1, getName()); rst = preparedKeysSql.executeQuery(); - ArrayList tmpkeys = new ArrayList(); + ArrayList tmpkeys = new ArrayList(); if (rst != null) { while (rst.next()) { tmpkeys.add(rst.getString(1)); } } - keys = (String[]) tmpkeys.toArray(new String[tmpkeys.size()]); + keys = tmpkeys.toArray(new String[tmpkeys.size()]); // Break out after the finally block numberOfTries = 0; } catch (SQLException e) { @@ -482,7 +480,7 @@ public class JDBCStore rst.close(); } } catch (SQLException e) { - ; + // Ignore } release(_conn); @@ -538,7 +536,7 @@ public class JDBCStore if (rst != null) rst.close(); } catch (SQLException e) { - ; + // Ignore } release(_conn); @@ -627,13 +625,13 @@ public class JDBCStore rst.close(); } } catch (SQLException e) { - ; + // Ignore } if (ois != null) { try { ois.close(); } catch (IOException e) { - ; + // Ignore } } release(_conn); @@ -793,7 +791,7 @@ public class JDBCStore if (dbConnection != null) close(dbConnection); } catch (IOException e) { - ; + // Ignore } finally { if (oos != null) { oos.close(); @@ -858,7 +856,7 @@ public class JDBCStore // Instantiate our database driver if necessary if (driver == null) { try { - Class clazz = Class.forName(driverName); + Class clazz = Class.forName(driverName); driver = (Driver) clazz.newInstance(); } catch (ClassNotFoundException ex) { manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".checkConnectionClassNotFoundException", @@ -899,41 +897,41 @@ public class JDBCStore try { preparedSizeSql.close(); } catch (Throwable f) { - ; + // Ignore } this.preparedSizeSql = null; try { preparedKeysSql.close(); } catch (Throwable f) { - ; + // Ignore } this.preparedKeysSql = null; try { preparedSaveSql.close(); } catch (Throwable f) { - ; + // Ignore } this.preparedSaveSql = null; try { preparedClearSql.close(); } catch (Throwable f) { - ; + // Ignore } try { preparedRemoveSql.close(); } catch (Throwable f) { - ; + // Ignore } this.preparedRemoveSql = null; try { preparedLoadSql.close(); } catch (Throwable f) { - ; + // Ignore } this.preparedLoadSql = null; @@ -955,7 +953,7 @@ public class JDBCStore * @param conn The connection to be released */ protected void release(Connection conn) { - ; + // NOOP } /** @@ -981,7 +979,7 @@ public class JDBCStore try { dbConnection.commit(); } catch (SQLException e) { - ; + // Ignore } close(dbConnection); } diff --git a/java/org/apache/catalina/session/ManagerBase.java b/java/org/apache/catalina/session/ManagerBase.java index 7bcffce39..8f5749fcc 100644 --- a/java/org/apache/catalina/session/ManagerBase.java +++ b/java/org/apache/catalina/session/ManagerBase.java @@ -225,9 +225,9 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { // ------------------------------------------------------------- Security classes - private class PrivilegedSetRandomFile implements PrivilegedAction{ + private class PrivilegedSetRandomFile implements PrivilegedAction{ - public Object run(){ + public DataInputStream run(){ try { File f=new File( devRandomSource ); if( ! f.exists() ) return null; @@ -376,7 +376,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { boolean apr = false; try { String methodName = "random"; - Class paramTypes[] = new Class[2]; + Class paramTypes[] = new Class[2]; paramTypes[0] = result.getClass(); paramTypes[1] = int.class; Object paramValues[] = new Object[2]; @@ -512,7 +512,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { // as a hack, you can use a static file - and genarate the same // session ids ( good for strange debugging ) if (Globals.IS_SECURITY_ENABLED){ - randomIS = (DataInputStream)AccessController.doPrivileged(new PrivilegedSetRandomFile()); + randomIS = AccessController.doPrivileged(new PrivilegedSetRandomFile()); } else { try{ devRandomSource=s; @@ -556,7 +556,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { } try { // Construct and seed a new random number generator - Class clazz = Class.forName(randomClass); + Class clazz = Class.forName(randomClass); this.random = (Random) clazz.newInstance(); this.random.setSeed(seed); } catch (Exception e) { @@ -731,7 +731,6 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { if( oname==null ) { try { StandardContext ctx=(StandardContext)this.getContainer(); - Engine eng=(Engine)ctx.getParent().getParent(); domain=ctx.getEngineName(); distributable = ctx.getDistributable(); StandardHost hst=(StandardHost)ctx.getParent(); @@ -884,7 +883,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { if (id == null) return (null); - return (Session) sessions.get(id); + return sessions.get(id); } @@ -1023,7 +1022,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { public Engine getEngine() { Engine e = null; for (Container c = getContainer(); e == null && c != null ; c = c.getParent()) { - if (c != null && c instanceof Engine) { + if (c instanceof Engine) { e = (Engine)c; } } @@ -1154,7 +1153,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { */ public String listSessionIds() { StringBuffer sb=new StringBuffer(); - Iterator keys = sessions.keySet().iterator(); + Iterator keys = sessions.keySet().iterator(); while (keys.hasNext()) { sb.append(keys.next()).append(" "); } @@ -1170,7 +1169,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { * @return The attribute value, if found, null otherwise */ public String getSessionAttribute( String sessionId, String key ) { - Session s = (Session) sessions.get(sessionId); + Session s = sessions.get(sessionId); if( s==null ) { if(log.isInfoEnabled()) log.info("Session not found " + sessionId); @@ -1194,8 +1193,8 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { * representation of their values, or null if no session with the * specified id exists, or if the session does not have any attributes */ - public HashMap getSession(String sessionId) { - Session s = (Session) sessions.get(sessionId); + public HashMap getSession(String sessionId) { + Session s = sessions.get(sessionId); if (s == null) { if (log.isInfoEnabled()) { log.info("Session not found " + sessionId); @@ -1203,14 +1202,14 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { return null; } - Enumeration ee = s.getSession().getAttributeNames(); + Enumeration ee = s.getSession().getAttributeNames(); if (ee == null || !ee.hasMoreElements()) { return null; } - HashMap map = new HashMap(); + HashMap map = new HashMap(); while (ee.hasMoreElements()) { - String attrName = (String) ee.nextElement(); + String attrName = ee.nextElement(); map.put(attrName, getSessionAttribute(sessionId, attrName)); } @@ -1219,7 +1218,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { public void expireSession( String sessionId ) { - Session s=(Session)sessions.get(sessionId); + Session s=sessions.get(sessionId); if( s==null ) { if(log.isInfoEnabled()) log.info("Session not found " + sessionId); @@ -1229,14 +1228,14 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { } public long getThisAccessedTimestamp( String sessionId ) { - Session s=(Session)sessions.get(sessionId); + Session s=sessions.get(sessionId); if(s== null) return -1 ; return s.getThisAccessedTime(); } public String getThisAccessedTime( String sessionId ) { - Session s=(Session)sessions.get(sessionId); + Session s=sessions.get(sessionId); if( s==null ) { if(log.isInfoEnabled()) log.info("Session not found " + sessionId); @@ -1246,14 +1245,14 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { } public long getLastAccessedTimestamp( String sessionId ) { - Session s=(Session)sessions.get(sessionId); + Session s=sessions.get(sessionId); if(s== null) return -1 ; return s.getLastAccessedTime(); } public String getLastAccessedTime( String sessionId ) { - Session s=(Session)sessions.get(sessionId); + Session s=sessions.get(sessionId); if( s==null ) { if(log.isInfoEnabled()) log.info("Session not found " + sessionId); @@ -1263,7 +1262,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { } public String getCreationTime( String sessionId ) { - Session s=(Session)sessions.get(sessionId); + Session s=sessions.get(sessionId); if( s==null ) { if(log.isInfoEnabled()) log.info("Session not found " + sessionId); @@ -1273,7 +1272,7 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { } public long getCreationTimestamp( String sessionId ) { - Session s=(Session)sessions.get(sessionId); + Session s=sessions.get(sessionId); if(s== null) return -1 ; return s.getCreationTime(); @@ -1301,12 +1300,15 @@ public abstract class ManagerBase implements Manager, MBeanRegistration { } public void postRegister(Boolean registrationDone) { + // NOOP } public void preDeregister() throws Exception { + // NOOP } public void postDeregister() { + // NOOP } } diff --git a/java/org/apache/catalina/session/PersistentManagerBase.java b/java/org/apache/catalina/session/PersistentManagerBase.java index e0d7c0d1f..9d5334b12 100644 --- a/java/org/apache/catalina/session/PersistentManagerBase.java +++ b/java/org/apache/catalina/session/PersistentManagerBase.java @@ -59,19 +59,20 @@ public abstract class PersistentManagerBase // ---------------------------------------------------- Security Classes private class PrivilegedStoreClear - implements PrivilegedExceptionAction { + implements PrivilegedExceptionAction { - PrivilegedStoreClear() { + PrivilegedStoreClear() { + // NOOP } - public Object run() throws Exception{ + public Void run() throws Exception{ store.clear(); return null; } } private class PrivilegedStoreRemove - implements PrivilegedExceptionAction { + implements PrivilegedExceptionAction { private String id; @@ -79,14 +80,14 @@ public abstract class PersistentManagerBase this.id = id; } - public Object run() throws Exception{ + public Void run() throws Exception{ store.remove(id); return null; } } private class PrivilegedStoreLoad - implements PrivilegedExceptionAction { + implements PrivilegedExceptionAction { private String id; @@ -94,13 +95,13 @@ public abstract class PersistentManagerBase this.id = id; } - public Object run() throws Exception{ + public Session run() throws Exception{ return store.load(id); } } private class PrivilegedStoreSave - implements PrivilegedExceptionAction { + implements PrivilegedExceptionAction { private Session session; @@ -108,19 +109,20 @@ public abstract class PersistentManagerBase this.session = session; } - public Object run() throws Exception{ + public Void run() throws Exception{ store.save(session); return null; } } private class PrivilegedStoreKeys - implements PrivilegedExceptionAction { + implements PrivilegedExceptionAction { - PrivilegedStoreKeys() { + PrivilegedStoreKeys() { + // NOOP } - public Object run() throws Exception{ + public String[] run() throws Exception{ return store.keys(); } } @@ -648,8 +650,8 @@ public abstract class PersistentManagerBase try { if (SecurityUtil.isPackageProtectionEnabled()){ try{ - ids = (String[]) - AccessController.doPrivileged(new PrivilegedStoreKeys()); + ids = AccessController.doPrivileged( + new PrivilegedStoreKeys()); }catch(PrivilegedActionException ex){ Exception exception = ex.getException(); log.error("Exception in the Store during load: " @@ -750,7 +752,7 @@ public abstract class PersistentManagerBase try { swapOut(sessions[i]); } catch (IOException e) { - ; // This is logged in writeSession() + // This is logged in writeSession() } } @@ -775,8 +777,8 @@ public abstract class PersistentManagerBase try { if (SecurityUtil.isPackageProtectionEnabled()){ try{ - session = (Session) - AccessController.doPrivileged(new PrivilegedStoreLoad(id)); + session = AccessController.doPrivileged( + new PrivilegedStoreLoad(id)); }catch(PrivilegedActionException ex){ Exception exception = ex.getException(); log.error("Exception in the Store during swapIn: " @@ -938,7 +940,7 @@ public abstract class PersistentManagerBase // Force initialization of the random number generator if (log.isDebugEnabled()) log.debug("Force random number initialization starting"); - String dummy = generateSessionId(); + generateSessionId(); if (log.isDebugEnabled()) log.debug("Force random number initialization completed"); @@ -1010,7 +1012,6 @@ public abstract class PersistentManagerBase // Validate the source of this event if (!(event.getSource() instanceof Context)) return; - Context context = (Context) event.getSource(); // Process a relevant property change if (event.getPropertyName().equals("sessionTimeout")) { @@ -1057,7 +1058,7 @@ public abstract class PersistentManagerBase try { swapOut(session); } catch (IOException e) { - ; // This is logged in writeSession() + // This is logged in writeSession() } } } @@ -1101,7 +1102,7 @@ public abstract class PersistentManagerBase try { swapOut(sessions[i]); } catch (IOException e) { - ; // This is logged in writeSession() + // This is logged in writeSession() } toswap--; } @@ -1140,7 +1141,7 @@ public abstract class PersistentManagerBase try { writeSession(session); } catch (IOException e) { - ; // This is logged in writeSession() + // This is logged in writeSession() } } } diff --git a/java/org/apache/catalina/session/StandardManager.java b/java/org/apache/catalina/session/StandardManager.java index 04557228c..78f38415a 100644 --- a/java/org/apache/catalina/session/StandardManager.java +++ b/java/org/apache/catalina/session/StandardManager.java @@ -68,24 +68,26 @@ public class StandardManager // ---------------------------------------------------- Security Classes private class PrivilegedDoLoad - implements PrivilegedExceptionAction { + implements PrivilegedExceptionAction { PrivilegedDoLoad() { + // NOOP } - public Object run() throws Exception{ + public Void run() throws Exception{ doLoad(); return null; } } private class PrivilegedDoUnload - implements PrivilegedExceptionAction { + implements PrivilegedExceptionAction { PrivilegedDoUnload() { + // NOOP } - public Object run() throws Exception{ + public Void run() throws Exception{ doUnload(); return null; } @@ -375,7 +377,7 @@ public class StandardManager try { ois.close(); } catch (IOException f) { - ; + // Ignore } ois = null; } @@ -403,7 +405,7 @@ public class StandardManager try { ois.close(); } catch (IOException f) { - ; + // Ignore } ois = null; } @@ -414,7 +416,7 @@ public class StandardManager try { ois.close(); } catch (IOException f) { - ; + // Ignore } ois = null; } @@ -429,7 +431,7 @@ public class StandardManager } // Delete the persistent storage file - if (file != null && file.exists() ) + if (file.exists() ) file.delete(); } } @@ -494,7 +496,7 @@ public class StandardManager try { oos.close(); } catch (IOException f) { - ; + // Ignore } oos = null; } @@ -502,18 +504,18 @@ public class StandardManager } // Write the number of active sessions, followed by the details - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); synchronized (sessions) { if (log.isDebugEnabled()) log.debug("Unloading " + sessions.size() + " sessions"); try { oos.writeObject(new Integer(sessions.size())); - Iterator elements = sessions.values().iterator(); + Iterator elements = sessions.values().iterator(); while (elements.hasNext()) { StandardSession session = (StandardSession) elements.next(); list.add(session); - ((StandardSession) session).passivate(); + session.passivate(); session.writeObjectData(oos); } } catch (IOException e) { @@ -522,7 +524,7 @@ public class StandardManager try { oos.close(); } catch (IOException f) { - ; + // Ignore } oos = null; } @@ -540,7 +542,7 @@ public class StandardManager try { oos.close(); } catch (IOException f) { - ; + // Ignore } oos = null; } @@ -550,13 +552,13 @@ public class StandardManager // Expire all the sessions we just wrote if (log.isDebugEnabled()) log.debug("Expiring " + list.size() + " persisted sessions"); - Iterator expires = list.iterator(); + Iterator expires = list.iterator(); while (expires.hasNext()) { - StandardSession session = (StandardSession) expires.next(); + StandardSession session = expires.next(); try { session.expire(false); } catch (Throwable t) { - ; + // Ignore } finally { session.recycle(); } @@ -628,7 +630,7 @@ public class StandardManager // Force initialization of the random number generator if (log.isDebugEnabled()) log.debug("Force random number initialization starting"); - String dummy = generateSessionId(); + generateSessionId(); if (log.isDebugEnabled()) log.debug("Force random number initialization completed"); @@ -678,7 +680,7 @@ public class StandardManager session.expire(); } } catch (Throwable t) { - ; + // Ignore } finally { // Measure against memory leaking if references to the session // object are kept in a shared field somewhere @@ -708,7 +710,6 @@ public class StandardManager // Validate the source of this event if (!(event.getSource() instanceof Context)) return; - Context context = (Context) event.getSource(); // Process a relevant property change if (event.getPropertyName().equals("sessionTimeout")) { diff --git a/java/org/apache/catalina/session/StandardSession.java b/java/org/apache/catalina/session/StandardSession.java index f466e5e89..135a67f91 100644 --- a/java/org/apache/catalina/session/StandardSession.java +++ b/java/org/apache/catalina/session/StandardSession.java @@ -130,7 +130,7 @@ public class StandardSession /** * The collection of user data attributes associated with this Session. */ - protected Map attributes = new ConcurrentHashMap(); + protected Map attributes = new ConcurrentHashMap(); /** @@ -155,8 +155,8 @@ public class StandardSession /** * The method signature for the fireContainerEvent method. */ - protected static final Class containerEventTypes[] = - { String.class, Object.class }; + protected static final Class containerEventTypes[] = + { String.class, Object.class }; /** @@ -210,7 +210,8 @@ public class StandardSession /** * The session event listeners for this Session. */ - protected transient ArrayList listeners = new ArrayList(); + protected transient ArrayList listeners = + new ArrayList(); /** @@ -244,7 +245,7 @@ public class StandardSession * and event listeners. IMPLEMENTATION NOTE: This object is * not saved and restored across session serializations! */ - protected transient Map notes = new Hashtable(); + protected transient Map notes = new Hashtable(); /** @@ -404,7 +405,7 @@ public class StandardSession "afterSessionCreated", listener); } catch (Exception e) { - ; + // Ignore } manager.getContainer().getLogger().error (sm.getString("standardSession.sessionEvent"), t); @@ -580,8 +581,9 @@ public class StandardSession if (facade == null){ if (SecurityUtil.isPackageProtectionEnabled()){ final StandardSession fsession = this; - facade = (StandardSessionFacade)AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ + facade = AccessController.doPrivileged( + new PrivilegedAction(){ + public StandardSessionFacade run(){ return new StandardSessionFacade(fsession); } }); @@ -736,7 +738,7 @@ public class StandardSession "afterSessionDestroyed", listener); } catch (Exception e) { - ; + // Ignore } manager.getContainer().getLogger().error (sm.getString("standardSession.sessionEvent"), t); @@ -869,7 +871,7 @@ public class StandardSession * Return an Iterator containing the String names of all notes bindings * that exist for this session. */ - public Iterator getNoteNames() { + public Iterator getNoteNames() { return (notes.keySet().iterator()); @@ -1073,13 +1075,13 @@ public class StandardSession * @exception IllegalStateException if this method is called on an * invalidated session */ - public Enumeration getAttributeNames() { + public Enumeration getAttributeNames() { if (!isValidInternal()) throw new IllegalStateException (sm.getString("standardSession.getAttributeNames.ise")); - return (new Enumerator(attributes.keySet(), true)); + return (new Enumerator(attributes.keySet(), true)); } @@ -1404,7 +1406,7 @@ public class StandardSession listener); } } catch (Exception e) { - ; + // Ignore } manager.getContainer().getLogger().error (sm.getString("standardSession.attributeEvent"), t); @@ -1458,13 +1460,13 @@ public class StandardSession // Deserialize the attribute count and attribute values if (attributes == null) - attributes = new Hashtable(); + attributes = new Hashtable(); int n = ((Integer) stream.readObject()).intValue(); boolean isValidSave = isValid; isValid = true; for (int i = 0; i < n; i++) { String name = (String) stream.readObject(); - Object value = (Object) stream.readObject(); + Object value = stream.readObject(); if ((value instanceof String) && (value.equals(NOT_SERIALIZED))) continue; if (manager.getContainer().getLogger().isDebugEnabled()) @@ -1475,11 +1477,11 @@ public class StandardSession isValid = isValidSave; if (listeners == null) { - listeners = new ArrayList(); + listeners = new ArrayList(); } if (notes == null) { - notes = new Hashtable(); + notes = new Hashtable(); } } @@ -1519,8 +1521,8 @@ public class StandardSession // Accumulate the names of serializable and non-serializable attributes String keys[] = keys(); - ArrayList saveNames = new ArrayList(); - ArrayList saveValues = new ArrayList(); + ArrayList saveNames = new ArrayList(); + ArrayList saveValues = new ArrayList(); for (int i = 0; i < keys.length; i++) { Object value = attributes.get(keys[i]); if (value == null) @@ -1538,7 +1540,7 @@ public class StandardSession int n = saveNames.size(); stream.writeObject(new Integer(n)); for (int i = 0; i < n; i++) { - stream.writeObject((String) saveNames.get(i)); + stream.writeObject(saveNames.get(i)); try { stream.writeObject(saveValues.get(i)); if (manager.getContainer().getLogger().isDebugEnabled()) @@ -1625,11 +1627,11 @@ public class StandardSession SessionEvent event = new SessionEvent(this, type, data); SessionListener list[] = new SessionListener[0]; synchronized (listeners) { - list = (SessionListener[]) listeners.toArray(list); + list = listeners.toArray(list); } for (int i = 0; i < list.length; i++){ - ((SessionListener) list[i]).sessionEvent(event); + (list[i]).sessionEvent(event); } } @@ -1642,7 +1644,7 @@ public class StandardSession */ protected String[] keys() { - return ((String[]) attributes.keySet().toArray(EMPTY_ARRAY)); + return attributes.keySet().toArray(EMPTY_ARRAY); } @@ -1708,7 +1710,7 @@ public class StandardSession "afterSessionAttributeRemoved", listener); } catch (Exception e) { - ; + // Ignore } manager.getContainer().getLogger().error (sm.getString("standardSession.attributeEvent"), t); diff --git a/java/org/apache/catalina/session/StandardSessionFacade.java b/java/org/apache/catalina/session/StandardSessionFacade.java index 3c94f3e14..eafb499ef 100644 --- a/java/org/apache/catalina/session/StandardSessionFacade.java +++ b/java/org/apache/catalina/session/StandardSessionFacade.java @@ -45,7 +45,7 @@ public class StandardSessionFacade */ public StandardSessionFacade(StandardSession session) { super(); - this.session = (HttpSession) session; + this.session = session; } @@ -101,6 +101,9 @@ public class StandardSessionFacade } + /** + * @deprecated + */ public HttpSessionContext getSessionContext() { return session.getSessionContext(); } @@ -111,6 +114,9 @@ public class StandardSessionFacade } + /** + * @deprecated + */ public Object getValue(String name) { return session.getAttribute(name); } @@ -121,6 +127,9 @@ public class StandardSessionFacade } + /** + * @deprecated + */ public String[] getValueNames() { return session.getValueNames(); } @@ -131,6 +140,9 @@ public class StandardSessionFacade } + /** + * @deprecated + */ public void putValue(String name, Object value) { session.setAttribute(name, value); } @@ -141,6 +153,9 @@ public class StandardSessionFacade } + /** + * @deprecated + */ public void removeValue(String name) { session.removeAttribute(name); } diff --git a/java/org/apache/catalina/session/StoreBase.java b/java/org/apache/catalina/session/StoreBase.java index 0eddfd6a2..857273248 100644 --- a/java/org/apache/catalina/session/StoreBase.java +++ b/java/org/apache/catalina/session/StoreBase.java @@ -173,7 +173,6 @@ public abstract class StoreBase * */ public void processExpires() { - long timeNow = System.currentTimeMillis(); String[] keys = null; if(!started) {