@Test public void shouldEscapeWindowsPath() { assumeTrue( IS_OS_WINDOWS ); String root = "X:\\path\\to\\project\\"; String pathToJar = "target\\surefire\\surefirebooter4942721306300108667.jar"; @SuppressWarnings( "checkstyle:magicnumber" ) int projectNameLength = 247 - root.length() - pathToJar.length(); StringBuilder projectFolder = new StringBuilder(); for ( int i = 0; i < projectNameLength; i++ ) { projectFolder.append( 'x' ); } String path = root + projectFolder + "\\" + pathToJar; String escaped = escapeToPlatformPath( path ); assertThat( escaped ).isEqualTo( "\\\\?\\" + path ); path = root + "\\" + pathToJar; escaped = escapeToPlatformPath( path ); assertThat( escaped ).isEqualTo( root + "\\" + pathToJar ); }
public static String escapeToPlatformPath( String path ) { if ( IS_OS_WINDOWS && path.length() > MAX_PATH_LENGTH_WINDOWS ) { path = path.startsWith( "\\\\" ) ? "\\\\?\\UNC\\" + path.substring( 2 ) : "\\\\?\\" + path; } return path; }
SurefireHelper { public static String escapeToPlatformPath( String path ) { if ( IS_OS_WINDOWS && path.length() > MAX_PATH_LENGTH_WINDOWS ) { path = path.startsWith( "\\\\" ) ? "\\\\?\\UNC\\" + path.substring( 2 ) : "\\\\?\\" + path; } return path; } }
SurefireHelper { public static String escapeToPlatformPath( String path ) { if ( IS_OS_WINDOWS && path.length() > MAX_PATH_LENGTH_WINDOWS ) { path = path.startsWith( "\\\\" ) ? "\\\\?\\UNC\\" + path.substring( 2 ) : "\\\\?\\" + path; } return path; } private  SurefireHelper(); }
SurefireHelper { public static String escapeToPlatformPath( String path ) { if ( IS_OS_WINDOWS && path.length() > MAX_PATH_LENGTH_WINDOWS ) { path = path.startsWith( "\\\\" ) ? "\\\\?\\UNC\\" + path.substring( 2 ) : "\\\\?\\" + path; } return path; } private  SurefireHelper(); @Nonnull static String replaceThreadNumberPlaceholders( @Nonnull String argLine, int threadNumber ); static File replaceForkThreadsInPath( File path, int replacement ); static String[] getDumpFilesToPrint(); static void reportExecution( SurefireReportParameters reportParameters, RunResult result,
                                        PluginConsoleLogger log, Exception firstForkException ); static List<CommandLineOption> commandLineOptions( MavenSession session, PluginConsoleLogger log ); static void logDebugOrCliShowErrors( String s, PluginConsoleLogger log, Collection<CommandLineOption> cli ); static String escapeToPlatformPath( String path ); }
SurefireHelper { public static String escapeToPlatformPath( String path ) { if ( IS_OS_WINDOWS && path.length() > MAX_PATH_LENGTH_WINDOWS ) { path = path.startsWith( "\\\\" ) ? "\\\\?\\UNC\\" + path.substring( 2 ) : "\\\\?\\" + path; } return path; } private  SurefireHelper(); @Nonnull static String replaceThreadNumberPlaceholders( @Nonnull String argLine, int threadNumber ); static File replaceForkThreadsInPath( File path, int replacement ); static String[] getDumpFilesToPrint(); static void reportExecution( SurefireReportParameters reportParameters, RunResult result,
                                        PluginConsoleLogger log, Exception firstForkException ); static List<CommandLineOption> commandLineOptions( MavenSession session, PluginConsoleLogger log ); static void logDebugOrCliShowErrors( String s, PluginConsoleLogger log, Collection<CommandLineOption> cli ); static String escapeToPlatformPath( String path ); static final String DUMP_FILE_PREFIX; static final String DUMP_FILENAME_FORMATTER; static final String DUMPSTREAM_FILENAME_FORMATTER; static final String DUMPSTREAM_FILENAME; static final String DUMP_FILENAME; }