Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigInteger and BigDecimal parameters are broken #475

Open
ctrueden opened this issue Jan 26, 2024 · 0 comments
Open

BigInteger and BigDecimal parameters are broken #475

ctrueden opened this issue Jan 26, 2024 · 0 comments
Labels
Milestone

Comments

@ctrueden
Copy link
Member

In the Script Editor, open Widgets.js (template from scripting-javascript).

It has many parameter types, including:

#@ BigInteger bigInteger
#@ BigDecimal bigDecimal

Run it, and an exception is thrown with message ClassCastException: java.lang.Double cannot be cast to java.math.BigInteger.

ClassCastException stack trace
[ERROR] Command errored: script:Widgets.js
java.lang.ClassCastException: java.lang.Double cannot be cast to java.math.BigInteger
	at org.scijava.ui.swing.widget.SpinnerNumberModelFactory.createModel(SpinnerNumberModelFactory.java:56)
	at org.scijava.ui.swing.widget.SwingNumberWidget.set(SwingNumberWidget.java:123)
	at org.scijava.ui.swing.widget.SwingNumberWidget.set(SwingNumberWidget.java:74)
	at org.scijava.plugin.WrapperService.create(WrapperService.java:65)
	at org.scijava.widget.AbstractInputHarvester.addInput(AbstractInputHarvester.java:110)
	at org.scijava.widget.AbstractInputHarvester.buildPanel(AbstractInputHarvester.java:84)
	at org.scijava.widget.InputHarvester.harvest(InputHarvester.java:67)
	at org.scijava.ui.AbstractInputHarvesterPlugin.process(AbstractInputHarvesterPlugin.java:74)
	at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:103)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:154)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
	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)
[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:3439)
	at org.scijava.ui.swing.script.TextEditor.access$600(TextEditor.java:208)
	at org.scijava.ui.swing.script.TextEditor$5.execute(TextEditor.java:2761)
	at org.scijava.ui.swing.script.TextEditor$Executer$1.run(TextEditor.java:2526)
Caused by: java.lang.RuntimeException: Module threw exception
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:128)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
	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.ClassCastException: java.lang.Double cannot be cast to java.math.BigInteger
	at org.scijava.ui.swing.widget.SpinnerNumberModelFactory.createModel(SpinnerNumberModelFactory.java:56)
	at org.scijava.ui.swing.widget.SwingNumberWidget.set(SwingNumberWidget.java:123)
	at org.scijava.ui.swing.widget.SwingNumberWidget.set(SwingNumberWidget.java:74)
	at org.scijava.plugin.WrapperService.create(WrapperService.java:65)
	at org.scijava.widget.AbstractInputHarvester.addInput(AbstractInputHarvester.java:110)
	at org.scijava.widget.AbstractInputHarvester.buildPanel(AbstractInputHarvester.java:84)
	at org.scijava.widget.InputHarvester.harvest(InputHarvester.java:67)
	at org.scijava.ui.AbstractInputHarvesterPlugin.process(AbstractInputHarvesterPlugin.java:74)
	at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:103)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:154)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
	... 6 more

Removing these two parameters avoids the exception. But it looks like something broken either here in scijava-common, or maybe in scijava-ui-swing.

CC @hwilson23

@ctrueden ctrueden added the bug label Jan 26, 2024
@ctrueden ctrueden added this to the m1 milestone Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant