Bug 567544 Do not lose information in DockerContainerNotFoundException

Just passing getMessage() and getCause() removes the exception from the
Exception trace, thus removing possibly valuable debug information.

Change-Id: Idbd2384ef18899a92a28def92711e7de0f7bb842
Signed-off-by: Moritz 'Morty' Strübe <moritz.struebe@mathema.de>
Reviewed-on: https://git.eclipse.org/r/c/linuxtools/org.eclipse.linuxtools/+/170202
Tested-by: Linux Tools Bot <linuxtools-bot@eclipse.org>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/DockerContainerNotFoundException.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/DockerContainerNotFoundException.java
index e1f808d..d4cfe7d 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/DockerContainerNotFoundException.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/DockerContainerNotFoundException.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2018 Red Hat.
+ * Copyright (c) 2014, 2020 Red Hat and others.
  * 
  * This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License 2.0
@@ -17,7 +17,7 @@
 	private static final long serialVersionUID = 1L;
 
 	public DockerContainerNotFoundException(Exception e) {
-		super(e.getMessage(), e.getCause());
+		super(e);
 	}
 
 }
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
index 26a159c..2e1db12 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
@@ -544,7 +544,7 @@
 				}
 			}
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage());
+			throw new DockerException(e);
 		} catch (InterruptedException e) {
 			return Collections.emptyList();
 		}
@@ -841,7 +841,7 @@
 							Activator.PLUGIN_ID,
 							Messages.List_Docker_Containers_Failure, e));
 				} else {
-					throw new DockerException(e.getMessage());
+					throw new DockerException(e);
 				}
 			} finally {
 				this.containersById = updatedContainersById;
@@ -916,7 +916,7 @@
 					&& e.getCause().getCause() instanceof ProcessingException) {
 				close();
 			} else {
-				throw new DockerException(e.getMessage());
+				throw new DockerException(e);
 			}
 		}
 		return labelSet;
@@ -1700,7 +1700,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1722,7 +1722,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			// Permit kill to fail silently even on non-running containers
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1738,7 +1738,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1772,7 +1772,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1788,7 +1788,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1845,10 +1845,10 @@
 					"DockerStartContainer.error", getCmdString(containerInfo))); //$NON-NLS-1$
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			if (e.status() != 304) {
-				throw new DockerException(e.getMessage());
+				throw new DockerException(e);
 			}
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1892,7 +1892,7 @@
 					"DockerStartContainer.error", getCmdString(containerInfo))); //$NON-NLS-1$
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			if (e.status() != 304) {
-				throw new DockerException(e.getMessage());
+				throw new DockerException(e);
 			}
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
 			throw new DockerException(e);
@@ -1935,7 +1935,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1956,7 +1956,7 @@
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException
 				| InterruptedException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -1968,7 +1968,7 @@
 			DockerClient copy = getClientCopy();
 			stream = copy.archiveContainer(id, path);
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 		return stream;
 	}
@@ -1981,7 +1981,7 @@
 		try {
 			stream = clientCopy.archiveContainer(id, path);
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 		return stream;
 	}
@@ -1998,7 +1998,7 @@
 						change.kind()));
 			}
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 		return containerChanges;
 	}
@@ -2044,7 +2044,7 @@
 			copy.copyToContainer(dirPath, id, path);
 			copy.close(); /* dispose of client copy now that we are done */
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2058,7 +2058,7 @@
 			copy.copyToContainer(dirPath, id, path);
 			copy.close(); /* dispose of client copy now that we are done */
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2074,7 +2074,7 @@
 					.serverAddress(new String(cfg.getServerAddress())).build();
 			return client.auth(authConfig);
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2135,7 +2135,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2151,7 +2151,7 @@
 			stream.attach(out, err);
 			stream.close();
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2164,7 +2164,7 @@
 			stream.attach(out, err);
 			stream.close();
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2184,7 +2184,7 @@
 		} catch (org.mandas.docker.client.exceptions.DockerRequestException e) {
 			throw new DockerException(e.getResponseBody());
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2240,7 +2240,7 @@
 				t_in.start();
 			}
 		} catch (Exception e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2252,7 +2252,7 @@
 					AttachParameter.STREAM);
 			logstream.attach(stdout, stderr);
 		} catch (Exception e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2367,7 +2367,7 @@
 			final IDockerContainerInfo info = getContainerInfo(id);
 			openTerminal(pty_stream, info.name() + " [shell]", null); //$NON-NLS-1$
 		} catch (Exception e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2434,7 +2434,7 @@
 			ITerminalService service = TerminalServiceFactory.getService();
 			service.openConsole(properties, null);
 		} catch (Exception e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2504,7 +2504,7 @@
 			return new DockerNetworkCreation(creation);
 
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2515,7 +2515,7 @@
 			Network n = client.inspectNetwork(networkId);
 			return new DockerNetwork(n);
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2530,7 +2530,7 @@
 			}
 			return networks;
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2540,7 +2540,7 @@
 		try {
 			client.removeNetwork(networkId);
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2550,7 +2550,7 @@
 		try {
 			client.connectToNetwork(id, networkId);
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}
 
@@ -2560,7 +2560,7 @@
 		try {
 			client.disconnectFromNetwork(id, networkId);
 		} catch (org.mandas.docker.client.exceptions.DockerException e) {
-			throw new DockerException(e.getMessage(), e.getCause());
+			throw new DockerException(e);
 		}
 	}