arturobernalg commented on code in PR #3589:
URL: https://github.com/apache/maven-surefire/pull/3589#discussion_r4574760549
##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java:
##########
@@ -26,11 +26,29 @@
* @author Andreas Gudian
*/
public final class FileReporterUtils {
+ // well under the 255-byte limit most filesystems enforce per path
component,
+ // leaving room for encodings that use more than one byte per character.
+ // Does not cover unusually restrictive encrypted-filename overlays such as
+ // eCryptfs (143 bytes with filename encryption enabled) - handling every
+ // such filesystem is out of scope here.
+ private static final int MAX_FILE_NAME_LENGTH = 200;
+
private FileReporterUtils() {
throw new IllegalStateException("non instantiable constructor");
}
- public static String stripIllegalFilenameChars(String original) {
+ /**
+ * Builds a safe report file name: illegal characters replaced, and
truncated with a
+ * unique suffix if it would otherwise exceed common filesystem limits.
+ *
+ * @param fileName the file name, including its extension
+ * @return a file name safe to pass to {@link
java.io.File#File(java.io.File, String)}
+ */
+ public static String makeFileName(String fileName) {
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]