Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If HTTP post message body data has %pa% the Results Tree can't show the message #4003

Closed
asfimport opened this issue Jun 16, 2016 · 3 comments

Comments

@asfimport
Copy link
Collaborator

Teemu Vesala (Bug 59712):
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)

Severity: normal
OS: All

Duplicates:

@asfimport
Copy link
Collaborator Author

Teemu Vesala (migrated from Bugzilla):
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;
}

@asfimport
Copy link
Collaborator Author

Teemu Vesala (migrated from Bugzilla):
Created attachment jmeter-issue-59712.diff: Patch which fixes the issue

jmeter-issue-59712.diff
Index: src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
===================================================================
--- src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java	(revision 1748496)
+++ src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java	(working copy)
@@ -347,7 +347,7 @@
                 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;
+                return query;
             } catch (UnsupportedEncodingException uee) {
                 log.warn("Error decoding query, maybe your request parameters should be encoded:" + query, uee);
                 return null;

@asfimport
Copy link
Collaborator Author

@FSchumacher (migrated from Bugzilla):
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)

#4003

Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
jmeter/trunk/xdocs/changes.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant