aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-07-20 18:31:14 -0400
committerJeff Johnston2018-07-20 19:07:14 -0400
commit531977c384e1fecc888e2642532d99ff0ff304bc (patch)
treebf90486138756b55799b0e868f5461d6bb97b767
parent04ccf3d141e1871ede08141a5d8d6ddc0384ac2d (diff)
downloadorg.eclipse.linuxtools-531977c384e1fecc888e2642532d99ff0ff304bc.tar.gz
org.eclipse.linuxtools-531977c384e1fecc888e2642532d99ff0ff304bc.tar.xz
org.eclipse.linuxtools-531977c384e1fecc888e2642532d99ff0ff304bc.zip
Bug 537248 - NoClassDefFoundError in ConnectionPropertyTester
- add a try/catch in the test logic of ConnectionPropertyTester in case org.eclipse.linuxtools.docker.core hasn't loaded - do similar for VolumePropertyTester Change-Id: I69670ac9a6a421cde02361a49e0799e2210fb1f1 Reviewed-on: https://git.eclipse.org/r/126409 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java39
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/VolumePropertyTester.java18
2 files changed, 29 insertions, 28 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java
index 627ecd1193..9bd1f0c445 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/ConnectionPropertyTester.java
@@ -47,28 +47,27 @@ public class ConnectionPropertyTester extends PropertyTester {
private boolean isConnectionEstablished(Object receiver, String property,
Object[] args, Object expectedValue) {
- if (receiver instanceof List) {
- if (!((List<?>) receiver).isEmpty()) {
- return isConnectionEstablished(((List<?>) receiver).get(0),
- property, args, expectedValue);
- } else {
- return isConnectionEstablished(
- DockerConnectionWatcher.getInstance().getConnection(),
- property, args,
- expectedValue);
+ try {
+ if (receiver instanceof List) {
+ if (!((List<?>) receiver).isEmpty()) {
+ return isConnectionEstablished(((List<?>) receiver).get(0), property, args, expectedValue);
+ } else {
+ return isConnectionEstablished(DockerConnectionWatcher.getInstance().getConnection(), property,
+ args, expectedValue);
+ }
}
- }
- if (receiver instanceof IAdaptable) {
- final IDockerConnection connection = ((IAdaptable) receiver)
- .getAdapter(IDockerConnection.class);
- if (connection != null) {
- return isConnectionEstablished(connection, property, args,
- expectedValue);
+ if (receiver instanceof IAdaptable) {
+ final IDockerConnection connection = ((IAdaptable) receiver).getAdapter(IDockerConnection.class);
+ if (connection != null) {
+ return isConnectionEstablished(connection, property, args, expectedValue);
+ }
}
- }
- if (receiver instanceof IDockerConnection) {
- return expectedValue.equals(((IDockerConnection) receiver)
- .getState() == EnumDockerConnectionState.ESTABLISHED);
+ if (receiver instanceof IDockerConnection) {
+ return expectedValue
+ .equals(((IDockerConnection) receiver).getState() == EnumDockerConnectionState.ESTABLISHED);
+ }
+ } catch (Exception e) {
+ // do nothing and fall through
}
return false;
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/VolumePropertyTester.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/VolumePropertyTester.java
index 9f0b13d50a..f38b8284e8 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/VolumePropertyTester.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/propertytesters/VolumePropertyTester.java
@@ -27,15 +27,17 @@ public class VolumePropertyTester extends PropertyTester {
@Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
- if (receiver instanceof DockerContainerVolume) {
- final DockerContainerVolume volume = (DockerContainerVolume) receiver;
- switch (property) {
- case HAS_HOST_PATH:
- DockerConnection connection = (DockerConnection) volume
- .getContainer().getConnection();
- return connection.isLocal() && volume.getHostPath() != null
- && !volume.getHostPath().isEmpty();
+ try {
+ if (receiver instanceof DockerContainerVolume) {
+ final DockerContainerVolume volume = (DockerContainerVolume) receiver;
+ switch (property) {
+ case HAS_HOST_PATH:
+ DockerConnection connection = (DockerConnection) volume.getContainer().getConnection();
+ return connection.isLocal() && volume.getHostPath() != null && !volume.getHostPath().isEmpty();
+ }
}
+ } catch (Exception e) {
+ // fall-through
}
return false;
}