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 2012/03/13 15:19:34 UTC
DO NOT REPLY [Bug 52897] New: NullPointerException: charsetName when
using HTTP Put File Upload
https://issues.apache.org/bugzilla/show_bug.cgi?id=52897
Bug #: 52897
Summary: NullPointerException: charsetName when using HTTP Put
File Upload
Product: JMeter
Version: 2.6
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: HTTP
AssignedTo: issues@jmeter.apache.org
ReportedBy: joemcc@ll86.net
Classification: Unclassified
Created attachment 28459
--> https://issues.apache.org/bugzilla/attachment.cgi?id=28459
Patched HTTPHC4Impl.java to workaround NullPointerException in
content-encoding.
My service accepts an HTTP PUT request with file contents as the body and
returns a 201: created when the file upload is successful. Here is how I test
it with cURL:
curl -u testuser:testpass "http://localhost:8080/photo" -T photo.jpg -H
"content-type:image/jpeg"
According to the documentation I should be able to do this by specifying a file
path with no name and no other parameters. It seems like the content encoding
is retrieved in this situation, but not set (even if it's available), resulting
in a NullPointerException:
java.lang.NullPointerException: charsetName at java.lang.String.<init>(Unknown
Source) at java.lang.String.<init>(Unknown Source) at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sendPutData(HTTPHC4Impl.java:1067)
at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:274)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1054)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1043)
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:416)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:271) at
java.lang.Thread.run(Unknown Source)
I checked out the code and did some digging. To work around this I specified
the content-encoding if it's available (copy/pasted from where truncated
parameter bodies are handled) and set the encoding in my test. Attached is a
patch of what I did.
I'm not sure if this is a fix or a workaround though. The real issue *might* be
that it's always expecting a content encoding for all HTTP PUT (and POST as far
as I can see) requests. I leave that for you to decide.
Thanks for your consideration,
Joe
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52897] HTTPSampler : Using PUT method with
HTTPClient4 and empty Content Encoding and sending files leads to
NullPointerException
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52897
Philippe Mouawad <p....@ubik-ingenierie.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |RESOLVED
Resolution| |FIXED
--- Comment #3 from Philippe Mouawad <p....@ubik-ingenierie.com> 2012-03-13 22:36:22 UTC ---
Date: Tue Mar 13 22:34:59 2012
New Revision: 1300387
URL: http://svn.apache.org/viewvc?rev=1300387&view=rev
Log:
Bug 52897 - HTTPSampler : Using PUT method with HTTPClient4 and empty Content
Encoding and sending files leads to NullPointerException
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
jmeter/trunk/xdocs/changes.xml
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52897] HTTPSampler : Using PUT method with
HTTPClient4 and empty Content Encoding and sending files leads to
NullPointerException
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52897
Philippe Mouawad <p....@ubik-ingenierie.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|NullPointerException: |HTTPSampler : Using PUT
|charsetName when using HTTP |method with HTTPClient4 and
|Put File Upload |empty Content Encoding and
| |sending files leads to
| |NullPointerException
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52897] HTTPSampler : Using PUT method with
HTTPClient4 and empty Content Encoding and sending files leads to
NullPointerException
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52897
--- Comment #4 from Philippe Mouawad <p....@ubik-ingenierie.com> 2012-03-13 22:37:06 UTC ---
Thanks for report and patch although it was not fully applied.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52897] NullPointerException: charsetName when
using HTTP Put File Upload
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52897
Philippe Mouawad <p....@ubik-ingenierie.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
CC| |p.mouawad@ubik-ingenierie.c
| |om
--- Comment #1 from Philippe Mouawad <p....@ubik-ingenierie.com> 2012-03-13 22:05:32 UTC ---
Hello,
Can you attach your test plan please ?
Thanks
Regards
Philippe
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52897] HTTPSampler : Using PUT method with
HTTPClient4 and empty Content Encoding and sending files leads to
NullPointerException
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52897
--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> 2012-03-13 22:35:28 UTC ---
Created attachment 28463
--> https://issues.apache.org/bugzilla/attachment.cgi?id=28463
Test plan to reproduce issue
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.