nus-yam/ex-repair huggingface dataset:
Program: 13422
Project: 13422
Buggy source:
private Element processInDesignComponent(InDesignComponent comp) throws Exception {
  String tagName=comp.getInxTagName();
  if (tagName == null) {
    throw new Exception("String_Node_Str" + comp);
  }
  Element myElement=this.currentParentNode.getOwnerDocument().createElement(tagName);
  this.currentParentNode.appendChild(myElement);
  for (  String propName : comp.getPropertyMap().keySet()) {
    InxValue value=comp.getValueObject(propName);
    myElement.setAttribute(propName,value.toEncodedString());
  }
  Node origParent=currentParentNode;
  currentParentNode=myElement;
  for (  InDesignComponent childComp : comp.getChildren()) {
    childComp.accept(this);
  }
  currentParentNode=origParent;
  return myElement;
}

Fixed version (ground truth):
private Element processInDesignComponent(InDesignComponent comp) throws Exception {
  comp.updatePropertyMap();
  String tagName=comp.getInxTagName();
  if (tagName == null) {
    throw new Exception("String_Node_Str" + comp);
  }
  Element myElement=this.currentParentNode.getOwnerDocument().createElement(tagName);
  this.currentParentNode.appendChild(myElement);
  for (  String propName : comp.getPropertyMap().keySet()) {
    InxValue value=comp.getValueObject(propName);
    myElement.setAttribute(propName,value.toEncodedString());
  }
  Node origParent=currentParentNode;
  currentParentNode=myElement;
  for (  InDesignComponent childComp : comp.getChildren()) {
    childComp.accept(this);
  }
  currentParentNode=origParent;
  return myElement;
}
Program: 13424
Project: 13424
Buggy source:
/** 
 * Tests the ability to access the page masters and frames within those page masters.
 * @throws Throwable
 */
public void testPageProperities() throws Throwable {
  InDesignDocument doc=new InDesignDocument();
  MasterSpread master;
  Spread spread;
  Collection<Page> pages;
  Page page;
  List<TextFrame> frames;
  String masterName;
  masterName="String_Node_Str";
  doc.load(inxData);
  master=doc.getMasterSpread(masterName);
  assertNotNull(master);
  pages=master.getPages();
  page=master.getEvenPage();
  assertNotNull(page);
  assertEquals("String_Node_Str",PageSideOption.LEFT_HAND,page.getPageSide());
  page=master.getOddPage();
  assertNotNull(page);
  assertEquals("String_Node_Str",PageSideOption.RIGHT_HAND,page.getPageSide());
  doc=new InDesignDocument();
  doc.load(geoTest);
  spread=doc.getSpreads().get(0);
  assertNotNull("String_Node_Str",spread);
  frames=spread.getAllFrames();
  assertNotNull("String_Node_Str",frames);
  assertTrue("String_Node_Str",frames.size() > 0);
  page=spread.getOddPage();
  assertNotNull("String_Node_Str",page);
  assertEquals("String_Node_Str",spread,page.getParent());
  frames=page.getAllFrames();
  assertNotNull("String_Node_Str",frames);
  assertTrue("String_Node_Str",frames.size() > 0);
  assertEquals("String_Node_Str" + frames.size(),5,frames.size());
}

Fixed version (ground truth):
/** 
 * Tests the ability to access the page masters and frames within those page masters.
 * @throws Throwable
 */
public void testPageProperities() throws Throwable {
  InDesignDocument doc=new InDesignDocument();
  MasterSpread master;
  Spread spread;
  Collection<Page> pages;
  Page page;
  List<TextFrame> frames;
  String masterName;
  masterName="String_Node_Str";
  doc.load(inxData);
  master=doc.getMasterSpread(masterName);
  assertNotNull(master);
  pages=master.getPages();
  page=master.getEvenPage();
  assertNotNull(page);
  assertEquals("String_Node_Str",PageSideOption.LEFT_HAND,page.getPageSide());
  page=master.getOddPage();
  assertNotNull(page);
  assertEquals("String_Node_Str",PageSideOption.RIGHT_HAND,page.getPageSide());
  doc=new InDesignDocument();
  doc.load(geoTest);
  spread=doc.getSpreads().get(0);
  return;
}
Program: 13425
Project: 13425
Buggy source:
@Override public void updatePropertyMap() throws Exception {
  super.updatePropertyMap();
  this.setObjectReferenceProperty(InDesignDocument.PROP_FTXF,this.getFirstFrameInThread());
  this.setObjectReferenceProperty(InDesignDocument.PROP_PTXF,this.previousInThread);
  this.setObjectReferenceProperty(InDesignDocument.PROP_NTXF,this.nextInThread);
  this.setObjectReferenceProperty(InDesignDocument.PROP_LTXF,this.getLastFrameInThread());
  this.setObjectReferenceProperty(InDesignDocument.PROP_STRP,this.parentStory);
}

Fixed version (ground truth):
@Override public void updatePropertyMap() throws Exception {
  super.updatePropertyMap();
  this.setObjectReferenceProperty(InDesignDocument.PROP_FTXF,this.getFirstFrameInThread());
  this.setObjectReferenceProperty(InDesignDocument.PROP_PTXF,this.getPreviousInThread());
  this.setObjectReferenceProperty(InDesignDocument.PROP_NTXF,this.getNextInThread());
  this.setObjectReferenceProperty(InDesignDocument.PROP_LTXF,this.getLastFrameInThread());
  this.setObjectReferenceProperty(InDesignDocument.PROP_STRP,this.getParentStory());
}
Program: 13426
Project: 13426
Buggy source:
/** 
 * Adds a new member, if the key is not already in the BOS. If the key is in the BOS, updates the existing member with the specified parent and returns the resulting member.
 * @param parentMember
 * @param member 
 * @return 
 */
public abstract BosMember addMember(BosMember parentMember,BosMember member) throws BosException ;

Fixed version (ground truth):
/** 
 * Adds a new member.
 * @param member Member to add if it is not already a member, based on member key matching.
 * @return The BosMember added or the pre-existing member instance.
 */
public abstract BosMember addMember(BosMember member);
Program: 13427
Project: 13427
Buggy source:
/** 
 * @param bos
 * @param dataSourceUri
 */
public BosMemberBase(DitaBoundedObjectSetImpl bos,URI dataSourceUri){
  this.bos=bos;
  this.setDataSourceUri(dataSourceUri);
  this.setEffectiveUri(dataSourceUri);
  this.key=dataSourceUri.toString();
}

Fixed version (ground truth):
/** 
 * @param bos
 * @param dataSourceUri
 */
public BosMemberBase(DitaBoundedObjectSet bos,URI dataSourceUri){
  this.bos=bos;
  this.setDataSourceUri(dataSourceUri);
  this.setEffectiveUri(dataSourceUri);
  this.key=dataSourceUri.toString();
}
Program: 13428
Project: 13428
Buggy source:
public BosMember addMember(BosMember parentMember,BosMember member){
  String memberKey=member.getKey();
  if (!this.members.containsKey(memberKey)) {
    this.members.put(memberKey,member);
  }
 else {
    member=getMember(member.getKey());
  }
  if (parentMember != null)   parentMember.addChild(member);
  return member;
}

Fixed version (ground truth):
@Override public BosMember addMember(BosMember member){
  String memberKey=member.getKey();
  if (!this.members.containsKey(memberKey)) {
    this.members.put(memberKey,member);
  }
 else {
    member=getMember(member.getKey());
  }
  return member;
}
Program: 13429
Project: 13429
Buggy source:
/** 
 * @param key
 * @return
 */
private BosMember getMember(String key){
  return this.members.get(key);
}

Fixed version (ground truth):
/** 
 * @param key
 * @return
 */
protected BosMember getMember(String key){
  return this.members.get(key);
}
Program: 13431
Project: 13431
Buggy source:
private void findConrefDependencies(BoundedObjectSet bos,XmlBosMember member,Set<BosMember> newMembers) throws Exception {
  NodeList conrefs;
  try {
    conrefs=(NodeList)DitaUtil.allConrefs.evaluate(member.getElement(),XPathConstants.NODESET);
  }
 catch (  XPathExpressionException e) {
    throw new BosException("String_Node_Str" + DitaUtil.allTopicrefs);
  }
  for (int i=0; i < conrefs.getLength(); i++) {
    Element conref=(Element)conrefs.item(i);
    Document targetDoc=null;
    String href=null;
    try {
      if (conref.hasAttribute("String_Node_Str")) {
        targetDoc=resolveKeyrefToDoc(conref.getAttribute("String_Node_Str"));
      }
      if (targetDoc == null && conref.hasAttribute("String_Node_Str")) {
        href=conref.getAttribute("String_Node_Str");
        if (!href.startsWith("String_Node_Str"))         targetDoc=AddressingUtil.resolveHrefToDoc(conref,href,bosConstructionOptions,this.failOnAddressResolutionFailure);
      }
    }
 catch (    AddressingException e) {
      if (this.failOnAddressResolutionFailure) {
        throw new BosException("String_Node_Str" + conref.getAttribute("String_Node_Str") + "String_Node_Str",e);
      }
    }
    if (targetDoc != null && targetDoc != member.getDocument()) {
      BosMember childMember=bos.constructBosMember(member,targetDoc);
      newMembers.add(childMember);
      if (href != null) {
        member.registerDependency(href,childMember,Constants.CONREF_DEPENDENCY);
      }
    }
  }
}

Fixed version (ground truth):
private void findConrefDependencies(BoundedObjectSet bos,XmlBosMember member,Set<BosMember> newMembers) throws Exception {
  NodeList conrefs;
  try {
    conrefs=(NodeList)DitaUtil.allConrefs.evaluate(member.getElement(),XPathConstants.NODESET);
  }
 catch (  XPathExpressionException e) {
    throw new BosException("String_Node_Str" + DitaUtil.allTopicrefs);
  }
  for (int i=0; i < conrefs.getLength(); i++) {
    Element conref=(Element)conrefs.item(i);
    Document targetDoc=null;
    String href=null;
    try {
      if (conref.hasAttribute("String_Node_Str")) {
        targetDoc=resolveKeyrefToDoc(conref.getAttribute("String_Node_Str"));
      }
      if (targetDoc == null && conref.hasAttribute("String_Node_Str")) {
        href=conref.getAttribute("String_Node_Str");
        if (!href.startsWith("String_Node_Str"))         targetDoc=AddressingUtil.resolveHrefToDoc(conref,href,bosConstructionOptions,this.failOnAddressResolutionFailure);
      }
    }
 catch (    AddressingException e) {
      if (this.failOnAddressResolutionFailure) {
        throw new BosException("String_Node_Str" + conref.getAttribute("String_Node_Str") + "String_Node_Str",e);
      }
    }
    if (targetDoc != null && targetDoc != member.getDocument()) {
      BosMember childMember=bos.constructBosMember(member,targetDoc);
      newMembers.add(childMember);
      if (href != null) {
        bos.addMemberAsDependency(href,Constants.CONREF_DEPENDENCY,member,childMember);
      }
 else {
        bos.addMember(childMember);
      }
    }
  }
}
Program: 13433
Project: 13433
Buggy source:
/** 
 * @param bos
 * @param member
 * @throws Exception 
 */
protected void walkMemberGetDependencies(BoundedObjectSet bos,BosMember member) throws Exception {
  if (!(member instanceof XmlBosMember)) {
  }
 else {
    Element elem=((XmlBosMember)member).getElement();
    this.walkedMembers.add(member);
    if (DitaUtil.isDitaMap(elem)) {
      walkMapGetDependencies(bos,(DitaMapBosMemberImpl)member);
    }
 else     if (DitaUtil.isDitaTopic(elem) || DitaUtil.isDitaBase(elem)) {
      walkTopicGetDependencies(bos,(DitaTopicBosMemberImpl)member);
    }
 else {
      log.warn("String_Node_Str" + elem.getTagName() + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * @param bos
 * @param member
 * @throws Exception 
 */
protected void walkMemberGetDependencies(BoundedObjectSet bos,BosMember member) throws Exception {
  if (!(member instanceof XmlBosMember)) {
  }
 else {
    Element elem=((XmlBosMember)member).getElement();
    this.walkedMembers.add(member);
    if (DitaUtil.isDitaMap(elem)) {
      walkMapGetDependencies(bos,(DitaMapBosMember)member);
    }
 else     if (DitaUtil.isDitaTopic(elem) || DitaUtil.isDitaBase(elem)) {
      walkTopicGetDependencies(bos,(DitaTopicBosMember)member);
    }
 else {
      log.warn("String_Node_Str" + elem.getTagName() + "String_Node_Str");
    }
  }
}
Program: 13434
Project: 13434
Buggy source:
/** 
 * Handles DITA BOS members in order to do pointer rewriting. By default calls rewriteLocalUris(), which must be implemented by subclasses. Can override this method to add different business logic (such as handling pointers to external or peer resources, rewriting key references, updating content in a CMS, etc.).
 */
public void visit(DitaBosMemberImpl bosMember) throws BosException {
  try {
    if (rewriteLocalUris(bosMember)) {
    }
  }
 catch (  AddressingException e) {
    throw new BosException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Handles DITA BOS members in order to do pointer rewriting. By default calls rewriteLocalUris(), which must be implemented by subclasses. Can override this method to add different business logic (such as handling pointers to external or peer resources, rewriting key references, updating content in a CMS, etc.).
 */
public void visit(DitaBosMember bosMember) throws BosException {
  try {
    if (rewriteLocalUris(bosMember)) {
    }
  }
 catch (  AddressingException e) {
    throw new BosException("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 13435
Project: 13435
Buggy source:
public boolean rewriteLocalUris(DitaBosMemberImpl member) throws BosException, AddressingException {
  log.debug("String_Node_Str" + member + "String_Node_Str");
  NodeList nl;
  try {
    nl=(NodeList)DitaUtil.allHrefsAndConrefs.evaluate(member.getElement(),XPathConstants.NODESET);
  }
 catch (  XPathExpressionException e) {
    throw new BosException("String_Node_Str" + DitaUtil.allHrefsAndConrefs,e);
  }
  boolean contentModified=false;
  if (nl.getLength() > 0) {
    for (int i=0; i < nl.getLength(); i++) {
      Element ref=(Element)nl.item(i);
      if (ref.hasAttribute("String_Node_Str") && DitaUtil.isLocalScope(ref))       ;
      String href=ref.getAttribute("String_Node_Str");
      BosMember depMember=member.getDependency(href);
      if (depMember == null) {
        log.warn("String_Node_Str" + href + "String_Node_Str");
        continue;
      }
      String newHref=constructNewHref(member,depMember,ref);
      ref.setAttribute("String_Node_Str",newHref);
      contentModified=true;
      log.debug("String_Node_Str" + href + "String_Node_Str"+ newHref+ "String_Node_Str");
    }
  }
  return contentModified;
}

Fixed version (ground truth):
public boolean rewriteLocalUris(DitaBosMember member) throws BosException, AddressingException {
  log.debug("String_Node_Str" + member + "String_Node_Str");
  NodeList nl;
  try {
    nl=(NodeList)DitaUtil.allHrefsAndConrefs.evaluate(member.getElement(),XPathConstants.NODESET);
  }
 catch (  XPathExpressionException e) {
    throw new BosException("String_Node_Str" + DitaUtil.allHrefsAndConrefs,e);
  }
  boolean contentModified=false;
  if (nl.getLength() > 0) {
    for (int i=0; i < nl.getLength(); i++) {
      Element ref=(Element)nl.item(i);
      if (ref.hasAttribute("String_Node_Str") && DitaUtil.isLocalScope(ref))       ;
      String href=ref.getAttribute("String_Node_Str");
      BosMember depMember=member.getDependency(href);
      if (depMember == null) {
        log.warn("String_Node_Str" + href + "String_Node_Str");
        continue;
      }
      String newHref=constructNewHref(member,depMember,ref);
      ref.setAttribute("String_Node_Str",newHref);
      contentModified=true;
      log.debug("String_Node_Str" + href + "String_Node_Str"+ newHref+ "String_Node_Str");
    }
  }
  return contentModified;
}
Program: 13436
Project: 13436
Buggy source:
/** 
 * @param member 
 * @param depMember 
 * @param ref
 * @return
 * @throws AddressingException 
 */
protected abstract String constructNewHref(DitaBosMemberImpl member,BosMember depMember,Element ref) throws BosException, AddressingException ;

Fixed version (ground truth):
/** 
 * @param member 
 * @param depMember 
 * @param ref
 * @return
 * @throws AddressingException 
 */
protected abstract String constructNewHref(DitaBosMember member,BosMember depMember,Element ref) throws BosException, AddressingException ;
Program: 13437
Project: 13437
Buggy source:
@Override protected String constructNewHref(DitaBosMemberImpl member,BosMember depMember,Element ref) throws BosException, AddressingException {
  URI baseUri;
  try {
    baseUri=AddressingUtil.getParent(member.getEffectiveUri());
  }
 catch (  URISyntaxException e) {
    throw new AddressingException("String_Node_Str" + member.getEffectiveUri() + "String_Node_Str"+ e.getMessage());
  }
catch (  MalformedURLException e) {
    throw new AddressingException("String_Node_Str" + member.getEffectiveUri() + "String_Node_Str"+ e.getMessage());
  }
catch (  IOException e) {
    throw new AddressingException("String_Node_Str" + member.getEffectiveUri() + "String_Node_Str"+ e.getMessage());
  }
  URI depUri=depMember.getEffectiveUri();
  String newHref=AddressingUtil.getRelativePath(depUri,baseUri);
  log.debug("String_Node_Str" + newHref + "String_Node_Str");
  return newHref;
}

Fixed version (ground truth):
@Override protected String constructNewHref(DitaBosMember member,BosMember depMember,Element ref) throws BosException, AddressingException {
  URI baseUri;
  try {
    baseUri=AddressingUtil.getParent(member.getEffectiveUri());
  }
 catch (  URISyntaxException e) {
    throw new AddressingException("String_Node_Str" + member.getEffectiveUri() + "String_Node_Str"+ e.getMessage());
  }
catch (  MalformedURLException e) {
    throw new AddressingException("String_Node_Str" + member.getEffectiveUri() + "String_Node_Str"+ e.getMessage());
  }
catch (  IOException e) {
    throw new AddressingException("String_Node_Str" + member.getEffectiveUri() + "String_Node_Str"+ e.getMessage());
  }
  URI depUri=depMember.getEffectiveUri();
  String newHref=AddressingUtil.getRelativePath(depUri,baseUri);
  log.debug("String_Node_Str" + newHref + "String_Node_Str");
  return newHref;
}
Program: 13438
Project: 13438
Buggy source:
private static File getFileForUrlString(File baseFile,String fileUrlStr) throws AddressingException {
  File resultFile=null;
  try {
    URL baseUrl=baseFile.toURL();
    URL targetUrl=new URL(baseUrl,fileUrlStr);
    resultFile=new File(targetUrl.getFile());
  }
 catch (  Throwable e) {
    throw new AddressingException("String_Node_Str" + fileUrlStr + "String_Node_Str",e);
  }
  return resultFile;
}

Fixed version (ground truth):
private static File getFileForUrlString(File baseFile,String fileUrlStr) throws AddressingException {
  File resultFile=null;
  try {
    URL baseUrl=baseFile.toURI().toURL();
    ;
    URL targetUrl=new URL(baseUrl,fileUrlStr);
    resultFile=new File(targetUrl.getFile());
  }
 catch (  Throwable e) {
    throw new AddressingException("String_Node_Str" + fileUrlStr + "String_Node_Str",e);
  }
  return resultFile;
}
Program: 13440
Project: 13440
Buggy source:
/** 
 * @throws Exception 
 */
private void run() throws Exception {
  DitaDxpOptions dxpOptions=new DitaDxpOptions();
  handleCommonDxpOptions(dxpOptions);
  String dxpFilepath=commandLine.getOptionValue(INPUT_OPTION_ONE_CHAR);
  File dxpFile=new File(dxpFilepath);
  checkExistsAndCanReadSystemExit(dxpFile);
  if (!dxpOptions.isQuiet())   log.info("String_Node_Str" + dxpFile.getAbsolutePath() + "String_Node_Str");
  String outputDirpath=commandLine.getOptionValue(OUTPUT_OPTION_ONE_CHAR);
  File outputDir=new File(outputDirpath);
  if (outputDir.exists() && !outputDir.isDirectory()) {
    System.err.println("String_Node_Str" + outputDirpath + "String_Node_Str");
    System.exit(1);
  }
  outputDir.mkdirs();
  if (!outputDir.exists()) {
    System.err.println("String_Node_Str" + outputDirpath + "String_Node_Str");
    System.exit(1);
  }
  if (!outputDir.canWrite()) {
    System.err.println("String_Node_Str" + outputDirpath + "String_Node_Str");
    System.exit(1);
  }
  String[] mapIds=commandLine.getOptionValues(MAPS_ID_OPTION_ONE_CHAR);
  if (mapIds != null && mapIds.length > 0) {
    for (    String mapId : mapIds) {
      dxpOptions.addMapId(mapId);
    }
  }
  try {
    DitaDxpHelper.unpackDxpPackage(dxpFile,outputDir,dxpOptions,log);
  }
 catch (  DitaDxpException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * @throws Exception 
 */
private void run() throws Exception {
  DitaDxpOptions dxpOptions=new DitaDxpOptions();
  handleCommonBosProcessorOptions(dxpOptions);
  String dxpFilepath=commandLine.getOptionValue(INPUT_OPTION_ONE_CHAR);
  File dxpFile=new File(dxpFilepath);
  checkExistsAndCanReadSystemExit(dxpFile);
  if (!dxpOptions.isQuiet())   log.info("String_Node_Str" + dxpFile.getAbsolutePath() + "String_Node_Str");
  String outputDirpath=commandLine.getOptionValue(OUTPUT_OPTION_ONE_CHAR);
  File outputDir=new File(outputDirpath);
  if (outputDir.exists() && !outputDir.isDirectory()) {
    System.err.println("String_Node_Str" + outputDirpath + "String_Node_Str");
    System.exit(1);
  }
  outputDir.mkdirs();
  if (!outputDir.exists()) {
    System.err.println("String_Node_Str" + outputDirpath + "String_Node_Str");
    System.exit(1);
  }
  if (!outputDir.canWrite()) {
    System.err.println("String_Node_Str" + outputDirpath + "String_Node_Str");
    System.exit(1);
  }
  String[] mapIds=commandLine.getOptionValues(MAPS_ID_OPTION_ONE_CHAR);
  if (mapIds != null && mapIds.length > 0) {
    for (    String mapId : mapIds) {
      dxpOptions.addMapId(mapId);
    }
  }
  try {
    DitaDxpHelper.unpackDxpPackage(dxpFile,outputDir,dxpOptions,log);
  }
 catch (  DitaDxpException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}
Program: 13442
Project: 13442
Buggy source:
/** 
 * Extracts only the local dependencies used from a map from a DXP package.
 * @param zipFile
 * @param mapEntry
 * @param outputDir
 * @param dxpOptions
 * @throws IOException 
 * @throws DomException 
 * @throws DitaBosHelperException 
 * @throws BosException 
 */
private static void extractMap(ZipFile zipFile,ZipEntry mapEntry,File outputDir,DitaDxpOptions dxpOptions) throws IOException, DomException, BosException, DitaBosHelperException {
  Map<URI,Document> domCache=new HashMap<URI,Document>();
  if (!dxpOptions.isQuiet())   log.info("String_Node_Str" + mapEntry.getName() + "String_Node_Str");
  BosConstructionOptions bosOptions=new BosConstructionOptions(log,domCache);
  InputSource source=new InputSource(zipFile.getInputStream(mapEntry));
  File dxpFile=new File(zipFile.getName());
  URL baseUri=new URL("String_Node_Str" + dxpFile.toURL().toExternalForm() + "String_Node_Str");
  URL mapUrl=new URL(baseUri,mapEntry.getName());
  source.setSystemId(mapUrl.toExternalForm());
  Document rootMap=DomUtil.getDomForSource(source,bosOptions,false);
  DitaBoundedObjectSet mapBos=DitaBosHelper.calculateMapBos(bosOptions,log,rootMap);
  MapCopyingBosVisitor visitor=new MapCopyingBosVisitor(outputDir);
  visitor.visit(mapBos);
  if (!dxpOptions.isQuiet())   log.info("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Extracts only the local dependencies used from a map from a DXP package.
 * @param zipFile
 * @param mapEntry
 * @param outputDir
 * @param dxpOptions
 * @throws IOException 
 * @throws DomException 
 * @throws DitaBosHelperException 
 * @throws BosException 
 */
private static void extractMap(ZipFile zipFile,ZipEntry mapEntry,File outputDir,MapBosProcessorOptions dxpOptions) throws IOException, DomException, BosException, DitaBosHelperException {
  Map<URI,Document> domCache=new HashMap<URI,Document>();
  if (!dxpOptions.isQuiet())   log.info("String_Node_Str" + mapEntry.getName() + "String_Node_Str");
  BosConstructionOptions bosOptions=new BosConstructionOptions(log,domCache);
  InputSource source=new InputSource(zipFile.getInputStream(mapEntry));
  File dxpFile=new File(zipFile.getName());
  URL baseUri=new URL("String_Node_Str" + dxpFile.toURI().toURL().toExternalForm() + "String_Node_Str");
  URL mapUrl=new URL(baseUri,mapEntry.getName());
  source.setSystemId(mapUrl.toExternalForm());
  Document rootMap=DomUtil.getDomForSource(source,bosOptions,false);
  DitaBoundedObjectSet mapBos=DitaBosHelper.calculateMapBos(bosOptions,log,rootMap);
  MapCopyingBosVisitor visitor=new MapCopyingBosVisitor(outputDir);
  visitor.visit(mapBos);
  if (!dxpOptions.isQuiet())   log.info("String_Node_Str");
}
Program: 13444
Project: 13444
Buggy source:
/** 
 * @param rootUrl URL of the root map 
 * @param outputDir
 * @throws MalformedURLException 
 */
public MapCopyingBosVisitor(File outputDir) throws MalformedURLException {
  super(log);
  this.outputUrl=outputDir.toURL();
}

Fixed version (ground truth):
/** 
 * @param rootUrl URL of the root map 
 * @param outputDir
 * @throws MalformedURLException 
 */
public MapCopyingBosVisitor(File outputDir) throws MalformedURLException {
  super(log);
  this.outputUrl=outputDir.toURI().toURL();
}
Program: 13446
Project: 13446
Buggy source:
/** 
 * @param mapFile
 * @param resultInxFile
 * @param options
 * @throws Exception 
 */
private void generateInDesign(File mapFile,File resultInxFile,Map2InDesignOptions options) throws Exception {
  InDesignFromDitaMapBuilder builder=new InDesignFromDitaMapBuilder();
  InDesignDocument doc=builder.buildMapDocument(mapFile.toURL(),options);
  InxWriter writer=new InxWriter(resultInxFile);
  writer.write(doc);
}

Fixed version (ground truth):
/** 
 * @param mapFile
 * @param resultInxFile
 * @param options
 * @throws Exception 
 */
private void generateInDesign(File mapFile,File resultInxFile,Map2InDesignOptions options) throws Exception {
  InDesignFromDitaMapBuilder builder=new InDesignFromDitaMapBuilder();
  InDesignDocument doc=builder.buildMapDocument(mapFile.toURI().toURL(),options);
  InxWriter writer=new InxWriter(resultInxFile);
  writer.write(doc);
}
Program: 13447
Project: 13447
Buggy source:
/** 
 * @return the pageBinding
 */
public Enum<PageBindingOption> getPageBinding() throws Exception {
  return getEnumProperty("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @return the pageBinding
 */
public Enum<PageBindingOption> getPageBinding() throws Exception {
  return (PageBindingOption)getEnumProperty("String_Node_Str");
}
Program: 13448
Project: 13448
Buggy source:
/** 
 * @param link Link to the external object for the image (e.g., EPS file, etc.).
 */
public void setItemLink(Link link){
  this.addChild(link);
  this.itemLink=link;
}

Fixed version (ground truth):
/** 
 * @param link Link to the external object for the image (e.g., EPS file, etc.).
 * @throws Exception 
 */
public void setItemLink(Link link) throws Exception {
  this.addChild(link);
  this.itemLink=link;
}
Program: 13449
Project: 13449
Buggy source:
/** 
 * @param sourceObj
 * @throws Exception 
 */
protected void loadComponent(InDesignComponent sourceObj) throws Exception {
  this.inxTagname=sourceObj.getInxTagName();
  if (sourceObj != null) {
    for (    String propName : sourceObj.getPropertyMap().keySet()) {
      this.setProperty(propName,sourceObj.getPropertyValue(propName));
    }
  }
  setTagsFromPtagProperty();
  for (  InDesignComponent child : sourceObj.getChildren()) {
    InDesignComponent newChild=this.getDocument().clone(child);
    this.childObjects.add(newChild);
  }
}

Fixed version (ground truth):
/** 
 * @param sourceObj
 * @throws Exception 
 */
protected void loadComponent(InDesignComponent sourceObj) throws Exception {
  this.inxTagname=sourceObj.getInxTagName();
  if (sourceObj != null) {
    for (    String propName : sourceObj.getPropertyMap().keySet()) {
      this.setProperty(propName,sourceObj.getPropertyValue(propName));
    }
  }
  setTagsFromPtagProperty();
  for (  InDesignComponent child : sourceObj.getChildren()) {
    InDesignComponent newChild=this.getDocument().clone(child);
    addChild(newChild);
  }
}
Program: 13450
Project: 13450
Buggy source:
/** 
 * @param run
 */
public void addChild(InDesignComponent child){
  this.childObjects.add(child);
  child.setParent(this);
}

Fixed version (ground truth):
/** 
 * @param run
 * @throws Exception 
 */
public void addChild(InDesignComponent child) throws Exception {
  this.childObjects.add(child);
  child.setParent(this);
}
Program: 13451
Project: 13451
Buggy source:
/** 
 * @param class1
 * @param dataSource
 * @return
 * @throws Exception 
 * @throws InstantiationException 
 */
private InDesignComponent newObject(Class<? extends InDesignObject> clazz,Element dataSource) throws Exception {
  logger.debug("String_Node_Str" + clazz.getSimpleName() + "String_Node_Str");
  InDesignObject obj=(InDesignObject)clazz.newInstance();
  obj.setDocument(this);
  if (dataSource != null) {
    logger.debug("String_Node_Str" + dataSource.getNodeName() + "String_Node_Str");
    obj.loadObject(dataSource);
    String selfValue=dataSource.getAttribute(PROP_SELF);
    if (selfValue != null && !"String_Node_Str".equals(selfValue.trim())) {
      String id=InxHelper.decodeRawValueToSingleString(selfValue);
      obj.setId(id);
      this.registerObject(obj);
    }
 else {
      assignIdAndRegister(obj);
    }
  }
  logger.debug("String_Node_Str" + obj.getId() + "String_Node_Str");
  return obj;
}

Fixed version (ground truth):
/** 
 * @param class1
 * @param dataSource
 * @return
 * @throws Exception 
 * @throws InstantiationException 
 */
private InDesignComponent newObject(Class<? extends InDesignObject> clazz,Element dataSource) throws Exception {
  logger.debug("String_Node_Str" + clazz.getSimpleName() + "String_Node_Str");
  InDesignObject obj=(InDesignObject)clazz.newInstance();
  obj.setDocument(this);
  if (dataSource != null) {
    logger.debug("String_Node_Str" + dataSource.getNodeName() + "String_Node_Str");
    obj.loadObject(dataSource);
    String selfValue=dataSource.getAttribute(PROP_SELF);
    if (selfValue != null && !"String_Node_Str".equals(selfValue.trim())) {
      String id=InxHelper.decodeRawValueToSingleString(selfValue);
      obj.setId(id);
      this.registerObject(obj);
    }
 else {
      assignIdAndRegister(obj);
    }
  }
 else {
    assignIdAndRegister(obj);
  }
  logger.debug("String_Node_Str" + obj.getId() + "String_Node_Str");
  return obj;
}
Program: 13452
Project: 13452
Buggy source:
/** 
 * Construct a new Story that is associated with the specified text frame,
 * @param frame Text frame to which the story is associated.
 * @return
 * @throws Exception 
 */
private Story newStory(TextFrame frame) throws Exception {
  Story story=new Story();
  assignIdAndRegister(story);
  this.addChild(story);
  this.stories.add(story);
  frame.setParentStory(story);
  return story;
}

Fixed version (ground truth):
/** 
 * Construct a new Story that is associated with the specified text frame,
 * @param frame Text frame to which the story is associated.
 * @return
 * @throws Exception 
 */
private Story newStory(TextFrame frame) throws Exception {
  Story story=new Story();
  assignIdAndRegister(story);
  this.addChild(story);
  frame.setParentStory(story);
  return story;
}
Program: 13453
Project: 13453
Buggy source:
/** 
 * @param masterSpreadName
 * @return
 * @throws Exception 
 */
public Spread addSpread(String masterSpreadName) throws Exception {
  Spread spread=new Spread();
  assignIdAndRegister(spread);
  spread.setParent(this);
  MasterSpread masterSpread=this.getMasterSpread(masterSpreadName);
  this.spreads.add(spread);
  spread.setTransformationMatrix(this.spreads.size() - 1);
  spread.setMasterSpread(masterSpread);
  this.addChild(spread);
  return spread;
}

Fixed version (ground truth):
/** 
 * @param masterSpreadName
 * @return
 * @throws Exception 
 */
public Spread addSpread(String masterSpreadName) throws Exception {
  Spread spread=new Spread();
  assignIdAndRegister(spread);
  spread.setParent(this);
  MasterSpread masterSpread=this.getMasterSpread(masterSpreadName);
  spread.setTransformationMatrix(this.spreads.size());
  this.spreads.add(spread);
  spread.setMasterSpread(masterSpread);
  this.addChild(spread);
  return spread;
}
Program: 13454
Project: 13454
Buggy source:
/** 
 * @param string
 * @return
 */
public InDesignComponent getObject(String id){
  return this.objectsById.get(id);
}

Fixed version (ground truth):
/** 
 * @param string
 * @return
 */
public InDesignObject getObject(String id){
  return this.objectsById.get(id);
}
Program: 13455
Project: 13455
Buggy source:
/** 
 * @param masterSpreadName
 * @return
 * @throws Exception 
 */
public Spread newSpread(String masterSpreadName) throws Exception {
  Spread newSpread=new Spread();
  assignIdAndRegister(newSpread);
  newSpread.setParent(this);
  MasterSpread masterSpread=this.getMasterSpread(masterSpreadName);
  if (masterSpread == null) {
    logger.info("String_Node_Str" + masterSpreadName + "String_Node_Str");
    for (    String key : this.masterSpreads.keySet()) {
      logger.info("String_Node_Str" + key + "String_Node_Str");
    }
    throw new Exception("String_Node_Str" + masterSpreadName + "String_Node_Str");
  }
  newSpread.setMasterSpread(masterSpread);
  newSpread.setTransformationMatrix(this.spreads.size());
  this.spreads.add(newSpread);
  this.addChild(newSpread);
  return newSpread;
}

Fixed version (ground truth):
/** 
 * @param masterSpreadName
 * @return
 * @throws Exception 
 */
public Spread newSpread(String masterSpreadName) throws Exception {
  Spread newSpread=new Spread();
  assignIdAndRegister(newSpread);
  newSpread.setParent(this);
  this.spreads.add(newSpread);
  MasterSpread masterSpread=this.getMasterSpread(masterSpreadName);
  if (masterSpread == null) {
    logger.info("String_Node_Str" + masterSpreadName + "String_Node_Str");
    for (    String key : this.masterSpreads.keySet()) {
      logger.info("String_Node_Str" + key + "String_Node_Str");
    }
    throw new Exception("String_Node_Str" + masterSpreadName + "String_Node_Str");
  }
  newSpread.setMasterSpread(masterSpread);
  newSpread.setTransformationMatrix(this.spreads.size());
  this.addChild(newSpread);
  return newSpread;
}
Program: 13456
Project: 13456
Buggy source:
/** 
 * @param child
 * @throws Exception 
 */
private DocumentPreferences newDocumentPreferences(Element child) throws Exception {
  DocumentPreferences prefs=(DocumentPreferences)newComponent(DocumentPreferences.class,child);
  this.addChild(prefs);
  this.docPrefs=prefs;
  return prefs;
}

Fixed version (ground truth):
/** 
 * @param child
 * @throws Exception 
 */
private DocumentPreferences newDocumentPreferences(Element child) throws Exception {
  DocumentPreferences prefs=(DocumentPreferences)newComponent(DocumentPreferences.class,child);
  this.addChild(prefs);
  return prefs;
}
Program: 13457
Project: 13457
Buggy source:
/** 
 * @param rect
 */
public void addRectangle(Rectangle rect){
  logger.debug("String_Node_Str" + rect);
  this.rectangles.put(rect.getId(),rect);
  if (rect instanceof TextFrame)   this.frames.put(rect.getId(),(TextFrame)rect);
  this.addChild(rect);
}

Fixed version (ground truth):
/** 
 * @param rect
 * @throws Exception 
 */
public void addRectangle(Rectangle rect) throws Exception {
  logger.debug("String_Node_Str" + rect);
  this.rectangles.put(rect.getId(),rect);
  if (rect instanceof TextFrame)   this.frames.put(rect.getId(),(TextFrame)rect);
  this.addChild(rect);
}
Program: 13458
Project: 13458
Buggy source:
/** 
 * Given the URI of an INCX (InCopy) article, parses it and returns the first story in the document.
 * @param inDesignDoc
 * @param incxFile
 * @return
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws IOException
 * @throws Exception
 */
public static Story getStoryForIncxDoc(InDesignDocument inDesignDoc,URI incxResource) throws ParserConfigurationException, SAXException, IOException, Exception {
  InputSource inputSource=new InputSource(incxResource.toURL().openStream());
  inputSource.setSystemId(incxResource.toString());
  DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
  DocumentBuilder db=dbf.newDocumentBuilder();
  Document doc=db.parse(inputSource);
  NodeList cflos=doc.getElementsByTagName("String_Node_Str");
  Element cfloElem=(Element)cflos.item(0);
  cfloElem.removeAttribute(InDesignDocument.PROP_SELF);
  Story incxStory=inDesignDoc.newStory(cfloElem);
  return incxStory;
}

Fixed version (ground truth):
/** 
 * Given the URI of an INCX (InCopy) article, parses it and returns the first story in the document.
 * @param inDesignDoc
 * @param incxFile
 * @return
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws IOException
 * @throws Exception
 */
public static Story getStoryForIncxDoc(InDesignDocument inDesignDoc,URI incxResource) throws ParserConfigurationException, SAXException, IOException, Exception {
  InputSource incxSource=new InputSource(incxResource.toURL().openStream());
  incxSource.setSystemId(incxResource.toString());
  InDesignDocument articleDoc=new InDesignDocument(incxSource);
  Story incxStory=articleDoc.getStoryIterator().next();
  Story importedStory=inDesignDoc.importStory(incxStory);
  return importedStory;
}
Program: 13459
Project: 13459
Buggy source:
/** 
 * @param valueStr
 */
public InxLong32(String rawValue){
  if (rawValue.startsWith("String_Node_Str"))   rawValue=rawValue.substring(2);
  if (rawValue.startsWith("String_Node_Str"))   rawValue=rawValue.substring(3);
  this.value=Long.parseLong(rawValue,16);
}

Fixed version (ground truth):
/** 
 * @param value
 */
public InxLong32(int value){
  this.value=value;
}
Program: 13460
Project: 13460
Buggy source:
/** 
 * @param sourceObj
 * @throws Exception 
 */
protected void loadComponent(InDesignComponent sourceObj) throws Exception {
  if (sourceObj != null) {
    for (    String propName : sourceObj.getPropertyMap().keySet()) {
      this.setProperty(propName,sourceObj.getPropertyValue(propName));
    }
  }
  setTagsFromPtagProperty();
  for (  InDesignComponent child : sourceObj.getChildren()) {
    InDesignComponent newChild=this.getDocument().clone(child);
  }
}

Fixed version (ground truth):
/** 
 * @param sourceObj
 * @throws Exception 
 */
protected void loadComponent(InDesignComponent sourceObj) throws Exception {
  this.inxTagname=sourceObj.getInxTagName();
  if (sourceObj != null) {
    for (    String propName : sourceObj.getPropertyMap().keySet()) {
      this.setProperty(propName,sourceObj.getPropertyValue(propName));
    }
  }
  setTagsFromPtagProperty();
  for (  InDesignComponent child : sourceObj.getChildren()) {
    InDesignComponent newChild=this.getDocument().clone(child);
    this.childObjects.add(newChild);
  }
}
Program: 13461
Project: 13461
Buggy source:
/** 
 * @throws Exception
 */
public Group() throws Exception {
  super();
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
public Group() throws Exception {
  super();
  this.setInxTagName("String_Node_Str");
}
Program: 13462
Project: 13462
Buggy source:
/** 
 * @throws Exception
 */
public Image() throws Exception {
  super();
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
public Image() throws Exception {
  super();
  setInxTagName("String_Node_Str");
}
Program: 13463
Project: 13463
Buggy source:
/** 
 * @param sourceObj
 */
protected void loadComponent(InDesignComponent sourceObj){
  if (sourceObj != null) {
    for (    String propName : sourceObj.getPropertyMap().keySet()) {
      this.setProperty(propName,sourceObj.getPropertyValue(propName));
    }
  }
}

Fixed version (ground truth):
/** 
 * @param sourceObj
 * @throws Exception 
 */
protected void loadComponent(InDesignComponent sourceObj) throws Exception {
  if (sourceObj != null) {
    for (    String propName : sourceObj.getPropertyMap().keySet()) {
      this.setProperty(propName,sourceObj.getPropertyValue(propName));
    }
  }
  setTagsFromPtagProperty();
  for (  InDesignComponent child : sourceObj.getChildren()) {
    InDesignComponent newChild=this.getDocument().clone(child);
  }
}
Program: 13464
Project: 13464
Buggy source:
/** 
 * @param dataSource
 * @throws Exception 
 */
private void loadPropertiesFromDataSource(Element dataSource) throws Exception {
  this.inxTagname=dataSource.getLocalName();
  NamedNodeMap atts=dataSource.getAttributes();
  for (int i=0; i < atts.getLength(); i++) {
    Attr att=(Attr)atts.item(i);
    String rawValue=att.getNodeValue();
    InxValue value=null;
    try {
      value=InxHelper.newValue(rawValue);
    }
 catch (    Exception e) {
      e.printStackTrace();
      throw e;
    }
    this.properties.put(att.getNodeName(),value);
  }
}

Fixed version (ground truth):
/** 
 * @param dataSource
 * @throws Exception 
 */
private void loadPropertiesFromDataSource(Element dataSource) throws Exception {
  this.inxTagname=dataSource.getNodeName();
  NamedNodeMap atts=dataSource.getAttributes();
  for (int i=0; i < atts.getLength(); i++) {
    Attr att=(Attr)atts.item(i);
    String rawValue=att.getNodeValue();
    InxValue value=null;
    try {
      value=InxHelper.newValue(rawValue);
    }
 catch (    Exception e) {
      e.printStackTrace();
      throw e;
    }
    this.properties.put(att.getNodeName(),value);
  }
}
Program: 13465
Project: 13465
Buggy source:
/** 
 * @param run
 */
protected void addChild(InDesignObject child){
  addChild((InDesignComponent)child);
  child.setParent(this);
}

Fixed version (ground truth):
/** 
 * @param run
 */
public void addChild(InDesignComponent child){
  this.childObjects.add(child);
  child.setParent(this);
}
Program: 13466
Project: 13466
Buggy source:
/** 
 * @param object
 * @param dataSource 
 * @return
 * @throws Exception 
 */
protected InDesignObject newObject(InDesignObject object,Element dataSource) throws Exception {
  addChild(object);
  object.loadObject(dataSource);
  return object;
}

Fixed version (ground truth):
/** 
 * @param object
 * @param dataSource 
 * @return
 * @throws Exception 
 */
protected InDesignComponent newObject(InDesignObject object,Element dataSource) throws Exception {
  addChild(object);
  object.loadObject(dataSource);
  return object;
}
Program: 13467
Project: 13467
Buggy source:
/** 
 * @param dataSource
 * @throws InDesignDocumentException 
 * @throws Exception 
 */
public void setDataSource(Element dataSource) throws Exception {
  this.dataSourceElement=dataSource;
  this.componentLoad();
}

Fixed version (ground truth):
/** 
 * @param dataSource
 * @throws InDesignDocumentException 
 * @throws Exception 
 */
public void setDataSource(Element dataSource) throws Exception {
  this.dataSourceElement=dataSource;
  if (dataSourceElement != null) {
    this.componentLoad();
  }
}
Program: 13468
Project: 13468
Buggy source:
/** 
 * Clones an object only if it hasn't been already cloned. Returns the clone.
 * @param sourceObj
 * @return The clone of the source object.
 * @throws Exception 
 */
public InDesignObject cloneIfNew(InDesignObject sourceObj,InDesignComponent targetParent) throws Exception {
  Map<String,InDesignObject> cloneMap=getCloneMapForDoc(sourceObj.getDocument());
  if (cloneMap.containsKey(sourceObj.getId()))   return cloneMap.get(sourceObj.getId());
  InDesignObject clone=this.clone(sourceObj);
  if (targetParent != null)   targetParent.addChild(clone);
  return clone;
}

Fixed version (ground truth):
/** 
 * Clones an object only if it hasn't been already cloned. Returns the clone.
 * @param sourceObj
 * @return The clone of the source object.
 * @throws Exception 
 */
public InDesignComponent cloneIfNew(InDesignObject sourceObj,InDesignComponent targetParent) throws Exception {
  Map<String,InDesignObject> cloneMap=getCloneMapForDoc(sourceObj.getDocument());
  if (cloneMap.containsKey(sourceObj.getId()))   return cloneMap.get(sourceObj.getId());
  InDesignComponent clone=this.clone(sourceObj);
  if (targetParent != null)   targetParent.addChild(clone);
  return clone;
}
Program: 13469
Project: 13469
Buggy source:
/** 
 * @param class1
 * @param dataSource
 * @return
 * @throws Exception 
 * @throws InstantiationException 
 */
private InDesignObject newObject(Class<? extends AbstractInDesignObject> clazz,Element dataSource) throws Exception {
  InDesignObject obj=(InDesignObject)clazz.newInstance();
  obj.setDocument(this);
  obj.loadObject(dataSource);
  this.registerObject(obj);
  return obj;
}

Fixed version (ground truth):
/** 
 * @param class1
 * @param dataSource
 * @return
 * @throws Exception 
 * @throws InstantiationException 
 */
private InDesignComponent newObject(Class<? extends AbstractInDesignObject> clazz,Element dataSource) throws Exception {
  InDesignObject obj=(InDesignObject)clazz.newInstance();
  obj.setDocument(this);
  obj.loadObject(dataSource);
  this.registerObject(obj);
  return obj;
}
Program: 13470
Project: 13470
Buggy source:
/** 
 * Construct a new Story that is associated with the specified text frame,
 * @param frame Text frame to which the story is associated.
 * @return
 */
private Story newStory(TextFrame frame){
  Story story=new Story();
  assignIdAndRegister(story);
  this.addChild(story);
  this.stories.add(story);
  frame.setParentStory(story);
  return story;
}

Fixed version (ground truth):
/** 
 * Construct a new Story that is associated with the specified text frame,
 * @param frame Text frame to which the story is associated.
 * @return
 * @throws Exception 
 */
private Story newStory(TextFrame frame) throws Exception {
  Story story=new Story();
  assignIdAndRegister(story);
  this.addChild(story);
  this.stories.add(story);
  frame.setParentStory(story);
  return story;
}
Program: 13471
Project: 13471
Buggy source:
/** 
 * @param masterSpreadName
 * @return
 * @throws Exception 
 */
public Spread addSpread(String masterSpreadName) throws Exception {
  Spread spread=new Spread();
  assignIdAndRegister(spread);
  spread.setParent(this);
  MasterSpread masterSpread=this.getMasterSpread(masterSpreadName);
  Element spreadDataSource=this.dataSource.createElement("String_Node_Str");
  spreadDataSource.setAttribute("String_Node_Str","String_Node_Str" + spread.getId());
  spreadDataSource.setAttribute("String_Node_Str","String_Node_Str" + masterSpread.getId());
  spreadDataSource.setAttribute("String_Node_Str","String_Node_Str" + masterSpread.getLongProperty("String_Node_Str"));
  this.spreads.add(spread);
  spread.setDataSource(spreadDataSource);
  spread.setTransformationMatrix(this.spreads.size() - 1);
  spread.setMasterSpread(masterSpread);
  this.addChild(spread);
  return spread;
}

Fixed version (ground truth):
/** 
 * @param masterSpreadName
 * @return
 * @throws Exception 
 */
public Spread addSpread(String masterSpreadName) throws Exception {
  Spread spread=new Spread();
  assignIdAndRegister(spread);
  spread.setParent(this);
  MasterSpread masterSpread=this.getMasterSpread(masterSpreadName);
  this.spreads.add(spread);
  spread.setTransformationMatrix(this.spreads.size() - 1);
  spread.setMasterSpread(masterSpread);
  this.addChild(spread);
  return spread;
}
Program: 13472
Project: 13472
Buggy source:
/** 
 * Create a new text frame. This results in a new story, which  the text frame is associated.
 * @return
 * @throws Exception 
 */
public TextFrame newTextFrame() throws Exception {
  TextFrame frame=new TextFrame();
  assignIdAndRegister(frame);
  this.newStory(frame);
  return frame;
}

Fixed version (ground truth):
/** 
 * Create a new text frame. This results in a new story, which  the text frame is associated.
 * @return
 * @throws Exception 
 */
public InDesignComponent newTextFrame() throws Exception {
  TextFrame frame=new TextFrame();
  assignIdAndRegister(frame);
  this.newStory(frame);
  return frame;
}
Program: 13473
Project: 13473
Buggy source:
/** 
 * Unconditionally clone an InDesign Object.
 * @param sourceObj
 * @return The clone of the object.
 * @throws Exception 
 */
public InDesignObject clone(InDesignObject sourceObj) throws Exception {
  logger.debug("String_Node_Str" + sourceObj.getClass().getSimpleName() + "String_Node_Str"+ sourceObj.getId()+ "String_Node_Str");
  InDesignObject clone=sourceObj.getClass().newInstance();
  assignIdAndRegister(clone);
  Map<String,InDesignObject> cloneMap=getCloneMapForDoc(sourceObj.getDocument());
  cloneMap.put(sourceObj.getId(),clone);
  clone.loadObject(sourceObj);
  return clone;
}

Fixed version (ground truth):
/** 
 * Unconditionally clone an InDesign Object.
 * @param sourceObj
 * @return The clone of the object.
 * @throws Exception 
 */
public InDesignComponent clone(InDesignObject sourceObj) throws Exception {
  logger.debug("String_Node_Str" + sourceObj.getClass().getSimpleName() + "String_Node_Str"+ sourceObj.getId()+ "String_Node_Str");
  InDesignObject clone=sourceObj.getClass().newInstance();
  assignIdAndRegister(clone);
  Map<String,InDesignObject> cloneMap=getCloneMapForDoc(sourceObj.getDocument());
  cloneMap.put(sourceObj.getId(),clone);
  clone.loadObject(sourceObj);
  clone.markAsModified();
  return clone;
}