src/main/java/org/jboss/util/Strings.java
/**
    * Make a URL from the given string.
    *
    * <p>
    * If the string is a properly formatted file URL, then the file
    * portion will be made canonical.
    *
    * <p>
    * If the string is an invalid URL then it will be converted into a
    * file URL.
    *
    * @param urlspec           The string to construct a URL for.
    * @param relativePrefix    The string to prepend to relative file
    *                          paths, or null to disable prepending.
    * @return                  A URL for the given string.
    *
    * @throws MalformedURLException  Could not make a URL for the given string.
    */
Make a URL from the given string.

If the string is a properly formatted file URL, then the file
portion will be made canonical.


If the string is an invalid URL then it will be converted into a
file URL.

@param urlspec           The string to construct a URL for.
@param relativePrefix    The string to prepend to relative file
paths, or null to disable prepending.
@return                  A URL for the given string.

@throws MalformedURLException  Could not make a URL for the given string.
Make a URL from the given string . If the string is a properly formatted file URL then the file portion will be made canonical . If the string is an invalid URL then it will be converted into a file URL . @param urlspec The string to construct a URL for . @param relativePrefix The string to prepend to relative file paths or null to disable prepending . @return A URL for the given string . @throws MalformedURLException Could not make a URL for the given string .
public static URL toURL(String urlspec, final String relativePrefix) throws MalformedURLException
   {
      urlspec = urlspec.trim();
      URL url;
      try
      {
         url = new URL(urlspec);
         if (url.getProtocol().equals("file"))
         {
            url = makeURLFromFilespec(url.getFile(), relativePrefix);
         }
      }
      catch (Exception e)
      {
         try
         {
            url = makeURLFromFilespec(urlspec, relativePrefix);
         }
         catch (IOException n)
         {
             jason: or should we rethrow e?
            throw new MalformedURLException(n.toString());
         }
      }
      return url;
   }
public static URL toURL ( String urlspec , final String relativePrefix ) throws MalformedURLException { urlspec = urlspec . trim ( ) ; URL url ; try { url = new URL ( urlspec ) ; if ( url . getProtocol ( ) . equals ( "file" ) ) { url = makeURLFromFilespec ( url . getFile ( ) , relativePrefix ) ; } } catch ( Exception e ) { try { url = makeURLFromFilespec ( urlspec , relativePrefix ) ; } catch ( IOException n ) { throw new MalformedURLException ( n . toString ( ) ) ; } } return url ; }
Make a URL from the given string.
Make a URL from the given string .
// make sure we have a absolute & canonical file url // // jason: or should we rethrow e? //