Bug 59712 - If HTTP post message body data has %pa% the Results Tree can't show the message
Summary: If HTTP post message body data has %pa% the Results Tree can't show the message
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 3.0
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
: 59714 59808 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-16 05:06 UTC by Teemu Vesala
Modified: 2016-07-06 19:12 UTC (History)
2 users (show)



Attachments
Patch which fixes the issue (916 bytes, patch)
2016-06-16 05:11 UTC, Teemu Vesala
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Teemu Vesala 2016-06-16 05:06:23 UTC
This is tested with 3.0 and also the trunk from SVN.

I have %pa% at body data of HTTP Request sampler. When I try to view it with Results Tree, the result is not shown at all. Instead I get the exception below. The problem is that quite many desktop applications are using HTTP(S) POST messages to transport the application specific data to the server. Those can violate the http-protocol. In my opinion the tree view (and others) should be able to show the results even at that case. 

Exception:
2016/06/16 07:48:03 WARN  - jmeter.protocol.http.visualizers.RequestViewHTTP: Error decoding query, maybe your request parameters should be encoded:%pa% java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "pa"
	at java.net.URLDecoder.decode(Unknown Source)
	at org.apache.jmeter.protocol.http.visualizers.RequestViewHTTP.decodeQuery(RequestViewHTTP.java:347)
	at org.apache.jmeter.protocol.http.visualizers.RequestViewHTTP.getQueryMap(RequestViewHTTP.java:301)
	at org.apache.jmeter.protocol.http.visualizers.RequestViewHTTP.setSamplerResult(RequestViewHTTP.java:223)
	at org.apache.jmeter.visualizers.RequestPanel.setSamplerResult(RequestPanel.java:109)
	at org.apache.jmeter.visualizers.SamplerResultTab.setupTabPane(SamplerResultTab.java:229)
	at org.apache.jmeter.visualizers.ViewResultsFullVisualizer.valueChanged(ViewResultsFullVisualizer.java:263)
	at javax.swing.JTree.fireValueChanged(Unknown Source)
	at javax.swing.JTree$TreeSelectionRedirector.valueChanged(Unknown Source)
	at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown Source)
	at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown Source)
	at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(Unknown Source)
	at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(Unknown Source)
	at javax.swing.JTree.setSelectionPath(Unknown Source)
	at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(Unknown Source)
	at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(Unknown Source)
	at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Comment 1 Teemu Vesala 2016-06-16 05:10:47 UTC
The problem is at the code snippet below. Returning null when the decoding fails for IllegalArgumentExpcetion prevents showing the message at all. I'd change this to return non-decoded query. I've attached the diff about that modification. It didn't add any new unit test error messages.  

    public static String decodeQuery(String query) {
        if (query != null && query.length() > 0) {
            try {
                query = URLDecoder.decode(query, CHARSET_DECODE); // better ISO-8859-1 than UTF-8
            } catch(IllegalArgumentException e) {
                log.warn("Error decoding query, maybe your request parameters should be encoded:" + query, e);
                return null;
            } catch (UnsupportedEncodingException uee) {
                log.warn("Error decoding query, maybe your request parameters should be encoded:" + query, uee);
                return null;
            } 
            return query;
        }
        return null;
    }
Comment 2 Teemu Vesala 2016-06-16 05:11:46 UTC
Created attachment 33954 [details]
Patch which fixes the issue
Comment 3 Felix Schumacher 2016-06-21 18:01:43 UTC
*** Bug 59714 has been marked as a duplicate of this bug. ***
Comment 4 Felix Schumacher 2016-06-21 18:17:01 UTC
Thanks for your contribution.

Date: Tue Jun 21 18:14:22 2016
New Revision: 1749583

URL: http://svn.apache.org/viewvc?rev=1749583&view=rev
Log:
Display original query in RequestViewHTTP when decoding fails.
Based on patch by Teemu Vesala (teemu.vesala at qentinel.com)

Bugzilla Id: 59712

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
    jmeter/trunk/xdocs/changes.xml
Comment 5 Felix Schumacher 2016-07-06 19:12:27 UTC
*** Bug 59808 has been marked as a duplicate of this bug. ***