Skip to content

Commit dcff0c7

Browse files
committed
ScriptInfo: ignore lines not _starting_ with @
This fixes a problem when executing scripts such as: /* arf@aol.com */ print("Hello"); See: https://list.nih.gov/cgi-bin/wa.exe?A2=ind1407&L=IMAGEJ&F=&S=&P=71357
1 parent edda0d9 commit dcff0c7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

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

217-
// scan for lines containing an '@' stopping at the first line
218-
// containing at least one alphameric character but no '@'.
217+
// NB: Scan for lines starting with an '@', stopping at the first line
218+
// not starting with '@' with at least one alphameric character.
219219
final int at = line.indexOf('@');
220-
if (at >= 0) parseParam(line.substring(at + 1));
220+
if (at >= 0 && line.substring(0, at).trim().isEmpty()) {
221+
parseParam(line.substring(at + 1));
222+
}
221223
else if (line.matches(".*\\w.*")) break;
222224
}
223225
if (reader == null) in.close();

0 commit comments

Comments
 (0)