Skip to content

NegativeArraySizeException from PrefService for Scripts with multiple Dataset inputs #442

@gselzer

Description

@gselzer

Writing the following Python script triggers the following error when running in Fiji's ScriptEditor. The issue comes from within PrefService. Note that this error will only appear the second time the script is run, as the first time it is run PrefService will not have yet cached the inputs from prior runs:

#@ Dataset d1
#@ Dataset d2
[INFO] Verifying GIF format
[ERROR] java.util.concurrent.ExecutionException: java.lang.RuntimeException: Module threw exception
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.scijava.ui.swing.script.TextEditor.evalScript(TextEditor.java:3506)
	at org.scijava.ui.swing.script.TextEditor.access$600(TextEditor.java:204)
	at org.scijava.ui.swing.script.TextEditor$5.execute(TextEditor.java:2793)
	at org.scijava.ui.swing.script.TextEditor$Executer$1.run(TextEditor.java:2558)
Caused by: java.lang.RuntimeException: Module threw exception
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NegativeArraySizeException
	at org.scijava.io.handle.DataHandle.readString(DataHandle.java:264)
	at io.scif.formats.GIFFormat$Parser.typedParse(GIFFormat.java:391)
	at io.scif.formats.GIFFormat$Parser.typedParse(GIFFormat.java:363)
	at io.scif.AbstractParser.parse(AbstractParser.java:244)
	at io.scif.AbstractParser.parse(AbstractParser.java:314)
	at io.scif.AbstractParser.parse(AbstractParser.java:53)
	at io.scif.AbstractReader.setSource(AbstractReader.java:271)
	at io.scif.services.DefaultInitializeService.initializeReader(DefaultInitializeService.java:91)
	at io.scif.img.ImgOpener.createReader(ImgOpener.java:483)
	at io.scif.img.ImgOpener.openImgs(ImgOpener.java:242)
	at io.scif.services.DefaultDatasetIOService.open(DefaultDatasetIOService.java:152)
	at io.scif.services.DefaultDatasetIOService.open(DefaultDatasetIOService.java:133)
	at io.scif.services.DefaultDatasetIOService.open(DefaultDatasetIOService.java:138)
	at io.scif.convert.FileToDatasetConverter.convert(FileToDatasetConverter.java:88)
	at org.scijava.convert.AbstractConvertService.convert(AbstractConvertService.java:125)
	at org.scijava.convert.AbstractDelegateConverter.convert(AbstractDelegateConverter.java:53)
	at org.scijava.convert.AbstractConvertService.convert(AbstractConvertService.java:125)
	at org.scijava.module.DefaultModuleService.load(DefaultModuleService.java:316)
	at org.scijava.module.DefaultModuleService.loadInput(DefaultModuleService.java:544)
	at org.scijava.module.DefaultModuleService.lambda$loadInputs$1(DefaultModuleService.java:346)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1082)
	at org.scijava.module.DefaultModuleService.loadInputs(DefaultModuleService.java:346)
	at org.scijava.module.process.LoadInputsPreprocessor.process(LoadInputsPreprocessor.java:58)
	at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:102)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:152)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)
	... 6 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions