remove mylyn core net dependency and removed corresponding code

This commit is contained in:
Martin Lippert
2022-04-25 11:18:28 +02:00
parent 155fa29f9f
commit 49873660e6
15 changed files with 20 additions and 1239 deletions

View File

@@ -6,7 +6,6 @@ Bundle-Version: 4.15.0.qualifier
Bundle-Activator: org.springsource.ide.eclipse.commons.internal.core.CorePlugin
Bundle-Vendor: VMware, Inc.
Require-Bundle: org.eclipse.core.resources,
org.eclipse.mylyn.commons.net;bundle-version="[3.3.0,4.0.0)",
org.eclipse.equinox.p2.core;resolution:=optional,
org.eclipse.equinox.p2.repository;resolution:=optional,
org.eclipse.jdt.core,
@@ -19,7 +18,8 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.text,
org.springsource.ide.eclipse.commons.livexp,
org.eclipse.debug.core,
org.eclipse.jface
org.eclipse.jface,
org.apache.commons.lang3
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.springsource.ide.eclipse.commons.core,
@@ -29,8 +29,7 @@ Export-Package: org.springsource.ide.eclipse.commons.core,
org.springsource.ide.eclipse.commons.core.templates,
org.springsource.ide.eclipse.commons.core.util,
org.springsource.ide.eclipse.commons.internal.core,
org.springsource.ide.eclipse.commons.internal.core.commandhistory,
org.springsource.ide.eclipse.commons.internal.core.net
org.springsource.ide.eclipse.commons.internal.core.commandhistory
Import-Package: org.eclipse.core.runtime,
org.eclipse.core.runtime.jobs,
org.eclipse.core.runtime.preferences,

View File

@@ -1,175 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springsource.ide.eclipse.commons.core;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.osgi.util.NLS;
import org.springsource.ide.eclipse.commons.core.util.IOUtil;
import org.springsource.ide.eclipse.commons.internal.core.CorePlugin;
import org.springsource.ide.eclipse.commons.internal.core.net.HttpClientTransportService;
import org.springsource.ide.eclipse.commons.internal.core.net.ITransportService;
import org.springsource.ide.eclipse.commons.internal.core.net.P2TransportService;
/**
* Provides helper methods for downloading files.
* @author Steffen Pingel
*/
public class HttpUtil {
private static ITransportService transport;
public static IStatus download(String url, File archiveFile, File targetDirectory, IProgressMonitor monitor) {
return download(url, archiveFile, targetDirectory, null, monitor);
}
public static IStatus download(String url, File archiveFile, File targetDirectory, String prefix,
IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
SubMonitor progress = SubMonitor.convert(monitor, 100);
targetDirectory.mkdirs();
// download archive file
try {
try {
OutputStream out = new BufferedOutputStream(new FileOutputStream(archiveFile));
try {
HttpUtil.download(new URI(url), out, progress.newChild(70));
}
catch (CoreException e) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, NLS.bind(
"I/O error while retrieving data: {0}", e.getMessage()), e);
}
catch (URISyntaxException e) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, NLS.bind("Invalid URL: {0}", url), e);
}
finally {
out.close();
}
}
catch (IOException e) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, "I/O error while retrieving data", e);
}
// extract archive file
try {
URL fileUrl = archiveFile.toURI().toURL();
ZipFileUtil.unzip(fileUrl, targetDirectory, prefix, progress.newChild(30));
if (targetDirectory.listFiles().length <= 0) {
String message = NLS.bind("Zip file {0} appears to be empty", archiveFile);
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, message);
}
}
catch (IOException e) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, "Error while extracting archive", e);
}
}
finally {
archiveFile.delete();
}
return Status.OK_STATUS;
}
public static void download(URI uri, OutputStream out, IProgressMonitor monitor) throws CoreException {
String protocol = uri.getScheme();
if ("file".equals(protocol)) {
// Yes. it is a bit strange that HttpUtil knows how to read from
// file url. But it is just easier that
// way. Don't need to special case file urls in other places.
// We should consider renaming this class but it has the potential
// of breaking a lot of dependencies.
File f = new File(uri);
FileInputStream contents = null;
try {
contents = new FileInputStream(f);
byte[] buf = new byte[40 * 1024];
int read;
while ((read = contents.read(buf)) >= 0) {
// read = -1 means EOF
// read == 0 probably is impossible but handle it anyway.
if (read > 0) {
out.write(buf, 0, read);
}
}
}
catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, e.getMessage(), e));
}
finally {
try {
if (contents != null) {
contents.close();
}
}
catch (IOException e) {
}
}
}
else {
getTransport().download(uri, out, monitor);
}
}
public static long getLastModified(URI location, IProgressMonitor monitor) throws CoreException {
return getTransport().getLastModified(location, monitor);
}
public static synchronized ITransportService getTransport() {
if (transport == null) {
if (Platform.isRunning()) {
try {
transport = new P2TransportService();
}
catch (ClassNotFoundException e) {
// fall back to HttpClientTransport
}
}
if (transport == null) {
transport = new HttpClientTransportService();
}
}
return transport;
}
public static InputStream stream(URI uri, IProgressMonitor monitor) throws CoreException {
return getTransport().stream(uri, monitor);
}
public static void ping(URI uri) throws MalformedURLException, IOException, CoreException {
URLConnection connection = uri.toURL().openConnection();
connection.setConnectTimeout(500);
InputStream input = connection.getInputStream();
IOUtil.consume(input);
}
}

View File

@@ -1,6 +1,6 @@
// COPIED from spring-ide org.springframework.ide.eclipse.core.SpringCoreUtils
/*******************************************************************************
* Copyright (c) 2012, 2013 Pivotal Software, Inc.
* Copyright (c) 2012, 2022 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012 Pivotal Software, Inc.
* Copyright (c) 2012, 2022 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,7 +12,7 @@ package org.springsource.ide.eclipse.commons.internal.core;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;

View File

@@ -1,233 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springsource.ide.eclipse.commons.internal.core.net;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.util.DateParseException;
import org.apache.commons.httpclient.util.DateUtil;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.mylyn.commons.net.WebLocation;
import org.eclipse.osgi.util.NLS;
import org.springsource.ide.eclipse.commons.internal.core.CorePlugin;
/**
* A utility for accessing web resources.
* @author Steffen Pingel
*/
public class HttpClientTransportService implements ITransportService {
private static final int BUFFER_SIZE = 4 * 1024;
public HttpClientTransportService() {
}
/**
* Download an HTTP-based resource
*
* @param target the target file to which the content is saved
* @param location the web location of the content
* @param monitor the monitor
* @throws IOException if a network or IO problem occurs
*/
public void download(java.net.URI uri, OutputStream out, IProgressMonitor progressMonitor) throws CoreException {
WebLocation location = new WebLocation(uri.toString());
SubMonitor monitor = SubMonitor.convert(progressMonitor);
monitor.subTask(NLS.bind("Fetching {0}", location.getUrl()));
try {
HttpClient client = new HttpClient();
org.eclipse.mylyn.commons.net.WebUtil.configureHttpClient(client, ""); //$NON-NLS-1$
GetMethod method = new GetMethod(location.getUrl());
try {
HostConfiguration hostConfiguration = org.eclipse.mylyn.commons.net.WebUtil.createHostConfiguration(
client, location, monitor);
int result = org.eclipse.mylyn.commons.net.WebUtil.execute(client, hostConfiguration, method, monitor);
if (result == HttpStatus.SC_OK) {
long total = method.getResponseContentLength();
if (total != -1) {
monitor.setWorkRemaining((int) total);
}
InputStream in = org.eclipse.mylyn.commons.net.WebUtil.getResponseBodyAsStream(method, monitor);
try {
in = new BufferedInputStream(in);
byte[] buffer = new byte[BUFFER_SIZE];
int len;
while ((len = in.read(buffer)) != -1) {
out.write(buffer, 0, len);
if (total != -1) {
monitor.worked(len);
}
else {
monitor.worked(1);
monitor.setWorkRemaining(10000);
}
if (monitor.isCanceled()) {
// this point is reached if the user requests a
// cancellation
throw new OperationCanceledException();
}
}
}
catch (OperationCanceledException e) {
// this point is reached if there is some problem with
// the download
throw toException(location, result);
}
catch (IOException e) {
// this point is reached if there is some problem with
// the network
throw toException(location, 500);
}
finally {
in.close();
}
}
else {
throw toException(location, result);
}
}
finally {
method.releaseConnection();
}
}
catch (IOException e) {
throw toException(location, e);
}
finally {
monitor.done();
}
}
/**
* Verify availability of resources at the given web locations. Normally
* this would be done using an HTTP HEAD.
*
* @param locations the locations of the resource to verify
* @param one indicate if only one of the resources must exist
* @param progressMonitor the monitor
* @return true if the resource exists
*/
public long getLastModified(java.net.URI uri, IProgressMonitor progressMonitor) throws CoreException {
WebLocation location = new WebLocation(uri.toString());
SubMonitor monitor = SubMonitor.convert(progressMonitor);
monitor.subTask(NLS.bind("Fetching {0}", location.getUrl()));
try {
HttpClient client = new HttpClient();
org.eclipse.mylyn.commons.net.WebUtil.configureHttpClient(client, ""); //$NON-NLS-1$
HeadMethod method = new HeadMethod(location.getUrl());
try {
HostConfiguration hostConfiguration = org.eclipse.mylyn.commons.net.WebUtil.createHostConfiguration(
client, location, monitor);
int result = org.eclipse.mylyn.commons.net.WebUtil.execute(client, hostConfiguration, method, monitor);
if (result == HttpStatus.SC_OK) {
Header lastModified = method.getResponseHeader("Last-Modified"); //$NON-NLS-1$
if (lastModified != null) {
try {
return DateUtil.parseDate(lastModified.getValue()).getTime();
}
catch (DateParseException e) {
// fall through
}
}
return 0;
}
else {
throw toException(location, result);
}
}
catch (IOException e) {
throw toException(location, e);
}
finally {
method.releaseConnection();
}
}
finally {
monitor.done();
}
}
/**
* Read a web-based resource at the specified location using the given
* processor.
*
* @param location the web location of the content
* @param processor the processor that will handle content
* @param progressMonitor the monitor
* @throws IOException if a network or IO problem occurs
*/
public InputStream stream(java.net.URI uri, IProgressMonitor progressMonitor) throws CoreException {
WebLocation location = new WebLocation(uri.toString());
SubMonitor monitor = SubMonitor.convert(progressMonitor);
monitor.subTask(NLS.bind("Fetching {0}", location.getUrl()));
try {
HttpClient client = new HttpClient();
org.eclipse.mylyn.commons.net.WebUtil.configureHttpClient(client, ""); //$NON-NLS-1$
boolean success = false;
GetMethod method = new GetMethod(location.getUrl());
try {
HostConfiguration hostConfiguration = org.eclipse.mylyn.commons.net.WebUtil.createHostConfiguration(
client, location, monitor);
int result = org.eclipse.mylyn.commons.net.WebUtil.execute(client, hostConfiguration, method, monitor);
if (result == HttpStatus.SC_OK) {
InputStream in = org.eclipse.mylyn.commons.net.WebUtil.getResponseBodyAsStream(method, monitor);
success = true;
return in;
}
else {
throw toException(location, result);
}
}
catch (IOException e) {
throw toException(location, e);
}
finally {
if (!success) {
method.releaseConnection();
}
}
}
finally {
monitor.done();
}
}
private CoreException toException(WebLocation location, int result) {
return new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, NLS.bind(
"Download of {0} failed: Unexpected HTTP response {1}", location.getUrl(), result)));
}
private CoreException toException(WebLocation location, IOException e) throws CoreException {
String message = e.getMessage() != null ? e.getMessage() : "Unexpected error";
return new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, NLS.bind(
"Download of {0} failed: {1}", location.getUrl(), message), e));
}
}

View File

@@ -1,31 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springsource.ide.eclipse.commons.internal.core.net;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* @author Steffen Pingel
*/
public interface ITransportService {
public abstract void download(URI uri, OutputStream out, IProgressMonitor monitor) throws CoreException;
public abstract long getLastModified(URI location, IProgressMonitor monitor) throws CoreException;
public abstract InputStream stream(URI uri, IProgressMonitor monitor) throws CoreException;
}

View File

@@ -1,120 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springsource.ide.eclipse.commons.internal.core.net;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.osgi.util.NLS;
import org.springsource.ide.eclipse.commons.internal.core.CorePlugin;
/**
* @author Terry Denney
*/
public class JDKTransportService implements ITransportService {
private static final int BUFFER_SIZE = 4 * 1024;
public void download(URI uri, OutputStream out, IProgressMonitor progressMonitor) throws CoreException {
SubMonitor monitor = SubMonitor.convert(progressMonitor);
try {
URL url = uri.toURL();
monitor.subTask(NLS.bind("Fetching {0}", url));
try {
InputStream in = url.openStream();
InputStream bufferedIn = new BufferedInputStream(in);
try {
byte[] buffer = new byte[BUFFER_SIZE];
int len;
while ((len = bufferedIn.read(buffer)) != -1) {
out.write(buffer, 0, len);
monitor.worked(1);
monitor.setWorkRemaining(10000);
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
}
}
finally {
bufferedIn.close();
in.close();
}
}
catch (IOException e) {
throw toException(url, e);
}
}
catch (MalformedURLException e) {
throw toException(uri, e);
}
}
public long getLastModified(URI location, IProgressMonitor monitor) throws CoreException {
try {
URL url = location.toURL();
try {
return url.openConnection().getLastModified();
}
catch (IOException e) {
throw toException(url, e);
}
}
catch (MalformedURLException e) {
throw toException(location, e);
}
}
public InputStream stream(URI uri, IProgressMonitor monitor) throws CoreException {
try {
URL url = uri.toURL();
try {
InputStream in = url.openStream();
return in;
}
catch (IOException e) {
throw toException(url, e);
}
}
catch (MalformedURLException e) {
throw toException(uri, e);
}
}
private CoreException toException(URI uri, IOException e) throws CoreException {
String message = e.getMessage() != null ? e.getMessage() : "Unexpected error";
return new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, NLS.bind(
"Download of {0} failed: {1}", uri.getFragment(), message), e));
}
private CoreException toException(URL url, IOException e) throws CoreException {
String message = e.getMessage() != null ? e.getMessage() : "Unexpected error";
return new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, NLS.bind(
"Download of {0} failed: {1}", url, message), e));
}
}

View File

@@ -1,151 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 Pivotal Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springsource.ide.eclipse.commons.internal.core.net;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.springsource.ide.eclipse.commons.internal.core.CorePlugin;
/**
* @author Steffen Pingel
*/
public class P2TransportService implements ITransportService {
private Object transport;
private Method downloadMethod;
private Method streamMethod;
private Method getLastModifiedMethod;
public P2TransportService() throws ClassNotFoundException {
// TODO e3.5 remove reflection
try {
Class<?> clazz;
try {
clazz = Class.forName("org.eclipse.equinox.internal.p2.repository.RepositoryTransport"); //$NON-NLS-1$
Method getInstanceMethod = clazz.getDeclaredMethod("getInstance"); //$NON-NLS-1$
transport = getInstanceMethod.invoke(null);
}
catch (ClassNotFoundException e) {
// the class moved to a different bundle in 3.7
transport = getTransport_e3_7();
clazz = transport.getClass();
}
downloadMethod = clazz.getDeclaredMethod("download", URI.class, OutputStream.class, IProgressMonitor.class); //$NON-NLS-1$
streamMethod = clazz.getDeclaredMethod("stream", URI.class, IProgressMonitor.class); //$NON-NLS-1$
getLastModifiedMethod = clazz.getDeclaredMethod("getLastModified", URI.class, IProgressMonitor.class); //$NON-NLS-1$
}
catch (LinkageError e) {
throw new ClassNotFoundException("Failed to load P2 transport", e); //$NON-NLS-1$
}
catch (Exception e) {
throw new ClassNotFoundException("Failed to load P2 transport", e); //$NON-NLS-1$
}
}
private static Object getTransport_e3_7() throws Exception {
// This line is here merely to make sure that the bundle gets activated
// before trying to use the service (to get rid of a race condition).
Class<?> clazz = Class.forName("org.eclipse.equinox.p2.core.IProvisioningAgent"); //$NON-NLS-1$
BundleContext bundleContext = CorePlugin.getDefault().getBundle().getBundleContext();
ServiceReference serviceReference = bundleContext
.getServiceReference("org.eclipse.equinox.p2.core.IProvisioningAgent");
if (serviceReference != null) {
try {
Object agent = bundleContext.getService(serviceReference);
if (agent != null) {
Method getServiceMethod = agent.getClass().getDeclaredMethod("getService", String.class); //$NON-NLS-1$
return getServiceMethod.invoke(agent, "org.eclipse.equinox.internal.p2.repository.Transport");
}
}
finally {
bundleContext.ungetService(serviceReference);
}
}
throw new RuntimeException("Transport service not available");
}
private void convertException(InvocationTargetException e) throws CoreException {
if (e.getCause() instanceof CoreException) {
throw (CoreException) e.getCause();
}
else {
throw new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, e.getCause().getMessage(),
e.getCause()));
}
}
public void download(URI uri, OutputStream out, IProgressMonitor monitor) throws CoreException {
try {
IStatus result = (IStatus) downloadMethod.invoke(transport, uri, out, monitor);
if (result.getSeverity() == IStatus.CANCEL) {
throw new OperationCanceledException();
}
if (!result.isOK()) {
throw new CoreException(result);
}
}
catch (InvocationTargetException e) {
if (e.getCause() instanceof CoreException) {
throw (CoreException) e.getCause();
}
}
catch (IllegalArgumentException e) {
throw new RuntimeException(e);
}
catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public long getLastModified(URI location, IProgressMonitor monitor) throws CoreException {
try {
return (Long) getLastModifiedMethod.invoke(transport, location, monitor);
}
catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
catch (InvocationTargetException e) {
convertException(e);
}
// should never happen
throw new IllegalStateException();
}
public InputStream stream(URI uri, IProgressMonitor monitor) throws CoreException {
try {
return (InputStream) streamMethod.invoke(transport, uri, monitor);
}
catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
catch (InvocationTargetException e) {
convertException(e);
}
// should never happen
throw new IllegalStateException();
}
}