code: private static File weakTemplateNameVerification(String name,
              SourceType type, File source) throws IllegalArgumentException {
  
          File location = null;
  
          if (source != null) {
  
              // From the name and type determine the correct ending of the source
              // File.
              StringBuilder sb = new StringBuilder("/");
              sb.append(name);
              sb.append(type.getExtension());
              String ending = sb.toString();
  
              // Ensure that the source File really ends with the required string.
              // The change to a URI handles any differences with file separators
              // on different platforms.
              String uri = source.toURI().toString();
              if (!uri.endsWith(ending)) {
                  throw new IllegalArgumentException(MessageUtils.format(
                          MSG_MISNAMED_TPL, name));
              }
  
              // Strip off the ending to get the load path for this file.
              try {
                  location = new File(new URI(uri.substring(0,
                          uri.lastIndexOf(ending))));
              } catch (URISyntaxException consumed) {
  
              }
          }
          return location;
      }
docs: Perform some weak verification checks between the source file name, type,
  and the source location. It will return the presumed loadpath (location)
  of the source file.
  
  @param name
  @param type
  @param source
  @return presumed loadpath (location) of the source file
  @throws IllegalArgumentException