Program: 11258
Project: 11258
Buggy source:
/** 
 * Parses the script's input and output parameters from the script header. <p> This method is called automatically the first time any parameter accessor method is called (  {@link #getInput},   {@link #getOutput},   {@link #inputs()},  {@link #outputs()}, etc.). Subsequent calls will reparse the parameters. <p> SciJava's scripting framework supports specifying @  {@link Parameter}-style inputs and outputs in a preamble. The format is a simplified version of the Java @  {@link Parameter} annotation syntax. The following syntaxes aresupported: </p> <ul> <li> {@code // @<type> <varName>}</li> <li>  {@code // @<type>(<attr1>=<value1>, ..., <attrN>=<valueN>) <varName>}</li> <li>  {@code // @<IOType> <type> <varName>}</li> <li>  {@code // @<IOType>(<attr1>=<value1>, ..., <attrN>=<valueN>) <type> <varName>}</li> </ul> <p> Where: </p> <ul> <li>  {@code //} = the comment style of the scripting language, so that theparameter line is ignored by the script engine itself.</li> <li> {@code <IOType>} = one of {@code INPUT},   {@code OUTPUT}, or  {@code BOTH}.</li> <li>  {@code <varName>} = the name of the input or output variable.</li><li> {@code <type>} = the Java {@link Class} of the variable.</li><li> {@code <attr*>} = an attribute key.</li><li> {@code <value*>} = an attribute value.</li></ul> <p> See the @ {@link Parameter} annotation for a list of valid attributes.</p> <p> Here are a few examples: </p> <ul> <li> {@code // @Dataset dataset}</li> <li>  {@code // @double(type=OUTPUT) result}</li> <li>  {@code // @BOTH ImageDisplay display}</li> <li>  {@code // @INPUT(persist=false, visibility=INVISIBLE) boolean verbose}</li> parameters will be parsed and filled just like @  {@link Parameter}-annotated fields in   {@link Command}s. </ul>
 */
@Override public void parseParameters(){
  clearParameters();
  appendReturnValue=true;
  try (final BufferedReader in=script == null ? new BufferedReader(new FileReader(getPath())) : getReader()){
    while (true) {
      final String line=in.readLine();
      if (line == null)       break;
      if (line.matches("String_Node_Str")) {
        final int at=line.indexOf('@');
        parseParam(line.substring(at + 1));
      }
 else       if (line.matches("String_Node_Str"))       break;
    }
    if (appendReturnValue)     addReturnValue();
  }
 catch (  final IOException exc) {
    log.error("String_Node_Str" + path,exc);
  }
catch (  final ScriptException exc) {
    log.error("String_Node_Str" + path,exc);
  }
}

Fixed version (ground truth):
/** 
 * Parses the script's input and output parameters from the script header. <p> This method is called automatically the first time any parameter accessor method is called (  {@link #getInput},   {@link #getOutput},   {@link #inputs()},  {@link #outputs()}, etc.). Subsequent calls will reparse the parameters. <p> SciJava's scripting framework supports specifying @  {@link Parameter}-style inputs and outputs in a preamble. The format is a simplified version of the Java @  {@link Parameter} annotation syntax. The following syntaxes aresupported: </p> <ul> <li> {@code // @<type> <varName>}</li> <li>  {@code // @<type>(<attr1>=<value1>, ..., <attrN>=<valueN>) <varName>}</li> <li>  {@code // @<IOType> <type> <varName>}</li> <li>  {@code // @<IOType>(<attr1>=<value1>, ..., <attrN>=<valueN>) <type> <varName>}</li> </ul> <p> Where: </p> <ul> <li>  {@code //} = the comment style of the scripting language, so that theparameter line is ignored by the script engine itself.</li> <li> {@code <IOType>} = one of {@code INPUT},   {@code OUTPUT}, or  {@code BOTH}.</li> <li>  {@code <varName>} = the name of the input or output variable.</li><li> {@code <type>} = the Java {@link Class} of the variable.</li><li> {@code <attr*>} = an attribute key.</li><li> {@code <value*>} = an attribute value.</li></ul> <p> See the @ {@link Parameter} annotation for a list of valid attributes.</p> <p> Here are a few examples: </p> <ul> <li> {@code // @Dataset dataset}</li> <li>  {@code // @double(type=OUTPUT) result}</li> <li>  {@code // @BOTH ImageDisplay display}</li> <li>  {@code // @INPUT(persist=false, visibility=INVISIBLE) boolean verbose}</li> </ul> <p> Parameters will be parsed and filled just like @  {@link Parameter}-annotated fields in   {@link Command}s. </p>
 */
@Override public void parseParameters(){
  clearParameters();
  appendReturnValue=true;
  try (final BufferedReader in=script == null ? new BufferedReader(new FileReader(getPath())) : getReader()){
    while (true) {
      final String line=in.readLine();
      if (line == null)       break;
      if (line.matches("String_Node_Str")) {
        final int at=line.indexOf('@');
        parseParam(line.substring(at + 1));
      }
 else       if (line.matches("String_Node_Str"))       break;
    }
    if (appendReturnValue)     addReturnValue();
  }
 catch (  final IOException exc) {
    log.error("String_Node_Str" + path,exc);
  }
catch (  final ScriptException exc) {
    log.error("String_Node_Str" + path,exc);
  }
}