You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/01/05 20:43:08 UTC
svn commit: r366259 - in /db/derby/code/trunk/java/engine/org/apache/derby:
iapi/jdbc/ impl/jdbc/ impl/sql/compile/ impl/sql/execute/ jdbc/
Author: djd
Date: Thu Jan 5 11:43:02 2006
New Revision: 366259
URL: http://svn.apache.org/viewcvs?rev=366259&view=rev
Log:
Reduce the visibility of various methods and fields based upon some
early investigation of object inspection by applications for security holes.
Methods/fields reduced to private or package from public or protected.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateConstantAction.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java Thu Jan 5 11:43:02 2006
@@ -47,9 +47,9 @@
{
// default for Derby
- protected int stateHoldability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
+ int stateHoldability = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
- protected final BrokeredConnectionControl control;
+ final BrokeredConnectionControl control;
private boolean isClosed;
private String connString;
@@ -371,14 +371,14 @@
*
* @return the current connection
*/
- protected final Connection getRealConnection() throws SQLException {
+ final Connection getRealConnection() throws SQLException {
if (isClosed)
throw Util.noCurrentConnection();
return control.getRealConnection();
}
- protected final void notifyException(SQLException sqle) {
+ final void notifyException(SQLException sqle) {
if (!isClosed)
control.notifyException(sqle);
}
@@ -525,5 +525,5 @@
return connString;
}
- protected int getJDBCLevel() { return 2;}
+ int getJDBCLevel() { return 2;}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection30.java Thu Jan 5 11:43:02 2006
@@ -221,6 +221,6 @@
return new BrokeredCallableStatement30(statementControl, getJDBCLevel(), sql);
}
- protected int getJDBCLevel() { return 3;}
+ int getJDBCLevel() { return 3;}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java Thu Jan 5 11:43:02 2006
@@ -93,7 +93,7 @@
throw Util.notImplemented();
}
- protected int getJDBCLevel() { return 4;}
+ int getJDBCLevel() { return 4;}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/ConnectionChild.java Thu Jan 5 11:43:02 2006
@@ -22,33 +22,29 @@
import org.apache.derby.jdbc.InternalDriver;
-import org.apache.derby.iapi.services.context.ContextManager;
-
-import org.apache.derby.iapi.db.Database;
-
import java.sql.SQLException;
/**
- Any class in the local JDBC driver (ie this package) that needs to
+ Any class in the embedded JDBC driver (ie this package) that needs to
refer back to the EmbedConnection object extends this class.
*/
abstract class ConnectionChild {
// parameters to handleException
- protected static final boolean CLOSE = true;
- protected static final boolean NOCLOSE = false;
+ static final boolean CLOSE = true;
+ static final boolean NOCLOSE = false;
/*
** Local connection is the current EmbedConnection
** object that we use for all our work.
*/
- protected EmbedConnection localConn;
+ EmbedConnection localConn;
/**
Factory for JDBC objects to be created.
*/
- protected final InternalDriver factory;
+ final InternalDriver factory;
/**
Calendar for data operations.
@@ -56,7 +52,7 @@
private java.util.Calendar cal;
- protected ConnectionChild(EmbedConnection conn) {
+ ConnectionChild(EmbedConnection conn) {
super();
localConn = conn;
factory = conn.getLocalDriver();
@@ -65,7 +61,7 @@
/**
Return a reference to the EmbedConnection
*/
- protected final EmbedConnection getEmbedConnection() {
+ final EmbedConnection getEmbedConnection() {
return localConn;
}
@@ -73,7 +69,7 @@
* Return an object to be used for connection
* synchronization.
*/
- protected final Object getConnectionSynchronization()
+ final Object getConnectionSynchronization()
{
return localConn.getConnectionSynchronization();
}
@@ -83,7 +79,7 @@
@see EmbedConnection#handleException
@exception SQLException thrown if can't handle
*/
- protected final SQLException handleException(Throwable t)
+ final SQLException handleException(Throwable t)
throws SQLException {
return localConn.handleException(t);
}
@@ -93,7 +89,7 @@
@see EmbedConnection#handleException
@exception SQLException thrown if can't handle
*/
- protected final SQLException handleException(Throwable t, boolean close)
+ final SQLException handleException(Throwable t, boolean close)
throws SQLException {
return localConn.handleException(t, close);
}
@@ -101,7 +97,7 @@
If Autocommit is on, note that a commit is needed.
@see EmbedConnection#needCommit
*/
- protected final void needCommit() {
+ final void needCommit() {
localConn.needCommit();
}
@@ -110,7 +106,7 @@
@see EmbedConnection#commitIfNeeded
@exception SQLException thrown on failure
*/
- protected final void commitIfNeeded() throws SQLException {
+ final void commitIfNeeded() throws SQLException {
//System.out.println(this + " <> " + localConn.getClass());
//new Throwable("cin").printStackTrace(System.out);
localConn.commitIfNeeded();
@@ -121,7 +117,7 @@
@see EmbedConnection#commitIfNeeded
@exception SQLException thrown on failure
*/
- protected final void commitIfAutoCommit() throws SQLException {
+ final void commitIfAutoCommit() throws SQLException {
//System.out.println(this + " <> " + localConn.getClass());
//new Throwable("cin").printStackTrace(System.out);
localConn.commitIfAutoCommit();
@@ -133,7 +129,7 @@
@see EmbedConnection#setupContextStack
@exception SQLException thrown on failure
*/
- protected final void setupContextStack() throws SQLException {
+ final void setupContextStack() throws SQLException {
localConn.setupContextStack();
}
@@ -143,20 +139,10 @@
@see EmbedConnection#restoreContextStack
@exception SQLException thrown on failure
*/
- protected final void restoreContextStack() throws SQLException {
+ final void restoreContextStack() throws SQLException {
localConn.restoreContextStack();
}
- public ContextManager getContextManager()
- {
- return localConn.getContextManager();
- }
-
- public Database getDatabase()
- {
- return localConn.getDatabase();
- }
-
/**
Get and save a unique calendar object for this JDBC object.
No need to synchronize because multiple threads should not
@@ -164,19 +150,19 @@
a small window where each would get its own Calendar for a
single call.
*/
- protected java.util.Calendar getCal() {
+ java.util.Calendar getCal() {
if (cal == null)
cal = new java.util.GregorianCalendar();
return cal;
}
- protected SQLException newSQLException(String messageId) {
+ SQLException newSQLException(String messageId) {
return localConn.newSQLException(messageId);
}
- protected SQLException newSQLException(String messageId, Object arg1) {
+ SQLException newSQLException(String messageId, Object arg1) {
return localConn.newSQLException(messageId, arg1);
}
- protected SQLException newSQLException(String messageId, Object arg1, Object arg2) {
+ SQLException newSQLException(String messageId, Object arg1, Object arg2) {
return localConn.newSQLException(messageId, arg1, arg2);
}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Thu Jan 5 11:43:02 2006
@@ -94,9 +94,9 @@
//////////////////////////////////////////////////////////
// OBJECTS SHARED ACROSS CONNECTION NESTING
//////////////////////////////////////////////////////////
- protected DatabaseMetaData dbMetadata;
+ DatabaseMetaData dbMetadata;
- protected final TransactionResourceImpl tr; // always access tr thru getTR()
+ final TransactionResourceImpl tr; // always access tr thru getTR()
//////////////////////////////////////////////////////////
@@ -104,12 +104,12 @@
// specific)
//////////////////////////////////////////////////////////
private boolean active;
- protected boolean autoCommit = true;
+ boolean autoCommit = true;
boolean needCommit;
//following is a new feature in JDBC3.0 where you can specify the holdability
//of a resultset at the end of the transaction. This gets set by the
//new method setHoldability(int) in JDBC3.0
- protected int connectionHoldAbility = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
+ int connectionHoldAbility = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
//////////////////////////////////////////////////////////
@@ -121,12 +121,12 @@
** we are the root connection unless we are created
** by copying the state from another connection.
*/
- protected final EmbedConnection rootConnection;
+ final EmbedConnection rootConnection;
private SQLWarning topWarning;
/**
Factory for JDBC objects to be created.
*/
- public InternalDriver factory;
+ private InternalDriver factory;
/**
The Connection object the application is using when accessing the
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseColumnNode.java Thu Jan 5 11:43:02 2006
@@ -48,13 +48,13 @@
public class BaseColumnNode extends ValueNode
{
- public String columnName;
+ private String columnName;
/*
** This is the user-specified table name. It will be null if the
** user specifies a column without a table name.
*/
- public TableName tableName;
+ private TableName tableName;
/**
* Initializer for when you only have the column name.
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java Thu Jan 5 11:43:02 2006
@@ -51,24 +51,24 @@
public class ColumnReference extends ValueNode
{
- public String columnName;
+ String columnName;
/*
** This is the user-specified table name. It will be null if the
** user specifies a column without a table name. Leave it null even
** when the column is bound as it is only used in binding.
*/
- public TableName tableName;
+ TableName tableName;
/* The table this column reference is bound to */
- public int tableNumber;
+ private int tableNumber;
/* The column number in the underlying base table */
- public int columnNumber;
+ private int columnNumber;
/* This is where the value for this column reference will be coming from */
- public ResultColumn source;
+ private ResultColumn source;
/* For unRemapping */
ResultColumn origSource;
- public String origName;
+ private String origName;
int origTableNumber = -1;
int origColumnNumber = -1;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java Thu Jan 5 11:43:02 2006
@@ -73,8 +73,8 @@
public class CreateConstraintConstantAction extends ConstraintConstantAction
{
- public String[] columnNames;
- public String constraintText;
+ String[] columnNames;
+ private String constraintText;
private ConstraintInfo otherConstraintInfo;
private ClassFactory cf;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java Thu Jan 5 11:43:02 2006
@@ -50,7 +50,7 @@
*
* @author jamie
*/
-public class TriggerInfo implements Formatable
+public final class TriggerInfo implements Formatable
{
/********************************************************
**
@@ -69,9 +69,9 @@
**
********************************************************/
- public TriggerDescriptor[] triggerArray;
- public String[] columnNames;
- public int[] columnIds;
+ TriggerDescriptor[] triggerArray;
+ String[] columnNames;
+ int[] columnIds;
/**
* Niladic constructor for Formattable
@@ -86,14 +86,13 @@
* causing the trigger to fire
* @param triggers the list of trigger descriptors
*
- * @exception StandardException on error
*/
public TriggerInfo
(
TableDescriptor td,
int[] changedCols,
GenericDescriptorList triggers
- ) throws StandardException
+ )
{
this.columnIds = changedCols;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateConstantAction.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateConstantAction.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateConstantAction.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateConstantAction.java Thu Jan 5 11:43:02 2006
@@ -65,16 +65,13 @@
** ITS read/writeExternal.
**
********************************************************/
-
- public ExecRow emptyHeapRow;
-
+
/*
** Integer array of columns that are being updated.
- ** Used by rep, hence public.
*/
- public int[] changedColumnIds;
+ int[] changedColumnIds;
- public boolean positionedUpdate;
+ private boolean positionedUpdate;
int numColumns;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java Thu Jan 5 11:43:02 2006
@@ -79,16 +79,16 @@
**
********************************************************/
- public long conglomId;
- public StaticCompiledOpenConglomInfo heapSCOCI;
- public IndexRowGenerator[] irgs;
- public long[] indexCIDS;
- public StaticCompiledOpenConglomInfo[] indexSCOCIs;
- public String[] indexNames;
- public boolean deferred;
- public Properties targetProperties;
- public UUID targetUUID;
- public int lockMode;
+ long conglomId;
+ StaticCompiledOpenConglomInfo heapSCOCI;
+ IndexRowGenerator[] irgs;
+ long[] indexCIDS;
+ StaticCompiledOpenConglomInfo[] indexSCOCIs;
+ String[] indexNames;
+ boolean deferred;
+ private Properties targetProperties;
+ UUID targetUUID;
+ int lockMode;
private FKInfo[] fkInfo;
private TriggerInfo triggerInfo;
@@ -96,7 +96,7 @@
private FormatableBitSet baseRowReadList;
private int[] baseRowReadMap;
private int[] streamStorableHeapColIds;
- public boolean singleRowSource;
+ boolean singleRowSource;
// CONSTRUCTORS
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java?rev=366259&r1=366258&r2=366259&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java Thu Jan 5 11:43:02 2006
@@ -68,13 +68,13 @@
private Vector eventListener; // who wants to know I am closed or error
- protected EmbedConnection realConnection;
- protected int defaultIsolationLevel;
+ EmbedConnection realConnection;
+ int defaultIsolationLevel;
private boolean defaultReadOnly;
- protected BrokeredConnection currentConnectionHandle;
+ BrokeredConnection currentConnectionHandle;
// set up once by the data source
- protected final ReferenceableDataSource dataSource;
+ final ReferenceableDataSource dataSource;
private final String username;
private final String password;
/**
@@ -156,7 +156,7 @@
return c;
}
- protected final void openRealConnection() throws SQLException {
+ final void openRealConnection() throws SQLException {
// first time we establish a connection
Connection rc = dataSource.getConnection(username, password, requestPassword);
@@ -167,7 +167,7 @@
realConnection.setApplicationConnection(currentConnectionHandle);
}
- protected final Connection getNewCurrentConnectionHandle() {
+ final Connection getNewCurrentConnectionHandle() {
Connection applicationConnection = currentConnectionHandle =
((org.apache.derby.jdbc.Driver20) (realConnection.getLocalDriver())).newBrokeredConnection(this);
realConnection.setApplicationConnection(applicationConnection);
@@ -178,7 +178,7 @@
/**
In this case the Listeners are *not* notified. JDBC 3.0 spec section 11.4
*/
- protected void closeCurrentConnectionHandle() throws SQLException {
+ private void closeCurrentConnectionHandle() throws SQLException {
if (currentConnectionHandle != null)
{
Vector tmpEventListener = eventListener;
@@ -194,7 +194,7 @@
}
}
- protected void resetRealConnection() throws SQLException {
+ void resetRealConnection() throws SQLException {
// ensure any outstanding changes from the previous
// user are rolledback.
@@ -328,7 +328,7 @@
}
}
- protected final void checkActive() throws SQLException {
+ final void checkActive() throws SQLException {
if (!isActive)
throw Util.noCurrentConnection();
}