Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stack trace print for jlm test connect exceptions #403

Merged
merged 1 commit into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,23 @@ private void getStatsViaProxy() {
ie.printStackTrace();
Assert.fail("The sleeping profiler was interrupted");
} catch (UndeclaredThrowableException ue) {
// If the exception was caused by a Connect or Unmarshal Exception
// assume the monitored JVM has finished.
Throwable cause = ue.getCause();
Class<ConnectException> connectExcept = ConnectException.class;
Class<UnmarshalException> unmarshalExcept = UnmarshalException.class;

if (connectExcept.isInstance(cause) || unmarshalExcept.isInstance(cause)) {

// If the exception was caused by a Connect or Unmarshal
// Exception, assume the monitored JVM has finished.
this.closeCSVFile();
Message.logOut("Exiting as JVM we are connected to has finished");
Assert.fail("Exiting as JVM we are connected to has finished");
} else {
Message.logOut(ue.getMessage());
ue.printStackTrace();
Assert.fail(ue.getMessage());
String msg = "";
if (connectExcept.isInstance(cause)) {
msg = "Exiting as ConnectException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
}
else if (unmarshalExcept.isInstance(cause)) {
msg = "Exiting as UnmarshalException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
}
msg += ue.getMessage();
this.closeCSVFile();
Message.logOut(msg);
ue.printStackTrace();
Assert.fail(msg);
} finally {
this.closeCSVFile();
}
Expand Down Expand Up @@ -258,17 +259,22 @@ private void getStatsViaServer() {
Thread.sleep(1000);
secondsCnt++;
}

// If the exception is a Connect or Unmarshal Exception, assume the
// monitored JVM has finished
// If the exception is a Connect or Unmarshal Exception assume the
// monitored JVM has finished.
} catch (ConnectException ce) {
this.closeCSVFile();
Message.logOut("Exiting as JVM we are connected to has finished");
Assert.fail("Exiting as JVM we are connected to has finished");
String msg = "Exiting as ConnectException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
msg += ce.getMessage();
Message.logOut(msg);
ce.printStackTrace();
Assert.fail(msg);
} catch (UnmarshalException ue) {
this.closeCSVFile();
Message.logOut("Exiting as JVM we are connected to has finished");
Assert.fail("Exiting as JVM we are connected to has finished");
String msg = "Exiting as UnmarshalException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
msg += ue.getMessage();
Message.logOut(msg);
ue.printStackTrace();
Assert.fail(msg);
} catch (InterruptedException ie) {
Message.logOut("The sleeping profiler was interrupted");
ie.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,23 @@ private void getStatsViaProxy() {
ie.printStackTrace();
Assert.fail("The sleeping profiler was interrupted");
} catch (UndeclaredThrowableException ue) {
// If the exception was caused by a Connect or Unmarshal Exception, assume the
// monitored JVM has finished.
// If the exception was caused by a Connect or Unmarshal Exception
// assume the monitored JVM has finished.
Throwable cause = ue.getCause();
Class<ConnectException> connectExcept = ConnectException.class;
Class<UnmarshalException> unmarshalExcept = UnmarshalException.class;

if (connectExcept.isInstance(cause) || unmarshalExcept.isInstance(cause)) {
this.closeCSVFile();
Message.logOut("Exiting as JVM we are connected to has finished");
Class<ConnectException> connectExcept = ConnectException.class;
Class<UnmarshalException> unmarshalExcept = UnmarshalException.class;
String msg = "";
if (connectExcept.isInstance(cause)) {
msg = "Exiting as ConnectException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
}
else {
Message.logOut("Rethrowing UndeclaredThrowableException");
else if (unmarshalExcept.isInstance(cause)) {
msg = "Exiting as UnmarshalException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
}
Assert.fail();
msg += ue.getMessage();
this.closeCSVFile();
Message.logOut(msg);
ue.printStackTrace();
Assert.fail(msg);
} finally {
this.closeCSVFile();
}
Expand Down Expand Up @@ -256,12 +259,22 @@ private void getStatsViaServer() {
Thread.sleep(1000);
secondsCnt++;
}
// If the exception is a Connect or Unmarshal Exception assume the
// monitored JVM has finished.
} catch (ConnectException ce) {
this.closeCSVFile();
Assert.fail("Exiting as JVM we are connected to has finished");
String msg = "Exiting as ConnectException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
msg += ce.getMessage();
Message.logOut(msg);
ce.printStackTrace();
Assert.fail(msg);
} catch (UnmarshalException ue) {
this.closeCSVFile();
Assert.fail("Exiting as JVM we are connected to has finished");
String msg = "Exiting as UnmarshalException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
msg += ue.getMessage();
Message.logOut(msg);
ue.printStackTrace();
Assert.fail(msg);
} catch (InterruptedException ie) {
ie.printStackTrace();
Assert.fail("The sleeping profiler was interrupted");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,18 @@ private void getStatsViaProxy() {
Throwable cause = ue.getCause();
Class<ConnectException> connectExcept = ConnectException.class;
Class<UnmarshalException> unmarshalExcept = UnmarshalException.class;

if (connectExcept.isInstance(cause) || unmarshalExcept.isInstance(cause)) {
this.closeCSVFile();
Message.logOut("Exiting as JVM we are connected to has finished");
Assert.fail("Exiting as JVM we are connected to has finished");
} else {
Message.logOut(ue.getMessage());
ue.printStackTrace();
Assert.fail(ue.getMessage());
String msg = "";
if (connectExcept.isInstance(cause)) {
msg = "Exiting as ConnectException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
}
else if (unmarshalExcept.isInstance(cause)) {
msg = "Exiting as UnmarshalException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
}
msg += ue.getMessage();
this.closeCSVFile();
Message.logOut(msg);
ue.printStackTrace();
Assert.fail(msg);
} finally {
this.closeCSVFile();
}
Expand Down Expand Up @@ -207,12 +209,18 @@ private void getStatsViaServer() {
// monitored JVM has finished.
} catch (ConnectException ce) {
this.closeCSVFile();
Message.logOut("Exiting as JVM we are connected to has finished");
Assert.fail("Exiting as JVM we are connected to has finished");
String msg = "Exiting as ConnectException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
msg += ce.getMessage();
Message.logOut(msg);
ce.printStackTrace();
Assert.fail(msg);
} catch (UnmarshalException ue) {
this.closeCSVFile();
Message.logOut("Exiting as JVM we are connected to has finished");
Assert.fail("Exiting as JVM we are connected to has finished");
String msg = "Exiting as UnmarshalException thrown receiving data from the connected JVM. This may mean the JVM we are connected to has finished. ";
msg += ue.getMessage();
Message.logOut(msg);
ue.printStackTrace();
Assert.fail(msg);
} catch (InterruptedException ie) {
Message.logOut("The sleeping profiler was interrupted");
ie.printStackTrace();
Expand Down