NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 1181 - When dragging and dropping an IJ1 macro into FIJI an error pops up in the console
When dragging and dropping an IJ1 macro into FIJI an error pops up in the con...
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
PC Windows
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2015-11-02 12:40 CST by Nick Galati
Modified: 2015-11-03 10:45 CST
2 users (show)

See Also:


Attachments
The macro that causes the error in the console (93.64 KB, text/plain)
2015-11-02 13:23 CST, Nick Galati

Description Nick Galati 2015-11-02 12:40:22 CST
The following error pops up when I drag and drop an IJ1 macro into FIJI. It is a complex macro with 1000 lines and many user-defined functions. The error does not pop up when I open simple IJ1 macros with a few lines of built in ImageJ macro functions.

The macro does run fine, so I am simply reporting the error message.

Thanks.



java.lang.NullPointerException
	at org.fife.ui.rsyntaxtextarea.TokenMakerBase.getLastTokenTypeOnLine(TokenMakerBase.java:221)
	at org.fife.ui.rsyntaxtextarea.RSyntaxDocument.updateSyntaxHighlightingInformation(RSyntaxDocument.java:660)
	at org.fife.ui.rsyntaxtextarea.RSyntaxDocument.setSyntaxStyle(RSyntaxDocument.java:543)
	at org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.setSyntaxEditingStyle(RSyntaxTextArea.java:2792)
	at net.imagej.ui.swing.script.EditorPane.setLanguage(EditorPane.java:490)
	at net.imagej.ui.swing.script.EditorPane.setLanguage(EditorPane.java:435)
	at net.imagej.ui.swing.script.EditorPane.setLanguageByFileName(EditorPane.java:423)
	at net.imagej.ui.swing.script.EditorPane.setFileName(EditorPane.java:369)
	at net.imagej.ui.swing.script.TextEditor.setEditorPaneFileName(TextEditor.java:1666)
	at net.imagej.ui.swing.script.TextEditor.open(TextEditor.java:1368)
	at net.imagej.legacy.plugin.DefaultLegacyEditor.open(DefaultLegacyEditor.java:93)
	at net.imagej.legacy.DefaultLegacyHooks.openInEditor(DefaultLegacyHooks.java:298)
	at ij.plugin.Compiler.edit(Compiler.java:46)
	at ij.plugin.Compiler.run(Compiler.java:33)
	at ij.IJ.runPlugIn(IJ.java:182)
	at ij.Executer.runCommand(Executer.java:132)
	at ij.Executer.run(Executer.java:65)
	at java.lang.Thread.run(Thread.java:662)
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 30
	at org.fife.ui.rsyntaxtextarea.DefaultTokenFactory.createToken(DefaultTokenFactory.java:118)
	at org.fife.ui.rsyntaxtextarea.TokenMakerBase.addToken(TokenMakerBase.java:132)
	at net.imagej.ui.swing.script.highliters.ImageJMacroTokenMaker.addToken(ImageJMacroTokenMaker.java:2428)
	at net.imagej.ui.swing.script.highliters.ImageJMacroTokenMaker.addToken(ImageJMacroTokenMaker.java:2411)
	at net.imagej.ui.swing.script.highliters.ImageJMacroTokenMaker.addToken(ImageJMacroTokenMaker.java:2400)
	at net.imagej.ui.swing.script.highliters.ImageJMacroTokenMaker.yylex(ImageJMacroTokenMaker.java:2756)
	at net.imagej.ui.swing.script.highliters.ImageJMacroTokenMaker.getTokenList(ImageJMacroTokenMaker.java:2469)
	at org.fife.ui.rsyntaxtextarea.RSyntaxDocument.getTokenListForLine(RSyntaxDocument.java:428)
	at org.fife.ui.rsyntaxtextarea.SyntaxView.paint(SyntaxView.java:721)
	at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1422)
	at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:722)
	at org.fife.ui.rtextarea.RTextAreaUI.paintSafely(RTextAreaUI.java:536)
	at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:869)
	at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:848)
	at org.fife.ui.rtextarea.RTextAreaBase.paintComponent(RTextAreaBase.java:728)
	at org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.paintComponent(RSyntaxTextArea.java:2017)
	at javax.swing.JComponent.paint(JComponent.java:1029)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JViewport.paint(JViewport.java:747)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1030)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paintToOffscreen(JComponent.java:5131)
	at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1479)
	at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1410)
	at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
	at javax.swing.JComponent.paint(JComponent.java:1015)
	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
	at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
	at java.awt.Container.paint(Container.java:1780)
	at java.awt.Window.paint(Window.java:3375)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
	at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:693)
	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
	at java.awt.EventQueue.access$000(EventQueue.java:85)
	at java.awt.EventQueue$1.run(EventQueue.java:603)
	at java.awt.EventQueue$1.run(EventQueue.java:601)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:612)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Information about your version of Java:

  os.arch => amd64
  os.name => Windows NT (unknown)
  os.version => 6.2
  java.version => 1.6.0_24
  java.vendor => Sun Microsystems Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_24-b07
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 19.1-b02
  java.vm.vendor => Sun Microsystems Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => sun.awt.Win32GraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => windows
  file.separator => \

The up-to-date check says: REMIND_LATER

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: C:\Users\Nick\Desktop\FIJI~1.APP/java/win64/jdk1.6.0_24//jre
  imagej.dir => C:\Users\Nick\Desktop\FIJI~1.APP

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20151026135651)
Fiji: http://update.fiji.sc/ (last check:20151028093859)
3D ImageJ Suite: http://sites.imagej.net/Tboudier/ (last check:20151008005610)

Files not up-to-date:
  8cb8d89b (LOCAL_ONLY) 20151102112105 plugins/quickhull3d.jar
Comment 1 Curtis Rueden 2015-11-02 12:58:06 CST
Thanks for the report!

Any chance you can post the macro which triggers the issue? We need to reproduce the problem in order to fix it.

In this case, we won't actually have to execute the macro -- just open it in the editor. So no sample data etc. is needed.
Comment 2 Nick Galati 2015-11-02 13:22:15 CST
(In reply to Curtis Rueden from comment #1)
> Thanks for the report!
> 
> Any chance you can post the macro which triggers the issue? We need to
> reproduce the problem in order to fix it.
> 
> In this case, we won't actually have to execute the macro -- just open it in
> the editor. So no sample data etc. is needed.

Sure thing. The macro is now uploaded. In addition, I am initiating a new bug regarding the 3D Convex Hull plugin. I am finally migrating over to IJ2 and I have a ton of IJ1 macros that draw from many other plugins. So I will be reporting any thing that is broken. Thanks.
Comment 3 Nick Galati 2015-11-02 13:23:35 CST
Created attachment 273
The macro that causes the error in the console
Comment 4 Curtis Rueden 2015-11-02 14:05:53 CST
Thanks for posting the macro.

However, I cannot reproduce the exception in a fully updated Fiji on either OS X or on Windows 10. The latter in particular was freshly downloaded and updated using Help > Update...

Can you check that your ImageJ is really fully 100% up to date?
  http://imagej.net/FAQ#How_can_I_verify_that_my_ImageJ_is_really_100.25_up_to_date.3F
Comment 5 Nick Galati 2015-11-03 10:14:47 CST
(In reply to Curtis Rueden from comment #4)
> Thanks for posting the macro.
> 
> However, I cannot reproduce the exception in a fully updated Fiji on either
> OS X or on Windows 10. The latter in particular was freshly downloaded and
> updated using Help > Update...
> 
> Can you check that your ImageJ is really fully 100% up to date?
>  
> http://imagej.net/FAQ#How_can_I_verify_that_my_ImageJ_is_really_100.
> 25_up_to_date.3F

I figured out the problem... 

When I open my macro in IJ2, the comment marker:
/*
 *
 */
was not being recognized by the script editor (i.e., they were not green and every "for" "if" and "macro" was showing up in blue. When I went back and recreated the:
/*
 *
 */
it turned green. Now when I open the macro I do not see any errors.

I still don't know why the original comment markers weren't being recognized, but at least its a simple fix. 

Thanks
Comment 6 Curtis Rueden 2015-11-03 10:45:54 CST
Great, glad it is working for you now.

Just to be safe, I did add a safeguard against this sort of exception in the future, since I think under normal circumstances we don't want to bother the user with it:

http://github.com/imagej/imagej-ui-swing/commit/8f7f10a4098a20a766ae5859dc99a8a4c086cf6f