code: private static URL getPersistenceRootUrl(URL url)
      {
          String f = url.getFile();
          f = parseFilePath(f);
  
          URL jarUrl = url;
          try
          {
              if (AllowedProtocol.isJarProtocol(url.getProtocol()))
              {
                  jarUrl = new URL(f);
                  if (jarUrl.getProtocol() != null
                          && AllowedProtocol.FILE.name().equals(jarUrl.getProtocol().toUpperCase())
                          && StringUtils.contains(f, " "))
                  {
                      jarUrl = new File(f).toURI().toURL();
                  }
              }
              else if (AllowedProtocol.isValidProtocol(url.getProtocol()))
              {
                  if (StringUtils.contains(f, " "))
                  {
                      jarUrl = new File(f).toURI().toURL();
                  }
                  else
                  {
                      jarUrl = new File(f).toURL();
                  }
              }
          }
          catch (MalformedURLException mex)
          {
              log.error("Error during getPersistenceRootUrl(), Caused by: {}.", mex);
              throw new IllegalArgumentException("Invalid jar URL[] provided!" + url);
          }
  
          return jarUrl;
      }
docs: Returns persistence unit root url
  
  @param url
  raw url
  @return rootUrl rootUrl