code: @Pure
  	public static URL addExtension(URL filename, String extension) {
  		if (filename != null && !hasExtension(filename, extension)) {
  			final String basename = largeBasename(filename);
  			if (!basename.isEmpty()) {
  				final StringBuilder buf = new StringBuilder(decodeHTMLEntities(
  						filename.getPath()).replaceFirst(Pattern.quote(URL_PATH_SEPARATOR)
  						+ "+$", "")); //$NON-NLS-1$ //$NON-NLS-2$
  				if (!"".equals(extension) && !extension.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$
  					buf.append(EXTENSION_SEPARATOR);
  				}
  				buf.append(extension);
  				final String path = buf.toString();
  				try {
  					if (isJarURL(filename)) {
  						return new URL(
  								filename.getProtocol(),
  								filename.getHost(),
  								filename.getPort(),
  								path);
  					}
  					return new URI(
  							filename.getProtocol(),
  							filename.getUserInfo(),
  							filename.getHost(),
  							filename.getPort(),
  							path,
  							encodeHTMLEntities(filename.getQuery()),
  							filename.getRef()).toURL();
  				} catch (AssertionError e) {
  					throw e;
  				} catch (Throwable exception) {
  					//
  				}
  				try {
  					return new URL(
  							filename.getProtocol(),
  							filename.getHost(),
  							path);
  				} catch (AssertionError e) {
  					throw e;
  				} catch (Throwable exception) {
  					return null;
  				}
  			}
  		}
  		return filename;
  	}
docs: Add the extension of to specified filename.
  If the filename has already the given extension, the filename is not changed.
  If the filename has no extension or an other extension, the specified one is added.
  
  @param filename is the filename to parse.
  @param extension is the extension to remove if it is existing.
  @return the filename with the extension.
  @since 6.0