Program: 74951
Project: 74951
Buggy source:
/** 
 * Generate makefile. // FIXME example TOSROOT=/home/celaine/ptII/vendors/ptinyos/tinyos-1.x TOSDIR=/home/celaine/ptII/vendors/ptinyos/tinyos-1.x/tos TOSMAKE_PATH += $(TOSROOT)/contrib/ptII/ptinyos/tools/make COMPONENT=_SenseToLedsInWireless_MicaBoard_MicaActor3071 PFLAGS += -I%T/lib/Counters PFLAGS += -DCOMMAND_PORT=10584 -DEVENT_PORT=10585 MY_PTCC_FLAGS += -D_PTII_NODE_NUM=_1SenseToLedsInWireless_1MicaBoard_1MicaActor3071 PFLAGS += "-I$(TOSROOT)/contrib/ptII/ptinyos/beta/TOSSIM-packet" include /home/celaine/ptII/mk/ptII.mk include /home/celaine/ptII/vendors/ptinyos/tinyos-1.x/tools/make/Makerules
 * @exception CancelException If the directory named by theptolemy.ptII.tosroot property does not exist.
 */
private String _generateMakefile() throws IllegalActionException, CancelException {
  if (tosRoot == null || tosRoot.asFile() == null || !tosRoot.asFile().isDirectory()) {
    String fileName=(tosRoot == null ? "String_Node_Str" : tosRoot.asFile().toString());
    fileName=(fileName == null ? "String_Node_Str" : fileName);
    String tosRootMessage="String_Node_Str" + fileName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    if (!MessageHandler.yesNoQuestion(tosRootMessage + "String_Node_Str")) {
      throw new CancelException();
    }
  }
  if (tosDir == null || tosDir.asFile() == null || !tosDir.asFile().isDirectory()) {
    String fileName=(tosDir == null ? "String_Node_Str" : tosDir.asFile().toString());
    fileName=(fileName == null ? "String_Node_Str" : fileName);
    String tosDirMessage="String_Node_Str" + fileName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    if (!MessageHandler.yesNoQuestion(tosDirMessage + "String_Node_Str")) {
      throw new CancelException();
    }
  }
  _CodeString text=new _CodeString();
  text.addLine("String_Node_Str" + tosRoot.stringValue());
  text.addLine("String_Node_Str" + tosDir.stringValue());
  text.addLine("String_Node_Str");
  NamedObj toplevel=_toplevelNC();
  String toplevelName=_sanitizedFullName(toplevel);
  text.addLine("String_Node_Str" + toplevelName);
  text.addLine("String_Node_Str" + pflags.stringValue());
  text.addLine("String_Node_Str" + "String_Node_Str" + commandPort.getToken() + "String_Node_Str"+ eventPort.getToken());
  String nativeMethodName=toplevelName.replaceAll("String_Node_Str","String_Node_Str");
  text.addLine("String_Node_Str" + "String_Node_Str" + nativeMethodName);
  String[] targets=target.stringValue().split("String_Node_Str");
  for (int i=0; i < targets.length; i++) {
    if (targets[i].equals("String_Node_Str") || targets[i].equals("String_Node_Str")) {
      text.addLine("String_Node_Str");
      break;
    }
  }
  String ptIImk=StringUtilities.getProperty("String_Node_Str") + "String_Node_Str";
  text.addLine("String_Node_Str" + ptIImk.replaceAll("String_Node_Str","String_Node_Str"));
  text.addLine("String_Node_Str" + tosRoot.stringValue().replace('\\','/').replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str");
  String makefileName=toplevelName + "String_Node_Str";
  File directory=destinationDirectory.asFile();
  File writeFile=new File(directory,makefileName);
  if (_confirmOverwrite(writeFile)) {
    try {
      FileWriter writer=new FileWriter(writeFile);
      writer.write(text.toString());
      writer.close();
    }
 catch (    IOException e) {
      throw new IllegalActionException(this,e,"String_Node_Str");
    }
  }
  return makefileName;
}

Fixed version (ground truth):
/** 
 * Generate makefile. // FIXME example TOSROOT=/home/celaine/ptII/vendors/ptinyos/tinyos-1.x TOSDIR=/home/celaine/ptII/vendors/ptinyos/tinyos-1.x/tos TOSMAKE_PATH += $(TOSROOT)/contrib/ptII/ptinyos/tools/make COMPONENT=_SenseToLedsInWireless_MicaBoard_MicaActor3071 PFLAGS += -I%T/lib/Counters PFLAGS += -DCOMMAND_PORT=10584 -DEVENT_PORT=10585 PFLAGS += -D_PTII_NODEID=0 MY_PTCC_FLAGS += -D_PTII_NODE_NAME=_1SenseToLedsInWireless_1MicaBoard_1MicaActor3071 PFLAGS += "-I$(TOSROOT)/contrib/ptII/ptinyos/beta/TOSSIM-packet" include /home/celaine/ptII/mk/ptII.mk include /home/celaine/ptII/vendors/ptinyos/tinyos-1.x/tools/make/Makerules
 * @exception CancelException If the directory named by theptolemy.ptII.tosroot property does not exist.
 */
private String _generateMakefile() throws IllegalActionException, CancelException {
  if (tosRoot == null || tosRoot.asFile() == null || !tosRoot.asFile().isDirectory()) {
    String fileName=(tosRoot == null ? "String_Node_Str" : tosRoot.asFile().toString());
    fileName=(fileName == null ? "String_Node_Str" : fileName);
    String tosRootMessage="String_Node_Str" + fileName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    if (!MessageHandler.yesNoQuestion(tosRootMessage + "String_Node_Str")) {
      throw new CancelException();
    }
  }
  if (tosDir == null || tosDir.asFile() == null || !tosDir.asFile().isDirectory()) {
    String fileName=(tosDir == null ? "String_Node_Str" : tosDir.asFile().toString());
    fileName=(fileName == null ? "String_Node_Str" : fileName);
    String tosDirMessage="String_Node_Str" + fileName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    if (!MessageHandler.yesNoQuestion(tosDirMessage + "String_Node_Str")) {
      throw new CancelException();
    }
  }
  _CodeString text=new _CodeString();
  text.addLine("String_Node_Str" + tosRoot.stringValue());
  text.addLine("String_Node_Str" + tosDir.stringValue());
  text.addLine("String_Node_Str");
  NamedObj toplevel=_toplevelNC();
  String toplevelName=_sanitizedFullName(toplevel);
  text.addLine("String_Node_Str" + toplevelName);
  text.addLine("String_Node_Str" + pflags.stringValue());
  text.addLine("String_Node_Str" + "String_Node_Str" + commandPort.getToken() + "String_Node_Str"+ eventPort.getToken());
  text.addLine("String_Node_Str" + "String_Node_Str" + nodeID.getToken());
  String nativeMethodName=toplevelName.replaceAll("String_Node_Str","String_Node_Str");
  text.addLine("String_Node_Str" + "String_Node_Str" + nativeMethodName);
  String[] targets=target.stringValue().split("String_Node_Str");
  for (int i=0; i < targets.length; i++) {
    if (targets[i].equals("String_Node_Str") || targets[i].equals("String_Node_Str")) {
      text.addLine("String_Node_Str" + "String_Node_Str");
      break;
    }
  }
  String ptIImk=StringUtilities.getProperty("String_Node_Str") + "String_Node_Str";
  text.addLine("String_Node_Str" + ptIImk.replaceAll("String_Node_Str","String_Node_Str"));
  text.addLine("String_Node_Str" + tosRoot.stringValue().replace('\\','/').replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str");
  String makefileName=toplevelName + "String_Node_Str";
  File directory=destinationDirectory.asFile();
  File writeFile=new File(directory,makefileName);
  if (_confirmOverwrite(writeFile)) {
    try {
      FileWriter writer=new FileWriter(writeFile);
      writer.write(text.toString());
      writer.close();
    }
 catch (    IOException e) {
      throw new IllegalActionException(this,e,"String_Node_Str");
    }
  }
  return makefileName;
}