Bug 43467 - HTTPSampler may produce NullpointerException
Summary: HTTPSampler may produce NullpointerException
Status: RESOLVED DUPLICATE of bug 42057
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.2
Hardware: All other
: P2 trivial (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-24 14:37 UTC by Ronny Karallus
Modified: 2007-09-24 14:55 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ronny Karallus 2007-09-24 14:37:08 UTC
Hi,

i am currently writing some Samplers for JMeter and realized that the source
code in HTTPSampler may throw a NullpointerException in one special case,
because there is a logical programming error:

Look at the method sample(URL, String, boolean, int) in HTTPSampler:
On (my) line 404 you can find the following statement:
con = setupConnection(url, method, res);

The method used (setupConnection) may throw an IOException. This statement is
the first one in the surrounding try block to initialize the HttpURLConnection 
conn (which is initially set to null). If the setupConnection(...) method now
throws the IOException on the first execution, the conn object would still have
the null state. Now go to the catch block handling the IOException. There you
can see the following code:

res.sampleEnd();
conn.disconnect(); <= this is where a NullpointerException may be thrown

Naturally its a programming error of mine that the IOException is thrown here,
but it is not very useful if the debugging message is supressed, because the
NullpointerException is thrown here and no output is generated from the
IOException ... That is why I set it to trivial.

Would be nice if anyone of you guys could handle it.
Comment 1 Sebb 2007-09-24 14:55:40 UTC
Thanks, but this was fixed in 2.3RC3

*** This bug has been marked as a duplicate of 42057 ***
Comment 2 The ASF infrastructure team 2022-09-24 20:37:40 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2023