Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2016-09-12 09:02:01 +0000
committerJeff Johnston2016-09-12 18:53:08 +0000
commitbd17655fa695eefe754dc6da76d571636221eb5c (patch)
tree226deb79adfc38703b7236c6f033d7ec1eef372f
parent0c1a87a9bc3aa1bff17976d205cc0eccc1f34b38 (diff)
downloadorg.eclipse.linuxtools-bd17655fa695eefe754dc6da76d571636221eb5c.tar.gz
org.eclipse.linuxtools-bd17655fa695eefe754dc6da76d571636221eb5c.tar.xz
org.eclipse.linuxtools-bd17655fa695eefe754dc6da76d571636221eb5c.zip
Bug 489111 - NoStackTrace in DockerConnection$LogThread.execute
Marked Activator#logErrorMessage(String) as deprecated and replaced all calls to Activator#logErrorMessage(String, Throwable) to log a proper stacktrace. Change-Id: I5722c96b5fa2657e560f016f42dba25c654729f2 Signed-off-by: Xavier Coulon <xcoulon@redhat.com> Reviewed-on: https://git.eclipse.org/r/80896 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit f1b44a7d70e91d68618d7a58eff0026275e2da80) Reviewed-on: https://git.eclipse.org/r/80938
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java4
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java40
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties7
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java3
4 files changed, 40 insertions, 14 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java
index 548c8df9bc..27e9ccf105 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java
@@ -60,6 +60,10 @@ public class Activator extends Plugin {
null));
}
+ /**
+ * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=489111
+ */
+ @Deprecated
public static void logErrorMessage(final String message) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, null));
}
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 796a849799..2992c17d17 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
@@ -222,7 +222,7 @@ public class DockerConnection
ISecurePreferences node = root.node(key);
try {
if (passwd != null && !passwd.equals("")) //$NON-NLS-1$
- node.put("password", passwd, true /* encrypt */);
+ node.put("password", passwd, true /* encrypt */); //$NON-NLS-1$
} catch (StorageException e) {
Activator.log(e);
}
@@ -630,16 +630,19 @@ public class DockerConnection
} while (follow && !stop);
listContainers();
} catch (com.spotify.docker.client.DockerRequestException e) {
- Activator.logErrorMessage(e.message());
+ Activator.logErrorMessage(
+ ProcessMessages.getString("Monitor_Logs_Exception"), e); //$NON-NLS-1$
throw new InterruptedException();
} catch (com.spotify.docker.client.DockerException | IOException e) {
- Activator.logErrorMessage(e.getMessage());
+ Activator.logErrorMessage(
+ ProcessMessages.getString("Monitor_Logs_Exception"), e); //$NON-NLS-1$
throw new InterruptedException();
} catch (InterruptedException e) {
kill = true;
Thread.currentThread().interrupt();
} catch (Exception e) {
- Activator.logErrorMessage(e.getMessage());
+ Activator.logErrorMessage(
+ ProcessMessages.getString("Monitor_Logs_Exception"), e); //$NON-NLS-1$
} finally {
follow = false;
copyClient.close(); // we are done with copyClient..dispose
@@ -756,7 +759,7 @@ public class DockerConnection
// ListContainersParam so we have
// to do a kludge and put in control chars ourselves and pretend
// we have a label with no value.
- String separator = "";
+ String separator = ""; //$NON-NLS-1$
StringBuffer labelString = new StringBuffer();
for (Entry<String, String> entry : labels.entrySet()) {
labelString.append(separator);
@@ -831,11 +834,15 @@ public class DockerConnection
final ContainerInfo info = client.inspectContainer(id);
return new DockerContainerInfo(info);
} catch (com.spotify.docker.client.DockerRequestException e) {
- Activator.logErrorMessage(e.message());
+ Activator.logErrorMessage(
+ ProcessMessages.getString("Container_Info_Exception"), e); //$NON-NLS-1$
return null;
} catch (com.spotify.docker.client.DockerException
| InterruptedException e) {
- Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to inspect container '" + id + "'", e));
+ Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ ProcessMessages.getFormattedString(
+ "Container_Inspect_Exception", id), //$NON-NLS-1$
+ e));
return null;
}
}
@@ -849,12 +856,15 @@ public class DockerConnection
final ImageInfo info = this.client.inspectImage(id);
return new DockerImageInfo(info);
} catch (com.spotify.docker.client.DockerRequestException e) {
- Activator.logErrorMessage(e.message());
+ Activator.logErrorMessage(
+ ProcessMessages.getString("Image_Info_Exception"), e); //$NON-NLS-1$
return null;
} catch (com.spotify.docker.client.DockerException
| InterruptedException e) {
Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Failed to inspect container '" + id + "'", e));
+ ProcessMessages.getFormattedString(
+ "Image_Inspect_Exception", id), //$NON-NLS-1$
+ e));
return null;
}
}
@@ -1032,7 +1042,8 @@ public class DockerConnection
public boolean hasImage(final String repository, final String tag) {
for (IDockerImage image : getImages()) {
for (String repoTag : image.repoTags()) {
- String tagExpr = (tag != null && !tag.isEmpty()) ? ':' + tag : ""; //$NON-NLS-1$
+ String tagExpr = (tag != null && !tag.isEmpty()) ? ":" + tag //$NON-NLS-1$
+ : ""; //$NON-NLS-1$
if (repoTag.equals(repository + tagExpr)) {
return true;
}
@@ -1983,8 +1994,11 @@ public class DockerConnection
InputStream tin = HttpHijackWorkaround.getInputStream(pty_stream);
// org.eclipse.tm.terminal.connector.ssh.controls.SshWizardConfigurationPanel
Map<String, Object> properties = new HashMap<>();
- properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, "org.eclipse.tm.terminal.connector.streams.launcher.streams");
- properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.terminal.connector.streams.StreamsConnector");
+ properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID,
+ "org.eclipse.tm.terminal.connector.streams.launcher.streams"); //$NON-NLS-1$
+ properties.put(
+ ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID,
+ "org.eclipse.tm.terminal.connector.streams.StreamsConnector"); //$NON-NLS-1$
properties.put(ITerminalsConnectorConstants.PROP_TITLE, name);
properties.put(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, false);
properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, true);
@@ -1998,7 +2012,7 @@ public class DockerConnection
* LogStream overrides finalize() to close the stream being
* used so we must preserve a reference to it.
*/
- properties.put("PREVENT_JVM_GC_FINALIZE", pty_stream);
+ properties.put("PREVENT_JVM_GC_FINALIZE", pty_stream); //$NON-NLS-1$
ITerminalService service = TerminalServiceFactory.getService();
service.openConsole(properties, null);
} catch (Exception e) {
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties
index 2470031b3e..d18a804e01 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties
@@ -12,3 +12,10 @@ Command_Not_Found=The ''{1}'' command could not be located in ''{0}''
Process_Error=Failed to execute command ''{0}'' (exit code={1}): {2}
Process_Start_Exception=Failed to execute command ''{0}'': {1}
Process_Monitor_Exception=Failed to monitor process
+Monitor_Logs_Exception=Failed to monitor container logs
+Settings_Detection_Exception=Failed to retrieve connection settings
+Container_Info_Exception=Failed to retrieve container info
+Image_Info_exception=Failed to retrieve image info
+Container_Inspect_Exception=Failed to inspect container: ''{0}''
+Image_Inspect_Exception=Failed to inspect image: ''{0}''
+
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java
index 04e1dee3c6..74be44598b 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java
@@ -120,7 +120,8 @@ public class ShellConnectionSettingsProvider implements IDockerConnectionSetting
}
script.setExecutable(true);
} catch (IOException e) {
- Activator.logErrorMessage(e.getMessage());
+ Activator.logErrorMessage(ProcessMessages
+ .getString("Settings_Detection_Exception"), e); //$NON-NLS-1$
}
}
return script;

Back to the top