Error during StatusEvent handling

imagej
search
progress

#1

Hi @ctrueden, @haesleinhuepf,

I am using SCIFIO to save a file and am getting these error messages:

[ERROR] Exception during event handling:
	[Event] org.scijava.app.event.StatusEvent
	context = org.scijava.Context@7625f457
	consumed = false
	progress = 42
	maximum = 136
	status = Saving plane 43/136
	warning = false
	[Subscriber] org.scijava.ui.DefaultUIService [priority = 0.0]
	[Method] protected void org.scijava.ui.DefaultUIService.onEvent(org.scijava.app.event.StatusEvent)
java.lang.NullPointerException
	at net.imagej.legacy.ui.LegacyStatusBar.setProgress(LegacyStatusBar.java:79)
	at org.scijava.ui.DefaultUIService.onEvent(DefaultUIService.java:463)
	at jdk.internal.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:301)
	at org.scijava.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:275)
	at org.bushe.swing.event.ThreadSafeEventService.publish(ThreadSafeEventService.java:971)
	at org.scijava.event.DefaultEventBus.access$201(DefaultEventBus.java:57)
	at org.scijava.event.DefaultEventBus$2.run(DefaultEventBus.java:217)
	at org.scijava.thread.DefaultThreadService$2.run(DefaultThreadService.java:221)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.base/java.lang.Thread.run(Thread.java:844)

I wonder whether this is because it clashes with the new Search UI element?


#2

At least my command with an explicit @Parameter StatusService works fine with the new search bar. The progress bar animates on its left side.

Best,
Richard


#3

Thank you Richard!
I get the error when executing this code:

ImgSaver imgSaver = new ImgSaver( );
imgSaver.saveImg( path,  imgPlus );

I saw just now that one can give the ImgSaver a Context object in the constructor. I am assuming this is needed for it to know which StatusService to use. I guess I will try something along those lines…still learning my way through SciJava :slight_smile:


#4

Why not use the DatasetIOService or IOService instead of ImgSaver? These services are already linked to the active application context. If you use ImgSaver, you will indeed need to pass the context to the constructor or else there will be issues.