nus-yam/ex-repair huggingface dataset:
Program: 185093
Project: 185093
Buggy source:
public synchronized static void configure(){
  if (!isConfigured()) {
    boolean disabled=Boolean.parseBoolean(Docx4jProperties.getProperties().getProperty("String_Node_Str","String_Node_Str"));
    if (disabled)     return;
    BasicConfigurator.configure();
    Logger.getRootLogger().setLevel(Level.INFO);
    Logger log=Logger.getLogger(Log4jConfigurator.class);
    log.info("String_Node_Str");
    try {
      org.docx4j.convert.out.pdf.viaXSLFO.Conversion.log.setLevel(Level.DEBUG);
    }
 catch (    NoClassDefFoundError n) {
    }
  }
}

Fixed version (ground truth):
public synchronized static void configure(){
  boolean disabled=Boolean.parseBoolean(Docx4jProperties.getProperties().getProperty("String_Node_Str","String_Node_Str"));
  if (disabled)   return;
  if (!isConfigured()) {
    BasicConfigurator.configure();
    Logger.getRootLogger().setLevel(Level.INFO);
    Logger log=Logger.getLogger(Log4jConfigurator.class);
    log.info("String_Node_Str");
    try {
      org.docx4j.convert.out.pdf.viaXSLFO.Conversion.log.setLevel(Level.DEBUG);
    }
 catch (    NoClassDefFoundError n) {
    }
  }
}
Program: 185095
Project: 185095
Buggy source:
private static void processString(JaxbXmlPart sourcePart,DocumentFragment docfrag,String text,RPr rPr) throws JAXBException {
  int pos=text.indexOf("String_Node_Str");
  if (pos == -1) {
    addRunToDocFrag(sourcePart,docfrag,text,rPr);
    return;
  }
  if (pos == 0) {
    int spacePos=text.indexOf("String_Node_Str");
    if (spacePos == -1) {
      addHyperlinkToDocFrag(sourcePart,docfrag,text);
      return;
    }
    String first=text.substring(0,spacePos);
    String rest=text.substring(spacePos);
    addHyperlinkToDocFrag(sourcePart,docfrag,first);
    processString(sourcePart,docfrag,rest,rPr);
    return;
  }
  String first=text.substring(0,pos);
  String rest=text.substring(pos);
  addRunToDocFrag(sourcePart,docfrag,first,rPr);
  processString(sourcePart,docfrag,rest,rPr);
}

Fixed version (ground truth):
private static void processString(JaxbXmlPart sourcePart,DocumentFragment docfrag,String text,RPr rPr) throws JAXBException {
  int NOT_FOUND=99999;
  int pos1=text.indexOf("String_Node_Str") == -1 ? NOT_FOUND : text.indexOf("String_Node_Str");
  int pos2=text.indexOf("String_Node_Str") == -1 ? NOT_FOUND : text.indexOf("String_Node_Str");
  int pos3=text.indexOf("String_Node_Str") == -1 ? NOT_FOUND : text.indexOf("String_Node_Str");
  int pos=Math.min(pos1,Math.min(pos2,pos3));
  if (pos == NOT_FOUND || hyperlinkStyleId == null) {
    addRunToDocFrag(sourcePart,docfrag,text,rPr);
    return;
  }
  if (pos == 0) {
    int spacePos=text.indexOf("String_Node_Str");
    if (spacePos == -1) {
      addHyperlinkToDocFrag(sourcePart,docfrag,text);
      return;
    }
    String first=text.substring(0,spacePos);
    String rest=text.substring(spacePos);
    addHyperlinkToDocFrag(sourcePart,docfrag,first);
    processString(sourcePart,docfrag,rest,rPr);
    return;
  }
  String first=text.substring(0,pos);
  String rest=text.substring(pos);
  addRunToDocFrag(sourcePart,docfrag,first,rPr);
  processString(sourcePart,docfrag,rest,rPr);
}
Program: 185096
Project: 185096
Buggy source:
/** 
 * Configure, how the handler handles links found in Custom XML. If set to <code>null</code>, strings containing 'http://' are not converted to w:hyperlink. This is the default behavior. If set to <code>true</code>, strings containing 'http://' are converted to w:hyperlink.  If you do this, you will need to post-process with RemovalHandler, since a content control with SdtPr w:dataBinding and w:text which contains a w:hyperlink will prevent Word 2007 from opening the docx. Due to the architecture of this class, this is a static flag changing the behavior of all following calls to   {@link #applyBindings}.
 * @param hyperlinkStyle The style to use for hyperlinks (eg Hyperlink)
 */
public static void setHyperlinkStyle(String hyperlinkStyleID){
  hyperlinkStyleId=hyperlinkStyleID;
}

Fixed version (ground truth):
/** 
 * Configure, how the handler handles links found in Custom XML. If hyperlinkStyleId is set to <code>null</code>, strings  containing 'http://' or 'https://' are not converted to  w:hyperlink. This is the default behavior. If hyperlinkStyleId is set to <code>"someWordHyperlinkStyleName"</code>,  strings containing 'http://' or 'https://' or or 'mailto:' are converted to w:hyperlink.   The default Word hyperlink style name is "Hyperlink". If you do this, you will need to post-process with RemovalHandler, since a content control with SdtPr w:dataBinding and w:text which contains a w:hyperlink will prevent Word 2007 from opening the docx. Due to the architecture of this class, this is a static flag changing the behavior of all following calls to   {@link #applyBindings}.
 * @param hyperlinkStyleID The style to use for hyperlinks (eg Hyperlink)
 */
public static void setHyperlinkStyle(String hyperlinkStyleID){
  hyperlinkStyleId=hyperlinkStyleID;
}
Program: 185097
Project: 185097
Buggy source:
public static void applyBindings(JaxbXmlPart part) throws Docx4JException {
  org.docx4j.openpackaging.packages.OpcPackage pkg=part.getPackage();
  org.w3c.dom.Document doc=XmlUtils.marshaltoW3CDomDocument(part.getJaxbElement());
  XPathsPart xPathsPart=null;
  if (((WordprocessingMLPackage)pkg).getMainDocumentPart().getXPathsPart() == null) {
    log.error("String_Node_Str");
  }
 else {
    xPathsPart=((WordprocessingMLPackage)pkg).getMainDocumentPart().getXPathsPart();
  }
  JAXBContext jc=Context.jc;
  try {
    Unmarshaller u=jc.createUnmarshaller();
    u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());
    javax.xml.bind.util.JAXBResult result=new javax.xml.bind.util.JAXBResult(u);
    Map<String,Object> transformParameters=new HashMap<String,Object>();
    transformParameters.put("String_Node_Str",part.getPackage().getCustomXmlDataStorageParts());
    transformParameters.put("String_Node_Str",(WordprocessingMLPackage)pkg);
    transformParameters.put("String_Node_Str",part);
    transformParameters.put("String_Node_Str",xPathsPart);
    org.docx4j.XmlUtils.transform(doc,xslt,transformParameters,result);
    part.setJaxbElement(result);
  }
 catch (  Exception e) {
    throw new Docx4JException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public static void applyBindings(JaxbXmlPart part) throws Docx4JException {
  org.docx4j.openpackaging.packages.OpcPackage pkg=part.getPackage();
  if (hyperlinkStyleId != null && pkg instanceof WordprocessingMLPackage) {
    ((WordprocessingMLPackage)pkg).getMainDocumentPart().getPropertyResolver().activateStyle(hyperlinkStyleId);
  }
  org.w3c.dom.Document doc=XmlUtils.marshaltoW3CDomDocument(part.getJaxbElement());
  XPathsPart xPathsPart=null;
  if (((WordprocessingMLPackage)pkg).getMainDocumentPart().getXPathsPart() == null) {
    log.error("String_Node_Str");
  }
 else {
    xPathsPart=((WordprocessingMLPackage)pkg).getMainDocumentPart().getXPathsPart();
  }
  JAXBContext jc=Context.jc;
  try {
    Unmarshaller u=jc.createUnmarshaller();
    u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());
    javax.xml.bind.util.JAXBResult result=new javax.xml.bind.util.JAXBResult(u);
    Map<String,Object> transformParameters=new HashMap<String,Object>();
    transformParameters.put("String_Node_Str",part.getPackage().getCustomXmlDataStorageParts());
    transformParameters.put("String_Node_Str",(WordprocessingMLPackage)pkg);
    transformParameters.put("String_Node_Str",part);
    transformParameters.put("String_Node_Str",xPathsPart);
    org.docx4j.XmlUtils.transform(doc,xslt,transformParameters,result);
    part.setJaxbElement(result);
  }
 catch (  Exception e) {
    throw new Docx4JException("String_Node_Str",e);
  }
}
Program: 185098
Project: 185098
Buggy source:
private void init(PgSz pgSz,PgMar pgMar){
  if (pgSz == null) {
    log.warn("String_Node_Str");
    pgSz=Context.getWmlObjectFactory().createSectPrPgSz();
    setPgSize(PageSizePaper.A4,false);
  }
 else {
    this.pgSz=pgSz;
  }
  if (pgMar == null) {
    log.warn("String_Node_Str");
    pgMar=Context.getWmlObjectFactory().createSectPrPgMar();
    setMargins(MarginsWellKnown.NORMAL);
  }
 else {
    this.pgMar=pgMar;
  }
}

Fixed version (ground truth):
private void init(PgSz pgSz,PgMar pgMar){
  if (pgSz == null) {
    log.warn("String_Node_Str");
    this.pgSz=Context.getWmlObjectFactory().createSectPrPgSz();
    setPgSize(PageSizePaper.A4,false);
  }
 else {
    this.pgSz=pgSz;
  }
  if (pgMar == null) {
    log.warn("String_Node_Str");
    this.pgMar=Context.getWmlObjectFactory().createSectPrPgMar();
    setMargins(MarginsWellKnown.NORMAL);
  }
 else {
    this.pgMar=pgMar;
  }
}
Program: 185099
Project: 185099
Buggy source:
public void addPartsFromRelationships(ZipOutputStream out,RelationshipsPart rp) throws Docx4JException {
  for (  Relationship r : rp.getRelationships().getRelationship()) {
    log.debug("String_Node_Str" + r.getId() + "String_Node_Str"+ rp.getSourceP().getPartName()+ "String_Node_Str"+ r.getTarget());
    if (r.getTargetMode() != null && r.getTargetMode().equals("String_Node_Str")) {
      log.warn("String_Node_Str" + r.getTarget() + "String_Node_Str"+ r.getType());
      continue;
    }
    try {
      String resolvedPartUri=URIHelper.resolvePartUri(rp.getSourceURI(),new URI(r.getTarget())).toString();
      resolvedPartUri=resolvedPartUri.substring(1);
      if (!false) {
        log.debug("String_Node_Str" + resolvedPartUri);
        Part part=p.getParts().get(new PartName("String_Node_Str" + resolvedPartUri));
        if (part == null) {
          log.error("String_Node_Str" + resolvedPartUri + "String_Node_Str");
        }
 else {
          log.debug(part.getClass().getName());
        }
        savePart(out,part);
      }
    }
 catch (    Exception e) {
      throw new Docx4JException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public void addPartsFromRelationships(ZipOutputStream out,RelationshipsPart rp) throws Docx4JException {
  for (  Relationship r : rp.getRelationships().getRelationship()) {
    log.debug("String_Node_Str" + r.getId() + "String_Node_Str"+ rp.getSourceP().getPartName()+ "String_Node_Str"+ r.getTarget());
    if (r.getType().equals(Namespaces.HYPERLINK)) {
      continue;
    }
    if (r.getTargetMode() != null && r.getTargetMode().equals("String_Node_Str")) {
      log.warn("String_Node_Str" + r.getTarget() + "String_Node_Str"+ r.getType());
      continue;
    }
    try {
      String resolvedPartUri=URIHelper.resolvePartUri(rp.getSourceURI(),new URI(r.getTarget())).toString();
      resolvedPartUri=resolvedPartUri.substring(1);
      if (!false) {
        log.debug("String_Node_Str" + resolvedPartUri);
        Part part=p.getParts().get(new PartName("String_Node_Str" + resolvedPartUri));
        if (part == null) {
          log.error("String_Node_Str" + resolvedPartUri + "String_Node_Str");
        }
 else {
          log.debug(part.getClass().getName());
        }
        savePart(out,part);
      }
    }
 catch (    Exception e) {
      throw new Docx4JException("String_Node_Str",e);
    }
  }
}
Program: 185100
Project: 185100
Buggy source:
/** 
 * Create a linked image part, and attach it as a rel of the specified source part (eg a header part)
 * @param wordMLPackage
 * @param sourcePart
 * @param fileurl
 * @return
 * @throws Exception
 */
public static BinaryPartAbstractImage createLinkedImagePart(WordprocessingMLPackage wordMLPackage,Part sourcePart,String fileurl) throws Exception {
  ImageInfo info=ensureFormatIsSupported(fileurl,null,null);
  ContentTypeManager ctm=wordMLPackage.getContentTypeManager();
  String proposedRelId=sourcePart.getRelationshipsPart().getNextId();
  String ext=info.getMimeType().substring(info.getMimeType().indexOf("String_Node_Str"));
  BinaryPartAbstractImage imagePart=(BinaryPartAbstractImage)ctm.newPartForContentType(info.getMimeType(),createImageName(sourcePart,proposedRelId,ext),null);
  log.debug("String_Node_Str" + imagePart.getClass().getName() + "String_Node_Str"+ imagePart.getPartName().toString());
  imagePart.rel=sourcePart.addTargetPart(imagePart);
  imagePart.rel.setTargetMode("String_Node_Str");
  wordMLPackage.getExternalResources().put(imagePart.getExternalTarget(),imagePart);
  if (!fileurl.startsWith("String_Node_Str") && new File(fileurl).isFile()) {
    imagePart.rel.setTarget("String_Node_Str" + fileurl);
  }
 else {
    imagePart.rel.setTarget(fileurl);
  }
  imagePart.setImageInfo(info);
  return imagePart;
}

Fixed version (ground truth):
/** 
 * Create a linked image part, and attach it as a rel of the specified source part (eg a header part)
 * @param wordMLPackage
 * @param sourcePart
 * @param fileurl
 * @return
 * @throws Exception
 */
public static BinaryPartAbstractImage createLinkedImagePart(WordprocessingMLPackage wordMLPackage,Part sourcePart,String fileurl) throws Exception {
  ImageInfo info=ensureFormatIsSupported(fileurl,null,null);
  ContentTypeManager ctm=wordMLPackage.getContentTypeManager();
  String proposedRelId=sourcePart.getRelationshipsPart().getNextId();
  String ext=info.getMimeType().substring(info.getMimeType().indexOf("String_Node_Str") + 1);
  BinaryPartAbstractImage imagePart=(BinaryPartAbstractImage)ctm.newPartForContentType(info.getMimeType(),createImageName(sourcePart,proposedRelId,ext),null);
  log.debug("String_Node_Str" + imagePart.getClass().getName() + "String_Node_Str"+ imagePart.getPartName().toString());
  imagePart.rel=sourcePart.addTargetPart(imagePart);
  imagePart.rel.setTargetMode("String_Node_Str");
  wordMLPackage.getExternalResources().put(imagePart.getExternalTarget(),imagePart);
  if (!fileurl.startsWith("String_Node_Str") && new File(fileurl).isFile()) {
    imagePart.rel.setTarget("String_Node_Str" + fileurl);
  }
 else {
    imagePart.rel.setTarget(fileurl);
  }
  imagePart.setImageInfo(info);
  return imagePart;
}
Program: 185106
Project: 185106
Buggy source:
public static org.opendope.xpaths.Xpaths.Xpath getXPathFromCondition(Condition c){
  org.opendope.conditions.Xpathref xpathRef=c.getXpathref();
  return XPathsPart.getXPathById(xPaths,xpathRef.getId());
}

Fixed version (ground truth):
public static org.opendope.xpaths.Xpaths.Xpath getXPathFromCondition(Condition c){
  org.opendope.conditions.Xpathref xpathRef=c.getXpathref();
  if (xpathRef == null) {
    log.error("String_Node_Str" + c.getId() + "String_Node_Str");
  }
  return XPathsPart.getXPathById(xPaths,xpathRef.getId());
}
Program: 185109
Project: 185109
Buggy source:
/** 
 * Create a linked image part, and attach it as a rel of the specified source part (eg a header part)
 * @param wordMLPackage
 * @param sourcePart
 * @param fileurl
 * @return
 * @throws Exception
 */
public static BinaryPartAbstractImage createLinkedImagePart(WordprocessingMLPackage wordMLPackage,Part sourcePart,String fileurl) throws Exception {
  ImageInfo info=ensureFormatIsSupported(fileurl,null,null);
  ContentTypeManager ctm=wordMLPackage.getContentTypeManager();
  String proposedRelId=sourcePart.getRelationshipsPart().getNextId();
  BinaryPartAbstractImage imagePart=(BinaryPartAbstractImage)ctm.newPartForContentType(info.getMimeType(),IMAGE_PREFIX + proposedRelId);
  log.debug("String_Node_Str" + imagePart.getClass().getName() + "String_Node_Str"+ imagePart.getPartName().toString());
  imagePart.rel=sourcePart.addTargetPart(imagePart);
  imagePart.rel.setTargetMode("String_Node_Str");
  wordMLPackage.getExternalResources().put(imagePart.getExternalTarget(),imagePart);
  if (!fileurl.startsWith("String_Node_Str") && new File(fileurl).isFile()) {
    imagePart.rel.setTarget("String_Node_Str" + fileurl);
  }
 else {
    imagePart.rel.setTarget(fileurl);
  }
  imagePart.setImageInfo(info);
  return imagePart;
}

Fixed version (ground truth):
/** 
 * Create a linked image part, and attach it as a rel of the specified source part (eg a header part)
 * @param wordMLPackage
 * @param sourcePart
 * @param fileurl
 * @return
 * @throws Exception
 */
public static BinaryPartAbstractImage createLinkedImagePart(WordprocessingMLPackage wordMLPackage,Part sourcePart,String fileurl) throws Exception {
  ImageInfo info=ensureFormatIsSupported(fileurl,null,null);
  ContentTypeManager ctm=wordMLPackage.getContentTypeManager();
  String proposedRelId=sourcePart.getRelationshipsPart().getNextId();
  BinaryPartAbstractImage imagePart=(BinaryPartAbstractImage)ctm.newPartForContentType(info.getMimeType(),createImageName(sourcePart,proposedRelId));
  log.debug("String_Node_Str" + imagePart.getClass().getName() + "String_Node_Str"+ imagePart.getPartName().toString());
  imagePart.rel=sourcePart.addTargetPart(imagePart);
  imagePart.rel.setTargetMode("String_Node_Str");
  wordMLPackage.getExternalResources().put(imagePart.getExternalTarget(),imagePart);
  if (!fileurl.startsWith("String_Node_Str") && new File(fileurl).isFile()) {
    imagePart.rel.setTarget("String_Node_Str" + fileurl);
  }
 else {
    imagePart.rel.setTarget(fileurl);
  }
  imagePart.setImageInfo(info);
  return imagePart;
}
Program: 185110
Project: 185110
Buggy source:
public static void createHeaderReference(WordprocessingMLPackage wordprocessingMLPackage,Relationship relationship) throws InvalidFormatException {
  SectPr sectPr=objectFactory.createSectPr();
  HeaderReference headerReference=objectFactory.createHeaderReference();
  headerReference.setId(relationship.getId());
  headerReference.setType(HdrFtrRef.DEFAULT);
  sectPr.getEGHdrFtrReferences().add(headerReference);
  wordprocessingMLPackage.getMainDocumentPart().addObject(sectPr);
}

Fixed version (ground truth):
public static void createHeaderReference(WordprocessingMLPackage wordprocessingMLPackage,Relationship relationship) throws InvalidFormatException {
  List<SectionWrapper> sections=wordprocessingMLPackage.getDocumentModel().getSections();
  SectPr sectPr=sections.get(sections.size() - 1).getSectPr();
  if (sectPr == null) {
    sectPr=objectFactory.createSectPr();
    wordprocessingMLPackage.getMainDocumentPart().addObject(sectPr);
    sections.get(sections.size() - 1).setSectPr(sectPr);
  }
  HeaderReference headerReference=objectFactory.createHeaderReference();
  headerReference.setId(relationship.getId());
  headerReference.setType(HdrFtrRef.DEFAULT);
  sectPr.getEGHdrFtrReferences().add(headerReference);
}
Program: 185111
Project: 185111
Buggy source:
protected Document createXslFoImageElement(){
  try {
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    Document document=factory.newDocumentBuilder().newDocument();
    Element imageElement=document.createElementNS("String_Node_Str","String_Node_Str");
    if (src != null && !src.equals("String_Node_Str")) {
      imageElement.setAttribute("String_Node_Str",src);
    }
    if (dimensions.width > 0) {
      imageElement.setAttribute("String_Node_Str",Integer.toString(dimensions.width) + dimensions.widthUnit);
    }
    if (dimensions.height > 0) {
      imageElement.setAttribute("String_Node_Str",Integer.toString(dimensions.height) + dimensions.heightUnit);
    }
    document.appendChild(imageElement);
    return document;
  }
 catch (  Exception e) {
    log.error(e);
    return null;
  }
}

Fixed version (ground truth):
protected Document createXslFoImageElement(){
  try {
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    Document document=factory.newDocumentBuilder().newDocument();
    Element imageElement=document.createElementNS("String_Node_Str","String_Node_Str");
    if (src != null && !src.equals("String_Node_Str")) {
      imageElement.setAttribute("String_Node_Str",src);
    }
 else {
      log.error("String_Node_Str");
    }
    if (dimensions.width > 0) {
      imageElement.setAttribute("String_Node_Str",Integer.toString(dimensions.width) + dimensions.widthUnit);
    }
    if (dimensions.height > 0) {
      imageElement.setAttribute("String_Node_Str",Integer.toString(dimensions.height) + dimensions.heightUnit);
    }
    document.appendChild(imageElement);
    return document;
  }
 catch (  Exception e) {
    log.error(e);
    return null;
  }
}
Program: 185112
Project: 185112
Buggy source:
private void findImageData(){
  if (shape.getAny() == null) {
    System.out.println("String_Node_Str" + XmlUtils.marshaltoString(shape,true));
  }
 else {
    for (    Object o : shape.getAny()) {
      if (o instanceof JAXBElement) {
        JAXBElement jb=(JAXBElement)o;
        if (jb.getDeclaredType().getName().equals("String_Node_Str")) {
          imageData=(CTImageData)jb.getValue();
          break;
        }
 else {
          log.info("String_Node_Str" + XmlUtils.JAXBElementDebug((JAXBElement)o));
        }
      }
 else {
        log.error(o.getClass().getName());
      }
    }
  }
}

Fixed version (ground truth):
private void findImageData(){
  if (shape.getAny() == null) {
    System.out.println("String_Node_Str" + XmlUtils.marshaltoString(shape,true));
  }
 else {
    for (    Object o : shape.getAny()) {
      if (o instanceof JAXBElement) {
        JAXBElement jb=(JAXBElement)o;
        if (jb.getDeclaredType().getName().equals("String_Node_Str")) {
          imageData=(CTImageData)jb.getValue();
          break;
        }
 else {
          log.debug("String_Node_Str" + XmlUtils.JAXBElementDebug((JAXBElement)o));
        }
      }
 else {
        log.error(o.getClass().getName());
      }
    }
  }
}
Program: 185113
Project: 185113
Buggy source:
/** 
 * Extension function to create an <img> element from "E1.0 images" //w:pict
 * @param wmlPackage
 * @param imageDirPath
 * @param shape
 * @param imageData
 * @return
 */
public static DocumentFragment createXslFoImgE10(WordprocessingMLPackage wmlPackage,String imageDirPath,NodeIterator wpict){
  WordXmlPictureE10 converter=createWordXmlPictureFromE10(wmlPackage,imageDirPath,wpict);
  if (converter == null) {
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    Document d;
    try {
      d=factory.newDocumentBuilder().newDocument();
      return d.createDocumentFragment();
    }
 catch (    ParserConfigurationException e) {
      log.error(e);
      return null;
    }
  }
 else {
    Document d=converter.createXslFoImageElement();
    DocumentFragment docfrag=d.createDocumentFragment();
    docfrag.appendChild(d.getDocumentElement());
    return docfrag;
  }
}

Fixed version (ground truth):
/** 
 * Extension function to create an <img> element from "E1.0 images" //w:pict
 * @param wmlPackage
 * @param imageDirPath
 * @param shape
 * @param imageData
 * @return
 */
public static DocumentFragment createXslFoImgE10(WordprocessingMLPackage wmlPackage,String imageDirPath,NodeIterator wpict){
  WordXmlPictureE10 converter=createWordXmlPictureFromE10(wmlPackage,imageDirPath,wpict);
  log.debug("String_Node_Str" + imageDirPath);
  if (converter == null) {
    log.error("String_Node_Str");
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    Document d;
    try {
      d=factory.newDocumentBuilder().newDocument();
      return d.createDocumentFragment();
    }
 catch (    ParserConfigurationException e) {
      log.error(e);
      return null;
    }
  }
 else {
    Document d=converter.createXslFoImageElement();
    DocumentFragment docfrag=d.createDocumentFragment();
    docfrag.appendChild(d.getDocumentElement());
    return docfrag;
  }
}
Program: 185114
Project: 185114
Buggy source:
private static WordXmlPictureE10 createWordXmlPictureFromE10(WordprocessingMLPackage wmlPackage,String imageDirPath,NodeIterator wpict){
  WordXmlPictureE10 converter=new WordXmlPictureE10(wmlPackage,wpict);
  converter.findShape();
  if (converter.shape == null) {
    log.error("String_Node_Str");
    return null;
  }
  converter.readStandardAttributes(converter.shape);
  converter.readDimensions(converter.style);
  converter.findImageData();
  if (converter.imageData == null) {
    log.error("String_Node_Str");
    return null;
  }
  String imgRelId=converter.imageData.getId();
  if (imgRelId != null && !imgRelId.equals("String_Node_Str")) {
    converter.handleImageRel(imgRelId,imageDirPath);
  }
  return converter;
}

Fixed version (ground truth):
private static WordXmlPictureE10 createWordXmlPictureFromE10(WordprocessingMLPackage wmlPackage,String imageDirPath,NodeIterator wpict){
  WordXmlPictureE10 converter=new WordXmlPictureE10(wmlPackage,wpict);
  converter.findShape();
  if (converter.shape == null) {
    log.error("String_Node_Str");
    return null;
  }
  converter.readStandardAttributes(converter.shape);
  converter.readDimensions(converter.style);
  converter.findImageData();
  if (converter.imageData == null) {
    log.error("String_Node_Str");
    return null;
  }
  String imgRelId=converter.imageData.getOtherAttributes().get(new QName("String_Node_Str","String_Node_Str"));
  if (imgRelId != null && !imgRelId.equals("String_Node_Str")) {
    log.debug("String_Node_Str" + imgRelId);
    converter.handleImageRel(imgRelId,imageDirPath);
  }
 else {
    log.error("String_Node_Str");
  }
  return converter;
}
Program: 185115
Project: 185115
Buggy source:
/** 
 * Connection (line)
 */
public static Document CxnSpToSVG(CxnSp cxnSp){
  CTTransform2D xfrm=cxnSp.getSpPr().getXfrm();
  Box b=new Box(xfrm.getOff().getX(),xfrm.getOff().getY(),xfrm.getExt().getCx(),xfrm.getExt().getCx());
  if (xfrm.getRot() != 0) {
    b.rotate(xfrm.getRot());
  }
  if (xfrm.isFlipH()) {
    b.flipH();
  }
  if (xfrm.isFlipV()) {
    b.flipV();
  }
  b.toPixels();
  Document document=createDocument();
  Element xhtmlDiv=document.createElement("String_Node_Str");
  xhtmlDiv.setAttribute("String_Node_Str","String_Node_Str");
  Node n=document.appendChild(xhtmlDiv);
  Svg svg=oFactory.createSvg();
  Line line=oFactory.createLine();
  svg.getSVGDescriptionClassOrSVGAnimationClassOrSVGStructureClass().add(line);
  line.setX1(b.getOffset().getXAsString());
  line.setY1(b.getOffset().getYAsString());
  Point otherEnd=b.getOtherCorner();
  line.setX2(otherEnd.getXAsString());
  line.setY2(otherEnd.getYAsString());
  line.setStyle("String_Node_Str");
  Document d2=XmlUtils.marshaltoW3CDomDocument(svg,jcSVG);
  XmlUtils.treeCopy(d2,n);
  return document;
}

Fixed version (ground truth):
/** 
 * Connection (line)
 */
public static Document CxnSpToSVG(CxnSp cxnSp){
  CTTransform2D xfrm=cxnSp.getSpPr().getXfrm();
  Box b=new Box(xfrm.getOff().getX(),xfrm.getOff().getY(),xfrm.getExt().getCx(),xfrm.getExt().getCy());
  if (xfrm.getRot() != 0) {
    b.rotate(xfrm.getRot());
  }
  if (xfrm.isFlipH()) {
    b.flipH();
  }
  if (xfrm.isFlipV()) {
    b.flipV();
  }
  b.toPixels();
  Document document=createDocument();
  Element xhtmlDiv=document.createElement("String_Node_Str");
  xhtmlDiv.setAttribute("String_Node_Str","String_Node_Str");
  Node n=document.appendChild(xhtmlDiv);
  Svg svg=oFactory.createSvg();
  Line line=oFactory.createLine();
  svg.getSVGDescriptionClassOrSVGAnimationClassOrSVGStructureClass().add(line);
  line.setX1(b.getOffset().getXAsString());
  line.setY1(b.getOffset().getYAsString());
  Point otherEnd=b.getOtherCorner();
  line.setX2(otherEnd.getXAsString());
  line.setY2(otherEnd.getYAsString());
  line.setStyle("String_Node_Str");
  Document d2=XmlUtils.marshaltoW3CDomDocument(svg,jcSVG);
  XmlUtils.treeCopy(d2,n);
  return document;
}
Program: 185116
Project: 185116
Buggy source:
public String getDefaultFont(){
  if (defaultFont != null) {
    defaultFont=mainDoc.getPropertyResolver().getDefaultFont();
  }
  return defaultFont;
}

Fixed version (ground truth):
public String getDefaultFont(){
  if (defaultFont == null) {
    defaultFont=mainDoc.getPropertyResolver().getDefaultFont();
    log.debug("String_Node_Str" + defaultFont);
  }
  return defaultFont;
}
Program: 185117
Project: 185117
Buggy source:
/** 
 * Build a StyleTree for stylesInUse. 
 * @param stylesInUse
 * @param allStyles
 */
public StyleTree(List<String> stylesInUse,Map<String,Style> allStyles){
  for (  String styleId : stylesInUse) {
    if (pTree.get(styleId) == null) {
      Style style=allStyles.get(styleId);
      if (style == null) {
        log.error("String_Node_Str" + styleId);
        continue;
      }
      if (style.getType().equals("String_Node_Str")) {
        this.addNode(styleId,allStyles,pTree);
      }
    }
  }
  for (  String styleId : stylesInUse) {
    if (cTree.get(styleId) == null) {
      Style style=allStyles.get(styleId);
      if (style == null) {
        log.error("String_Node_Str" + styleId);
        continue;
      }
      if (style.getType().equals("String_Node_Str")) {
        this.addNode(styleId,allStyles,cTree);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Build a StyleTree for stylesInUse. 
 * @param stylesInUse
 * @param allStyles
 */
public StyleTree(List<String> stylesInUse,Map<String,Style> allStyles){
  stylesInUse.add("String_Node_Str");
  for (  String styleId : stylesInUse) {
    if (pTree.get(styleId) == null) {
      Style style=allStyles.get(styleId);
      if (style == null) {
        log.error("String_Node_Str" + styleId);
        continue;
      }
      if (style.getType().equals("String_Node_Str")) {
        this.addNode(styleId,allStyles,pTree);
      }
    }
  }
  stylesInUse.add("String_Node_Str");
  for (  String styleId : stylesInUse) {
    if (cTree.get(styleId) == null) {
      Style style=allStyles.get(styleId);
      if (style == null) {
        log.error("String_Node_Str" + styleId);
        continue;
      }
      if (style.getType().equals("String_Node_Str")) {
        this.addNode(styleId,allStyles,cTree);
      }
    }
  }
}
Program: 185118
Project: 185118
Buggy source:
public static Property createPropertyFromCssName(String name,CSSValue value){
  if (name.equals(Font.CSS_NAME)) {
    return new Font(value);
  }
 else   if (name.equals(Bold.CSS_NAME)) {
    return new Bold(value);
  }
 else   if (name.equals(Italics.CSS_NAME)) {
    return new Italics(value);
  }
 else   if (name.equals(Strike.CSS_NAME)) {
    return new Strike(value);
  }
 else   if (name.equals(FontColor.CSS_NAME)) {
    return new FontColor(value);
  }
 else   if (name.equals(FontSize.CSS_NAME)) {
    return new FontSize(value);
  }
 else   if (name.equals(Underline.CSS_NAME)) {
    return new Underline(value);
  }
  if (name.equals(Indent.CSS_NAME)) {
    return new Indent(value);
  }
 else   if (name.equals(Justification.CSS_NAME)) {
    return new Justification(value);
  }
 else   if (name.equals(KeepNext.CSS_NAME)) {
    return new KeepNext(value);
  }
 else   if (name.equals(PageBreakBefore.CSS_NAME)) {
    return new PageBreakBefore(value);
  }
 else   if (name.equals(TextAlignmentVertical.CSS_NAME)) {
    return new TextAlignmentVertical(value);
  }
  log.warn("String_Node_Str" + name + "String_Node_Str");
  return null;
}

Fixed version (ground truth):
public static Property createPropertyFromCssName(String name,CSSValue value){
  if (name.equals(Font.CSS_NAME)) {
    return new Font(value);
  }
 else   if (name.equals(Bold.CSS_NAME)) {
    return new Bold(value);
  }
 else   if (name.equals(Italics.CSS_NAME)) {
    return new Italics(value);
  }
 else   if (name.equals("String_Node_Str")) {
    if (value.getCssText().toLowerCase().equals("String_Node_Str")) {
      return new Strike(value);
    }
 else     if (value.getCssText().toLowerCase().equals("String_Node_Str")) {
      return new Underline(value);
    }
 else {
      log.error("String_Node_Str" + name + "String_Node_Str"+ value.getCssText());
    }
  }
 else   if (name.equals(FontColor.CSS_NAME)) {
    return new FontColor(value);
  }
 else   if (name.equals(FontSize.CSS_NAME)) {
    return new FontSize(value);
  }
  if (name.equals(Indent.CSS_NAME)) {
    return new Indent(value);
  }
 else   if (name.equals(Justification.CSS_NAME)) {
    return new Justification(value);
  }
 else   if (name.equals(KeepNext.CSS_NAME)) {
    return new KeepNext(value);
  }
 else   if (name.equals(PageBreakBefore.CSS_NAME)) {
    return new PageBreakBefore(value);
  }
 else   if (name.equals(TextAlignmentVertical.CSS_NAME)) {
    return new TextAlignmentVertical(value);
  }
  log.warn("String_Node_Str" + name + "String_Node_Str");
  return null;
}
Program: 185119
Project: 185119
Buggy source:
public Underline(CSSValue value){
  debug(CSS_NAME,value);
}

Fixed version (ground truth):
public Underline(CSSValue value){
  debug(CSS_NAME,value);
  U u=Context.getWmlObjectFactory().createU();
  if (value.getCssText().toLowerCase().equals("String_Node_Str")) {
    u.setVal(UnderlineEnumeration.SINGLE);
  }
 else   if (value.getCssText().toLowerCase().equals("String_Node_Str")) {
    u.setVal(UnderlineEnumeration.NONE);
  }
 else {
    log.error("String_Node_Str" + CSS_NAME + "String_Node_Str"+ value.getCssText().toLowerCase());
  }
  this.setObject(u);
}
Program: 185120
Project: 185120
Buggy source:
/** 
 * Clone this JAXB object
 * @param value
 * @param jc
 * @return
 */
public static <T>T deepCopy(T value,JAXBContext jc){
  try {
    JAXBElement<?> elem;
    Class<?> valueClass;
    if (value instanceof JAXBElement<?>) {
      log.debug("String_Node_Str");
      elem=(JAXBElement<?>)value;
      valueClass=elem.getDeclaredType();
    }
 else {
      log.debug("String_Node_Str" + value.getClass().getName());
      @SuppressWarnings("String_Node_Str") Class<T> classT=(Class<T>)value.getClass();
      elem=new JAXBElement<T>(new QName("String_Node_Str"),classT,value);
      valueClass=classT;
    }
    Marshaller mar=Context.jc.createMarshaller();
    ByteArrayOutputStream bout=new ByteArrayOutputStream(256);
    mar.marshal(elem,bout);
    Unmarshaller unmar=Context.jc.createUnmarshaller();
    elem=unmar.unmarshal(new StreamSource(new ByteArrayInputStream(bout.toByteArray())),valueClass);
    T res;
    if (value instanceof JAXBElement<?>) {
      @SuppressWarnings("String_Node_Str") T resT=(T)elem;
      res=resT;
    }
 else {
      @SuppressWarnings("String_Node_Str") T resT=(T)elem.getValue();
      res=resT;
    }
    log.info("String_Node_Str");
    return res;
  }
 catch (  JAXBException ex) {
    throw new IllegalArgumentException(ex);
  }
}

Fixed version (ground truth):
/** 
 * Clone this JAXB object
 * @param value
 * @param jc
 * @return
 */
public static <T>T deepCopy(T value,JAXBContext jc){
  try {
    JAXBElement<?> elem;
    Class<?> valueClass;
    if (value instanceof JAXBElement<?>) {
      log.debug("String_Node_Str");
      elem=(JAXBElement<?>)value;
      valueClass=elem.getDeclaredType();
    }
 else {
      log.debug("String_Node_Str" + value.getClass().getName());
      @SuppressWarnings("String_Node_Str") Class<T> classT=(Class<T>)value.getClass();
      elem=new JAXBElement<T>(new QName("String_Node_Str"),classT,value);
      valueClass=classT;
    }
    Marshaller mar=jc.createMarshaller();
    ByteArrayOutputStream bout=new ByteArrayOutputStream(256);
    mar.marshal(elem,bout);
    Unmarshaller unmar=jc.createUnmarshaller();
    elem=unmar.unmarshal(new StreamSource(new ByteArrayInputStream(bout.toByteArray())),valueClass);
    T res;
    if (value instanceof JAXBElement<?>) {
      @SuppressWarnings("String_Node_Str") T resT=(T)elem;
      res=resT;
    }
 else {
      @SuppressWarnings("String_Node_Str") T resT=(T)elem.getValue();
      res=resT;
    }
    log.info("String_Node_Str");
    return res;
  }
 catch (  JAXBException ex) {
    throw new IllegalArgumentException(ex);
  }
}
Program: 185121
Project: 185121
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args) throws Exception {
  String BASE_DIR="String_Node_Str";
  String paraL=BASE_DIR + "String_Node_Str";
  String paraR=BASE_DIR + "String_Node_Str";
  P pl=loadParagraph(paraL);
  P pr=loadParagraph(paraR);
  StreamResult result=new StreamResult(System.out);
  Differencer pd=new Differencer();
  pd.diff(pl,pr,result,null,null,null,null);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  Writer diffxResult=new StringWriter();
  try {
    XMLInputFactory inputFactory=XMLInputFactory.newInstance();
    String simplified=combineAdjacent(inputFactory.createXMLStreamReader(new FileInputStream(new File("String_Node_Str"))));
    System.out.println("String_Node_Str");
  }
 catch (  Exception exc) {
    exc.printStackTrace();
    diffxResult=null;
  }
}
Program: 185123
Project: 185123
Buggy source:
/** 
 * This is private, in order to control what objects the user can invoke diff on.  At present there are public methods for pairs of w:body, w:sdtContent, and w:p.   TODO: consider/test w:table! 
 */
private void diffWorker(Node newer,Node older,javax.xml.transform.Result result,String author,java.util.Calendar date,RelationshipsPart docPartRelsNewer,RelationshipsPart docPartRelsOlder){
  Writer diffxResult=new StringWriter();
  try {
    Docx4jDriver.diff(newer,older,diffxResult);
    diffxResult.close();
  }
 catch (  Exception exc) {
    exc.printStackTrace();
    diffxResult=null;
  }
  try {
    XMLInputFactory inputFactory=XMLInputFactory.newInstance();
    Reader reader;
    if (log.isDebugEnabled()) {
      String res=diffxResult.toString();
      log.debug(res);
      reader=new StringReader(res);
    }
 else {
      reader=new StringReader(diffxResult.toString());
    }
    String simplified=null;
    try {
      simplified=combineAdjacent(inputFactory.createXMLStreamReader(reader));
    }
 catch (    XMLStreamException e) {
      e.printStackTrace();
    }
    log.debug("String_Node_Str" + simplified);
    StreamSource src=new StreamSource(new StringReader(simplified));
    transformDiffxOutputToWml(result,author,date,docPartRelsNewer,docPartRelsOlder,src);
  }
 catch (  Exception exc) {
    exc.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * This is private, in order to control what objects the user can invoke diff on.  At present there are public methods for pairs of w:body, w:sdtContent, and w:p.   TODO: consider/test w:table! 
 */
private void diffWorker(Node newer,Node older,javax.xml.transform.Result result,String author,java.util.Calendar date,RelationshipsPart docPartRelsNewer,RelationshipsPart docPartRelsOlder){
  Writer diffxResult=new StringWriter();
  try {
    Docx4jDriver.diff(newer,older,diffxResult);
    diffxResult.close();
  }
 catch (  Exception exc) {
    exc.printStackTrace();
    diffxResult=null;
  }
  try {
    XMLInputFactory inputFactory=XMLInputFactory.newInstance();
    Reader reader;
    if (log.isDebugEnabled()) {
      String res=diffxResult.toString();
      log.debug("String_Node_Str" + res);
      reader=new StringReader(res);
    }
 else {
      reader=new StringReader(diffxResult.toString());
    }
    String simplified=null;
    try {
      simplified=combineAdjacent(inputFactory.createXMLStreamReader(reader));
    }
 catch (    XMLStreamException e) {
      e.printStackTrace();
    }
    log.debug("String_Node_Str" + simplified);
    StreamSource src=new StreamSource(new StringReader(simplified));
    transformDiffxOutputToWml(result,author,date,docPartRelsNewer,docPartRelsOlder,src);
  }
 catch (  Exception exc) {
    exc.printStackTrace();
  }
}
Program: 185126
Project: 185126
Buggy source:
/** 
 * Creates a new formatter using the specified writer.
 * @param w The writer to use.
 * @throws IOException should an I/O exception occurs.
 */
public SmartXMLFormatter(Writer w) throws IOException {
  this.xml=new NSAwareXMLWriter(w,false);
  this.xml.xmlDecl();
  this.xml.setPrefixMapping(Constants.BASE_NS,"String_Node_Str");
  this.xml.setPrefixMapping(Constants.DELETE_NS,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a new formatter using the specified writer.
 * @param w The writer to use.
 * @throws IOException should an I/O exception occurs.
 */
public SmartXMLFormatter(Writer w) throws IOException {
  this.xml=new NSAwareXMLWriter(w,false);
  this.xml.xmlDecl();
  this.xml.setPrefixMapping(Constants.BASE_NS,"String_Node_Str");
  this.xml.setPrefixMapping(Constants.DELETE_NS,"String_Node_Str");
  this.xml.setPrefixMapping("String_Node_Str","String_Node_Str");
}
Program: 185130
Project: 185130
Buggy source:
/** 
 * Add the specified relationship to the collection.
 * @param rel The relationship to add.
 */
public void addRelationship(Relationship rel){
  String id="String_Node_Str" + nextId;
  nextId++;
  if (rel.getId() != null && !rel.getId().equals("String_Node_Str")) {
    logger.warn("String_Node_Str" + rel.getId() + "String_Node_Str"+ id+ "String_Node_Str");
  }
  rel.setId(id);
  relationships.getRelationship().add(rel);
}

Fixed version (ground truth):
/** 
 * Add the specified relationship to the collection.
 * @param rel The relationship to add.
 */
public void addRelationship(Relationship rel){
  String id=getNextId();
  if (rel.getId() != null && !rel.getId().equals("String_Node_Str")) {
    logger.warn("String_Node_Str" + rel.getId() + "String_Node_Str"+ id+ "String_Node_Str");
  }
  rel.setId(id);
  relationships.getRelationship().add(rel);
}
Program: 185132
Project: 185132
Buggy source:
private RelationshipsPart getRelationshipsPartFromXmlPackage(Base p,String partName) throws Docx4JException {
  RelationshipsPart thePart=null;
  try {
    org.docx4j.xmlPackage.Part part=parts.get(partName);
    if (part == null) {
      return null;
    }
    org.w3c.dom.Element el=part.getXmlData().getAny();
    RelationshipsPart rp=new RelationshipsPart(new PartName(partName));
    rp.setSourceP(p);
    rp.unmarshal(el);
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new Docx4JException("String_Node_Str" + partName,e);
  }
  return thePart;
}

Fixed version (ground truth):
private RelationshipsPart getRelationshipsPartFromXmlPackage(Base p,String partName) throws Docx4JException {
  RelationshipsPart rp=null;
  try {
    org.docx4j.xmlPackage.Part part=parts.get(partName);
    if (part == null) {
      return null;
    }
    org.w3c.dom.Element el=part.getXmlData().getAny();
    rp=new RelationshipsPart(new PartName(partName));
    rp.setSourceP(p);
    rp.setRelationships((Relationships)rp.unmarshal(el));
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new Docx4JException("String_Node_Str" + partName,e);
  }
  return rp;
}
Program: 185133
Project: 185133
Buggy source:
Map<String,Object> getSettings(){
  Map<String,Object> settings=new java.util.HashMap<String,Object>();
  settings.put("String_Node_Str",removeProofErrors);
  return settings;
}

Fixed version (ground truth):
Map<String,Object> getSettings(){
  Map<String,Object> settings=new java.util.HashMap<String,Object>();
  settings.put("String_Node_Str",removeProofErrors);
  settings.put("String_Node_Str",removeContentControls);
  settings.put("String_Node_Str",removeRsids);
  return settings;
}
Program: 185134
Project: 185134
Buggy source:
public org.docx4j.wml.Package exportPkgXml(){
  org.docx4j.wml.ObjectFactory factory=new org.docx4j.wml.ObjectFactory();
  org.docx4j.wml.Package pkg=factory.createPackage();
  org.docx4j.wml.Package.Part pkgPartDocument=factory.createPackagePart();
  MainDocumentPart documentPart=getMainDocumentPart();
  pkgPartDocument.setName(documentPart.getPartName().getName());
  pkgPartDocument.setContentType(documentPart.getContentType());
  org.docx4j.wml.Package.Part.XmlData XmlDataDoc=factory.createPackagePartXmlData();
  org.docx4j.wml.Document wmlDocumentEl=(org.docx4j.wml.Document)documentPart.getJaxbElement();
  XmlDataDoc.setDocument(wmlDocumentEl);
  pkgPartDocument.setXmlData(XmlDataDoc);
  pkg.getPart().add(pkgPartDocument);
  org.docx4j.wml.Package.Part pkgPartStyles=factory.createPackagePart();
  org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart stylesPart=documentPart.getStyleDefinitionsPart();
  pkgPartDocument.setName(stylesPart.getPartName().getName());
  pkgPartDocument.setContentType(stylesPart.getContentType());
  org.docx4j.wml.Package.Part.XmlData XmlDataStyles=factory.createPackagePartXmlData();
  org.docx4j.wml.Styles styles=(org.docx4j.wml.Styles)stylesPart.getJaxbElement();
  XmlDataStyles.setStyles(styles);
  pkgPartStyles.setXmlData(XmlDataStyles);
  pkg.getPart().add(pkgPartStyles);
  return pkg;
}

Fixed version (ground truth):
public org.docx4j.wml.Package exportPkgXml(){
  org.docx4j.wml.ObjectFactory factory=new org.docx4j.wml.ObjectFactory();
  org.docx4j.wml.Package pkg=factory.createPackage();
  org.docx4j.wml.Package.Part pkgPartDocument=factory.createPackagePart();
  MainDocumentPart documentPart=getMainDocumentPart();
  pkgPartDocument.setName(documentPart.getPartName().getName());
  pkgPartDocument.setContentType(documentPart.getContentType());
  org.docx4j.wml.Package.Part.XmlData XmlDataDoc=factory.createPackagePartXmlData();
  org.docx4j.wml.Document wmlDocumentEl=(org.docx4j.wml.Document)documentPart.getJaxbElement();
  XmlDataDoc.setDocument(wmlDocumentEl);
  pkgPartDocument.setXmlData(XmlDataDoc);
  pkg.getPart().add(pkgPartDocument);
  org.docx4j.wml.Package.Part pkgPartStyles=factory.createPackagePart();
  org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart stylesPart=documentPart.getStyleDefinitionsPart();
  pkgPartStyles.setName(stylesPart.getPartName().getName());
  pkgPartStyles.setContentType(stylesPart.getContentType());
  org.docx4j.wml.Package.Part.XmlData XmlDataStyles=factory.createPackagePartXmlData();
  org.docx4j.wml.Styles styles=(org.docx4j.wml.Styles)stylesPart.getJaxbElement();
  XmlDataStyles.setStyles(styles);
  pkgPartStyles.setXmlData(XmlDataStyles);
  pkg.getPart().add(pkgPartStyles);
  return pkg;
}
Program: 185136
Project: 185136
Buggy source:
public boolean handleEvent(ValidationEvent ve){
  if (ve.getSeverity() == ValidationEvent.FATAL_ERROR || ve.getSeverity() == ValidationEvent.ERROR) {
    ValidationEventLocator locator=ve.getLocator();
    if (log.isDebugEnabled()) {
      log.warn(printSeverity(ve) + "String_Node_Str" + ve.getMessage());
    }
 else {
      log.warn(printSeverity(ve) + "String_Node_Str" + ve.getMessage().substring(0,120));
    }
    if (ve.getLinkedException() != null && log.isDebugEnabled()) {
      ve.getLinkedException().printStackTrace();
    }
  }
 else   if (ve.getSeverity() == ve.WARNING) {
    log.warn(printSeverity(ve) + "String_Node_Str" + ve.getMessage());
  }
  log.info("String_Node_Str");
  return true;
}

Fixed version (ground truth):
public boolean handleEvent(ValidationEvent ve){
  if (ve.getSeverity() == ValidationEvent.FATAL_ERROR || ve.getSeverity() == ValidationEvent.ERROR) {
    ValidationEventLocator locator=ve.getLocator();
    if (log.isDebugEnabled() || ve.getMessage().length() < 120) {
      log.warn(printSeverity(ve) + "String_Node_Str" + ve.getMessage());
    }
 else {
      log.warn(printSeverity(ve) + "String_Node_Str" + ve.getMessage().substring(0,120));
    }
    if (ve.getLinkedException() != null && log.isDebugEnabled()) {
      ve.getLinkedException().printStackTrace();
    }
  }
 else   if (ve.getSeverity() == ve.WARNING) {
    log.warn(printSeverity(ve) + "String_Node_Str" + ve.getMessage());
  }
  log.info("String_Node_Str");
  return true;
}
Program: 185137
Project: 185137
Buggy source:
/** 
 * Gets the value of the blockLevelElements property. <p> This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for the blockLevelElements property. <p> For example, to add a new item, do as follows: <pre> getBlockLevelElements().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list  {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}{@link JAXBElement }{@code <}{@link Tbl }{@code >}{@link Sdt }{@link JAXBElement }{@code <}{@link P }{@code >}{@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
 */
public List<Object> getBlockLevelElements(){
  if (blockLevelElements == null) {
    blockLevelElements=new ArrayList<Object>();
  }
  return this.blockLevelElements;
}

Fixed version (ground truth):
/** 
 * Gets the value of the blockLevelElements property. <p> This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for the blockLevelElements property. <p> For example, to add a new item, do as follows: <pre> getBlockLevelElements().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list  {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}{@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}{@link JAXBElement }{@code <}{@link P }{@code >}{@link JAXBElement }{@code <}{@link Tbl }{@code >}{@link Sdt }
 */
public List<Object> getBlockLevelElements(){
  if (blockLevelElements == null) {
    blockLevelElements=new ArrayList<Object>();
  }
  return this.blockLevelElements;
}