cws1989 / java-syntax-highlighter

Java port of SyntaxHighlighter
1 stars 2 forks source link

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: offset out of bounds #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I attached my small project that uses SyntaxHighlighter
2. To see the problem Please run model.Main class . 
Then, choose menu 'File' 
and 'Open' menuItem to open HTML file. Must be HTML file.

What is the expected output? What do you see instead?
The exception is :
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: 
offset out of bounds
    at java.text.RuleBasedBreakIterator.checkOffset(Unknown Source)
    at java.text.RuleBasedBreakIterator.preceding(Unknown Source)
    at javax.swing.text.GlyphView.getBreakSpot(Unknown Source)
    at javax.swing.text.GlyphView.getMinimumSpan(Unknown Source)
    at javax.swing.text.ParagraphView.calculateMinorAxisRequirements(Unknown Source)
    at javax.swing.text.BoxView.checkRequests(Unknown Source)
    at javax.swing.text.BoxView.getMinimumSpan(Unknown Source)
    at javax.swing.text.BoxView.calculateMinorAxisRequirements(Unknown Source)
    at javax.swing.text.BoxView.checkRequests(Unknown Source)
    at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
    at javax.swing.text.BoxView.layout(Unknown Source)
    at javax.swing.text.BoxView.setSize(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at javax.swing.JEditorPane.getPreferredSize(Unknown Source)
    at syntaxhighlight.JTextComponentRowHeader.getPreferredSize(JTextComponentRowHeader.java:271)
    at javax.swing.ViewportLayout.layoutContainer(Unknown Source)
    at java.awt.Container.layout(Unknown Source)
    at java.awt.Container.doLayout(Unknown Source)
    at syntaxhighlight.JTextComponentRowHeader.updatePanelSize(JTextComponentRowHeader.java:234)
    at syntaxhighlight.JTextComponentRowHeader.checkPanelSize(JTextComponentRowHeader.java:224)
    at syntaxhighlight.JTextComponentRowHeader$1.handleEvent(JTextComponentRowHeader.java:187)
    at syntaxhighlight.JTextComponentRowHeader$1.insertUpdate(JTextComponentRowHeader.java:168)
    at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source)
    at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source)
    at javax.swing.text.AbstractDocument.insertString(Unknown Source)
    at syntaxhighlight.SyntaxHighlighterPane.setContent(SyntaxHighlighterPane.java:308)
    at syntaxhighlight.SyntaxHighlighter.setContent(SyntaxHighlighter.java:259)
    at syntaxhighlight.SyntaxHighlighter.setContent(SyntaxHighlighter.java:249)
    at model.SyntaxHighlighterManager.setContent(SyntaxHighlighterManager.java:50)
    at model.SyntaxHighlighterManager.viewHTML(SyntaxHighlighterManager.java:63)
    at model.FileViewerManager.viewFile(FileViewerManager.java:15)
    at model.FileMenuAction.openFile(FileMenuAction.java:41)
    at model.FileMenuAction.actionPerformed(FileMenuAction.java:31)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

What version of the product are you using? On what operating system?
JDK 1.7u51 and Windows 7.

Please provide any additional information below.
I attached my project. 

Original issue reported on code.google.com by vle...@mail.ru on 11 Apr 2014 at 4:25

Attachments:

GoogleCodeExporter commented 9 years ago
Note, when Html file is selected by fileChooser the main frame is validated and 
repainted in method Main.setContent(Container content).

Original comment by vle...@mail.ru on 11 Apr 2014 at 4:30

GoogleCodeExporter commented 9 years ago
Hi, I've run your program, open the file 'Notepad+++/src/model/test.htm' in 
your attachment, and it shows on the UI without any exception. My version is 
JDK 1.7u40 and Windows 7.

Original comment by cws1989@gmail.com on 14 Apr 2014 at 3:36