384896 JDBCSessionManager fails to load existing sessions on oracle when contextPath is /
This commit is contained in:
parent
9315ed8b73
commit
b62473b58f
|
@ -85,7 +85,6 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
||||||
|
|
||||||
protected String _insertSession;
|
protected String _insertSession;
|
||||||
protected String _deleteSession;
|
protected String _deleteSession;
|
||||||
protected String _selectSession;
|
|
||||||
protected String _updateSession;
|
protected String _updateSession;
|
||||||
protected String _updateSessionNode;
|
protected String _updateSessionNode;
|
||||||
protected String _updateSessionAccessTime;
|
protected String _updateSessionAccessTime;
|
||||||
|
@ -110,6 +109,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
||||||
String _dbName;
|
String _dbName;
|
||||||
boolean _isLower;
|
boolean _isLower;
|
||||||
boolean _isUpper;
|
boolean _isUpper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DatabaseAdaptor (DatabaseMetaData dbMeta)
|
public DatabaseAdaptor (DatabaseMetaData dbMeta)
|
||||||
|
@ -189,6 +189,39 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
||||||
|
|
||||||
return "rowId";
|
return "rowId";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isEmptyStringNull ()
|
||||||
|
{
|
||||||
|
return (_dbName.startsWith("oracle"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public PreparedStatement getLoadStatement (Connection connection, String rowId, String contextPath, String virtualHosts)
|
||||||
|
throws SQLException
|
||||||
|
{
|
||||||
|
if (contextPath == null || "".equals(contextPath))
|
||||||
|
{
|
||||||
|
if (isEmptyStringNull())
|
||||||
|
{
|
||||||
|
PreparedStatement statement = connection.prepareStatement("select * from "+_sessionTable+
|
||||||
|
" where sessionId = ? and contextPath is null and virtualHost = ?");
|
||||||
|
statement.setString(1, rowId);
|
||||||
|
statement.setString(2, virtualHosts);
|
||||||
|
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PreparedStatement statement = connection.prepareStatement("select * from "+_sessionTable+
|
||||||
|
" where sessionId = ? and contextPath = ? and virtualHost = ?");
|
||||||
|
statement.setString(1, rowId);
|
||||||
|
statement.setString(2, contextPath);
|
||||||
|
statement.setString(3, virtualHosts);
|
||||||
|
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -628,10 +661,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
||||||
|
|
||||||
_deleteSession = "delete from "+_sessionTable+
|
_deleteSession = "delete from "+_sessionTable+
|
||||||
" where "+_sessionTableRowId+" = ?";
|
" where "+_sessionTableRowId+" = ?";
|
||||||
|
|
||||||
_selectSession = "select * from "+_sessionTable+
|
|
||||||
" where sessionId = ? and contextPath = ? and virtualHost = ?";
|
|
||||||
|
|
||||||
_updateSession = "update "+_sessionTable+
|
_updateSession = "update "+_sessionTable+
|
||||||
" set lastNode = ?, accessTime = ?, lastAccessTime = ?, lastSavedTime = ?, expiryTime = ?, map = ? where "+_sessionTableRowId+" = ?";
|
" set lastNode = ?, accessTime = ?, lastAccessTime = ?, lastSavedTime = ?, expiryTime = ?, map = ? where "+_sessionTableRowId+" = ?";
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
@ -831,10 +832,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connection = getConnection();
|
connection = getConnection();
|
||||||
statement = connection.prepareStatement(_jdbcSessionIdMgr._selectSession);
|
statement = _jdbcSessionIdMgr._dbAdaptor.getLoadStatement(connection, id, canonicalContextPath, vhost);
|
||||||
statement.setString(1, id);
|
|
||||||
statement.setString(2, canonicalContextPath);
|
|
||||||
statement.setString(3, vhost);
|
|
||||||
ResultSet result = statement.executeQuery();
|
ResultSet result = statement.executeQuery();
|
||||||
if (result.next())
|
if (result.next())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue