tuliob / jsyntaxpane

Automatically exported from code.google.com/p/jsyntaxpane
0 stars 0 forks source link

Comonent hangs if xml content is set #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. DefaultSyntaxKit.initKit();
2. jEditorPane.setContentType("text/xml");
3. jEditorPane.setText(xmlContent);

What is the expected output? What do you see instead?
I see nothing the complete application hangs.

What version of the product are you using? On what operating system?
Problem occured with version 0.9.4. The version 0.9.4a didn't had this problem.

Please provide any additional information below.
I attached the xml content which has been set into the editor.

Original issue reported on code.google.com by oliver.b...@gmail.com on 29 Jan 2009 at 3:18

Attachments:

GoogleCodeExporter commented 9 years ago
I do not have the source with me right now, but i tested with the 0.9.4 binary
download, pasted the attached file, and it worked fine.  Did you build your 
copy?
From what version?

Original comment by ayman.al...@gmail.com on 29 Jan 2009 at 5:29

GoogleCodeExporter commented 9 years ago
No, I'm using the official version.
I set the text inside of a SwingWorker. Maybe a timing effect.

I will use the sources instead of the binary to make further investigations

Original comment by oliver.b...@gmail.com on 30 Jan 2009 at 9:20

GoogleCodeExporter commented 9 years ago
I have done some tests.

And I can reproduce the error in the attached test application. Just start the
Test.class with the binary distribution and click on the button. 

The application will freez.

Original comment by oliver.b...@gmail.com on 30 Jan 2009 at 10:42

Attachments:

GoogleCodeExporter commented 9 years ago
I will not be able to test for the next few days.  In your main method, can you
enclose the new "Test().setVisible(true);" call inside of invokeLater, just 
like the
SyntaxTester.  I had another issue, and this sorted it out.

Original comment by ayman.al...@gmail.com on 30 Jan 2009 at 2:26

GoogleCodeExporter commented 9 years ago
Hi, I changed the main method to show the JFrame in the invokeLater without any 
success.
I also tried to use a different content type without any success.

Original comment by oliver.b...@gmail.com on 2 Feb 2009 at 2:00

GoogleCodeExporter commented 9 years ago
I have another concern.  the setText method on a pane should not be used.  It
actually breaks down the String, and causes the the Document to reparse 
repeatedly,
and partially.  These partial parses may be why it did hang.  A better 
alternative is
to use the pane's read method.  This creates a new document and is much faster.

Original comment by ayman.al...@gmail.com on 3 Feb 2009 at 8:56

GoogleCodeExporter commented 9 years ago
I replaced the setString as follows:
// String text = readFromFile("AxisTest.wsdl");
pane.read(new FileReader("AxisTest.wsdl"), null);

That sorted it out.  It's probably a Swing EDT issue.

Original comment by ayman.al...@gmail.com on 3 Feb 2009 at 9:25

GoogleCodeExporter commented 9 years ago
The above test caused incorrect line numbers to be displayed this will be 
firxed with
next release.

Original comment by ayman.al...@gmail.com on 3 Feb 2009 at 9:43

GoogleCodeExporter commented 9 years ago
Thank you for the solution.

I have changed the setTest to the read method. Even if it is a little bit 
strange
because I don't read the content out of a stream. So I use a StringReader to 
make
this possible.

Will the setText method generally not be available? Or is this just a behaviour 
of
the actual version?

Original comment by oliver.b...@gmail.com on 3 Feb 2009 at 10:19

GoogleCodeExporter commented 9 years ago
setText will still be available as I do not change anything in the JEditorPane
itself.  The preferred method is using a read to read from a file or to set the 
text
to a large string, or from a file.
setText should work.  It does in the SyntaxTester.  
There is a bug in your code that has to do with threads and EDT that is,
unfortunately, beyond me for now.

Original comment by ayman.al...@gmail.com on 3 Feb 2009 at 11:48