You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/12/26 20:00:35 UTC
svn commit: r729523 - in /tomcat/trunk/java/org/apache/catalina/session:
FileStore.java JDBCStore.java ManagerBase.java PersistentManagerBase.java
StandardManager.java StandardSession.java StandardSessionFacade.java
StoreBase.java
Author: markt
Date: Fri Dec 26 11:00:35 2008
New Revision: 729523
URL: http://svn.apache.org/viewvc?rev=729523&view=rev
Log:
o.a.c.session generics changes
Deprecate methods that implement deprecated methods
Fix assorted Eclipse warnings
Modified:
tomcat/trunk/java/org/apache/catalina/session/FileStore.java
tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
tomcat/trunk/java/org/apache/catalina/session/StandardManager.java
tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java
tomcat/trunk/java/org/apache/catalina/session/StoreBase.java
Modified: tomcat/trunk/java/org/apache/catalina/session/FileStore.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/FileStore.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/FileStore.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/FileStore.java Fri Dec 26 11:00:35 2008
@@ -37,7 +37,6 @@
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 @@
* @version $Revision$ $Date$
*/
-public final class FileStore
- extends StoreBase implements Store {
+public final class FileStore extends StoreBase {
// ----------------------------------------------------- Constants
@@ -219,14 +217,14 @@
}
// Build and return the list of session identifiers
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
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 @@
try {
ois.close();
} catch (IOException f) {
- ;
+ // Ignore
}
ois = null;
}
@@ -302,7 +300,7 @@
try {
ois.close();
} catch (IOException f) {
- ;
+ // Ignore
}
}
}
@@ -362,7 +360,7 @@
try {
oos.close();
} catch (IOException f) {
- ;
+ // Ignore
}
}
throw e;
Modified: tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java Fri Dec 26 11:00:35 2008
@@ -21,7 +21,6 @@
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 @@
* @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 @@
preparedKeysSql.setString(1, getName());
rst = preparedKeysSql.executeQuery();
- ArrayList tmpkeys = new ArrayList();
+ ArrayList<String> tmpkeys = new ArrayList<String>();
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 @@
rst.close();
}
} catch (SQLException e) {
- ;
+ // Ignore
}
release(_conn);
@@ -538,7 +536,7 @@
if (rst != null)
rst.close();
} catch (SQLException e) {
- ;
+ // Ignore
}
release(_conn);
@@ -627,13 +625,13 @@
rst.close();
}
} catch (SQLException e) {
- ;
+ // Ignore
}
if (ois != null) {
try {
ois.close();
} catch (IOException e) {
- ;
+ // Ignore
}
}
release(_conn);
@@ -793,7 +791,7 @@
if (dbConnection != null)
close(dbConnection);
} catch (IOException e) {
- ;
+ // Ignore
} finally {
if (oos != null) {
oos.close();
@@ -858,7 +856,7 @@
// 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 @@
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 @@
* @param conn The connection to be released
*/
protected void release(Connection conn) {
- ;
+ // NOOP
}
/**
@@ -981,7 +979,7 @@
try {
dbConnection.commit();
} catch (SQLException e) {
- ;
+ // Ignore
}
close(dbConnection);
}
Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Fri Dec 26 11:00:35 2008
@@ -225,9 +225,9 @@
// ------------------------------------------------------------- Security classes
- private class PrivilegedSetRandomFile implements PrivilegedAction{
+ private class PrivilegedSetRandomFile implements PrivilegedAction<DataInputStream>{
- public Object run(){
+ public DataInputStream run(){
try {
File f=new File( devRandomSource );
if( ! f.exists() ) return null;
@@ -376,7 +376,7 @@
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 @@
// 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 @@
}
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 @@
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 @@
if (id == null)
return (null);
- return (Session) sessions.get(id);
+ return sessions.get(id);
}
@@ -1023,7 +1022,7 @@
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 String listSessionIds() {
StringBuffer sb=new StringBuffer();
- Iterator keys = sessions.keySet().iterator();
+ Iterator<String> keys = sessions.keySet().iterator();
while (keys.hasNext()) {
sb.append(keys.next()).append(" ");
}
@@ -1170,7 +1169,7 @@
* @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 @@
* 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<String, String> getSession(String sessionId) {
+ Session s = sessions.get(sessionId);
if (s == null) {
if (log.isInfoEnabled()) {
log.info("Session not found " + sessionId);
@@ -1203,14 +1202,14 @@
return null;
}
- Enumeration ee = s.getSession().getAttributeNames();
+ Enumeration<String> ee = s.getSession().getAttributeNames();
if (ee == null || !ee.hasMoreElements()) {
return null;
}
- HashMap map = new HashMap();
+ HashMap<String, String> map = new HashMap<String, String>();
while (ee.hasMoreElements()) {
- String attrName = (String) ee.nextElement();
+ String attrName = ee.nextElement();
map.put(attrName, getSessionAttribute(sessionId, attrName));
}
@@ -1219,7 +1218,7 @@
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 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 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 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 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 void postRegister(Boolean registrationDone) {
+ // NOOP
}
public void preDeregister() throws Exception {
+ // NOOP
}
public void postDeregister() {
+ // NOOP
}
}
Modified: tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java Fri Dec 26 11:00:35 2008
@@ -59,19 +59,20 @@
// ---------------------------------------------------- Security Classes
private class PrivilegedStoreClear
- implements PrivilegedExceptionAction {
+ implements PrivilegedExceptionAction<Void> {
- PrivilegedStoreClear() {
+ PrivilegedStoreClear() {
+ // NOOP
}
- public Object run() throws Exception{
+ public Void run() throws Exception{
store.clear();
return null;
}
}
private class PrivilegedStoreRemove
- implements PrivilegedExceptionAction {
+ implements PrivilegedExceptionAction<Void> {
private String id;
@@ -79,14 +80,14 @@
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<Session> {
private String id;
@@ -94,13 +95,13 @@
this.id = id;
}
- public Object run() throws Exception{
+ public Session run() throws Exception{
return store.load(id);
}
}
private class PrivilegedStoreSave
- implements PrivilegedExceptionAction {
+ implements PrivilegedExceptionAction<Void> {
private Session session;
@@ -108,19 +109,20 @@
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<String[]> {
- PrivilegedStoreKeys() {
+ PrivilegedStoreKeys() {
+ // NOOP
}
- public Object run() throws Exception{
+ public String[] run() throws Exception{
return store.keys();
}
}
@@ -648,8 +650,8 @@
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 @@
try {
swapOut(sessions[i]);
} catch (IOException e) {
- ; // This is logged in writeSession()
+ // This is logged in writeSession()
}
}
@@ -775,8 +777,8 @@
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 @@
// 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 @@
// 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 @@
try {
swapOut(session);
} catch (IOException e) {
- ; // This is logged in writeSession()
+ // This is logged in writeSession()
}
}
}
@@ -1101,7 +1102,7 @@
try {
swapOut(sessions[i]);
} catch (IOException e) {
- ; // This is logged in writeSession()
+ // This is logged in writeSession()
}
toswap--;
}
@@ -1140,7 +1141,7 @@
try {
writeSession(session);
} catch (IOException e) {
- ; // This is logged in writeSession()
+ // This is logged in writeSession()
}
}
}
Modified: tomcat/trunk/java/org/apache/catalina/session/StandardManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardManager.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardManager.java Fri Dec 26 11:00:35 2008
@@ -68,24 +68,26 @@
// ---------------------------------------------------- Security Classes
private class PrivilegedDoLoad
- implements PrivilegedExceptionAction {
+ implements PrivilegedExceptionAction<Void> {
PrivilegedDoLoad() {
+ // NOOP
}
- public Object run() throws Exception{
+ public Void run() throws Exception{
doLoad();
return null;
}
}
private class PrivilegedDoUnload
- implements PrivilegedExceptionAction {
+ implements PrivilegedExceptionAction<Void> {
PrivilegedDoUnload() {
+ // NOOP
}
- public Object run() throws Exception{
+ public Void run() throws Exception{
doUnload();
return null;
}
@@ -375,7 +377,7 @@
try {
ois.close();
} catch (IOException f) {
- ;
+ // Ignore
}
ois = null;
}
@@ -403,7 +405,7 @@
try {
ois.close();
} catch (IOException f) {
- ;
+ // Ignore
}
ois = null;
}
@@ -414,7 +416,7 @@
try {
ois.close();
} catch (IOException f) {
- ;
+ // Ignore
}
ois = null;
}
@@ -429,7 +431,7 @@
}
// Delete the persistent storage file
- if (file != null && file.exists() )
+ if (file.exists() )
file.delete();
}
}
@@ -494,7 +496,7 @@
try {
oos.close();
} catch (IOException f) {
- ;
+ // Ignore
}
oos = null;
}
@@ -502,18 +504,18 @@
}
// Write the number of active sessions, followed by the details
- ArrayList list = new ArrayList();
+ ArrayList<StandardSession> list = new ArrayList<StandardSession>();
synchronized (sessions) {
if (log.isDebugEnabled())
log.debug("Unloading " + sessions.size() + " sessions");
try {
oos.writeObject(new Integer(sessions.size()));
- Iterator elements = sessions.values().iterator();
+ Iterator<Session> 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 @@
try {
oos.close();
} catch (IOException f) {
- ;
+ // Ignore
}
oos = null;
}
@@ -540,7 +542,7 @@
try {
oos.close();
} catch (IOException f) {
- ;
+ // Ignore
}
oos = null;
}
@@ -550,13 +552,13 @@
// Expire all the sessions we just wrote
if (log.isDebugEnabled())
log.debug("Expiring " + list.size() + " persisted sessions");
- Iterator expires = list.iterator();
+ Iterator<StandardSession> 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 @@
// 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 @@
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 @@
// 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")) {
Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Fri Dec 26 11:00:35 2008
@@ -130,7 +130,7 @@
/**
* The collection of user data attributes associated with this Session.
*/
- protected Map attributes = new ConcurrentHashMap();
+ protected Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
/**
@@ -155,8 +155,8 @@
/**
* The method signature for the <code>fireContainerEvent</code> method.
*/
- protected static final Class containerEventTypes[] =
- { String.class, Object.class };
+ protected static final Class<?> containerEventTypes[] =
+ { String.class, Object.class };
/**
@@ -210,7 +210,8 @@
/**
* The session event listeners for this Session.
*/
- protected transient ArrayList listeners = new ArrayList();
+ protected transient ArrayList<SessionListener> listeners =
+ new ArrayList<SessionListener>();
/**
@@ -244,7 +245,7 @@
* and event listeners. <b>IMPLEMENTATION NOTE:</b> This object is
* <em>not</em> saved and restored across session serializations!
*/
- protected transient Map notes = new Hashtable();
+ protected transient Map<String, Object> notes = new Hashtable<String, Object>();
/**
@@ -404,7 +405,7 @@
"afterSessionCreated",
listener);
} catch (Exception e) {
- ;
+ // Ignore
}
manager.getContainer().getLogger().error
(sm.getString("standardSession.sessionEvent"), t);
@@ -580,8 +581,9 @@
if (facade == null){
if (SecurityUtil.isPackageProtectionEnabled()){
final StandardSession fsession = this;
- facade = (StandardSessionFacade)AccessController.doPrivileged(new PrivilegedAction(){
- public Object run(){
+ facade = AccessController.doPrivileged(
+ new PrivilegedAction<StandardSessionFacade>(){
+ public StandardSessionFacade run(){
return new StandardSessionFacade(fsession);
}
});
@@ -736,7 +738,7 @@
"afterSessionDestroyed",
listener);
} catch (Exception e) {
- ;
+ // Ignore
}
manager.getContainer().getLogger().error
(sm.getString("standardSession.sessionEvent"), t);
@@ -869,7 +871,7 @@
* Return an Iterator containing the String names of all notes bindings
* that exist for this session.
*/
- public Iterator getNoteNames() {
+ public Iterator<String> getNoteNames() {
return (notes.keySet().iterator());
@@ -1073,13 +1075,13 @@
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
- public Enumeration getAttributeNames() {
+ public Enumeration<String> getAttributeNames() {
if (!isValidInternal())
throw new IllegalStateException
(sm.getString("standardSession.getAttributeNames.ise"));
- return (new Enumerator(attributes.keySet(), true));
+ return (new Enumerator<String>(attributes.keySet(), true));
}
@@ -1404,7 +1406,7 @@
listener);
}
} catch (Exception e) {
- ;
+ // Ignore
}
manager.getContainer().getLogger().error
(sm.getString("standardSession.attributeEvent"), t);
@@ -1458,13 +1460,13 @@
// Deserialize the attribute count and attribute values
if (attributes == null)
- attributes = new Hashtable();
+ attributes = new Hashtable<String, Object>();
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 @@
isValid = isValidSave;
if (listeners == null) {
- listeners = new ArrayList();
+ listeners = new ArrayList<SessionListener>();
}
if (notes == null) {
- notes = new Hashtable();
+ notes = new Hashtable<String, Object>();
}
}
@@ -1519,8 +1521,8 @@
// Accumulate the names of serializable and non-serializable attributes
String keys[] = keys();
- ArrayList saveNames = new ArrayList();
- ArrayList saveValues = new ArrayList();
+ ArrayList<String> saveNames = new ArrayList<String>();
+ ArrayList<Object> saveValues = new ArrayList<Object>();
for (int i = 0; i < keys.length; i++) {
Object value = attributes.get(keys[i]);
if (value == null)
@@ -1538,7 +1540,7 @@
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 @@
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 @@
*/
protected String[] keys() {
- return ((String[]) attributes.keySet().toArray(EMPTY_ARRAY));
+ return attributes.keySet().toArray(EMPTY_ARRAY);
}
@@ -1708,7 +1710,7 @@
"afterSessionAttributeRemoved",
listener);
} catch (Exception e) {
- ;
+ // Ignore
}
manager.getContainer().getLogger().error
(sm.getString("standardSession.attributeEvent"), t);
Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java Fri Dec 26 11:00:35 2008
@@ -45,7 +45,7 @@
*/
public StandardSessionFacade(StandardSession session) {
super();
- this.session = (HttpSession) session;
+ this.session = session;
}
@@ -101,6 +101,9 @@
}
+ /**
+ * @deprecated
+ */
public HttpSessionContext getSessionContext() {
return session.getSessionContext();
}
@@ -111,6 +114,9 @@
}
+ /**
+ * @deprecated
+ */
public Object getValue(String name) {
return session.getAttribute(name);
}
@@ -121,6 +127,9 @@
}
+ /**
+ * @deprecated
+ */
public String[] getValueNames() {
return session.getValueNames();
}
@@ -131,6 +140,9 @@
}
+ /**
+ * @deprecated
+ */
public void putValue(String name, Object value) {
session.setAttribute(name, value);
}
@@ -141,6 +153,9 @@
}
+ /**
+ * @deprecated
+ */
public void removeValue(String name) {
session.removeAttribute(name);
}
Modified: tomcat/trunk/java/org/apache/catalina/session/StoreBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StoreBase.java?rev=729523&r1=729522&r2=729523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StoreBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StoreBase.java Fri Dec 26 11:00:35 2008
@@ -173,7 +173,6 @@
*
*/
public void processExpires() {
- long timeNow = System.currentTimeMillis();
String[] keys = null;
if(!started) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org