Skip to content

Handle spaces in parameter style declarations #333

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

Open
3 tasks
imagejan opened this issue Jul 19, 2018 · 2 comments
Open
3 tasks

Handle spaces in parameter style declarations #333

imagejan opened this issue Jul 19, 2018 · 2 comments
Assignees

Comments

@imagejan
Copy link
Member

Currently, these two parameter declarations behave differently:

#@ File[] (style="files,extensions:xls/xlsx") files

and

#@ File[] (style="files, extensions:xls/xlsx") files

The latter ignores the file extension filter because after splitting, the style string has a leading space.

Let's fix this by changing style.split(",") to style.trim().split("\\s*,\\s*") in all places where it is relevant:

@imagejan imagejan self-assigned this Jan 16, 2019
imagejan added a commit that referenced this issue May 13, 2019
This fixes the issue reported by @kephale on the forum, where the absence of a style attribute
on a File parameter leads to a NullPointerException:

https://forum.image.sc/t/error-for-file-type-imagej2-parameter/25585

This commit is a quick fix, it should probably be rewritten when addressing issue #333
@ctrueden
Copy link
Member

ctrueden commented Apr 24, 2020

Let's make a utility method (in a new WidgetStyle class, perhaps?) to handle this in a unified way?

@imagejan
Copy link
Member Author

@ctrueden do we want to be case-insensitive when testing style attributes (i.e. allowing all of message, MESSAGE and mEsSaGe)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants