This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new a1b170d  Catch NullPointerException from JSoup when recording a test 
plan
a1b170d is described below

commit a1b170de57f7f32a333aec2db9bb4d1823f44258
Author: Felix Schumacher <[email protected]>
AuthorDate: Wed Feb 2 16:49:57 2022 +0100

    Catch NullPointerException from JSoup when recording a test plan
    
    As reported in the bug issue, JSoup throws a NPE on some input.
    When we know more about that input, we might be able to do
    better, for now, let us wrap the exception into the declared
    HTMLParseException and hope, that we can continue.
    
    Bugzilla Id: 65864
---
 .../org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java    | 6 +++++-
 xdocs/changes.xml                                                   | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
 
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
index 77b3fe2..43e3395 100644
--- 
a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
+++ 
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
@@ -52,7 +52,11 @@ public class FormCharSetFinder {
             throws HTMLParseException {
         log.debug("Parsing html of: {}", html);
 
-        Document document = Jsoup.parse(html);
+        try {
+            Document document = Jsoup.parse(html);
+        } catch (RuntimeException e) {
+            throw new HTMLParseException("Could not parse HTML to look for 
forms charsets", e);
+        }
         Elements forms = document.select("form");
         for (Element element : forms) {
             String action = element.attr("action");
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 3877b55..2f86ec8 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -210,6 +210,7 @@ however, the profile can't be updated while the test is 
running.
   <li><bug>65363</bug><code>NullPointerException</code> in 
<code>HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizationForAuthScope</code>
 when <code>401</code> response from remote and 
<code>httpclient4.auth.preemptive=false</code></li>
   <li><bug>65692</bug>HTTP(s) Test Script Recorder: Enable setting enabled 
cipher suite and enabled protocols on SSLContext/ Align ssl properties between 
Java and HC4 impl</li>
   <li><bug>65108</bug>Support JMeter variables in <a 
href="./usermanual/component_reference.html#HTTP_Request">GraphQL HTTP 
Request</a></li>
+  <li><bug>65864</bug>Catch NullPointerException from JSoup when recording a 
test plan</li>
 </ul>
 
 <h3>Other Samplers</h3>

Reply via email to