Pārlūkot izejas kodu

Don't fiddle with ports before passing them to the parser.

If the user doesn't specify a port, allow the parser implementation
to figure it out for itself. This allows for things like SRV lookups,
or different default ports per protocol.
pull/702/head
Chris Smith 7 gadus atpakaļ
vecāks
revīzija
ac24970184
1 mainītis faili ar 1 papildinājumiem un 14 dzēšanām
  1. 1
    14
      src/main/java/com/dmdirc/Server.java

+ 1
- 14
src/main/java/com/dmdirc/Server.java Parādīt failu

@@ -60,7 +60,6 @@ import java.net.NoRouteToHostException;
60 60
 import java.net.SocketException;
61 61
 import java.net.SocketTimeoutException;
62 62
 import java.net.URI;
63
-import java.net.URISyntaxException;
64 63
 import java.net.UnknownHostException;
65 64
 import java.util.ArrayList;
66 65
 import java.util.Collection;
@@ -214,8 +213,7 @@ public class Server implements Connection {
214 213
     }
215 214
 
216 215
     /**
217
-     * Updates the connection details for this server. If the specified URI does not define a port,
218
-     * the default port from the protocol description will be used.
216
+     * Updates the connection details for this server.
219 217
      *
220 218
      * @param uri     The new URI that this server should connect to
221 219
      * @param profile The profile that this server should use
@@ -224,17 +222,6 @@ public class Server implements Connection {
224 222
         this.address = checkNotNull(uri);
225 223
         this.protocolDescription = Optional.ofNullable(parserFactory.getDescription(uri));
226 224
         this.profile = profile;
227
-
228
-        if (uri.getPort() == -1) {
229
-            protocolDescription.ifPresent(pd -> {
230
-                try {
231
-                    this.address = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(),
232
-                            pd.getDefaultPort(), uri.getPath(), uri.getQuery(), uri.getFragment());
233
-                } catch (URISyntaxException ex) {
234
-                    LOG.warn(APP_ERROR, "Unable to construct URI", ex);
235
-                }
236
-            });
237
-        }
238 225
     }
239 226
 
240 227
     @Override

Notiek ielāde…
Atcelt
Saglabāt