Skip to content

Commit ce4077a

Browse files
committed
Replace a split method by a StringTokenizer clas to parse run param.
In current implementation for split "Run Paramteres" of project is used split method that split a String by space. I that not handle qouted parameters with spaces and split it by space that not allow to pass the text as parameter with spaces. To handle this situation the split method are replaced by use the StringTokenizer class, that support single (`) and duble (") quote that arrond the tekst as a params. Task: albilu#123
1 parent 5aa8f1f commit ce4077a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/netbeans/modules/python/actions/PythonRun.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import java.util.List;
88
import java.util.Properties;
99
import java.util.logging.Logger;
10+
import org.apache.commons.text.StringTokenizer;
11+
import org.apache.commons.text.matcher.StringMatcherFactory;
1012
import org.netbeans.api.extexecution.ExecutionService;
1113
import org.netbeans.api.project.Project;
1214
import org.netbeans.modules.python.PythonOutputLine;
@@ -57,8 +59,7 @@ public static List<String> getRunArgs(Project owner, DataObject context, boolean
5759
if (owner != null) {
5860
Properties prop = PythonUtility.getProperties(owner, false);
5961
if (!prop.getProperty("nbproject.run.params", "").isEmpty()) {
60-
params = prop.getProperty("nbproject.run.params", "")
61-
.split(" ");
62+
params = new StringTokenizer(prop.getProperty("nbproject.run.params", ""), StringMatcherFactory.INSTANCE.spaceMatcher(), StringMatcherFactory.INSTANCE.quoteMatcher()).getTokenArray();
6263
}
6364
}
6465
if (owner != null && PythonUtility.isPoetry((PythonProject) owner) && !isDebug) {

0 commit comments

Comments
 (0)