Skip to content

Commit 20900a7

Browse files
authored
Limit launch config name length to 10 characters in .temp file (#232)
The `createFileForArgument` method in `JavaLaunchingUtils` was generating file names that were too long. This caused some unexpected behavior. To fix this, the maximum launch config name length is limited to 10 characters. If the launch config name is longer than 10 characters, it is truncated to the first 10 characters. Fixes: #97
1 parent cc3709e commit 20900a7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JavaLaunchingUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
public class JavaLaunchingUtils {
2626

27+
public static final int MAX_LAUNCH_CONFIG_NAME_LENGTH = 10;
2728

2829
/**
2930
* Returns the argument file for a launch within the given temp directory
@@ -37,6 +38,9 @@ public class JavaLaunchingUtils {
3738
* @return Created file
3839
*/
3940
public static File createFileForArgument(String timeStamp, File processTempFilesDir, String launchConfigName, String optionalString) {
41+
if (launchConfigName.length() > MAX_LAUNCH_CONFIG_NAME_LENGTH) {
42+
launchConfigName = launchConfigName.substring(0, MAX_LAUNCH_CONFIG_NAME_LENGTH);
43+
}
4044
String child = String.format(org.eclipse.jdt.internal.launching.LaunchingPlugin.LAUNCH_TEMP_FILE_PREFIX
4145
+ optionalString, launchConfigName, timeStamp);
4246
File argumentsFile = new File(processTempFilesDir, child);

0 commit comments

Comments
 (0)