private static String getSourceLocation(Class<?> clazz) {
    final CodeSource source = clazz.getProtectionDomain().getCodeSource();
    if (source != null) {
      final URL location = source.getLocation();
      if (location != null) {
        return location.toExternalForm();
      }
    }
    final String name = clazz.getName().replace('.', '/') + ".class";
    final ClassLoader loader = clazz.getClassLoader();
    final URL resource = loader != null ? loader.getResource(name) : ClassLoader.getSystemResource(name);
    return resource != null ? resource.toExternalForm() : "<unknown>";
  }
private static String getSourceLocation(Class<?> clazz)