Class UnifiedDiffApplier
java.lang.Object
io.jenkins.plugins.explain_error.autofix.UnifiedDiffApplier
Standalone utility class that applies unified diffs to file content.
-
Method Summary
-
Method Details
-
apply
Applies a unified diff string to original file content.- Parameters:
originalContent- the original file contentdiff- the unified diff to apply- Returns:
- the modified file content
- Throws:
IllegalArgumentException- if the diff cannot be applied (e.g., context mismatch)
-
validate
Validates that a diff string is syntactically valid unified diff format. Checks for: valid @@ hunk headers, non-empty hunks.- Returns:
- null if valid, or an error message string if invalid
-