in src/main/java/org/apache/sling/api/resource/path/PathBuilder.java [50:68]
public PathBuilder append(final String path) {
if ( path == null || path.isEmpty() ) {
throw new IllegalArgumentException("Path '" + path + "' is null or empty");
}
boolean trailingSlash = sb.charAt(sb.length() - 1) == '/';
boolean leadingSlash = path.charAt(0) == '/';
if ( trailingSlash && leadingSlash) {
sb.append(path.substring(1));
} else if ( !trailingSlash && !leadingSlash ) {
sb.append('/').append(path);
} else {
sb.append(path);
}
return this;
}