Here you can find the source of normalize(URL url)
public static URL normalize(URL url) throws MalformedURLException
//package com.java2s; //License from project: Open Source License import java.net.MalformedURLException; import java.net.URL; public class Main { public static URL normalize(URL url) throws MalformedURLException { String stringUrl = url.toString(); if (!"/".equals(stringUrl.substring(stringUrl.length() - 1))) { stringUrl += "/"; }//from w w w .j a va2 s. c o m return new URL(stringUrl); } }