public static URL appendTrailingSlash(URL url) {
        String file = url.getFile();
        if (file.endsWith("/")) { //$NON-NLS-1$
            return url;
        }
        try {
            return new URL(url.getProtocol(), url.getHost(), url.getPort(), file + "/"); //$NON-NLS-1$
        } catch (MalformedURLException e) {
            Assert.isTrue(false, Policy.bind("assert.internalError")); //$NON-NLS-1$
        }
        return null;
    }
public static URL appendTrailingSlash ( URL url ) { String file = url . getFile ( ) ; if ( file . endsWith ( "/" ) ) { return url ; } try { return new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , file + "/" ) ; } catch ( MalformedURLException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; } return null ; }
Returns the given <code>URL</code> with a trailing slash appended to
it. If the <code>URL</code> already has a trailing slash the
<code>URL</code> is returned unchanged.
<table>
<caption>Example</caption>
<tr>
<th>Given URL</th>
<th>Returned URL</th>
<tr>
<td>"http://hostname/folder"</td>
<td>"http://hostname/folder/"</td>
<tr>
<td>"http://hostname/folder/</td>
<td>"http://hostname/folder/"</td>
</table>

@param url a URL
@return    the given URL with a trailing slash