Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2015-09-08 19:30:52 +0000
committerRoland Grunberg2015-09-09 19:06:41 +0000
commitc89caf881cb1e7a667b211cfb1d121e263671349 (patch)
treebab1299aa68e78f53a8f116573288be5f29f5ac8 /containers/org.eclipse.linuxtools.docker.core/src/org/eclipse
parent8b200d2f8331ad95e73ec261151076a200a3698a (diff)
downloadorg.eclipse.linuxtools-c89caf881cb1e7a667b211cfb1d121e263671349.tar.gz
org.eclipse.linuxtools-c89caf881cb1e7a667b211cfb1d121e263671349.tar.xz
org.eclipse.linuxtools-c89caf881cb1e7a667b211cfb1d121e263671349.zip
Bug 476870: Add support for Java 9 attaching to container under https.
The internal SSLSocketImpl field in sun.security.ssl.AppInputStream has changed from 'c' to 'socket' in Java 9. Also mark all strings as non-translatable. Change-Id: Ic371ba1ffa37e069f3d00e60d30190be01f7027a Reviewed-on: https://git.eclipse.org/r/55500 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
Diffstat (limited to 'containers/org.eclipse.linuxtools.docker.core/src/org/eclipse')
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/HttpHijackWorkaround.java48
1 files changed, 32 insertions, 16 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/HttpHijackWorkaround.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/HttpHijackWorkaround.java
index fa7d68a2e2..ffe2169b75 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/HttpHijackWorkaround.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/HttpHijackWorkaround.java
@@ -39,22 +39,31 @@ import com.spotify.docker.client.LogStream;
public class HttpHijackWorkaround {
public static WritableByteChannel getOutputStream(LogStream stream, String uri) throws Exception {
- final String[] fields = new String[] { "reader", "stream", "original",
- "input", "in", "in", "wrappedStream", "in", "instream" };
+ final String[] fields = new String[] {
+ "reader", //$NON-NLS-1$
+ "stream", //$NON-NLS-1$
+ "original", //$NON-NLS-1$
+ "input", //$NON-NLS-1$
+ "in", //$NON-NLS-1$
+ "in", //$NON-NLS-1$
+ "wrappedStream", //$NON-NLS-1$
+ "in", //$NON-NLS-1$
+ "instream" //$NON-NLS-1$
+ };
final String[] declared = new String[] {
LogStream.class.getName(),
LogReader.class.getName(),
- "org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream",
- "org.glassfish.jersey.message.internal.EntityInputStream",
+ "org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream", //$NON-NLS-1$
+ "org.glassfish.jersey.message.internal.EntityInputStream", //$NON-NLS-1$
FilterInputStream.class.getName(),
FilterInputStream.class.getName(),
- "org.apache.http.conn.EofSensorInputStream",
- "org.apache.http.impl.io.IdentityInputStream",
- "org.apache.http.impl.io.SessionInputBufferImpl" };
+ "org.apache.http.conn.EofSensorInputStream", //$NON-NLS-1$
+ "org.apache.http.impl.io.IdentityInputStream", //$NON-NLS-1$
+ "org.apache.http.impl.io.SessionInputBufferImpl" }; //$NON-NLS-1$
final String [] bundles = new String[] {
- "org.glassfish.jersey.core.jersey-common",
- "org.apache.httpcomponents.httpcore",
- "org.apache.httpcomponents.httpclient"
+ "org.glassfish.jersey.core.jersey-common", //$NON-NLS-1$
+ "org.apache.httpcomponents.httpcore", //$NON-NLS-1$
+ "org.apache.httpcomponents.httpclient" //$NON-NLS-1$
};
List<String[]> list = new LinkedList<>();
@@ -62,12 +71,19 @@ public class HttpHijackWorkaround {
list.add(new String[] { declared[i], fields[i] });
}
- if (uri.startsWith("unix:")) {
- list.add(new String[] { "sun.nio.ch.ChannelInputStream", "ch" });
- } else if (uri.startsWith("https:")) {
- list.add(new String[] { "sun.security.ssl.AppInputStream", "c" });
+ if (uri.startsWith("unix:")) { //$NON-NLS-1$
+ list.add(new String[] { "sun.nio.ch.ChannelInputStream", "ch" }); //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (uri.startsWith("https:")) { //$NON-NLS-1$
+ float jvmVersion = Float.parseFloat(System.getProperty("java.specification.version")); //$NON-NLS-1$
+ String fName;
+ if (jvmVersion < 1.9f) {
+ fName = "c"; //$NON-NLS-1$
+ } else {
+ fName = "socket"; //$NON-NLS-1$
+ }
+ list.add(new String[] { "sun.security.ssl.AppInputStream", fName }); //$NON-NLS-1$
} else {
- list.add(new String[] { "java.net.SocketInputStream", "socket" });
+ list.add(new String[] { "java.net.SocketInputStream", "socket" }); //$NON-NLS-1$ //$NON-NLS-2$
}
Object res = getInternalField(stream, list, bundles);
@@ -87,7 +103,7 @@ public class HttpHijackWorkaround {
* happens with the HTTP Hijacking situation.
*/
public static InputStream getInputStream(LogStream stream) {
- final String[] fields = new String[] { "reader", "stream" };
+ final String[] fields = new String[] { "reader", "stream" }; //$NON-NLS-1$ //$NON-NLS-2$
final String[] declared = new String[] { LogStream.class.getName(), LogReader.class.getName()};
List<String[]> list = new LinkedList<>();

Back to the top