diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java index 18e7ce171..b9cfe3e85 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java @@ -83,16 +83,19 @@ public class TcfURLConnection extends URLConnection { * @param url * The URL of the resource. */ - public TcfURLConnection(final URL url) { + public TcfURLConnection(final URL url) throws IOException { super(url); - // The peerId is stored as the host name in URL. See TcfURLStreamHandlerService#parseURL for details. String peerId = url.getHost(); Assert.isNotNull(peerId); peer = findPeer(peerId); - if(peer == null) { - throw new IllegalArgumentException(NLS.bind(Messages.TcfURLConnection_NoPeerFound, peerId)); + if (peer == null) { + throw new IOException(NLS.bind(Messages.TcfURLConnection_NoPeerFound, peerId)); } - path = url.getPath(); + String p = url.getPath(); + if (!p.startsWith("/")) { //$NON-NLS-1$ + throw new IOException(Messages.TcfURLConnection_relativePath); + } + path = p.substring(1); // Set default timeout. setConnectTimeout(DEFAULT_CONNECT_TIMEOUT); setOpenTimeout(DEFAULT_OPEN_TIMEOUT); |