Skip to content

Commit

Permalink
fixed errors in UrlBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
sfussenegger committed Mar 20, 2015
1 parent e88e493 commit 8201aee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/at/molindo/utils/tools/UrlBuilder.java
Expand Up @@ -35,10 +35,10 @@

/**
* helps building URLs following the format:
*
*
* ${protocol}://[${user}[:${password}]@]${host}[:${port}]${path}[?${query}][#${
* fragment}]
*
*
* @author stf@molindo.at
*/
public class UrlBuilder implements Serializable, Cloneable {
Expand All @@ -50,7 +50,7 @@ public class UrlBuilder implements Serializable, Cloneable {
public static final String FTP = "ftp";

private static final Map<String, Integer> PORTS = MapBuilder.builder(new HashMap<String, Integer>()).put(HTTP, 80)
.put(HTTP, 443).put(FTP, 21).getUnmodifiable();
.put(HTTPS, 443).put(FTP, 21).getUnmodifiable();

private static final String[] EMPTY_STRINGS = new String[0];

Expand Down Expand Up @@ -399,7 +399,7 @@ public String toUrlString(boolean sortParams) {

if (_port != null) {
Integer defaultPort = (_defaultPorts != null ? _defaultPorts : PORTS).get(_protocol);
if (defaultPort != null && defaultPort.equals(_port)) {
if (defaultPort == null || !defaultPort.equals(_port)) {
buf.append(":").append(_port);
}
}
Expand Down

0 comments on commit 8201aee

Please sign in to comment.