private static void completeManifest(Manifest manifest, URL url) {

    String path = url.getPath();
    int start = 0;
    int end = path.length();
    if (path.endsWith(JAR_SUFFIX)) {
      // 4 for ".jar"
      end = end - JAR_SUFFIX.length() + 4;
      start = path.lastIndexOf('/', end) + 1;
    }
    String source = path.substring(start, end);
    manifest.getMainAttributes().put(MANIFEST_SOURCE, source);
  }
private static void completeManifest ( Manifest manifest , URL url ) { String path = url . getPath ( ) ; int start = 0 ; int end = path . length ( ) ; if ( path . endsWith ( JAR_SUFFIX ) ) { end = end - JAR_SUFFIX . length ( ) + 4 ; start = path . lastIndexOf ( '/' , end ) + 1 ; } String source = path . substring ( start , end ) ; manifest . getMainAttributes ( ) . put ( MANIFEST_SOURCE , source ) ; }
This method adds dynamic attributes to the given {@code manifest}.

@param manifest is the {@link Manifest} to modify.
@param url is the {@link URL} with the source of the manifest.