Index: src/java/org/apache/commons/httpclient/HttpURL.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpURL.java,v retrieving revision 1.12.2.4 diff -r1.12.2.4 HttpURL.java 122,123c122 < this(null, host, port, path, null, null); < checkValid(); --- > this(null, null, host, port, path, null, null); 140,141c139 < this(null, host, port, path, query, null); < checkValid(); --- > this(null, null, host, port, path, query, null); 157,160c155 < this((user == null) ? null : user < + ((password == null) ? "" : ':' + password), < host, -1, null, null, null); < checkValid(); --- > this(user, password, host, -1, null, null, null); 177,180c172 < this((user == null) ? null : user < + ((password == null) ? "" : ':' + password), < host, port, null, null, null); < checkValid(); --- > this(user, password, host, port, null, null, null); 198,201c190 < this((user == null) ? null : user < + ((password == null) ? "" : ':' + password), < host, port, path, null, null); < checkValid(); --- > this(user, password, host, port, path, null, null); 220,223c209 < this((user == null) ? null : user < + ((password == null) ? "" : ':' + password), < host, port, path, query, null); < checkValid(); --- > this(user, password, host, port, path, query, null); 240,241c226 < this(null, host, -1, path, query, fragment); < checkValid(); --- > this(null, null, host, -1, path, query, fragment); 254a240 > * @deprecated The userinfo does not get escaped correctly. 260d245 < checkValid(); 272a258 > * @deprecated The userinfo does not get escaped correctly. 278d263 < checkValid(); 291a277 > * @deprecated The userinfo does not get escaped correctly. 297d282 < checkValid(); 311a297 > * @deprecated The userinfo does not get escaped correctly. 323a310,367 > buff.append('@'); > } > if (host != null) { > buff.append(URIUtil.encode(host, URI.allowed_host)); > if (port != -1 || port != DEFAULT_PORT) { > buff.append(':'); > buff.append(port); > } > } > } > if (path != null) { // accept empty path > if (scheme != null && !path.startsWith("/")) { > throw new URIException(URIException.PARSING, > "abs_path requested"); > } > buff.append(URIUtil.encode(path, URI.allowed_abs_path)); > } > if (query != null) { > buff.append('?'); > buff.append(URIUtil.encode(query, URI.allowed_query)); > } > if (fragment != null) { > buff.append('#'); > buff.append(URIUtil.encode(fragment, URI.allowed_fragment)); > } > parseUriReference(buff.toString(), true); > checkValid(); > } > > > /** > * Construct a HTTP URL from given components. > * > * @param user the user name > * @param password his or her password > * @param host the host string > * @param port the port number > * @param path the path string > * @param query the query string > * @param fragment the fragment string > * @throws URIException If {@link #checkValid()} fails > * @see #getDefaultProtocolCharset > */ > public HttpURL(String user, String password, String host, int port, > String path, String query, String fragment) throws URIException { > > // validate and contruct the URI character sequence > StringBuffer buff = new StringBuffer(); > if (user != null || password != null || host != null || port != -1) { > _scheme = DEFAULT_SCHEME; // in order to verify the own protocol > buff.append(_default_scheme); > buff.append("://"); > if (user != null) { > buff.append(URIUtil.encode(user, URI.allowed_within_userinfo)); > if (password != null) { > buff.append(':').append( > URIUtil.encode(password, URI.allowed_within_userinfo)); > }