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 km...@apache.org on 2010/09/29 02:45:53 UTC
svn commit: r1002434 - in /db/derby/code/branches/10.6: ./
java/engine/org/apache/derby/impl/store/replication/net/
java/testing/org/apache/derbyTesting/functionTests/tests/tools/
java/tools/org/apache/derby/impl/tools/sysinfo/
Author: kmarsden
Date: Wed Sep 29 00:45:53 2010
New Revision: 1002434
URL: http://svn.apache.org/viewvc?rev=1002434&view=rev
Log:
DERBY-4812 ReplicationMessageTransmit run does not unwrap PrivilegedActionException which can lead to failure of replicationTests.ReplicationRun_Local_StateTest_part1_1
Modified:
db/derby/code/branches/10.6/ (props changed)
db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java
db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java
db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
db/derby/code/branches/10.6/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 29 00:45:53 2010
@@ -1,2 +1,2 @@
-/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,958163,958522,958555,958618,958939,959550,962716,963206,963705,964115,965647,967304,980684,986689,986834,987539,989099,990292,997325,998170,999119
+/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,958163,958522,958555,958618,958939,959550,962716,963206,963705,964115,965647,967304,980684,986689,986834,987539,989099,990292,997325,998170,999119,1002291
/db/derby/docs/trunk:954344
Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java?rev=1002434&r1=1002433&r2=1002434&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageReceive.java Wed Sep 29 00:45:53 2010
@@ -113,7 +113,7 @@ public class ReplicationMessageReceive {
* @param timeout The amount of time, in milliseconds, this method
* will wait for a connection to be established. If no connection
* has been established before the timeout, a
- * PrivilegedExceptionAction is raised with cause
+ * IOException is raised with cause
* java.net.SocketTimeoutException
* @param synchOnInstant the slave log instant, used to check that
* the master and slave log files are in synch. If no chunks of log
@@ -123,11 +123,11 @@ public class ReplicationMessageReceive {
* Note that there is a difference!
* @param dbname the name of the replicated database
*
- * @throws PrivilegedActionException if an exception occurs while trying
- * to open a connection.
+ *
*
* @throws IOException if an exception occurs while trying to create the
- * <code>SocketConnection</code> class.
+ * <code>SocketConnection</code> class or while
+ * trying to open a connection.
*
* @throws ClassNotFoundException Class of a serialized object cannot
* be found.
@@ -136,7 +136,6 @@ public class ReplicationMessageReceive {
*/
public void initConnection(int timeout, long synchOnInstant, String dbname)
throws
- PrivilegedActionException,
IOException,
StandardException,
ClassNotFoundException {
@@ -148,16 +147,20 @@ public class ReplicationMessageReceive {
serverSocket = createServerSocket();
}
serverSocket.setSoTimeout(timeout);
-
- //Start listening on the socket and accepting the connection
- Socket client =
- (Socket)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- return serverSocket.accept();
- }
- });
-
+ Socket client = null;
+ try {
+ //Start listening on the socket and accepting the connection
+ client =
+ (Socket)
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws IOException {
+ return serverSocket.accept();
+ }
+ });
+ } catch(PrivilegedActionException pea) {
+ throw (IOException) pea.getException();
+ }
+
//create the SocketConnection object using the client connection.
socketConn = new SocketConnection(client);
@@ -180,20 +183,26 @@ public class ReplicationMessageReceive {
*
* @return an instance of the <code>ServerSocket</code> class.
*
- * @throws PrivilegedActionException if an exception occurs while trying
+ * @throws IOException if an exception occurs while trying
* to open a connection.
*/
- private ServerSocket createServerSocket() throws PrivilegedActionException {
+ private ServerSocket createServerSocket() throws IOException {
//create a ServerSocket at the specified host name and the
//port number.
- return (ServerSocket) AccessController.doPrivileged
+ ServerSocket ss = null;
+ try {
+ ss = (ServerSocket) AccessController.doPrivileged
(new PrivilegedExceptionAction() {
- public Object run() throws IOException, StandardException {
- ServerSocketFactory sf = ServerSocketFactory.getDefault();
- return sf.createServerSocket(slaveAddress.getPortNumber(),
- 0, slaveAddress.getHostAddress());
- }
- });
+ public Object run() throws IOException {
+ ServerSocketFactory sf = ServerSocketFactory.getDefault();
+ return sf.createServerSocket(slaveAddress.getPortNumber(),
+ 0, slaveAddress.getHostAddress());
+ }
+ });
+ return ss;
+ } catch(PrivilegedActionException pea) {
+ throw (IOException) pea.getException();
+ }
}
/**
Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java?rev=1002434&r1=1002433&r2=1002434&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java (original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/replication/net/ReplicationMessageTransmit.java Wed Sep 29 00:45:53 2010
@@ -101,11 +101,9 @@ public class ReplicationMessageTransmit
* end position in the current log file. If a chunk of log has
* been shipped, this is the instant of the log record shipped
* last. Note that there is a difference!
- * @throws PrivilegedActionException if an exception occurs while trying
- * to open a connection.
- *
+ *
* @throws IOException if an exception occurs while trying to create the
- * <code>SocketConnection</code> class.
+ * <code>SocketConnection</code> class or open a connection.
*
* @throws StandardException If an error message is received from the
* server indicating incompatible software versions of master
@@ -115,7 +113,6 @@ public class ReplicationMessageTransmit
* be found.
*/
public void initConnection(int timeout, long synchOnInstant) throws
- PrivilegedActionException,
IOException,
StandardException,
ClassNotFoundException {
@@ -123,20 +120,23 @@ public class ReplicationMessageTransmit
Socket s = null;
final int timeout_ = timeout;
-
- //create a connection to the slave.
- s = (Socket)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- SocketFactory sf = SocketFactory.getDefault();
- InetSocketAddress sockAddr = new InetSocketAddress(
- slaveAddress.getHostAddress(),
- slaveAddress.getPortNumber());
- Socket s_temp = sf.createSocket();
- s_temp.connect(sockAddr, timeout_);
- return s_temp;
- }
- });
+ try {
+ //create a connection to the slave.
+ s = (Socket)
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws IOException {
+ SocketFactory sf = SocketFactory.getDefault();
+ InetSocketAddress sockAddr = new InetSocketAddress(
+ slaveAddress.getHostAddress(),
+ slaveAddress.getPortNumber());
+ Socket s_temp = sf.createSocket();
+ s_temp.connect(sockAddr, timeout_);
+ return s_temp;
+ }
+ });
+ } catch(PrivilegedActionException pea) {
+ throw (IOException) pea.getException();
+ }
// keep socket alive even if no log is shipped for a long time
s.setKeepAlive(true);
Modified: db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java?rev=1002434&r1=1002433&r2=1002434&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java (original)
+++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java Wed Sep 29 00:45:53 2010
@@ -137,7 +137,7 @@ public class SysinfoCPCheckTest extends
byte[] testRawBytes = rawBytes.toByteArray();
- //System.out.println("cp command: -cp " + tstargs[tst][0]);
+ System.out.println("cp command: -cp " + tstargs[tst][0]);
String s = null;
@@ -167,12 +167,13 @@ public class SysinfoCPCheckTest extends
// get the appropriate line for the full line comparison
int linenumber = Integer.parseInt(tstargs[tst][1]);
-
+ System.out.println("linenumber=" + linenumber);
boolean found = false;
for (int i=0; i<linenumber; i++)
{
s = sysinfoOutput.readLine();
+ System.out.println(i + ":" + s);
if (tstargs[tst][3] != null)
{
// do the search for the optional string comparison
@@ -186,7 +187,7 @@ public class SysinfoCPCheckTest extends
// read the line to be compared
s = sysinfoOutput.readLine();
-
+ System.out.println((linenumber + 1) + ":" + s);
if (s == null)
fail("encountered unexpected null strings");
else
@@ -196,7 +197,8 @@ public class SysinfoCPCheckTest extends
// read one more line - should be the next command's sequence number
s = sysinfoOutput.readLine();
-
+ System.out.println(s);
+ System.out.println((linenumber + 2) + ":" + s);
sysinfoOutput.close();
} catch (Exception e) {
e.printStackTrace();
Modified: db/derby/code/branches/10.6/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java?rev=1002434&r1=1002433&r2=1002434&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/branches/10.6/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java Wed Sep 29 00:45:53 2010
@@ -671,9 +671,9 @@ public static void getMainInfo (java.io.
}
catch (Throwable t) {
-
- failures.append(notFound(cn, library));
-
+ t.printStackTrace();
+ failures.append(notFound(cn, library, t.getMessage()));
+
}
@@ -689,7 +689,8 @@ public static void getMainInfo (java.io.
}
catch (Throwable t) {
- failures.append(notFound(cn, library));
+ t.printStackTrace();
+ failures.append(notFound(cn, library, t.getMessage()));
}
@@ -704,12 +705,12 @@ public static void getMainInfo (java.io.
temp.append(crLf());
return temp.toString();
}
- private static String notFound(String cn, String library) {
+ private static String notFound(String cn, String library, String exceptionText) {
StringBuffer temp = new StringBuffer(crLf());
temp.append(" " + library);
temp.append(crLf());
- temp.append(" " + Main.getTextMessage("SIF08.U", cn));
+ temp.append(" " + Main.getTextMessage("SIF08.U", cn, exceptionText));
temp.append(crLf());
temp.append(crLf());
return temp.toString();