docs: public static File normalizePath(File file) {
  	if (file == null) {
  	    return new File("");
  	}
  	String normalizedFile = file.getPath();
  	// remove all '//'...
  	String quotedSeparator = Pattern.quote(File.separator);
  	String replacementSeparator = File.separator.equals("/") ? File.separator
  		: File.separator + File.separator;
  	boolean isAbsolute = file.isAbsolute()
  		|| normalizedFile.startsWith(File.separator);
  	while (normalizedFile.contains(replacementSeparator
  		+ replacementSeparator)) {
  	    normalizedFile = normalizedFile.replaceAll(quotedSeparator
  		    + quotedSeparator, replacementSeparator);
  	}
  	// remove all redundant '..'
  	Pattern pattern = Pattern.compile("([^\\." + replacementSeparator
  		+ "]+" + quotedSeparator + "\\.\\.)");
  	Matcher matcher = pattern.matcher(normalizedFile);
  	while (matcher.find()) {
  	    normalizedFile = normalizedFile.replace(matcher.group(1), "")
  		    .replaceAll(quotedSeparator + quotedSeparator,
  			    replacementSeparator);
  	    if ((!isAbsolute) && (normalizedFile.startsWith(File.separator))) {
  		normalizedFile = normalizedFile.replaceFirst(quotedSeparator,
  			"");
  	    } else if ((isAbsolute)
  		    && (!normalizedFile.startsWith(File.separator))) {
  		normalizedFile = File.separator + normalizedFile;
  	    }
  	    matcher = pattern.matcher(normalizedFile);
  	}
  	/* remove all '/./' and /. at the end */
  	pattern = Pattern.compile(quotedSeparator + "\\." + quotedSeparator);
  	matcher = pattern.matcher(normalizedFile);
  	while (matcher.find()) {
  	    normalizedFile = normalizedFile.replace(matcher.group(0),
  		    replacementSeparator);
  	    matcher = pattern.matcher(normalizedFile);
  	}
  	if (normalizedFile.endsWith(File.separator + ".")) {
  	    normalizedFile = normalizedFile.substring(0,
  		    normalizedFile.length() - 2);
  	}
  	return new File(normalizedFile);
      }