Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-02-22 17:17:07 -0500
committerJeff Johnston2018-02-23 10:49:09 -0500
commit6ae9ece869084644bb68863ff8e73df95584e79a (patch)
treebbdae26c817753d6cb9c37f0eb4299691d237c25
parent43f70661b98f2e6c66b362953dd51dc6f29e725f (diff)
downloadorg.eclipse.linuxtools-6ae9ece869084644bb68863ff8e73df95584e79a.tar.gz
org.eclipse.linuxtools-6ae9ece869084644bb68863ff8e73df95584e79a.tar.xz
org.eclipse.linuxtools-6ae9ece869084644bb68863ff8e73df95584e79a.zip
Bug 531563 - Regression in Docker copy files from Container
- add back BlockingInputStream wrapper to TarArchive streams passed back by copyFromContainer Change-Id: I9f31e58199af43104692f92d54caee94b035cb0d Reviewed-on: https://git.eclipse.org/r/117993 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java20
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CopyFromContainerCommandHandler.java18
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java19
3 files changed, 54 insertions, 3 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java
index 121c4787cb..5c1dbdf999 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java
@@ -161,6 +161,22 @@ public class ContainerLauncher {
}
+ /**
+ * A blocking input stream that waits until data is available.
+ */
+ private class BlockingInputStream extends InputStream {
+ private InputStream in;
+
+ public BlockingInputStream(InputStream in) {
+ this.in = in;
+ }
+
+ @Override
+ public int read() throws IOException {
+ return in.read();
+ }
+ }
+
private class CopyVolumesFromImageJob extends Job {
private static final String COPY_VOLUMES_FROM_JOB_TITLE = "ContainerLaunch.copyVolumesFromJob.title"; //$NON-NLS-1$
@@ -233,6 +249,7 @@ public class ContainerLauncher {
writer);) {
bufferedWriter.write(dockerImage.id());
bufferedWriter.newLine();
+ dirList.clear();
} catch (IOException e) {
// ignore
}
@@ -285,7 +302,8 @@ public class ContainerLauncher {
* stream that is guaranteed to block until data is
* available.
*/
- TarArchiveInputStream k = new TarArchiveInputStream(in);
+ TarArchiveInputStream k = new TarArchiveInputStream(
+ new BlockingInputStream(in));
TarArchiveEntry te = null;
target.toFile().mkdirs();
IPath currDir = target.append(volume)
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CopyFromContainerCommandHandler.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CopyFromContainerCommandHandler.java
index bc25be0a89..2bb90762aa 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CopyFromContainerCommandHandler.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CopyFromContainerCommandHandler.java
@@ -87,6 +87,22 @@ public class CopyFromContainerCommandHandler extends AbstractHandler {
return null;
}
+ /**
+ * A blocking input stream that waits until data is available.
+ */
+ private class BlockingInputStream extends InputStream {
+ private InputStream in;
+
+ public BlockingInputStream(InputStream in) {
+ this.in = in;
+ }
+
+ @Override
+ public int read() throws IOException {
+ return in.read();
+ }
+ }
+
private void performCopyFromContainer(final IDockerConnection connection,
final IDockerContainer container, final String target,
final List<ContainerFileProxy> files) {
@@ -122,7 +138,7 @@ public class CopyFromContainerCommandHandler extends AbstractHandler {
* data is available.
*/
TarArchiveInputStream k = new TarArchiveInputStream(
- in);
+ new BlockingInputStream(in));
TarArchiveEntry te = null;
while ((te = k.getNextTarEntry()) != null) {
long size = te.getSize();
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
index 3230133b1f..66036dd7b4 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
@@ -167,6 +167,22 @@ public class ContainerCommandProcess extends Process {
return new ByteArrayOutputStream();
}
+ /**
+ * A blocking input stream that waits until data is available.
+ */
+ private class BlockingInputStream extends InputStream {
+ private InputStream in;
+
+ public BlockingInputStream(InputStream in) {
+ this.in = in;
+ }
+
+ @Override
+ public int read() throws IOException {
+ return in.read();
+ }
+ }
+
private class CopyVolumesFromImageJob extends Job {
private static final String COPY_VOLUMES_FROM_JOB_TITLE = "ContainerLaunch.copyVolumesFromJob.title"; //$NON-NLS-1$
@@ -215,7 +231,8 @@ public class ContainerCommandProcess extends Process {
* stream that is guaranteed to block until data is
* available.
*/
- TarArchiveInputStream k = new TarArchiveInputStream(in);
+ TarArchiveInputStream k = new TarArchiveInputStream(
+ new BlockingInputStream(in));
TarArchiveEntry te = null;
IPath currDir = new Path(volume).removeLastSegments(1);
currDir.toFile().mkdirs();

Back to the top