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 207430 - IllegalArgumentException: run.single.method
Summary: IllegalArgumentException: run.single.method
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Freeform (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords: RANDOM
Depends on:
Blocks:
 
Reported: 2012-01-18 09:32 UTC by ricktw
Modified: 2015-02-04 03:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 184501


Attachments
stacktrace (503 bytes, text/plain)
2012-01-18 09:33 UTC, ricktw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ricktw 2012-01-18 09:32:59 UTC
Build: NetBeans IDE 7.1 (Build 201112071828)
VM: Java HotSpot(TM) 64-Bit Server VM, 21.0-b17, Java(TM) SE Runtime Environment, 1.7.0-b147
OS: Windows 7

User Comments:
ricktw: try to run one single test method using the right mouse button option menu.




Stacktrace: 
java.lang.IllegalArgumentException: run.single.method
   at org.netbeans.modules.ant.freeform.LookupMergerImpl$ActionProviderImpl.invokeAction(LookupMergerImpl.java:137)
   at org.netbeans.modules.junit.actions.TestMethodAction$1.run(TestMethodAction.java:104)
   at org.netbeans.modules.progress.ui.RunOffEDTImpl$1.run(RunOffEDTImpl.java:151)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)
Comment 1 ricktw 2012-01-18 09:33:02 UTC
Created attachment 114986 [details]
stacktrace
Comment 2 Jesse Glick 2012-01-18 20:58:22 UTC
Not sure what is going on here, and cannot reproduce. Either nbproject/project.xml binds run.single.method or it does not. The only thing I can think of is a race condition between when TestMethodAction.performAction calls ap.getSupportedActions or ap.isActionEnabled and when it calls ap.invokeAction, during which time the binding is removed. That could be solved by quietly returning from iAE/iA rather than throwing IAE (probably best done as an API change in ActionProvider), but this seems an unlikely explanation. The only other clue is

[Fatal Error] :1:1: Content is not allowed in prolog.

which suggests a parse error in project.xml.

BTW ant.freeform should probably be using LookupProviderSupport.createActionProviderMerger rather than using its own implementation.
Comment 3 ricktw 2012-01-19 13:29:25 UTC
I've did some research and found a workaround.

The reason this error occurs is because there is no action names "run.single.method" in project.xml.

This is what I did to get "run Focused test" to work:
1) create new "run.single.method" action in project.xml file (copy "run.single" action and change target).

=== project.xml EXAMPLE ===
<action name="run.single.method">
 <script>nbproject/ide-file-targets.xml</script>
 <target>run.single.method</target>
 <context>
  <property>run.class</property>
  <folder>test/src</folder>
  <pattern>\.java$</pattern>
  <format>java-name</format>
  <arity>
   <one-file-only/>
  </arity>
  </context>
</action>
==========================

2) create new "run.single.method" target in ide-file-targets.xml (copy "run-selected-file-in-src") and make sure the test tag has a parameter "methods" using the property "${method}".

=== ide-file-targets.xml EXAMPLE ===
<target name="run.single.method" depends="compile">
 <fail unless="run.class">Must set property 'run.class'</fail>
 <junit maxmemory="256m" fork="true" haltonerror="true" haltonfailure="true" printsummary="on" jvm="${jdk.dir}/bin/java" showoutput="true">
  <sysproperty key="build.basedir" value="${basedir}"/>
  <test name="${run.class}" methods="${method}"/>
  <formatter type="plain" usefile="false"/>
  <classpath refid="CLASSPATH"/>
 </junit>
</target>
====================================


Now you can use the right mouse menu  "Run focused test".
Maybe these actions/targets can be automatically created in the two files mentioned above?

-
Rick
Comment 4 Jesse Glick 2012-01-19 20:55:27 UTC
(In reply to comment #3)
> The reason this error occurs is because there is no action names
> "run.single.method" in project.xml.

I do not think that is it. If there is no such action name in project.xml, Run Focused Test should simply be disabled, not throw an error. That was what I observed in a sample freeform project with no such action binding (from JDK demos).

> Maybe these actions/targets can be automatically created in the two files
> mentioned above?

Sure, that would be a useful RFE, but this bug is separate.
Comment 5 Quality Engineering 2015-02-04 03:34:36 UTC
Reported for 7.3.x or earlier, no new info since then -> closing as worksforme, please reopen in case you see it.