apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.27k stars 2.09k forks source link

Clicking on View Results Tree, Response Data gives ClassCastException in MacOS when installing with homebrew (due to 3rd party plugins) #5051

Closed asfimport closed 5 years ago

asfimport commented 5 years ago

Emmanuel Proulx (Bug 63360): SETUP: I'm using the latest JMeter with Java 11 on Mac OS 10.14.4.

STEPS: After I run my test when I open the View Results Tree, and I click on any of the elements on the tree. Then I click on "Response data".

RESULTS: Nothing is displayed. Instead I get the following error:

Uncaught Exception java.lang.ClassCastException: class javax.swing.text.DefaultStyledDocument cannot be cast to class jsyntaxpane.SyntaxDocument (javax.swing.text.DefaultStyledDocument is in module java.desktop of loader 'bootstrap'; jsyntaxpane.SyntaxDocument is in unnamed module of loader org.apache.jmeter.DynamicClassLoader @2eee9593). See log file for details.

The log contains the following trace: 2019-04-17 14:12:09,621 ERROR o.a.j.JMeter: Uncaught exception: java.lang.ClassCastException: class javax.swing.text.DefaultStyledDocument cannot be cast to class jsyntaxpane.SyntaxDocument (javax.swing.text.DefaultStyledDocument is in module java.desktop of loader 'bootstrap'; jsyntaxpane.SyntaxDocument is in unnamed module of loader org.apache.jmeter.DynamicClassLoader @2eee9593) at jsyntaxpane.SyntaxView.drawUnselectedText(SyntaxView.java:68) ~[jsyntaxpane-1.0.0.jar:1.0.0] at javax.swing.text.PlainView.callDrawUnselectedText(PlainView.java:199) ~[?:?] at javax.swing.text.PlainView.drawElement(PlainView.java:149) ~[?:?] at javax.swing.text.PlainView.drawLineImpl(PlainView.java:101) ~[?:?] at javax.swing.text.PlainView.drawLine(PlainView.java:126) ~[?:?] at javax.swing.text.PlainView.paint(PlainView.java:441) ~[?:?] at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1533) ~[?:?] at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:759) ~[?:?] at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:917) ~[?:?] at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:896) ~[?:?] at javax.swing.JComponent.paintComponent(JComponent.java:797) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1074) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JViewport.paint(JViewport.java:737) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JViewport.paint(JViewport.java:737) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?] at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?] at javax.swing.JComponent.paintToOffscreen(JComponent.java:5255) ~[?:?] at javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1643) ~[?:?] at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1618) ~[?:?] at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1556) ~[?:?] at javax.swing.RepaintManager.paint(RepaintManager.java:1323) ~[?:?] at javax.swing.JComponent._paintImmediately(JComponent.java:5203) ~[?:?] at javax.swing.JComponent.paintImmediately(JComponent.java:5013) ~[?:?] at javax.swing.RepaintManager$4.run(RepaintManager.java:865) ~[?:?] at javax.swing.RepaintManager$4.run(RepaintManager.java:848) ~[?:?] at java.security.AccessController.doPrivileged(Native Method) ~[?:?] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?] at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848) ~[?:?] at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823) ~[?:?] at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772) ~[?:?] at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1890) ~[?:?] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) ~[?:?] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) ~[?:?] at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?] at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?] at java.security.AccessController.doPrivileged(Native Method) ~[?:?] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?] at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) ~[?:?] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?] at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]

Severity: normal OS: All

asfimport commented 5 years ago

Emmanuel Proulx (migrated from Bugzilla): One more thing: the Response Body tab is the one that fails. The Response Headers tab works fine.

asfimport commented 5 years ago

Brian Tully (migrated from Bugzilla): I've experienced the same issue. I wound up downgrading to JMeter 4 as it seems much more stable.

asfimport commented 5 years ago

@FSchumacher (migrated from Bugzilla): I can't reproduce this on Ubuntu 18.04 with Java OpenJDK 11.0.2+9.

Can you give more details, when this happens? A minimal test case would be great.

What is the modus of the View Results Tree (text, regexp tester, boundary extractor tester, ...)?

Do you have any plugins installed? Are there any left overs from previous JMeter installations? Is there a jsyntaxpane-1.0.0.jar in the JMeter lib's dir? If so, where did it come from?

asfimport commented 5 years ago

Emmanuel Proulx (migrated from Bugzilla): I specified that this bug ONLY happens on Mac OS. It does not happen on Linux or Windows. It happens for ANY test plan over HTTP.

Also, it appears that this person is experiencing the same issue: https://stackoverflow.com/questions/51403018/jmeter-java-exception-while-clicking-on-response-in-view-results-tree/55817872#55817872

asfimport commented 5 years ago

Emmanuel Proulx (migrated from Bugzilla): (In reply to Brian Tully from comment 2)

I've experienced the same issue. I wound up downgrading to JMeter 4 as it seems much more stable.

Thanks Brian, this is a great workaround!!

asfimport commented 5 years ago

@FSchumacher (migrated from Bugzilla): (In reply to Emmanuel Proulx from comment 4)

I specified that this bug ONLY happens on Mac OS. It does not happen on Linux or Windows. It happens for ANY test plan over HTTP.

Well, I read your first entry that you tested it on MacOS -- which I don't have. So I did try it on linux and could not reproduce it. That's why I stated that fact. Sorry, that it was obvious to you ;)

Also, it appears that this person is experiencing the same issue: https://stackoverflow.com/questions/51403018/jmeter-java-exception-while- clicking-on-response-in-view-results-tree/55817872#55817872

And it has the same strange jsyntaxpane in its stacktrace. Where is it coming from? Do you have any plugins installed?

And please note, I am doing this in my spare time.

asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): Hello, How are you starting JMeter ?

Thanks

asfimport commented 5 years ago

thijs.stuurman (migrated from Bugzilla): I have the same issue on MacOS.

Installed jMeter using brew, running version 5.1.1r1855137. Previously running 5.0 something the View Results Tree worked fine.

Clicking on View Results Tree GET result results in an error in the console:

Uncaught Exception java.lang.ClassCastException: class javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to class javax.swing.text.AbstractDocument$DefaultDocumentEvent (javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper and javax.swing.text.AbstractDocument$DefaultDocumentEvent are in module java.desktop of loader 'bootstrap'). See log file for details.

I can see the View Results Tree window. Sampler result and Request work, clicking on Response data crashes things:

Uncaught Exception java.lang.ClassCastException: class javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to class javax.swing.text.AbstractDocument$DefaultDocumentEvent (javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper and javax.swing.text.AbstractDocument$DefaultDocumentEvent are in module java.desktop of loader 'bootstrap'). See log file for details. Uncaught Exception java.lang.ClassCastException: class javax.swing.text.DefaultStyledDocument cannot be cast to class jsyntaxpane.SyntaxDocument (javax.swing.text.DefaultStyledDocument is in module java.desktop of loader 'bootstrap'; jsyntaxpane.SyntaxDocument is in unnamed module of loader org.apache.jmeter.DynamicClassLoader @2eee9593). See log file for details.

The previous jMeter 5 worked just fine, downgrading to 4 seems excessive...

asfimport commented 5 years ago

thijs.stuurman (migrated from Bugzilla): Downgraded to 5.0 using brew install ./jmeter.rb with the following contents:

class Jmeter < Formula desc "Load testing and performance measurement application" homepage "https://jmeter.apache.org/" url "https://www.apache.org/dyn/closer.cgi?path=jmeter/binaries/apache-jmeter-5.0.tgz" sha256 "b29e9dc6351394a458fdb9270f5df5636175fe9c433bc86b8ee394bfcabfb142"

bottle do cellar :any_skip_relocation rebuild 1 sha256 "c2cf569765547f24e3816d3712a30341c6356e86b3797cb359b81362b2f7e340" => :mojave sha256 "336e62c42ad531715e3c5fc1ce2b70f2514c960e0efee97a191b10bde581814c" => :high_sierra sha256 "336e62c42ad531715e3c5fc1ce2b70f2514c960e0efee97a191b10bde581814c" => :sierra sha256 "c403a79093d88cf11fa7897bbbd755daee31c64b339e63330c5c880636c049b6" => :x86_64_linux end

resource "jmeterplugins-standard" do url "https://jmeter-plugins.org/downloads/file/JMeterPlugins-Standard-1.4.0.zip" sha256 "3f740bb9b9a7120ed72548071cd46a5f92929e1ab196acc1b2548549090a2148" end

resource "serveragent" do url "https://jmeter-plugins.org/downloads/file/ServerAgent-2.2.1.zip" sha256 "2d5cfd6d579acfb89bf16b0cbce01c8817cba52ab99b3fca937776a72a8f95ec" end

resource "jmeterplugins-extras" do url "https://jmeter-plugins.org/downloads/file/JMeterPlugins-Extras-1.4.0.zip" sha256 "de35e653250882268aa24d011ec0f2afbc13e1c552fbb676c67515bc80ef3194" end

resource "jmeterplugins-extraslibs" do url "https://jmeter-plugins.org/downloads/file/JMeterPlugins-ExtrasLibs-1.4.0.zip" sha256 "81d600a5bda6fdb362573d55c11208b2635728a2c18b7f647b9c7413c0f33ef3" end

resource "jmeterplugins-webdriver" do url "https://jmeter-plugins.org/downloads/file/JMeterPlugins-WebDriver-1.4.0.zip" sha256 "521c2f7d452a84099407534bd50f29fd3761aa8a5beca52966bb9731e33b03e2" end

resource "jmeterplugins-hadoop" do url "https://jmeter-plugins.org/downloads/file/JMeterPlugins-Hadoop-1.4.0.zip" sha256 "93030738d613748a685764fbfff0fe00ad2e161f2b72df6365294adc88db09b4" end

def install

Remove windows files

rm_f Dir["bin/*.bat"]
prefix.install_metafiles
libexec.install Dir["*"]
bin.write_exec_script libexec/"bin/jmeter"

resource("jmeterplugins-standard").stage do
  rm_f Dir["lib/ext/*.bat"]
  (libexec/"lib/ext").install Dir["lib/ext/*"]
  (libexec/"licenses/plugins/standard").install "LICENSE", "README"
end
resource("serveragent").stage do
  rm_f Dir["*.bat"]
  rm_f Dir["lib/*winnt*"]
  rm_f Dir["lib/*solaris*"]
  rm_f Dir["lib/*aix*"]
  rm_f Dir["lib/*hpux*"]
  rm_f Dir["lib/*linux*"]
  rm_f Dir["lib/*freebsd*"]
  (libexec/"serveragent").install Dir["*"]
end
resource("jmeterplugins-extras").stage do
  (libexec/"lib/ext").install Dir["lib/ext/*.jar"]
  (libexec/"licenses/plugins/extras").install "LICENSE", "README"
end
resource("jmeterplugins-extraslibs").stage do
  (libexec/"lib/ext").install Dir["lib/ext/*.jar"]
  (libexec/"lib").install Dir["lib/*.jar"]
  (libexec/"licenses/plugins/extras").install "LICENSE", "README"
end
resource("jmeterplugins-webdriver").stage do
  (libexec/"lib/ext").install Dir["lib/ext/*.jar"]
  (libexec/"lib").install Dir["lib/*.jar"]
  (libexec/"licenses/plugins/extras").install "LICENSE", "README"
end
resource("jmeterplugins-hadoop").stage do
  (libexec/"lib/ext").install Dir["lib/ext/*.jar"]
  (libexec/"lib").install Dir["lib/*.jar"]
  (libexec/"licenses/plugins/extras").install "LICENSE", "README", "NOTICE"
end

end

test do system "#{bin}/jmeter", "--version" end end

asfimport commented 5 years ago

Emmanuel Proulx (migrated from Bugzilla):

Well, I read your first entry that you tested it on MacOS -- which I don't have. So I did try it on linux and could not reproduce it. That's why I stated that fact. Sorry, that it was obvious to you ;) No, I'm sorry that my reply sounded so contemptuous. I didn't mean it in that way. It was just stating the facts of the matter.

And it has the same strange jsyntaxpane in its stacktrace. Where is it coming from? Do you have any plugins installed? I didn't install any plug-ins. I set it up with "brew install jmeter".

And please note, I am doing this in my spare time. I understand totally.

asfimport commented 5 years ago

Emmanuel Proulx (migrated from Bugzilla): (In reply to Philippe Mouawad from comment 7)

How are you starting JMeter ?

I installed it with "brew install jmeter" and I'm running it from the terminal prompt with "jmeter".

asfimport commented 5 years ago

@FSchumacher (migrated from Bugzilla): (In reply to Emmanuel Proulx from comment 10)

> Well, I read your first entry that you tested it on MacOS -- which I don't > have. So I did try it on linux and could not reproduce it. That's why I > stated that fact. Sorry, that it was obvious to you ;) No, I'm sorry that my reply sounded so contemptuous. I didn't mean it in that way. It was just stating the facts of the matter.

> And it has the same strange jsyntaxpane in its stacktrace. Where is it > coming from? Do you have any plugins installed? I didn't install any plug-ins. I set it up with "brew install jmeter".

Is that done by the same method as explained by Thijs? His file seems to contain plugins. Especially the jmeterplugins-webdriver is probably the cause of this issue. It contains jsyntaxpane-1.0.0.jar. That jar is not contained in the Apache JMeter distribution, but a class from this jar is right at the top of the exception in the log.

When I look at https://github.com/nordfalk/jsyntaxpane I see a commit message, that says "Version 1.1.5 released with support for Java 9" which suggests -- at least to me -- that older versions had problems with Java 9 and above.

So I think you could try a few things out:

> And please note, I am doing this in my spare time. I understand totally.

asfimport commented 5 years ago

@FSchumacher (migrated from Bugzilla): @philippe Could "https://github.com/apache/jmeter/issues/5002 - View listener tree take a long time to open response that have Huge text" r1853121 be related to the surfacing of this issue?

asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): (In reply to Felix Schumacher from comment 13)

@philippe Could "https://github.com/apache/jmeter/issues/5002 - View listener tree take a long time to open response that have Huge text" r1853121 be related to the surfacing of this issue?

Hello Felix, Yes it is absolutely related.

I'll try to have a look , but if you have an idea, I'll be happy to test if you need me to

Regards

asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): Hello, I downloaded jmeter from jmeter website.

I tried to reproduce issue without success on Mac OSX 10.11.6 (15G22010) (EL CAPITAN) and on jdk: openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)

And Oracle JDK

So for me , issue is related to brew installed package

asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): IMO , the installation through brew will lead to a lot of other issues since there are duplicate jars. See what it install in lib folder of jmeter:

Saxon-HE-9.9.1-1.jar javax.activation-api-1.2.0.jar accessors-smart-1.2.jar jcharts-0.7.5.jar asm-5.0.3.jar jcl-over-slf4j-1.7.25.jar asm-7.0.jar jedis-2.2.1.jar bsf-2.4.0.jar jodd-core-5.0.6.jar bsh-2.0b6.jar jodd-lagarto-5.0.6.jar bshclient.jar jodd-log-5.0.6.jar caffeine-2.6.2.jar jodd-props-5.0.6.jar cglib-nodep-2.1_3.jar jorphan.jar commons-beanutils-1.7.0.jar json-lib-2.4-jdk15.jar commons-beanutils-1.8.3.jar json-path-2.1.0.jar commons-codec-1.11.jar json-path-2.4.0.jar commons-collections-3.2.2.jar json-smart-2.2.jar commons-dbcp2-2.5.0.jar json-smart-2.3.jar commons-exec-1.3.jar jsoup-1.11.3.jar commons-io-2.6.jar jsyntaxpane-1.0.0.jar commons-jexl-2.1.1.jar jtidy-r938.jar commons-jexl3-3.1.jar junit commons-lang-2.6.jar junit-4.12.jar commons-lang3-3.8.1.jar log4j-1.2-api-2.11.1.jar commons-math3-3.6.1.jar log4j-api-2.11.1.jar commons-net-3.6.jar log4j-core-2.11.1.jar commons-pool-1.6.jar log4j-slf4j-impl-2.11.1.jar commons-pool2-2.6.0.jar mail-1.5.0-b01.jar commons-text-1.6.jar mongo-java-driver-2.11.3.jar cssparser-0.9.16.jar nekohtml-1.9.22.jar darcula.jar oro-2.0.8.jar dec-0.1.2.jar ph-commons-9.2.1.jar dnsjava-2.1.7.jar ph-css-6.1.1.jar dnsjava-2.1.8.jar phantomjsdriver-1.2.1.jar ext qpid-client-0.20.jar ezmorph-1.0.6.jar qpid-common-0.20.jar freemarker-2.3.28.jar rhino-1.7.10.jar geronimo-jms_1.1_spec-1.1.1.jar rsyntaxtextarea-3.0.2.jar groovy-all-2.4.16.jar sac-1.3.jar gson-2.3.1.jar selenium-api-2.52.0.jar guava-11.0.2.jar selenium-chrome-driver-2.52.0.jar guava-19.0.jar selenium-firefox-driver-2.52.0.jar hadoop-core-1.1.2.jar selenium-htmlunit-driver-2.52.0.jar hamcrest-core-1.3.jar selenium-ie-driver-2.52.0.jar hamcrest-date-2.0.4.jar selenium-remote-driver-2.52.0.jar hbase-0.94.5.jar selenium-support-2.52.0.jar htmlunit-2.18.jar serializer-2.7.2.jar htmlunit-core-js-2.17.jar slf4j-api-1.7.25.jar httpasyncclient-4.1.4.jar spring-core-2.5.6.jar httpclient-4.5.7.jar spring-jms-2.5.6.jar httpclient-4.5.jar tika-core-1.20.jar httpcore-4.4.1.jar tika-parsers-1.20.jar httpcore-4.4.11.jar xalan-2.7.2.jar httpcore-nio-4.4.11.jar xercesImpl-2.12.0.jar httpmime-4.5.7.jar xml-apis-1.4.01.jar httpmime-4.5.jar xmlgraphics-commons-2.3.jar jackson-annotations-2.9.8.jar xmlpull-1.1.3.1.jar jackson-core-2.9.8.jar xom-1.2.10.jar jackson-databind-2.9.8.jar xpp3_min-1.1.4c.jar jackson-mapper-asl-1.8.8.jar xstream-1.4.11.jar javax.activation-1.2.0.jar zookeeper-3.4.5.jar

asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): It's strange that now jmeter-plugins is installed by default. In previous versions of formula, you had to do this:

brew install jmeter --with-plugins

now brew install jmeter installs plugins by default

I think you/we ? should report an issue to: https://github.com/Homebrew/homebrew-core/issues

asfimport commented 5 years ago

@FSchumacher (migrated from Bugzilla): (In reply to Philippe Mouawad from comment 14)

(In reply to Felix Schumacher from comment 13) > @philippe Could "https://github.com/apache/jmeter/issues/5002 - View listener tree take a long time to open > response that have Huge text" r1853121 be related to the surfacing of this > issue?

Hello Felix, Yes it is absolutely related.

I'll try to have a look , but if you have an idea, I'll be happy to test if you need me to

Regards

I don't think we can fix this easily in our code -- apart from reverting the speed improvement.

The class jsyntaxpane.SyntaxView assumes in line 68 that the document it gets by calling getDocumet() is a SyntaxDocument. But in (the new 5.1.1) reality it might be a DefaultStyledDocument. That leads to the ClassCastException.

I can think of one situation, where this could happen. It is when we have changed in the blank placeholder (empty instance of DefaultStyledDocument) with the filled document that was displayed. But the call to SyntaxView#drawUnselectedText would have to happen while the documents are switched. This should not happen (famous last words).

I will attach a patch for jsyntaxpane, that makes it fallback to super.drawUnselectedText when it doesn't find a SyntaxDocument. I am not sure, whether it helps or it is the right thing to do.

asfimport commented 5 years ago

@FSchumacher (migrated from Bugzilla): Might get rid of the ClassCastException, as it only does a cast, if the document is really a SyntaxDocument.

To build: git clone https://github.com/nordfalk/jsyntaxpane.git cd jsyntaxpane patch -p1 < ../jsyntaxview-no-cast-without-syntaxdocument.diff cd jsyntaxpane mvn package

now the new jar should be located under target/jsyntaxpane-1.1.5.jar and be replaced with the jsyntaxpane-1.0.0.jar from JMeter's lib dir.

Created attachment jsyntaxview-no-cast-without-syntaxdocument.diff: cast only conditionally

jsyntaxview-no-cast-without-syntaxdocument.diff ````diff diff --git a/jsyntaxpane/src/main/java/jsyntaxpane/SyntaxView.java b/jsyntaxpane/src/main/java/jsyntaxpane/SyntaxView.java index b64ed33..8bc7d83 100644 --- a/jsyntaxpane/src/main/java/jsyntaxpane/SyntaxView.java +++ b/jsyntaxpane/src/main/java/jsyntaxpane/SyntaxView.java @@ -24,11 +24,14 @@ import java.util.Iterator; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; + import javax.swing.text.BadLocationException; +import javax.swing.text.Document; import javax.swing.text.Element; import javax.swing.text.PlainView; import javax.swing.text.Segment; import javax.swing.text.ViewFactory; + import jsyntaxpane.util.Configuration; public class SyntaxView extends PlainView { @@ -61,11 +64,15 @@ public class SyntaxView extends PlainView { @Override protected int drawUnselectedText(Graphics graphics, int x, int y, int p0, - int p1) { + int p1) throws BadLocationException { setRenderingHits((Graphics2D) graphics); Font saveFont = graphics.getFont(); Color saveColor = graphics.getColor(); - SyntaxDocument doc = (SyntaxDocument) getDocument(); + Document document = getDocument(); + if (!(document instanceof SyntaxDocument)) { + return super.drawUnselectedText(graphics, x, y, p0, p1); + } + SyntaxDocument doc = (SyntaxDocument) document; Segment segment = getLineBuffer(); // Draw the right margin first, if needed. This way the text overlays // the margin ````
asfimport commented 5 years ago

@pmouawad (migrated from Bugzilla): Issue is not in JMeter but in 3rd party plugin. Closing as wontfix.