Use Matcher from pre-compiled Pattern rather than String for replaceAll
Closes gh-14483
This commit is contained in:
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.model.Dependency;
|
||||
@@ -62,6 +63,8 @@ import org.springframework.boot.loader.tools.Repackager.MainClassTimeoutWarningL
|
||||
@Mojo(name = "repackage", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
|
||||
public class RepackageMojo extends AbstractDependencyFilterMojo {
|
||||
|
||||
private static final Pattern WHITE_SPACE_PATTERN = Pattern.compile("\\s+");
|
||||
|
||||
/**
|
||||
* The Maven project.
|
||||
* @since 1.0
|
||||
@@ -312,7 +315,8 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
|
||||
}
|
||||
|
||||
private String removeLineBreaks(String description) {
|
||||
return (description != null) ? description.replaceAll("\\s+", " ") : null;
|
||||
return (description != null)
|
||||
? WHITE_SPACE_PATTERN.matcher(description).replaceAll(" ") : null;
|
||||
}
|
||||
|
||||
private void putIfMissing(Properties properties, String key,
|
||||
|
||||
Reference in New Issue
Block a user