From e2e43cd534eb09c091b3d4487a3e7bc15acd9869 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Wed, 21 Apr 2010 17:05:39 +0000 Subject: [PATCH] * EepGet: Don't convert a MalformedURLException into an IOE so we recognize it when it's throuwn --- core/java/src/net/i2p/util/EepGet.java | 18 ++++++++++-------- core/java/src/net/i2p/util/EepHead.java | 9 +++++---- core/java/src/net/i2p/util/SSLEepGet.java | 9 +++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/core/java/src/net/i2p/util/EepGet.java b/core/java/src/net/i2p/util/EepGet.java index ca5c0d55a9..70913615cf 100644 --- a/core/java/src/net/i2p/util/EepGet.java +++ b/core/java/src/net/i2p/util/EepGet.java @@ -507,7 +507,7 @@ public class EepGet { timeout.setInactivityTimeout(INACTIVITY_TIMEOUT); if (_redirectLocation != null) { - try { + //try { URL oldURL = new URL(_actualURL); String query = oldURL.getQuery(); if (query == null) query = ""; @@ -525,9 +525,10 @@ public class EepGet { if ( (_actualURL.indexOf('?') < 0) && (query.length() > 0) ) _actualURL = _actualURL + "?" + query; } - } catch (MalformedURLException mue) { - throw new IOException("Redirected from an invalid URL"); - } + // an MUE is an IOE + //} catch (MalformedURLException mue) { + // throw new IOException("Redirected from an invalid URL"); + //} _redirects++; if (_redirects > 5) throw new IOException("Too many redirects: to " + _redirectLocation); @@ -874,7 +875,7 @@ public class EepGet { if (_shouldProxy) { _proxy = InternalSocket.getSocket(_proxyHost, _proxyPort); } else { - try { + //try { URL url = new URL(_actualURL); if ("http".equals(url.getProtocol())) { String host = url.getHost(); @@ -885,9 +886,10 @@ public class EepGet { } else { throw new IOException("URL is not supported:" + _actualURL); } - } catch (MalformedURLException mue) { - throw new IOException("Request URL is invalid"); - } + // an MUE is an IOE + //} catch (MalformedURLException mue) { + // throw new IOException("Request URL is invalid"); + //} } _proxyIn = _proxy.getInputStream(); _proxyOut = _proxy.getOutputStream(); diff --git a/core/java/src/net/i2p/util/EepHead.java b/core/java/src/net/i2p/util/EepHead.java index 38438a4029..938241616a 100644 --- a/core/java/src/net/i2p/util/EepHead.java +++ b/core/java/src/net/i2p/util/EepHead.java @@ -117,7 +117,7 @@ public class EepHead extends EepGet { timeout.setInactivityTimeout(60*1000); if (_redirectLocation != null) { - try { + //try { URL oldURL = new URL(_actualURL); String query = oldURL.getQuery(); if (query == null) query = ""; @@ -135,9 +135,10 @@ public class EepHead extends EepGet { if ( (_actualURL.indexOf('?') < 0) && (query.length() > 0) ) _actualURL = _actualURL + "?" + query; } - } catch (MalformedURLException mue) { - throw new IOException("Redirected from an invalid URL"); - } + // an MUE is an IOE + //} catch (MalformedURLException mue) { + // throw new IOException("Redirected from an invalid URL"); + //} _redirects++; if (_redirects > 5) throw new IOException("Too many redirects: to " + _redirectLocation); diff --git a/core/java/src/net/i2p/util/SSLEepGet.java b/core/java/src/net/i2p/util/SSLEepGet.java index a4b5899908..8a5bf364af 100644 --- a/core/java/src/net/i2p/util/SSLEepGet.java +++ b/core/java/src/net/i2p/util/SSLEepGet.java @@ -286,7 +286,7 @@ public class SSLEepGet extends EepGet { String req = getRequest(); - try { + //try { URL url = new URL(_actualURL); if ("https".equals(url.getProtocol())) { String host = url.getHost(); @@ -301,9 +301,10 @@ public class SSLEepGet extends EepGet { } else { throw new IOException("Only https supported: " + _actualURL); } - } catch (MalformedURLException mue) { - throw new IOException("Request URL is invalid"); - } + // an MUE is an IOE + //} catch (MalformedURLException mue) { + // throw new IOException("Request URL is invalid"); + //} _proxyIn = _proxy.getInputStream(); _proxyOut = _proxy.getOutputStream(); -- GitLab