You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2020/08/01 14:36:29 UTC

[Bug 64636] New: Curl importer can't parse empty data argument

https://bz.apache.org/bugzilla/show_bug.cgi?id=64636

            Bug ID: 64636
           Summary: Curl importer can't parse empty data argument
           Product: JMeter
           Version: Nightly (Please specify date)
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: felix.schumacher@internetallee.de
  Target Milestone: JMETER_5.3.1

If you try to import a curl script with a blank argument for a switch that
expects an argument, the importer will throw an exception instead of using an
empty string as data.

Take for example the curl script:

  curl --data '' https://example.invalid

JMeter will currently throw an exception on importing:

2020-08-01 16:29:18,878 ERROR o.a.j.p.h.g.a.ParseCurlCommandAction: Error
creating test plan from cURL command:curl --data '' https://example.invalid,
error:null
java.net.MalformedURLException: null
        at java.net.URL.<init>(URL.java:627) ~[?:1.8.0_201]
        at java.net.URL.<init>(URL.java:490) ~[?:1.8.0_201]
        at java.net.URL.<init>(URL.java:439) ~[?:1.8.0_201]
        at
org.apache.jmeter.protocol.http.gui.action.ParseCurlCommandAction.createSampler(ParseCurlCommandAction.java:286)
~[ApacheJMeter_http.jar:5.3.1-SNAPSHOT]
        at
org.apache.jmeter.protocol.http.gui.action.ParseCurlCommandAction.createHttpRequest(ParseCurlCommandAction.java:260)
~[ApacheJMeter_http.jar:5.3.1-SNAPSHOT]
        at
org.apache.jmeter.protocol.http.gui.action.ParseCurlCommandAction.createTestPlan(ParseCurlCommandAction.java:222)
~[ApacheJMeter_http.jar:5.3.1-SNAPSHOT]
        at
org.apache.jmeter.protocol.http.gui.action.ParseCurlCommandAction.actionPerformed(ParseCurlCommandAction.java:624)
[ApacheJMeter_http.jar:5.3.1-SNAPSHOT]
        at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[?:1.8.0_201]
        at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
[?:1.8.0_201]
        at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[?:1.8.0_201]
        at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[?:1.8.0_201]
        at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
[?:1.8.0_201]
        at java.awt.Component.processMouseEvent(Component.java:6539)
[?:1.8.0_201]
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
[?:1.8.0_201]
        at java.awt.Component.processEvent(Component.java:6304) [?:1.8.0_201]
        at java.awt.Container.processEvent(Container.java:2239) [?:1.8.0_201]
        at java.awt.Component.dispatchEventImpl(Component.java:4889)
[?:1.8.0_201]
        at java.awt.Container.dispatchEventImpl(Container.java:2297)
[?:1.8.0_201]
        at java.awt.Component.dispatchEvent(Component.java:4711) [?:1.8.0_201]
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
[?:1.8.0_201]
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
[?:1.8.0_201]
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
[?:1.8.0_201]
        at java.awt.Container.dispatchEventImpl(Container.java:2283)
[?:1.8.0_201]
        at java.awt.Window.dispatchEventImpl(Window.java:2746) [?:1.8.0_201]
        at java.awt.Component.dispatchEvent(Component.java:4711) [?:1.8.0_201]
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
[?:1.8.0_201]
        at java.awt.EventQueue.access$500(EventQueue.java:97) [?:1.8.0_201]
        at java.awt.EventQueue$3.run(EventQueue.java:709) [?:1.8.0_201]
        at java.awt.EventQueue$3.run(EventQueue.java:703) [?:1.8.0_201]
        at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_201]
        at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
[?:1.8.0_201]
        at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
[?:1.8.0_201]
        at java.awt.EventQueue$4.run(EventQueue.java:733) [?:1.8.0_201]
        at java.awt.EventQueue$4.run(EventQueue.java:731) [?:1.8.0_201]
        at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_201]
        at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
[?:1.8.0_201]
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) [?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
[?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
[?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
[?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[?:1.8.0_201]
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[?:1.8.0_201]
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[?:1.8.0_201]
Caused by: java.lang.NullPointerException
        at java.net.URL.<init>(URL.java:532) ~[?:1.8.0_201]
        ... 42 more

If we switch the parameters around and use the data switch with a blank
argument at the end of the line like:

  curl https://example.invalid --data ''

we get the following exception:
2020-08-01 16:34:08,396 ERROR o.a.j.p.h.g.a.ParseCurlCommandAction: Error
creating test plan from cURL command list:[curl https://example.invalid --data
'']
java.lang.IllegalArgumentException: Unexpected format for command line:curl
https://example.invalid --data '', error:Missing argument to option --data
        at
org.apache.jmeter.protocol.http.curl.BasicCurlParser.parse(BasicCurlParser.java:797)
~[ApacheJMeter_http.jar:5.3.1-SNAPSHOT]
        at
org.apache.jmeter.protocol.http.gui.action.ParseCurlCommandAction.parseCommands(ParseCurlCommandAction.java:665)
~[ApacheJMeter_http.jar:5.3.1-SNAPSHOT]
        at
org.apache.jmeter.protocol.http.gui.action.ParseCurlCommandAction.actionPerformed(ParseCurlCommandAction.java:614)
[ApacheJMeter_http.jar:5.3.1-SNAPSHOT]
        at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[?:1.8.0_201]
        at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
[?:1.8.0_201]
        at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[?:1.8.0_201]
        at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[?:1.8.0_201]
        at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
[?:1.8.0_201]
        at java.awt.Component.processMouseEvent(Component.java:6539)
[?:1.8.0_201]
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
[?:1.8.0_201]
        at java.awt.Component.processEvent(Component.java:6304) [?:1.8.0_201]
        at java.awt.Container.processEvent(Container.java:2239) [?:1.8.0_201]
        at java.awt.Component.dispatchEventImpl(Component.java:4889)
[?:1.8.0_201]
        at java.awt.Container.dispatchEventImpl(Container.java:2297)
[?:1.8.0_201]
        at java.awt.Component.dispatchEvent(Component.java:4711) [?:1.8.0_201]
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
[?:1.8.0_201]
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
[?:1.8.0_201]
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
[?:1.8.0_201]
        at java.awt.Container.dispatchEventImpl(Container.java:2283)
[?:1.8.0_201]
        at java.awt.Window.dispatchEventImpl(Window.java:2746) [?:1.8.0_201]
        at java.awt.Component.dispatchEvent(Component.java:4711) [?:1.8.0_201]
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
[?:1.8.0_201]
        at java.awt.EventQueue.access$500(EventQueue.java:97) [?:1.8.0_201]
        at java.awt.EventQueue$3.run(EventQueue.java:709) [?:1.8.0_201]
        at java.awt.EventQueue$3.run(EventQueue.java:703) [?:1.8.0_201]
        at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_201]
        at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
[?:1.8.0_201]
        at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
[?:1.8.0_201]
        at java.awt.EventQueue$4.run(EventQueue.java:733) [?:1.8.0_201]
        at java.awt.EventQueue$4.run(EventQueue.java:731) [?:1.8.0_201]
        at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_201]
        at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
[?:1.8.0_201]
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) [?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
[?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
[?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
[?:1.8.0_201]
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[?:1.8.0_201]
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[?:1.8.0_201]
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[?:1.8.0_201]

Both exceptions have the same origin. The used parser will skip the blank
argument and our logic is therefore missing the argument.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64636] Curl importer can't parse empty data argument

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64636

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
   Target Milestone|JMETER_5.3.1                |---

-- 
You are receiving this mail because:
You are the assignee for the bug.