jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1853121 - in /jmeter/trunk: src/components/org/apache/jmeter/visualizers/ xdocs/
Date Thu, 07 Feb 2019 11:24:15 GMT
Author: pmouawad
Date: Thu Feb  7 11:24:15 2019
New Revision: 1853121

URL: http://svn.apache.org/viewvc?rev=1853121&view=rev
Log:
Bug 63144 - View listener tree take a long time to open response that have Huge text

Contributed by UbikLoadPack
Bugzilla Id: 63144

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsDocument.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsHTMLFormatted.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsJSON.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsText.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsDocument.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsDocument.java?rev=1853121&r1=1853120&r2=1853121&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsDocument.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsDocument.java Thu Feb
 7 11:24:15 2019
@@ -44,7 +44,7 @@ public class RenderAsDocument extends Sa
         String response = Document.getTextFromDocument(sampleResult.getResponseData());
 
         results.setContentType("text/plain"); // $NON-NLS-1$
-        results.setText(response);
+        setTextOptimized(response);
         results.setCaretPosition(0);
         resultsScrollPane.setViewportView(results);
     }

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsHTMLFormatted.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsHTMLFormatted.java?rev=1853121&r1=1853120&r2=1853121&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsHTMLFormatted.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsHTMLFormatted.java Thu
Feb  7 11:24:15 2019
@@ -34,7 +34,7 @@ public class RenderAsHTMLFormatted exten
 
     private void showHTMLFormattedResponse(String response) {
         results.setContentType("text/plain"); // $NON-NLS-1$
-        results.setText(response == null ? "" : Jsoup.parse(response).html()); // $NON-NLS-1$
+        setTextOptimized(response == null ? "" : Jsoup.parse(response).html()); // $NON-NLS-1$
         results.setCaretPosition(0);
         resultsScrollPane.setViewportView(results);
         // Bug 55111 - Refresh JEditor pane size depending on the presence or absence of
scrollbars

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsJSON.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsJSON.java?rev=1853121&r1=1853120&r2=1853121&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsJSON.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsJSON.java Thu Feb  7
11:24:15 2019
@@ -44,7 +44,7 @@ public class RenderAsJSON extends Sample
 
     private void showRenderJSONResponse(String response) {
         results.setContentType("text/plain"); // $NON-NLS-1$
-        results.setText(response == null ? "" : prettyJSON(response));
+        setTextOptimized(response == null ? "" : prettyJSON(response));
         results.setCaretPosition(0);
         resultsScrollPane.setViewportView(results);
     }

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsText.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsText.java?rev=1853121&r1=1853120&r2=1853121&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsText.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RenderAsText.java Thu Feb  7
11:24:15 2019
@@ -33,7 +33,7 @@ public class RenderAsText extends Sample
 
     private void showTextResponse(String response) {
         results.setContentType("text/plain"); // $NON-NLS-1$
-        results.setText(response == null ? "" : response); // $NON-NLS-1$
+        setTextOptimized(response == null ? "" : response); // $NON-NLS-1$
         results.setCaretPosition(0);
         resultsScrollPane.setViewportView(results);
         // Bug 55111 - Refresh JEditor pane size depending on the presence or absence of
scrollbars

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java?rev=1853121&r1=1853120&r2=1853121&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java Thu Feb
 7 11:24:15 2019
@@ -45,6 +45,8 @@ import javax.swing.SwingConstants;
 import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumn;
 import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultStyledDocument;
+import javax.swing.text.Document;
 import javax.swing.text.Style;
 import javax.swing.text.StyleConstants;
 import javax.swing.text.StyledDocument;
@@ -62,6 +64,8 @@ import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.gui.ObjectTableModel;
 import org.apache.jorphan.gui.RendererUtils;
 import org.apache.jorphan.reflect.Functor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Right side in View Results Tree
@@ -69,7 +73,7 @@ import org.apache.jorphan.reflect.Functo
  */
 public abstract class SamplerResultTab implements ResultRenderer {
 
-    
+    private static final Logger LOGGER = LoggerFactory.getLogger(RenderAsText.class);
     // N.B. these are not multi-threaded, so don't make it static
     private final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
// ISO format $NON-NLS-1$
 
@@ -674,4 +678,21 @@ public abstract class SamplerResultTab i
             this.value = value;
         }
     }
+    
+    /**
+     * Optimized way to set text based on :
+     * http://javatechniques.com/blog/faster-jtextpane-text-insertion-part-i/
+     * @param response String data
+     */
+    protected void setTextOptimized(String data) {
+        Document document = results.getDocument();
+        Document blank = new DefaultStyledDocument();
+        results.setDocument(blank);
+        try {
+            document.insertString(0, data == null ? "" : data, null);
+        } catch (BadLocationException ex) {
+            LOGGER.error("Error inserting text", ex);
+        }
+        results.setDocument(document);
+    }
 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1853121&r1=1853120&r2=1853121&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Feb  7 11:24:15 2019
@@ -152,6 +152,7 @@ containing a fix to this issue, we decid
     <li><bug>63093</bug>Add <code>Compile JSR223 Test Elements</code>
menu item. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>63094</bug>Introduce a new Tools menu</li>
     <li><bug>63101</bug>Propose a menu item to generate readable overview
of Test Plan</li>
+    <li><bug>63144</bug>View listener tree take a long time to open response
that has huge text. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>



Mime
View raw message