Skip to content

Commit c3ee328

Browse files
committed
Fix broken parameter parsing
We were mistakenly looking for lines that start with an "@" symbol, forgetting that parameter declarations have comment symbols and arbitrary whitespace preceeding the "@".
1 parent dcff0c7 commit c3ee328

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/org/scijava/script/ScriptInfo.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,11 @@ public void parseParameters() {
214214
final String line = in.readLine();
215215
if (line == null) break;
216216

217-
// NB: Scan for lines starting with an '@', stopping at the first line
218-
// not starting with '@' with at least one alphameric character.
219-
final int at = line.indexOf('@');
220-
if (at >= 0 && line.substring(0, at).trim().isEmpty()) {
217+
// NB: Scan for lines containing an '@' with no prior alphameric
218+
// characters. This assumes that only non-alphanumeric characters can
219+
// be used as comment line markers.
220+
if (line.matches("^[^\\w]*@.*")) {
221+
final int at = line.indexOf('@');
221222
parseParam(line.substring(at + 1));
222223
}
223224
else if (line.matches(".*\\w.*")) break;

0 commit comments

Comments
 (0)