Skip to content

Commit

Permalink
Merge pull request #18 from unv-unv/unv/model-reformat
Browse files Browse the repository at this point in the history
Code reformat of org.jetbrains.idea.maven.dom.* using IJ4 code style.
  • Loading branch information
VISTALL authored Oct 10, 2024
2 parents 95e4e98 + c1e9445 commit 0df720f
Show file tree
Hide file tree
Showing 81 changed files with 2,782 additions and 2,823 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,29 @@
* @author Sergey Evdokimov
*/
public class MavenEscapeWindowsCharacterUtils {
// See org.apache.maven.shared.filtering.FilteringUtils.PATTERN
private static final Pattern WINDOWS_PATH_PATTERN = Pattern.compile("^(.*)[a-zA-Z]:\\\\(.*)");

// See org.apache.maven.shared.filtering.FilteringUtils.PATTERN
private static final Pattern WINDOWS_PATH_PATTERN = Pattern.compile("^(.*)[a-zA-Z]:\\\\(.*)");
/*
* See org.apache.maven.shared.filtering.FilteringUtils.escapeWindowsPath()
*/
public static void escapeWindowsPath(Appendable result, String val) throws IOException {
if (!val.isEmpty() && WINDOWS_PATH_PATTERN.matcher(val).matches()) {
// Adapted from StringUtils.replace in plexus-utils to accommodate pre-escaped backslashes.
int start = 0, end;
while ((end = val.indexOf('\\', start)) != -1) {
result.append(val, start, end).append("\\\\");
start = end + 1;

/*
* See org.apache.maven.shared.filtering.FilteringUtils.escapeWindowsPath()
*/
public static void escapeWindowsPath(Appendable result, String val) throws IOException {
if (!val.isEmpty() && WINDOWS_PATH_PATTERN.matcher(val).matches()) {
// Adapted from StringUtils.replace in plexus-utils to accommodate pre-escaped backslashes.
int start = 0, end;
while ((end = val.indexOf('\\', start)) != -1) {
result.append(val, start, end).append("\\\\");
start = end + 1;
if (val.indexOf('\\', end + 1) == end + 1) {
start++;
}
}

if (val.indexOf('\\', end + 1) == end + 1) {
start++;
result.append(val, start, val.length());
}
else {
result.append(val);
}
}

result.append(val, start, val.length());
}
else {
result.append(val);
}
}
}
Loading

0 comments on commit 0df720f

Please sign in to comment.