This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228901 - IllegalArgumentException: Argument has embedded quote, use the explicit CMD.EXE call.
Summary: IllegalArgumentException: Argument has embedded quote, use the explicit CMD.E...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3.1
Hardware: All All
: P2 normal with 3 votes (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-23 14:10 UTC by zdenek.rod
Modified: 2013-10-20 19:29 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 200171


Attachments
stacktrace (578 bytes, text/plain)
2013-04-23 14:10 UTC, zdenek.rod
Details
stacktrace (578 bytes, text/plain)
2013-04-23 16:10 UTC, alied
Details
stacktrace (578 bytes, text/plain)
2013-05-29 16:31 UTC, Exceptions Reporter
Details
stacktrace (578 bytes, text/plain)
2013-05-31 06:52 UTC, claus_ch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zdenek.rod 2013-04-23 14:10:30 UTC
Build: NetBeans IDE Dev (Build 201304212301)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b11
OS: Windows 7

User Comments:
zdenek.rod: I wanted to profile current maven project and it cause this error.




Stacktrace: 
java.lang.IllegalArgumentException: Argument has embedded quote, use the explicit CMD.EXE call.
   at java.lang.ProcessImpl.isQuoted(ProcessImpl.java:168)
   at java.lang.ProcessImpl.needsEscaping(ProcessImpl.java:182)
   at java.lang.ProcessImpl.<init>(ProcessImpl.java:262)
   at java.lang.ProcessImpl.start(ProcessImpl.java:133)
   at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)
   at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:205)
Comment 1 zdenek.rod 2013-04-23 14:10:31 UTC
Created attachment 133714 [details]
stacktrace
Comment 2 alied 2013-04-23 16:10:15 UTC
Created attachment 133721 [details]
stacktrace

right-click on a maven JavaSE project and selected "Profile"
this is the command line from the output (some path have been changed due to privacy):

cd C:\home\alied\NetBeansProjects\company\router\router-pipeline; JAVA_HOME=C:\\usr\\local\\jdk1.7 M2_HOME=C:\\maven C:\\maven\\bin\\mvn.bat "-Dexec.args=-agentpath:\\\"C:/usr/local/NetBeans 7.3.1 Dev/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\\\"=\\\"C:\\usr\\local\\NetBeans 7.3.1 Dev\\profiler\\lib\\\",5140,60 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\\Users\\alied.perez\\AppData\\Local\\NetBeans\\Cache\\7.3.1dev\\mavencachedirs\\65877311\\org-netbeans-modules-profiler  -classpath %classpath com.mycompany.company.platform.router.Router" -Dexec.executable=C:\\usr\\local\\jdk1.7\\bin\\java.exe -DskipTests=true -T 1C process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec

I haven't yet looked much at this, but I see too many '\'s here
Comment 3 alied 2013-04-23 16:27:03 UTC
ok, just did a small test:
created a symlink NetBeans -> NetBeans 7.3.1 Dev and now the profiler is working. Is this a regression? I remember to have seen this before
Comment 4 alied 2013-04-23 16:28:56 UTC
so the issue seems to be when there is a space in the Netbeans path. I managed to make a workaround, but I believe this is a priority bug (although this was happening in 7.3 as I recall)
Comment 5 Milos Kleint 2013-04-23 16:36:18 UTC
I wonder if this is JDK related? maybe some of the security patches turned this off?

In any case I don't see many ways of workarounding it, we are stuffing multiple parameters to JDK into a single maven property that we pass to maven  (maven's JDK) to process. if the multiple parameters contain spaces when they need to be escaped. That's what we are doing AFAIK, apparently that's bad now, but not quoting the space in path will just cause the agent not to be found.
Comment 6 Antonin Nebuzelsky 2013-04-25 11:50:26 UTC
Related to this change introduced by Java in 7u21?
http://www.oracle.com/technetwork/java/javase/7u21-relnotes-1932873.html#jruntime
Comment 7 alied 2013-04-25 13:17:56 UTC
Although Netbeans is using ProcessBuilder, it seems to be related to the new changes in JDK7u21 (since both reports use this version)

There are some related issues in JDK db[1][2]
(see also related bugs)
and just found  this issue from 2005!![3](is is still valid?):
an interesting explanation is in this code review request[4]

[1]http://bugs.sun.com/view_bug.do?bug_id=7051946
[2]http://bugs.sun.com/view_bug.do?bug_id=7177083
[3]https://netbeans.org/bugzilla/show_bug.cgi?id=61597
[4]http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-September/007674.html
Comment 8 Milos Kleint 2013-05-09 11:42:01 UTC
just for the record, with jdk 1.7_21 I can build a maven project with both the IDE (and it's maven binaries) and java itself in paths with spaces. So the issue is not in how we run maven itself, it's likely in how we pass parameters to maven plugins that process them and spawn another JVM.
Comment 9 Milos Kleint 2013-05-09 12:01:37 UTC
I'm able to debug and also profile the main class, with both the jdk and ide having space in path on win 7 professional, 64 bit. The command line looks like this for me (as printed in the output):

cd C:\Users\mkleint\src\maven-3\maven-model-builder; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_21" "\"C:\\Program Files\\NetBeans Dev 201305062300\\java\\maven\\bin\\mvn.bat\"" "-Dexec.args=-agentpath:\\\"C:/Program Files/NetBeans Dev 201305062300/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\\\"=\\\"C:\\Program Files\\NetBeans Dev 201305062300\\profiler\\lib\\\",5140,10 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\\Users\\mkleint\\AppData\\Local\\NetBeans\\Cache\\dev\\mavencachedirs\\992689654\\org-netbeans-modules-profiler  -classpath %classpath org.apache.maven.model.validation.NewMain" "-Dexec.executable=C:\\Program Files\\Java\\jdk1.7.0_21\\bin\\java.exe" -Dexec.classpathScope=runtime org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Comment 10 Milos Kleint 2013-05-09 12:27:39 UTC
never mind, I can reproduce now, the IDE was using older jdk 1.7 build before. with _21, this always occurs with profile main class but can potentially occur with any other command where a single maven parameter/property is used to set multiple cmd line parameters.
Comment 11 RedShadow 2013-05-12 14:19:16 UTC
This effectively makes JDK 1.7_u21 unsuable with JavaFX projects on windows since they pass the jfxrt.jar as parameter for the bootclasspath.
Comment 12 _ gtzabari 2013-05-21 04:26:56 UTC
JDK bug #8014730 (referenced by this issue) isn't visible to the public (not sure why) but I believe this issue is fixed by JDK bug #8012453. The downside is this issue is marked as fixed in JDK 8 and has not been backported to JDK 7 (though perhaps it will be in the future).
Comment 13 Exceptions Reporter 2013-05-22 14:38:14 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=200171
Comment 14 Exceptions Reporter 2013-05-29 16:31:20 UTC
Created attachment 135088 [details]
stacktrace

Running the memory profile on a project.
Comment 15 claus_ch 2013-05-31 06:52:24 UTC
Created attachment 135166 [details]
stacktrace

I start a simple Java application (main) and pass it a path containing blanks as a parameter.
I enclose the path with "" (quotes), which leads to this error.
The same works fine if executed from the OS command line
Comment 16 Milos Kleint 2013-06-03 08:09:56 UTC
a partial workaround is to  keep both netbeans binaries and project sources on paths without spaces..
Comment 17 Exceptions Reporter 2013-06-06 06:10:28 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=200171
Comment 18 _ gtzabari 2013-06-06 06:14:32 UTC
Looking at the last comment on http://bugs.sun.com/view_bug.do?bug_id=8014730 isn't the evaluator implying that this is a Maven bug?

Did anyone open a corresponding bug report against Maven?
Comment 19 Milos Kleint 2013-06-06 06:19:25 UTC
(In reply to comment #18)
> Looking at the last comment on http://bugs.sun.com/view_bug.do?bug_id=8014730
> isn't the evaluator implying that this is a Maven bug?

AFAIK no, he's implying that we are calling the maven bat file wrongly from netbeans codebase..
Comment 20 Milos Kleint 2013-06-11 12:39:32 UTC
note to self: 
what appears to work on cmd line (win7) is this:

cmd /c ""C:\Users\mkleint\space in path\apache-maven-3.0.4\bin\mvn.bat" -Dexec.executable=java -Dexec.args="-jar C:\Users\mkleint\Documents\NetBeansProjects\JavaApplication13\dist\JavaApplication13.jar -Dxx=\"space path\" -Dfoo=bar" exec:exec""

please note the -Dxx=\"space path\" -Dfoo=bar" part.
when changed to -Dxx=\"space path\"" it fails.
when changed to -Dxx=\"space path\" " (extra space between the quotes), it works.
Comment 21 Milos Kleint 2013-06-13 15:48:02 UTC
http://hg.netbeans.org/core-main/rev/b93ec984cbca

converted the execution on windows to use cmd /c
appears to be working for me for both maven and netbeans with and without space in path, with jdk u17 and u21. both simple builds and profile main class actions.

mmirilovic, nebuzelsky: is there still time to backport to beta branch?
Comment 22 Milos Kleint 2013-06-13 16:40:45 UTC
http://hg.netbeans.org/releases/rev/d740df48ffc8 also in release74 beta branch now
Comment 23 Quality Engineering 2013-06-14 00:49:48 UTC
Integrated into 'releases', will be available in build *201306132201* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/d740df48ffc8
User: Milos Kleint <mkleint@netbeans.org>
Log: #228901 use cmd /c on windows, since u21 embedded quotes don't work otherwise.
Comment 24 Quality Engineering 2013-06-15 03:05:06 UTC
Integrated into 'main-golden', will be available in build *201306142301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b93ec984cbca
User: Milos Kleint <mkleint@netbeans.org>
Log: #228901 use cmd /c on windows, since u21 embedded quotes don't work otherwise.
Comment 25 jaylogan 2013-08-25 15:42:44 UTC
I see that the target for this bug fix is 7.4. Will it ever be ported to 7.3.1?

I ran a check for updates and none were available.
And the build number for the 7.3.1 Netbeans I have installed is: 201306052037
Comment 26 mimkorn 2013-10-20 19:27:36 UTC
I am too interested if this will be integrated into 7.3.1. If not, why not?
Comment 27 Milos Kleint 2013-10-20 19:29:48 UTC
(In reply to mimkorn from comment #26)
> I am too interested if this will be integrated into 7.3.1. If not, why not?

because it's working in 7.4 that was released. There's no resources allocated for  backporting issue fixes to older versions right now.