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 ka...@apache.org on 2012/07/24 08:40:40 UTC
svn commit: r1364917 - in /db/derby/code/trunk/java:
engine/org/apache/derby/iapi/jdbc/ engine/org/apache/derby/iapi/security/
engine/org/apache/derby/iapi/services/
engine/org/apache/derby/iapi/services/monitor/
engine/org/apache/derby/impl/jdbc/ engi...
Author: kahatlen
Date: Tue Jul 24 06:40:39 2012
New Revision: 1364917
URL: http://svn.apache.org/viewvc?rev=1364917&view=rev
Log:
DERBY-5840: Compile embedded JDBC 3.0 classes for Java 5
Added:
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint.java
- copied, changed from r1364690, db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint30.java
Removed:
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection30.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint30.java
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement30.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml
db/derby/code/trunk/java/engine/org/apache/derby/iapi/security/SecurityUtil.java
db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/build.xml
db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml
db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/ProtocolKey.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDriver.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedSimpleDataSource.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ResourceAdapterImpl.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XATransactionState.java
db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/RollBackWrappingWhenFailOnImportTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/UnitTestMain.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement.java Tue Jul 24 06:40:39 2012
@@ -163,8 +163,7 @@ public abstract class BrokeredCallableSt
return getCallableStatement().getBigDecimal( parameterIndex);
}
- public final Object getObject(int i,
- Map map)
+ public final Object getObject(int i, Map<String, Class<?>> map)
throws SQLException
{
return getCallableStatement().getObject( i, map);
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement30.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement30.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement30.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement30.java Tue Jul 24 06:40:39 2012
@@ -22,13 +22,9 @@
package org.apache.derby.iapi.jdbc;
import java.sql.*;
-import java.math.BigDecimal;
import java.net.URL;
-
-import java.util.Calendar;
import java.util.Map;
-
/**
JDBC 3 brokered CallableStatement
*/
@@ -155,7 +151,8 @@ public class BrokeredCallableStatement30
public final java.math.BigDecimal getBigDecimal(java.lang.String parameterName) throws SQLException {
return getCallableStatement().getBigDecimal(parameterName);
}
- public final java.lang.Object getObject(java.lang.String parameterName, java.util.Map map) throws SQLException {
+ public final java.lang.Object getObject(String parameterName,
+ Map<String, Class<?>> map) throws SQLException {
return getCallableStatement().getObject(parameterName, map);
}
public final java.sql.Ref getRef(java.lang.String parameterName) throws SQLException {
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection.java?rev=1364917&r1=1364916&r2=1364917&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 Tue Jul 24 06:40:39 2012
@@ -336,7 +336,7 @@ public abstract class BrokeredConnection
}
}
- public java.util.Map getTypeMap() throws SQLException
+ public java.util.Map<String, Class<?>> getTypeMap() throws SQLException
{
try
{
@@ -349,7 +349,7 @@ public abstract class BrokeredConnection
}
}
- public final void setTypeMap(java.util.Map map) throws SQLException
+ public final void setTypeMap(java.util.Map<String, Class<?>> map) throws SQLException
{
try
{
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredConnection40.java?rev=1364917&r1=1364916&r2=1364917&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 Tue Jul 24 06:40:39 2012
@@ -24,8 +24,8 @@ package org.apache.derby.iapi.jdbc;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
-import java.sql.SQLClientInfoException;
import java.sql.NClob;
+import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLXML;
import java.sql.Struct;
@@ -281,21 +281,6 @@ public class BrokeredConnection40
}
/**
- * Returns the type map for this connection.
- *
- * @return type map for this connection
- * @exception SQLException if a database access error occurs
- */
- public final java.util.Map<String,Class<?>> getTypeMap() throws SQLException {
- try {
- return getRealConnection().getTypeMap();
- } catch (SQLException se) {
- notifyException(se);
- throw se;
- }
- }
-
- /**
* Returns false unless <code>interfaces</code> is implemented
*
* @param interfaces a Class defining an interface.
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/JDBCBoot.java Tue Jul 24 06:40:39 2012
@@ -21,15 +21,13 @@
package org.apache.derby.iapi.jdbc;
-import org.apache.derby.iapi.reference.Property;
-import org.apache.derby.iapi.reference.MessageId;
-import org.apache.derby.iapi.jdbc.AuthenticationService;
+import java.io.PrintWriter;
+import java.util.Properties;
import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.property.PropertyUtil;
+import org.apache.derby.iapi.reference.MessageId;
+import org.apache.derby.iapi.reference.Property;
import org.apache.derby.iapi.services.monitor.Monitor;
-
-import java.util.Properties;
-import java.io.PrintStream;
+import org.apache.derby.iapi.services.property.PropertyUtil;
/**
A class to boot a Derby system that includes a JDBC driver.
@@ -55,7 +53,7 @@ public class JDBCBoot {
no current JDBC driver that is handling the required protocol.
*/
- public void boot(String protocol, PrintStream logging) {
+ public void boot(String protocol, PrintWriter logging) {
if (org.apache.derby.jdbc.InternalDriver.activeDriver() == null)
{
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/build.xml Tue Jul 24 06:40:39 2012
@@ -75,29 +75,6 @@
</javac>
</target>
- <target name="compile_iapi_jdbc_jdbc2" depends="compile_iapi_jdbc_stmt,compile_iapi_jdbc_jsr169">
- <javac
- source="1.4"
- target="1.4"
- bootclasspath="${empty}"
- nowarn="on"
- debug="${debug}"
- depend="${depend}"
- deprecation="${deprecation}"
- optimize="${optimize}"
- proceed="${proceed}"
- verbose="${verbose}"
- srcdir="${derby.engine.src.dir}"
- destdir="${out.dir}">
- <classpath>
- <pathelement path="${java15compile.classpath}"/>
- </classpath>
- <include name="${derby.dir}/${cur.dir}/BrokeredConnection.java"/>
- <include name="${derby.dir}/${cur.dir}/BrokeredPreparedStatement.java"/>
- <include name="${derby.dir}/${cur.dir}/BrokeredCallableStatement.java"/>
- </javac>
- </target>
-
<target name="compile_iapi_jdbc_stmt">
<javac
source="1.4"
@@ -119,10 +96,10 @@
</javac>
</target>
- <target name="compile_iapi_jdbc_jdbc3" depends="compile_iapi_jdbc_jdbc2">
+ <target name="compile_iapi_jdbc_jdbc3" depends="compile_iapi_jdbc_stmt,compile_iapi_jdbc_jsr169">
<javac
- source="1.4"
- target="1.4"
+ source="1.5"
+ target="1.5"
bootclasspath="${empty}"
nowarn="on"
debug="${debug}"
@@ -136,6 +113,9 @@
<classpath>
<pathelement path="${java15compile.classpath}"/>
</classpath>
+ <include name="${derby.dir}/${cur.dir}/BrokeredConnection.java"/>
+ <include name="${derby.dir}/${cur.dir}/BrokeredPreparedStatement.java"/>
+ <include name="${derby.dir}/${cur.dir}/BrokeredCallableStatement.java"/>
<include name="${derby.dir}/${cur.dir}/BrokeredConnection30.java"/>
<include name="${derby.dir}/${cur.dir}/BrokeredPreparedStatement30.java"/>
<include name="${derby.dir}/${cur.dir}/BrokeredCallableStatement30.java"/>
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/security/SecurityUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/security/SecurityUtil.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/security/SecurityUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/security/SecurityUtil.java Tue Jul 24 06:40:39 2012
@@ -54,7 +54,7 @@ public class SecurityUtil {
* @see <a href="http://wiki.apache.org/db-derby/UserIdentifiers">User Names & Authorization Identifiers in Derby</a>
*/
static public Subject createSystemPrincipalSubject(String user) {
- final Set principals = new HashSet();
+ final Set<SystemPrincipal> principals = new HashSet<SystemPrincipal>();
// add the authenticated user
if (user != null) {
// The Java security runtime checks whether a Subject falls
@@ -117,16 +117,16 @@ public class SecurityUtil {
static public void checkSubjectHasPermission(final Subject subject,
final Permission perm) {
// the checks
- final PrivilegedAction runCheck
- = new PrivilegedAction() {
- public Object run() {
+ final PrivilegedAction<Void> runCheck
+ = new PrivilegedAction<Void>() {
+ public Void run() {
AccessController.checkPermission(perm);
return null;
}
};
- final PrivilegedAction runCheckAsPrivilegedUser
- = new PrivilegedAction() {
- public Object run() {
+ final PrivilegedAction<Void> runCheckAsPrivilegedUser
+ = new PrivilegedAction<Void>() {
+ public Void run() {
// run check only using the the subject
// (by using null as the AccessControlContext)
final AccessControlContext acc = null;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/build.xml?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/build.xml Tue Jul 24 06:40:39 2012
@@ -34,7 +34,7 @@
<!-- Targets -->
- <target name="compile" depends="compile_jdbc3"/>
+ <target name="compile" depends="compile_crypto"/>
<target name="compile_iapi_services_jsr169">
<javac
@@ -64,8 +64,5 @@
<ant dir="${derby.engine.dir}/iapi/services/crypto" target="compile_crypto"/>
</target>
- <target name="compile_jdbc3" depends="compile_crypto">
- </target>
-
</project>
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java Tue Jul 24 06:40:39 2012
@@ -21,24 +21,20 @@
package org.apache.derby.iapi.services.monitor;
+import java.io.PrintWriter;
+import java.util.Locale;
+import java.util.Properties;
import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.Attribute;
+import org.apache.derby.iapi.reference.EngineType;
+import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.services.i18n.MessageService;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
-import org.apache.derby.iapi.services.info.ProductGenusNames;
import org.apache.derby.iapi.services.info.ProductVersionHolder;
-import org.apache.derby.iapi.reference.EngineType;
-import org.apache.derby.iapi.reference.Attribute;
-import org.apache.derby.iapi.services.property.PropertyUtil;
-
import org.apache.derby.iapi.services.loader.InstanceGetter;
-
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.reference.Property;
-
-import java.util.Properties;
-import java.util.Locale;
-import java.io.PrintStream;
+import org.apache.derby.iapi.services.property.PropertyUtil;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
/**
<P><B>Services</B><BR>
@@ -284,7 +280,7 @@ public class Monitor {
until an InfoStreams module is successfully started.
*/
- public static void startMonitor(Properties bootProperties, PrintStream logging) {
+ public static void startMonitor(Properties bootProperties, PrintWriter logging) {
new org.apache.derby.impl.services.monitor.FileMonitor(bootProperties, logging);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1364917&r1=1364916&r2=1364917&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 Tue Jul 24 06:40:39 2012
@@ -70,6 +70,7 @@ import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
+import java.sql.Savepoint;
import java.sql.Statement;
import java.util.HashSet;
@@ -81,6 +82,8 @@ import java.util.Iterator;
import org.apache.derby.iapi.jdbc.EngineLOB;
import org.apache.derby.iapi.jdbc.ExceptionFactory;
+import org.apache.derby.iapi.reference.Limits;
+import org.apache.derby.iapi.sql.conn.StatementContext;
import org.apache.derby.iapi.util.InterruptStatus;
import org.apache.derby.impl.jdbc.authentication.NoneAuthenticationServiceImpl;
@@ -106,14 +109,14 @@ import org.apache.derby.impl.jdbc.authen
* the a synchronized object return by the rootConnection.
<P><B>Supports</B>
<UL>
- <LI> JDBC 2.0
+ <LI> JDBC 3.0
</UL>
*
*
* @see TransactionResourceImpl
*
*/
-public abstract class EmbedConnection implements EngineConnection
+public class EmbedConnection implements EngineConnection
{
protected static final StandardException exceptionClose = StandardException.closeException();
@@ -3421,6 +3424,180 @@ public abstract class EmbedConnection im
setInactive();
}
+ /////////////////////////////////////////////////////////////////////////
+ //
+ // JDBC 3.0 - New public methods
+ //
+ /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an unnamed savepoint in the current transaction and
+ * returns the new Savepoint object that represents it.
+ *
+ * @return The new Savepoint object
+ *
+ * @exception SQLException if a database access error occurs or
+ * this Connection object is currently in auto-commit mode
+ */
+ public Savepoint setSavepoint() throws SQLException {
+ return commonSetSavepointCode(null, false);
+ }
+
+ /**
+ * Creates a savepoint with the given name in the current transaction and
+ * returns the new Savepoint object that represents it.
+ *
+ * @param name A String containing the name of the savepoint
+ *
+ * @return The new Savepoint object
+ *
+ * @exception SQLException if a database access error occurs or
+ * this Connection object is currently in auto-commit mode
+ */
+ public Savepoint setSavepoint(String name) throws SQLException {
+ return commonSetSavepointCode(name, true);
+ }
+
+ /**
+ * Creates a savepoint with the given name (if it is a named
+ * savepoint else we will generate a name because Derby only
+ * supports named savepoints internally) in the current
+ * transaction and returns the new Savepoint object that
+ * represents it.
+ *
+ * @param name A String containing the name of the savepoint. Will
+ * be null if this is an unnamed savepoint
+ * @param userSuppliedSavepointName If true means it's a named
+ * user defined savepoint.
+ *
+ * @return The new Savepoint object
+ */
+ private Savepoint commonSetSavepointCode(String name, boolean userSuppliedSavepointName) throws SQLException
+ {
+ synchronized (getConnectionSynchronization()) {
+ setupContextStack();
+ try {
+ verifySavepointCommandIsAllowed();
+ // make sure that if it is a named savepoint then
+ // supplied name is not null
+ if (userSuppliedSavepointName && (name == null)) {
+ throw newSQLException(SQLState.NULL_NAME_FOR_SAVEPOINT);
+ }
+ // make sure that if it is a named savepoint then
+ // supplied name length is not > 128
+ if (userSuppliedSavepointName &&
+ (name.length() > Limits.MAX_IDENTIFIER_LENGTH)) {
+ throw newSQLException(SQLState.LANG_IDENTIFIER_TOO_LONG,
+ name, String.valueOf(Limits.MAX_IDENTIFIER_LENGTH));
+ }
+ // to enforce DB2 restriction which is savepoint name
+ // can't start with SYS
+ if (userSuppliedSavepointName && name.startsWith("SYS")) {
+ throw newSQLException(SQLState.INVALID_SCHEMA_SYS, "SYS");
+ }
+ Savepoint savePt = new EmbedSavepoint(this, name);
+ return savePt;
+ } catch (StandardException e) {
+ throw handleException(e);
+ } finally {
+ restoreContextStack();
+ }
+ }
+ }
+
+ /**
+ * Undoes all changes made after the given Savepoint object was set.
+ * This method should be used only when auto-commit has been disabled.
+ *
+ * @param savepoint The Savepoint object to rollback to
+ *
+ * @exception SQLException if a database access error occurs,
+ * the Savepoint object is no longer valid, or this Connection
+ * object is currently in auto-commit mode
+ */
+ public void rollback(Savepoint savepoint) throws SQLException {
+ synchronized (getConnectionSynchronization()) {
+ setupContextStack();
+ try {
+ verifySavepointCommandIsAllowed();
+ verifySavepointArg(savepoint);
+ // Need to cast and get the name because JDBC3 spec
+ // doesn't support names for unnamed savepoints but
+ // Derby keeps names for named & unnamed savepoints.
+ getLanguageConnection().internalRollbackToSavepoint(
+ ((EmbedSavepoint)savepoint).getInternalName(),
+ true, savepoint);
+ } catch (StandardException e) {
+ throw handleException(e);
+ } finally {
+ restoreContextStack();
+ }
+ }
+ }
+
+ /**
+ * Removes the given Savepoint object from the current transaction.
+ * Any reference to the savepoint after it has been removed will cause
+ * an SQLException to be thrown
+ *
+ * @param savepoint The Savepoint object to be removed
+ *
+ * @exception SQLException if a database access error occurs or
+ * the given Savepoint object is not a valid savepoint in the
+ * current transaction
+ */
+ public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+ synchronized (getConnectionSynchronization()) {
+ setupContextStack();
+ try {
+ verifySavepointCommandIsAllowed();
+ verifySavepointArg(savepoint);
+ // Need to cast and get the name because JDBC3 spec
+ // doesn't support names for unnamed savepoints but
+ // Derby keeps name for named & unnamed savepoints.
+ getLanguageConnection().releaseSavePoint(
+ ((EmbedSavepoint)savepoint).getInternalName(), savepoint);
+ } catch (StandardException e) {
+ throw handleException(e);
+ } finally {
+ restoreContextStack();
+ }
+ }
+ }
+
+ // used by setSavepoint to check autocommit is false and not
+ // inside the trigger code
+ private void verifySavepointCommandIsAllowed() throws SQLException {
+ if (autoCommit) {
+ throw newSQLException(SQLState.NO_SAVEPOINT_WHEN_AUTO);
+ }
+
+ //Bug 4507 - savepoint not allowed inside trigger
+ StatementContext stmtCtxt =
+ getLanguageConnection().getStatementContext();
+ if (stmtCtxt!= null && stmtCtxt.inTrigger()) {
+ throw newSQLException(SQLState.NO_SAVEPOINT_IN_TRIGGER);
+ }
+ }
+
+ // used by release/rollback to check savepoint argument
+ private void verifySavepointArg(Savepoint savepoint) throws SQLException {
+ //bug 4451 - Check for null savepoint
+ EmbedSavepoint lsv = (EmbedSavepoint) savepoint;
+ // bug 4451 need to throw error for null Savepoint
+ if (lsv == null) {
+ throw Util.generateCsSQLException(
+ SQLState.XACT_SAVEPOINT_NOT_FOUND, "null");
+ }
+
+ // bug 4468 - verify that savepoint rollback is for a savepoint from
+ // the current connection
+ if (!lsv.sameConnection(this)) {
+ throw newSQLException(
+ SQLState.XACT_SAVEPOINT_RELEASE_ROLLBACK_FAIL);
+ }
+ }
+
////////////////////////////////////////////////////////////////////
//
// INTRODUCED BY JDBC 4.1 IN JAVA 7
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java Tue Jul 24 06:40:39 2012
@@ -38,7 +38,7 @@ import org.apache.derby.iapi.jdbc.Engine
import org.apache.derby.iapi.jdbc.FailedProperties40;
public class EmbedConnection40
- extends EmbedConnection30 implements EngineConnection40 {
+ extends EmbedConnection implements EngineConnection40 {
/** Creates a new instance of EmbedConnection40 */
public EmbedConnection40(EmbedConnection inputConnection) {
Copied: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint.java (from r1364690, db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint30.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint.java?p2=db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint.java&p1=db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint30.java&r1=1364690&r2=1364917&rev=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint30.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSavepoint.java Tue Jul 24 06:40:39 2012
@@ -1,6 +1,6 @@
/*
- Derby - Class org.apache.derby.impl.jdbc.EmbedSavepoint30
+ Derby - Class org.apache.derby.impl.jdbc.EmbedSavepoint
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -21,19 +21,13 @@
package org.apache.derby.impl.jdbc;
-import org.apache.derby.impl.jdbc.EmbedConnection;
-import org.apache.derby.impl.jdbc.ConnectionChild;
-import org.apache.derby.impl.jdbc.Util;
-
-import org.apache.derby.iapi.reference.SQLState;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import java.sql.Savepoint;
import java.sql.SQLException;
+import java.sql.Savepoint;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
/**
- * This class implements the Savepoint interface from JDBC3.0
+ * This class implements the Savepoint interface from JDBC 3.0.
* This allows to set, release, or rollback a transaction to
* designated Savepoints. Savepoints provide finer-grained
* control of transactions by marking intermediate points within
@@ -48,7 +42,7 @@ import java.sql.SQLException;
* @see java.sql.Savepoint
*
*/
-final class EmbedSavepoint30 extends ConnectionChild
+final class EmbedSavepoint extends ConnectionChild
implements Savepoint {
//In order to avoid name conflict, the external names are prepanded
@@ -66,7 +60,7 @@ final class EmbedSavepoint30 extends Con
and restore it.
@exception SQLException on error
*/
- EmbedSavepoint30(EmbedConnection conn, String name)
+ EmbedSavepoint(EmbedConnection conn, String name)
throws StandardException {
super(conn);
if (name == null) //this is an unnamed savepoint
@@ -91,8 +85,9 @@ final class EmbedSavepoint30 extends Con
* @exception SQLException if this is a named savepoint
*/
public int getSavepointId() throws SQLException {
- if (savepointID == -1)
+ if (savepointID == -1) {
throw newSQLException(SQLState.NO_ID_FOR_NAMED_SAVEPOINT);
+ }
return savepointID;
}
@@ -105,8 +100,9 @@ final class EmbedSavepoint30 extends Con
* @exception SQLException if this is an un-named savepoint
*/
public String getSavepointName() throws SQLException {
- if (savepointID != -1)
+ if (savepointID != -1) {
throw newSQLException(SQLState.NO_NAME_FOR_UNNAMED_SAVEPOINT);
+ }
return savepointName.substring(2);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/authentication/LDAPAuthenticationSchemeImpl.java Tue Jul 24 06:40:39 2012
@@ -21,28 +21,19 @@
package org.apache.derby.impl.jdbc.authentication;
-import org.apache.derby.iapi.reference.MessageId;
-import org.apache.derby.iapi.services.monitor.Monitor;
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.i18n.MessageService;
-import org.apache.derby.iapi.jdbc.AuthenticationService;
-
-import org.apache.derby.authentication.UserAuthenticator;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.util.StringUtil;
-
-import javax.naming.*;
-import javax.naming.directory.*;
-
-
-import java.util.Properties;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import java.sql.SQLException;
+import java.util.Properties;
+import javax.naming.*;
+import javax.naming.directory.*;
+import org.apache.derby.authentication.UserAuthenticator;
+import org.apache.derby.iapi.reference.MessageId;
+import org.apache.derby.iapi.services.monitor.Monitor;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.util.StringUtil;
/**
* This is the Derby LDAP authentication scheme implementation.
@@ -206,22 +197,16 @@ extends JNDIAuthenticationSchemeBase
*/
private DirContext privInitialDirContext(final Properties env) throws NamingException {
try {
- return ((InitialDirContext)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws SecurityException, NamingException {
+ return AccessController.doPrivileged(
+ new PrivilegedExceptionAction<DirContext>() {
+ public DirContext run() throws NamingException {
return new InitialDirContext(env);
}
- }));
- } catch (PrivilegedActionException pae) {
- Exception e = pae.getException();
-
- if (e instanceof NamingException)
- throw (NamingException)e;
- else
- throw (SecurityException)e;
- }
-
- }
+ });
+ } catch (PrivilegedActionException pae) {
+ throw (NamingException) pae.getCause();
+ }
+ }
/**
* This method basically tests and sets default/expected JNDI properties
@@ -383,41 +368,35 @@ extends JNDIAuthenticationSchemeBase
}
}
- if (SanityManager.DEBUG)
- {
- if (SanityManager.DEBUG_ON(
- AuthenticationServiceBase.AuthenticationTrace)) {
-
- // This tracing needs some investigation and cleanup.
- // 1) It creates the file in user.dir instead of derby.system.home
- // 2) It doesn't seem to work. The file is empty after successful
- // and unsuccessful ldap connects. Perhaps the fileOutputStream
- // is never flushed and closed.
- // I (Kathey Marsden) wrapped this in a priv block and kept the previous
- // behaviour that it will not stop processing if file
- // creation fails. Perhaps that should be investigated as well.
- FileOutputStream fos = null;
- try {
- fos = ((FileOutputStream)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws SecurityException, java.io.IOException {
- return new FileOutputStream("DerbyLDAP.out");
- }
- }));
- } catch (PrivilegedActionException pae) {
- // If trace file creation fails do not stop execution.
- }
- if (fos != null)
- initDirContextEnv.put("com.sun.naming.ldap.trace.ber",fos);
-
-
- }
- }
+ if (SanityManager.DEBUG &&
+ SanityManager.DEBUG_ON(
+ AuthenticationServiceBase.AuthenticationTrace)) {
+
+ // This tracing needs some investigation and cleanup.
+ // 1) It creates the file in user.dir instead of derby.system.home
+ // 2) It doesn't seem to work. The file is empty after successful
+ // and unsuccessful ldap connects. Perhaps the fileOutputStream
+ // is never flushed and closed.
+ // I (Kathey Marsden) wrapped this in a priv block and kept the
+ // previous behaviour that it will not stop processing if file
+ // creation fails. Perhaps that should be investigated as well.
+ FileOutputStream fos = null;
+ try {
+ fos = AccessController.doPrivileged(
+ new PrivilegedExceptionAction<FileOutputStream>() {
+ public FileOutputStream run() throws IOException {
+ return new FileOutputStream("DerbyLDAP.out");
+ }
+ });
+ } catch (PrivilegedActionException pae) {
+ // If trace file creation fails do not stop execution.
+ }
+ if (fos != null) {
+ initDirContextEnv.put("com.sun.naming.ldap.trace.ber", fos);
+ }
+ }
}
-
-
-
/**
* Search for the full user's DN in the LDAP server.
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/build.xml Tue Jul 24 06:40:39 2012
@@ -88,8 +88,8 @@
</target>
<target name="compile_jdbc3" depends="compile_jsr169">
<javac
- source="1.4"
- target="1.4"
+ source="1.5"
+ target="1.5"
bootclasspath="${empty}"
nowarn="on"
debug="${debug}"
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java Tue Jul 24 06:40:39 2012
@@ -36,7 +36,6 @@ import org.apache.derby.iapi.services.co
import org.apache.derby.iapi.services.context.Context;
import org.apache.derby.iapi.services.context.ContextService;
-import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
import org.apache.derby.iapi.services.stream.InfoStreams;
import org.apache.derby.iapi.services.stream.PrintWriterGetHeader;
@@ -72,7 +71,6 @@ import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.ByteArrayInputStream;
-import java.io.PrintStream;
import java.util.Collections;
import java.util.Date;
@@ -127,7 +125,7 @@ abstract class BaseMonitor
private TimerFactory timerFactory;
boolean reportOn;
- private PrintStream logging;
+ private PrintWriter logging;
ThreadGroup daemonGroup;
@@ -239,7 +237,7 @@ abstract class BaseMonitor
}
}
- protected final void runWithState(Properties properties, PrintStream log) {
+ protected final void runWithState(Properties properties, PrintWriter log) {
bootProperties = properties;
logging = log;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java Tue Jul 24 06:40:39 2012
@@ -21,22 +21,19 @@
package org.apache.derby.impl.services.monitor;
-import org.apache.derby.iapi.reference.Property;
-
-import org.apache.derby.iapi.services.io.FileUtil;
-import org.apache.derby.iapi.services.info.ProductVersionHolder;
-import org.apache.derby.iapi.services.info.ProductGenusNames;
-
-import java.io.FileInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-
+import java.io.PrintWriter;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
-
import java.util.Properties;
+import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.services.info.ProductGenusNames;
+import org.apache.derby.iapi.services.info.ProductVersionHolder;
+import org.apache.derby.iapi.services.io.FileUtil;
/**
Implementation of the monitor that uses the class loader
@@ -57,7 +54,7 @@ public final class FileMonitor extends B
applicationProperties = readApplicationProperties();
}
- public FileMonitor(java.util.Properties properties, java.io.PrintStream log) {
+ public FileMonitor(Properties properties, PrintWriter log) {
runWithState(properties, log);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/ProtocolKey.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/ProtocolKey.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/ProtocolKey.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/ProtocolKey.java Tue Jul 24 06:40:39 2012
@@ -67,6 +67,8 @@ class ProtocolKey {
t = cnfe;
} catch (IllegalArgumentException iae) {
t = iae;
+ } catch (LinkageError le) {
+ t = le;
}
throw Monitor.exceptionStartingModule(t);
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java Tue Jul 24 06:40:39 2012
@@ -102,7 +102,7 @@ public class XactFactory implements Tran
private boolean inCreateNoLog = false; // creating database, no logging
- private XAResourceManager xa_resource;
+ private /* XAResourceManager */ Object xa_resource;
private Object backupSemaphore = new Object();
private long backupBlockingOperations = 0;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver169.java Tue Jul 24 06:40:39 2012
@@ -57,7 +57,7 @@ public class Driver169 extends InternalD
throws SQLException
{
// make a new local connection with a new transaction resource
- return new EmbedConnection30(this, url, info);
+ return new EmbedConnection(this, url, info);
}
@@ -71,7 +71,7 @@ public class Driver169 extends InternalD
*/
public Connection getNewNestedConnection(EmbedConnection conn)
{
- return new EmbedConnection30(conn);
+ return new EmbedConnection(conn);
}
/*
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver30.java Tue Jul 24 06:40:39 2012
@@ -62,12 +62,7 @@ public class Driver30 extends Driver20 {
*/
public Connection getNewNestedConnection(EmbedConnection conn)
{
- if (SanityManager.DEBUG)
- {
- SanityManager.ASSERT(conn instanceof EmbedConnection30,
- "conn expected to be instanceof EmbedConnection30");
- }
- return new EmbedConnection30(conn);
+ return new EmbedConnection(conn);
}
/*
@@ -77,7 +72,7 @@ public class Driver30 extends Driver20 {
protected EmbedConnection getNewEmbedConnection(String url, Properties info)
throws SQLException
{
- return new EmbedConnection30(this, url, info);
+ return new EmbedConnection(this, url, info);
}
/**
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/Driver40.java Tue Jul 24 06:40:39 2012
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.sql.ResultS
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.impl.jdbc.EmbedConnection;
-import org.apache.derby.impl.jdbc.EmbedConnection30;
import org.apache.derby.impl.jdbc.EmbedPreparedStatement40;
import org.apache.derby.impl.jdbc.EmbedCallableStatement40;
import org.apache.derby.impl.jdbc.EmbedConnection40;
@@ -57,10 +56,6 @@ import javax.sql.XAConnection;
public class Driver40 extends Driver30 {
public Connection getNewNestedConnection(EmbedConnection conn) {
- if (SanityManager.DEBUG) {
- SanityManager.ASSERT(conn instanceof EmbedConnection30,
- "conn expected to be instanceof EmbedConnection30");
- }
return new EmbedConnection40(conn);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedPooledConnection.java?rev=1364917&r1=1364916&r2=1364917&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 Tue Jul 24 06:40:39 2012
@@ -71,7 +71,7 @@ class EmbedPooledConnection implements j
* The list of {@code ConnectionEventListener}s. It is initially {@code
* null} and will be initialized lazily when the first listener is added.
*/
- private ArrayList eventListener;
+ private ArrayList<ConnectionEventListener> eventListener;
/**
* The number of iterators going through the list of connection event
@@ -198,7 +198,7 @@ class EmbedPooledConnection implements j
private void closeCurrentConnectionHandle() throws SQLException {
if (currentConnectionHandle != null)
{
- ArrayList tmpEventListener = eventListener;
+ ArrayList<ConnectionEventListener> tmpEventListener = eventListener;
eventListener = null;
try {
@@ -279,13 +279,14 @@ class EmbedPooledConnection implements j
if (listener == null)
return;
if (eventListener == null) {
- eventListener = new ArrayList();
+ eventListener = new ArrayList<ConnectionEventListener>();
} else if (eventIterators > 0) {
// DERBY-3401: Someone is iterating over the ArrayList, and since
// we were able to synchronize on this, that someone is us. Clone
// the list of listeners in order to prevent invalidation of the
// iterator.
- eventListener = (ArrayList) eventListener.clone();
+ eventListener =
+ new ArrayList<ConnectionEventListener>(eventListener);
}
eventListener.add(listener);
}
@@ -303,7 +304,8 @@ class EmbedPooledConnection implements j
// we were able to synchronize on this, that someone is us. Clone
// the list of listeners in order to prevent invalidation of the
// iterator.
- eventListener = (ArrayList) eventListener.clone();
+ eventListener =
+ new ArrayList<ConnectionEventListener>(eventListener);
}
eventListener.remove(listener);
}
@@ -360,9 +362,7 @@ class EmbedPooledConnection implements j
ConnectionEvent event = new ConnectionEvent(this, exception);
eventIterators++;
try {
- for (Iterator it = eventListener.iterator(); it.hasNext();) {
- ConnectionEventListener l =
- (ConnectionEventListener) it.next();
+ for (ConnectionEventListener l : eventListener) {
if (exception == null) {
l.connectionClosed(event);
} else {
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDriver.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDriver.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDriver.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedDriver.java Tue Jul 24 06:40:39 2012
@@ -21,19 +21,15 @@
package org.apache.derby.jdbc;
-import java.sql.DriverManager;
-import java.sql.Driver;
+import java.io.PrintWriter;
import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
-
-import java.io.PrintStream;
import java.util.Properties;
-
-import org.apache.derby.iapi.reference.MessageId;
-import org.apache.derby.iapi.reference.Attribute;
-import org.apache.derby.iapi.services.i18n.MessageService;
import org.apache.derby.iapi.jdbc.JDBCBoot;
+import org.apache.derby.iapi.reference.Attribute;
/**
@@ -191,12 +187,13 @@ public class EmbeddedDriver implements
* This is package protected so that AutoloadedDriver can call it.
*/
static void boot() {
- PrintStream ps = DriverManager.getLogStream();
+ PrintWriter pw = DriverManager.getLogWriter();
- if (ps == null)
- ps = System.err;
+ if (pw == null) {
+ pw = new PrintWriter(System.err, true);
+ }
- new JDBCBoot().boot(Attribute.PROTOCOL, ps);
+ new JDBCBoot().boot(Attribute.PROTOCOL, pw);
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedSimpleDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedSimpleDataSource.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedSimpleDataSource.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbeddedSimpleDataSource.java Tue Jul 24 06:40:39 2012
@@ -424,8 +424,8 @@ public final class EmbeddedSimpleDataSou
// shutdown by a 'jdbc:derby:;shutdown=true'
if (driver == null || !driver.acceptsURL(url)) {
-
- new JDBCBoot().boot(Attribute.PROTOCOL, System.err);
+ new JDBCBoot().boot(Attribute.PROTOCOL,
+ new PrintWriter(System.err, true));
// If we know the driver, we loaded it. Otherwise only
// work if DriverManager has already loaded it.
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ResourceAdapterImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ResourceAdapterImpl.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ResourceAdapterImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/ResourceAdapterImpl.java Tue Jul 24 06:40:39 2012
@@ -51,7 +51,7 @@ public class ResourceAdapterImpl
private XAResourceManager rm;
// maps Xid to XATransationResource for run time transactions
- private Hashtable connectionTable;
+ private Hashtable<XAXactId, XATransactionState> connectionTable;
/*
* Module control
@@ -63,7 +63,7 @@ public class ResourceAdapterImpl
// we can only run on jdk1.2 or beyond with JTA and JAVA 20 extension
// loaded.
- connectionTable = new Hashtable();
+ connectionTable = new Hashtable<XAXactId, XATransactionState>();
AccessFactory af =
(AccessFactory)Monitor.findServiceModule(this, AccessFactory.MODULE);
@@ -77,9 +77,10 @@ public class ResourceAdapterImpl
{
active = false;
- for (Enumeration e = connectionTable.elements(); e.hasMoreElements(); ) {
+ for (Enumeration<XATransactionState> e = connectionTable.elements();
+ e.hasMoreElements(); ) {
- XATransactionState tranState = (XATransactionState) e.nextElement();
+ XATransactionState tranState = e.nextElement();
try {
tranState.conn.close();
@@ -111,7 +112,7 @@ public class ResourceAdapterImpl
// put this into the transaction table, if the xid is already
// present as an in-doubt transaction, we need to remove it from
// the run time list
- connectionTable.put(xid, conn);
+ connectionTable.put(xid, (XATransactionState) conn);
return true;
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XATransactionState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XATransactionState.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XATransactionState.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/XATransactionState.java Tue Jul 24 06:40:39 2012
@@ -67,7 +67,7 @@ final class XATransactionState extends C
the JTA spec. Note that while the transaction is suspended by this XAResource,
another XAResource may join the transaction and suspend it after the join.
*/
- HashMap suspendedList;
+ HashMap<EmbedXAResource, XATransactionState> suspendedList;
/**
@@ -292,8 +292,10 @@ final class XATransactionState extends C
if (resource != associatedResource)
throw new XAException(XAException.XAER_PROTO);
- if (suspendedList == null)
- suspendedList = new HashMap();
+ if (suspendedList == null) {
+ suspendedList =
+ new HashMap<EmbedXAResource, XATransactionState>();
+ }
suspendedList.put(resource, this);
associationState = XATransactionState.T0_NOT_ASSOCIATED;
Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/build.xml Tue Jul 24 06:40:39 2012
@@ -33,10 +33,10 @@
<property file="${properties.dir}/compilepath.properties"/>
<!-- Targets -->
- <target name="jdbc" depends="compile_jdbc2,compile_jdbc3,compile_jdbc4"/>
+ <target name="jdbc" depends="compile_jdbc3,compile_jdbc4"/>
-<!-- build targets which need jdbc2.0 libs in the end-->
-<!-- first build all non-special (non jdbc2.0) targets-->
+<!-- build targets which need JDBC 3.0 libs in the end-->
+<!-- first build all non-special (non-JDBC 3.0) targets-->
<target name="compile_jsr169">
<javac
source="1.4"
@@ -58,13 +58,12 @@
<include name="${derby.dir}/jdbc/EmbeddedSimpleDataSource.java"/>
<include name="${derby.dir}/jdbc/Driver169.java"/>
</javac>
-
</target>
-
- <target name="compile_jdbc2" depends="compile_jsr169">
+
+ <target name="compile_jdbc3" depends="compile_jsr169">
<javac
- source="1.4"
- target="1.4"
+ source="1.5"
+ target="1.5"
bootclasspath="${empty}"
nowarn="on"
debug="${debug}"
@@ -84,27 +83,7 @@
<include name="${derby.dir}/jdbc/EmbeddedDataSource.java"/>
<include name="${derby.dir}/jdbc/EmbeddedConnectionPoolDataSource.java"/>
<include name="${derby.dir}/jdbc/EmbedPooledConnection.java"/>
- <include name="${derby.dir}/jdbc/Driver20.java"/>
- </javac>
- </target>
-
- <target name="compile_jdbc3">
- <javac
- source="1.4"
- target="1.4"
- bootclasspath="${empty}"
- nowarn="on"
- debug="${debug}"
- depend="${depend}"
- deprecation="${deprecation}"
- optimize="${optimize}"
- proceed="${proceed}"
- verbose="${verbose}"
- srcdir="${derby.engine.src.dir}"
- destdir="${out.dir}">
- <classpath>
- <pathelement path="${java15compile.classpath}"/>
- </classpath>
+ <include name="${derby.dir}/jdbc/Driver20.java"/>
<include name="${derby.dir}/jdbc/Driver30.java"/>
<include name="${derby.dir}/jdbc/EmbedXAConnection.java"/>
<include name="${derby.dir}/jdbc/EmbeddedXADataSource.java"/>
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/RollBackWrappingWhenFailOnImportTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/RollBackWrappingWhenFailOnImportTest.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/RollBackWrappingWhenFailOnImportTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/RollBackWrappingWhenFailOnImportTest.java Tue Jul 24 06:40:39 2012
@@ -31,7 +31,6 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.derby.impl.jdbc.EmbedConnection;
-import org.apache.derby.impl.jdbc.EmbedConnection30;
import org.apache.derby.jdbc.Driver30;
import org.apache.derbyTesting.junit.BaseJDBCTestCase;
import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
@@ -49,7 +48,7 @@ import org.apache.derbyTesting.junit.Tes
public class RollBackWrappingWhenFailOnImportTest extends BaseJDBCTestCase {
class MockInternalDriver extends Driver30 {
- public class MockConnectionFailWhenRollBack extends EmbedConnection30 {
+ public class MockConnectionFailWhenRollBack extends EmbedConnection {
public MockConnectionFailWhenRollBack(Connection connection) {
super((EmbedConnection)connection);
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/UnitTestMain.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/UnitTestMain.java?rev=1364917&r1=1364916&r2=1364917&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/UnitTestMain.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/UnitTestMain.java Tue Jul 24 06:40:39 2012
@@ -21,11 +21,9 @@
package org.apache.derbyTesting.unitTests.harness;
-import org.apache.derby.iapi.services.monitor.Monitor;
-
-import org.apache.derbyTesting.unitTests.harness.UnitTestManager;
-
+import java.io.PrintWriter;
import java.util.Properties;
+import org.apache.derby.iapi.services.monitor.Monitor;
/**
A very simple class to boot up a system based upon a configuration file
@@ -48,6 +46,6 @@ public class UnitTestMain {
// request that a unit test manager service is started
bootProperties.put("derby.service.unitTestManager", UnitTestManager.MODULE);
- Monitor.startMonitor(bootProperties, System.err);
+ Monitor.startMonitor(bootProperties, new PrintWriter(System.err, true));
}
}