nus-yam/ex-repair huggingface dataset:
Program: 77117
Project: 77117
Buggy source:
public Image(IImageContent content){
  String imgUri=content.getURI();
  byte[] imgData=content.getData();
  extension=content.getExtension();
  if (extension == null) {
    String mimeType=content.getMIMEType();
    if (mimeType != null) {
      extension=FileUtil.getExtFromType(mimeType);
    }
  }
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
    if (imgUri != null) {
      this.id=imgUri;
      this.source=IImage.FILE_IMAGE;
    }
  break;
case IImageContent.IMAGE_NAME:
if (imgData != null) {
  this.data=imgData;
  this.source=IImage.DESIGN_IMAGE;
  this.id=imgUri;
}
break;
case IImageContent.IMAGE_EXPRESSION:
if (imgData != null) {
this.data=imgData;
this.source=IImage.CUSTOM_IMAGE;
this.id=content.getInstanceID().toString();
}
break;
case IImageContent.IMAGE_URL:
if (imgUri != null) {
this.id=imgUri;
this.source=IImage.URL_IMAGE;
}
break;
default :
assert(false);
}
}

Fixed version (ground truth):
public Image(IImageContent content){
  String imgUri=content.getURI();
  byte[] imgData=content.getData();
  extension=content.getExtension();
  if (extension == null) {
    String mimeType=content.getMIMEType();
    if (mimeType != null) {
      extension=FileUtil.getExtFromType(mimeType);
    }
  }
  if (content.getImageMap() != null) {
    this.imageMap=(String)content.getImageMap();
  }
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
    if (imgUri != null) {
      this.id=imgUri;
      this.source=IImage.FILE_IMAGE;
    }
  break;
case IImageContent.IMAGE_NAME:
if (imgData != null) {
  this.data=imgData;
  this.source=IImage.DESIGN_IMAGE;
  this.id=imgUri;
}
break;
case IImageContent.IMAGE_EXPRESSION:
if (imgData != null) {
this.data=imgData;
this.source=IImage.CUSTOM_IMAGE;
this.id=content.getInstanceID().toString();
}
break;
case IImageContent.IMAGE_URL:
if (imgUri != null) {
this.id=imgUri;
this.source=IImage.URL_IMAGE;
}
break;
default :
assert(false);
}
}
Program: 77118
Project: 77118
Buggy source:
/** 
 * Removes 'resultSetHit' property if version is between 3.2.2 and 3.2.6 .
 * @param dataSet the data set element
 */
private void doCompatibleRemoveResultSetHitProperty(OdaDataSet dataSet){
  if (dataSet == null)   return;
  if ((handler.versionNumber > VersionUtil.VERSION_3_2_2) && (handler.versionNumber < VersionUtil.VERSION_3_2_6)) {
    dataSet.setProperty(IDataSetModel.RESULT_SET_HINTS_PROP,null);
  }
}

Fixed version (ground truth):
/** 
 * Removes 'resultSetHit' property if version is between 3.2.2 and 3.2.6 .
 * @param dataSet the data set element
 */
private void doCompatibleRemoveResultSetHitProperty(OdaDataSet dataSet){
  if (dataSet == null)   return;
  if ((handler.versionNumber >= VersionUtil.VERSION_3_2_2) && (handler.versionNumber < VersionUtil.VERSION_3_2_6)) {
    dataSet.setProperty(IDataSetModel.RESULT_SET_HINTS_PROP,null);
  }
}
Program: 77119
Project: 77119
Buggy source:
/** 
 * @param parameterType The parameterType to set.
 */
public void setParameterType(int parameterType){
  this.parameterType=parameterType;
switch (parameterType) {
case IParameterDefnBase.FILTER_PARAMETER:
    this.typeName=FILTER;
  break;
case IParameterDefnBase.LIST_PARAMETER:
this.typeName=LIST;
break;
case IParameterDefnBase.TABLE_PARAMETER:
this.typeName=TABLE;
break;
case IParameterDefnBase.PARAMETER_GROUP:
this.typeName=GROUP;
break;
case IParameterDefnBase.SCALAR_PARAMETER:
default :
this.typeName=SCALAR;
break;
}
}

Fixed version (ground truth):
/** 
 * @param parameterType The parameterType to set.
 */
public void setParameterType(int parameterType){
  this.parameterType=parameterType;
}
Program: 77120
Project: 77120
Buggy source:
public String getTypeName(){
  return typeName;
}

Fixed version (ground truth):
public String getTypeName(){
  String typeName;
switch (parameterType) {
case IParameterDefnBase.FILTER_PARAMETER:
    typeName=FILTER;
  break;
case IParameterDefnBase.LIST_PARAMETER:
typeName=LIST;
break;
case IParameterDefnBase.TABLE_PARAMETER:
typeName=TABLE;
break;
case IParameterDefnBase.PARAMETER_GROUP:
typeName=GROUP;
break;
case IParameterDefnBase.SCALAR_PARAMETER:
default :
typeName=SCALAR;
break;
}
return typeName;
}
Program: 77121
Project: 77121
Buggy source:
/** 
 * Local do get.
 */
protected void __doGet(IContext context) throws ServletException, IOException, BirtException {
  ViewerAttributeBean bean=(ViewerAttributeBean)context.getBean();
  if (IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(context.getRequest().getServletPath()) && bean != null && bean.isMissingParameter()) {
    requester.service(context.getRequest(),context.getResponse());
  }
 else   if (IBirtConstants.SERVLET_PATH_PARAMETER.equalsIgnoreCase(context.getRequest().getServletPath())) {
    requester.service(context.getRequest(),context.getResponse());
  }
 else {
    engine.service(context.getRequest(),context.getResponse());
  }
}

Fixed version (ground truth):
/** 
 * Local do get.
 */
protected void __doGet(IContext context) throws ServletException, IOException, BirtException {
  context.getResponse().setHeader("String_Node_Str","String_Node_Str");
  context.getResponse().setHeader("String_Node_Str","String_Node_Str");
  context.getResponse().setHeader("String_Node_Str","String_Node_Str");
  context.getResponse().setDateHeader("String_Node_Str",0);
  ViewerAttributeBean bean=(ViewerAttributeBean)context.getBean();
  if (IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(context.getRequest().getServletPath()) && bean != null && bean.isMissingParameter()) {
    requester.service(context.getRequest(),context.getResponse());
  }
 else   if (IBirtConstants.SERVLET_PATH_PARAMETER.equalsIgnoreCase(context.getRequest().getServletPath())) {
    requester.service(context.getRequest(),context.getResponse());
  }
 else {
    engine.service(context.getRequest(),context.getResponse());
  }
}
Program: 77122
Project: 77122
Buggy source:
/** 
 * Local process http request with GET method.
 * @param request incoming http request
 * @param response http response
 * @exception ServletException
 * @exception IOException
 * @return
 */
protected void __doGet(IContext context) throws ServletException, IOException, BirtException {
  IFragment activeFragment=null;
  String servletPath=context.getRequest().getServletPath();
  if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(servletPath)) {
    activeFragment=viewer;
  }
  activeFragment.service(context.getRequest(),context.getResponse());
}

Fixed version (ground truth):
/** 
 * Local process http request with GET method.
 * @param request incoming http request
 * @param response http response
 * @exception ServletException
 * @exception IOException
 * @return
 */
protected void __doGet(IContext context) throws ServletException, IOException, BirtException {
  IFragment activeFragment=null;
  String servletPath=context.getRequest().getServletPath();
  if (IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(servletPath)) {
    activeFragment=viewer;
  }
  context.getResponse().setHeader("String_Node_Str","String_Node_Str");
  context.getResponse().setHeader("String_Node_Str","String_Node_Str");
  context.getResponse().setHeader("String_Node_Str","String_Node_Str");
  context.getResponse().setDateHeader("String_Node_Str",0);
  activeFragment.service(context.getRequest(),context.getResponse());
}
Program: 77123
Project: 77123
Buggy source:
/** 
 * Uses the new name space of the current module for reference property values of the given element. This method checks the <code>content</code> and nested elements in it.
 * @param module the module that <code>content</code> attaches.
 * @param content the element to revise
 * @param propDefn
 * @param nameSpace the new name space
 */
public static void revisePropertyNameSpace(Module module,DesignElement content,IElementPropertyDefn propDefn,String nameSpace){
  if (propDefn.getTypeCode() != IPropertyType.ELEMENT_REF_TYPE)   return;
  Object value=content.getLocalProperty(module,(ElementPropertyDefn)propDefn);
  if (value == null)   return;
  ReferenceValue refValue=(ReferenceValue)value;
  refValue.setLibraryNamespace(nameSpace);
}

Fixed version (ground truth):
/** 
 * Uses the new name space of the current module for reference property values of the given element. This method checks the <code>content</code> and nested elements in it.
 * @param module the module that <code>content</code> attaches.
 * @param content the element to revise
 * @param propDefn
 * @param nameSpace the new name space
 */
public static void revisePropertyNameSpace(Module module,DesignElement content,IElementPropertyDefn propDefn,String nameSpace){
  if (propDefn.getTypeCode() != IPropertyType.ELEMENT_REF_TYPE && propDefn.getTypeCode() != IPropertyType.EXTENDS_TYPE)   return;
  Object value=content.getLocalProperty(module,(ElementPropertyDefn)propDefn);
  if (value == null)   return;
  ReferenceValue refValue=(ReferenceValue)value;
  refValue.setLibraryNamespace(nameSpace);
}
Program: 77124
Project: 77124
Buggy source:
/** 
 * Gets the display string for the value with default locale and default format, The value must be the valid data type. That is: <ul> <li>if data type is <code>PARAM_TYPE_DATETIME</code>, then the value must be <code>java.util.Date<code>.</li> <li>if the data type is <code>PARAM_TYPE_FLOAT</code>, then the value must be <code>java.lang.Double</code>.</li> <li>if the data type is <code>PARAM_TYPE_DECIMAL</code>, then the value must be <code>java.math.BigDecimal</code>.</li> <li>if the data type is <code>PARAM_TYPE_BOOLEAN</code>, then the value must be <code>java.lang.Boolean</code>.</li> <li>if the data type is <code>PARAM_TYPE_STRING</code>, then the value must be <code>java.lang.String</code>.</li> </ul>
 * @param value the input value to validate
 * @return the formatted string
 */
static public String getDisplayValue(Object value){
  if (value == null)   return null;
  if (value instanceof Float || value instanceof Double || value instanceof BigDecimal|| value instanceof com.ibm.icu.math.BigDecimal) {
    return value.toString();
  }
  return ParameterValidationUtil.getDisplayValue(value);
}

Fixed version (ground truth):
/** 
 * Gets the display string for the value with default locale and default format, The value must be the valid data type. That is: <ul> <li>if data type is <code>PARAM_TYPE_DATETIME</code>, then the value must be <code>java.util.Date<code>.</li> <li>if the data type is <code>PARAM_TYPE_FLOAT</code>, then the value must be <code>java.lang.Double</code>.</li> <li>if the data type is <code>PARAM_TYPE_DECIMAL</code>, then the value must be <code>java.math.BigDecimal</code>.</li> <li>if the data type is <code>PARAM_TYPE_BOOLEAN</code>, then the value must be <code>java.lang.Boolean</code>.</li> <li>if the data type is <code>PARAM_TYPE_STRING</code>, then the value must be <code>java.lang.String</code>.</li> </ul>
 * @param value the input value to validate
 * @return the formatted string
 */
public static String getDisplayValue(Object value){
  if (value == null)   return null;
  if (value instanceof Float || value instanceof Double || value instanceof BigDecimal|| value instanceof com.ibm.icu.math.BigDecimal) {
    return value.toString();
  }
  return ParameterValidationUtil.getDisplayValue(value);
}
Program: 77125
Project: 77125
Buggy source:
/** 
 * Creates iText BaseFont with the given font family name.	
 * @param ffn			the specified font family name.
 * @param encoding		the encoding for the font.
 * @return				the created BaseFont.
 */
private BaseFont createFont(String ffn,int fontStyle){
  String key=ffn + fontStyle;
synchronized (baseFonts) {
    BaseFont font=(BaseFont)baseFonts.get(key);
    if (font == null) {
      String encoding=getEncoding(ffn);
      Font f=FontFactory.getFont(ffn,encoding,BaseFont.NOT_EMBEDDED,14,fontStyle);
      font=f.getBaseFont();
      baseFonts.put(key,font);
    }
    return font;
  }
}

Fixed version (ground truth):
/** 
 * Creates iText BaseFont with the given font family name.	
 * @param ffn			the specified font family name.
 * @param encoding		the encoding for the font.
 * @return				the created BaseFont.
 */
private BaseFont createFont(String ffn,int fontStyle){
  String key=ffn + fontStyle;
synchronized (baseFonts) {
    BaseFont font=(BaseFont)baseFonts.get(key);
    if (font == null) {
      String encoding=getEncoding(ffn);
      Font f=null;
      try {
        f=FontFactory.getFont(ffn,encoding,BaseFont.NOT_EMBEDDED,14,fontStyle);
      }
 catch (      Throwable de) {
        logger.log(Level.WARNING,de.getLocalizedMessage());
        return null;
      }
      font=f.getBaseFont();
      if (font != null) {
        baseFonts.put(key,font);
      }
    }
    return font;
  }
}
Program: 77126
Project: 77126
Buggy source:
protected void repeatHeader(){
  if (isFirst) {
    isFirst=false;
    return;
  }
  if (!isRepeatHeader()) {
    return;
  }
  IListBandContent band=getHeader();
  if (band == null) {
    return;
  }
  IReportItemExecutor headerExecutor=new DOMReportItemExecutor(band);
  headerExecutor.execute();
  ContainerArea headerArea=(ContainerArea)AreaFactory.createLogicContainer(content.getReportContent());
  headerArea.setAllocatedWidth(parent.getMaxAvaWidth());
  PDFRegionLM regionLM=new PDFRegionLM(context,headerArea,band,headerExecutor);
  boolean allowPB=context.allowPageBreak();
  context.setAllowPageBreak(false);
  regionLM.layout();
  context.setAllowPageBreak(allowPB);
  if (headerArea.getAllocatedHeight() + currentBP < parent.getMaxAvaHeight()) {
    addArea(headerArea);
    repeatCount++;
  }
}

Fixed version (ground truth):
protected void repeatHeader(){
  if (isFirst) {
    isFirst=false;
    return;
  }
  if (!isCurrentDetailBand()) {
    return;
  }
  if (!isRepeatHeader()) {
    return;
  }
  IListBandContent band=getHeader();
  if (band == null) {
    return;
  }
  IReportItemExecutor headerExecutor=new DOMReportItemExecutor(band);
  headerExecutor.execute();
  ContainerArea headerArea=(ContainerArea)AreaFactory.createLogicContainer(content.getReportContent());
  headerArea.setAllocatedWidth(parent.getMaxAvaWidth());
  PDFRegionLM regionLM=new PDFRegionLM(context,headerArea,band,headerExecutor);
  boolean allowPB=context.allowPageBreak();
  context.setAllowPageBreak(false);
  regionLM.layout();
  context.setAllowPageBreak(allowPB);
  if (headerArea.getAllocatedHeight() + currentBP < parent.getMaxAvaHeight()) {
    addArea(headerArea);
    repeatCount++;
  }
}
Program: 77129
Project: 77129
Buggy source:
/** 
 * Creates the visibility rule( i.e. the hide)
 * @param handle the DE's handle
 * @return the created visibility rule
 */
protected VisibilityRuleDesign createHide(HideRuleHandle handle){
  VisibilityRuleDesign rule=new VisibilityRuleDesign();
  rule.setExpression(createExpression(handle.getExpression()));
  rule.setFormat(handle.getFormat());
  return rule;
}

Fixed version (ground truth):
/** 
 * Creates the visibility rule( i.e. the hide)
 * @param handle the DE's handle
 * @return the created visibility rule
 */
protected VisibilityRuleDesign createHide(HideRuleHandle handle){
  VisibilityRuleDesign rule=new VisibilityRuleDesign();
  rule.setExpression(createExpression(handle.getExpression()));
  String format=handle.getFormat();
  if ("String_Node_Str".equalsIgnoreCase(format)) {
    format=EngineIRConstants.FORMAT_TYPE_VIEWER;
  }
  rule.setFormat(format);
  return rule;
}
Program: 77130
Project: 77130
Buggy source:
/** 
 * prepare the queries defined in the report.
 */
public void prepare(Report report,Map appContext){
  ReportDesignHandle rptHandle=report.getReportDesign();
  ModelDteApiAdapter adaptor=new ModelDteApiAdapter(context,context.getSharedScope());
  List dataSourceList=rptHandle.getAllDataSources();
  for (int i=0; i < dataSourceList.size(); i++) {
    DataSourceHandle dataSource=(DataSourceHandle)dataSourceList.get(i);
    try {
      dteEngine.defineDataSource(adaptor.createDataSourceDesign(dataSource));
    }
 catch (    BirtException be) {
      logger.log(Level.SEVERE,be.getMessage(),be);
      context.addException(dataSource,be);
    }
  }
  List dataSetList=rptHandle.getAllDataSets();
  for (int i=0; i < dataSetList.size(); i++) {
    DataSetHandle dataset=(DataSetHandle)dataSetList.get(i);
    try {
      dteEngine.defineDataSet(adaptor.createDataSetDesign(dataset));
    }
 catch (    BirtException be) {
      logger.log(Level.SEVERE,be.getMessage(),be);
      context.addException(dataset,be);
    }
  }
  new ReportQueryBuilder().build(report,context);
  doPrepareQuery(report,appContext);
}

Fixed version (ground truth):
public void prepare(Report report,Map appContext){
  ReportDesignHandle rptHandle=report.getReportDesign();
  List dataSetList=rptHandle.getAllDataSets();
  for (int i=0; i < dataSetList.size(); i++) {
    DataSetHandle dataset=(DataSetHandle)dataSetList.get(i);
    try {
      adapter.defineDataSet(dataset,dteEngine);
    }
 catch (    BirtException be) {
      logger.log(Level.SEVERE,be.getMessage(),be);
      context.addException(dataset,be);
    }
  }
  new ReportQueryBuilder().build(report,context);
  doPrepareQuery(report,appContext);
}
Program: 77131
Project: 77131
Buggy source:
public void defineDataSet(DataSetHandle dataSet){
  DataSourceHandle dataSource=dataSet.getDataSource();
  ModelDteApiAdapter adaptor=new ModelDteApiAdapter(context,context.getSharedScope());
  try {
    if (dataSource != null) {
      doDefineDataSource(adaptor,dataSource);
    }
    doDefineDataSet(adaptor,dataSet);
  }
 catch (  BirtException e) {
    logger.log(Level.SEVERE,e.getMessage());
  }
}

Fixed version (ground truth):
public void defineDataSet(DataSetHandle dataSet){
  try {
    adapter.defineDataSet(dataSet,dteEngine);
  }
 catch (  BirtException e) {
    logger.log(Level.SEVERE,e.getMessage());
  }
}
Program: 77132
Project: 77132
Buggy source:
/** 
 */
public IResultSet execute(IResultSet parent,IBaseQueryDefinition query){
  if (query instanceof IQueryDefinition) {
    return doExecuteQuery((DteResultSet)parent,(IQueryDefinition)query);
  }
 else   if (query instanceof ISubqueryDefinition) {
    return doExecuteSubQuery((DteResultSet)parent,query);
  }
  return null;
}

Fixed version (ground truth):
public IResultSet execute(IResultSet parent,IBaseQueryDefinition query){
  if (query instanceof IQueryDefinition) {
    return doExecuteQuery((DteResultSet)parent,(IQueryDefinition)query);
  }
 else   if (query instanceof ISubqueryDefinition) {
    return doExecuteSubQuery((DteResultSet)parent,query);
  }
  return null;
}
Program: 77133
Project: 77133
Buggy source:
public AbstractDataEngine(ExecutionContext context){
  this.context=context;
  try {
    Scriptable scope=context.getScope();
    context.registerBean("String_Node_Str",new NativeRowObject(scope,context));
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
public AbstractDataEngine(ExecutionContext context){
  this.context=context;
  this.adapter=new ModelDteApiAdapter(context,context.getSharedScope());
  try {
    Scriptable scope=context.getScope();
    context.registerBean("String_Node_Str",new NativeRowObject(scope,context));
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    ex.printStackTrace();
  }
}
Program: 77135
Project: 77135
Buggy source:
/** 
 * @param val string to be handled
 * @param option to upper case or to lower case
 * @return
 */
private String handleCase(String val,char option){
  if (option == '<')   return val.toLowerCase();
 else   if (option == '>')   return val.toUpperCase();
 else   return val;
}

Fixed version (ground truth):
/** 
 * @param val string to be handled
 * @param option to upper case or to lower case
 * @return
 */
private String handleCase(String val,char option){
  if (option == '<')   return UCharacter.toLowerCase(locale,val);
 else   if (option == '>')   return UCharacter.toUpperCase(locale,val);
 else   return val;
}
Program: 77136
Project: 77136
Buggy source:
public XMLParserException semanticError(XMLParserException e){
  e.setLineNumber(locator.getLineNumber());
  MetaLogManager.log(e.getMessage(),e);
  logger.log(Level.SEVERE,e.getMessage());
  errors.add(e);
  return e;
}

Fixed version (ground truth):
public XMLParserException semanticError(XMLParserException e){
}
Program: 77137
Project: 77137
Buggy source:
public XMLParserException semanticError(XMLParserException e){
  e.setLineNumber(locator.getLineNumber());
  e.setTag(currentElement);
  errors.add(e);
  return e;
}

Fixed version (ground truth):
public XMLParserException semanticError(XMLParserException e){
  if (locator != null)   e.setLineNumber(locator.getLineNumber());
 else   e.setLineNumber(1);
  e.setTag(currentElement);
  errors.add(e);
  return e;
}
Program: 77138
Project: 77138
Buggy source:
public Object visitForeign(IForeignContent foreign,Object value){
  if (IForeignContent.HTML_TYPE.equals(foreign.getRawType())) {
    if (converter == null) {
      converter=new HTML2Content(foreign.getReportContent().getDesign().getBasePath());
    }
    converter.html2Content(foreign);
    executor=new DOMReportItemExecutor(foreign);
    executor.execute();
    return visitContent(foreign,value);
  }
  LabelContent label=new LabelContent(foreign);
  return handleText(label);
}

Fixed version (ground truth):
public Object visitForeign(IForeignContent foreign,Object value){
  if (IForeignContent.HTML_TYPE.equals(foreign.getRawType())) {
    if (converter == null) {
      converter=new HTML2Content(foreign.getReportContent().getDesign().getReportDesign());
    }
    converter.html2Content(foreign);
    executor=new DOMReportItemExecutor(foreign);
    executor.execute();
    return visitContent(foreign,value);
  }
  LabelContent label=new LabelContent(foreign);
  return handleText(label);
}
Program: 77139
Project: 77139
Buggy source:
public HTML2Content(String rootPath){
  this.rootPath=rootPath;
}

Fixed version (ground truth):
public HTML2Content(ReportDesignHandle report){
  this.report=report;
}
Program: 77140
Project: 77140
Buggy source:
protected void processForeignData(IForeignContent foreign){
  if (foreign.getChildren() != null && foreign.getChildren().size() > 0) {
    return;
  }
  HashMap styleMap=new HashMap();
  HTMLStyleProcessor htmlProcessor=new HTMLStyleProcessor(this.rootPath);
  Object rawValue=foreign.getRawValue();
  Document doc=null;
  if (null != rawValue) {
    doc=new TextParser().parse(foreign.getRawValue().toString(),(String)textTypeMapping.get(foreign.getRawType()));
  }
  Element body=null;
  if (doc != null) {
    Node node=doc.getFirstChild();
    if (node instanceof Element) {
      body=(Element)node;
    }
  }
  if (body != null) {
    htmlProcessor.execute(body,styleMap);
    processNodes(body,checkEscapeSpace(doc),styleMap,foreign);
  }
}

Fixed version (ground truth):
protected void processForeignData(IForeignContent foreign){
  if (foreign.getChildren() != null && foreign.getChildren().size() > 0) {
    return;
  }
  HashMap styleMap=new HashMap();
  HTMLStyleProcessor htmlProcessor=new HTMLStyleProcessor(report);
  Object rawValue=foreign.getRawValue();
  Document doc=null;
  if (null != rawValue) {
    doc=new TextParser().parse(foreign.getRawValue().toString(),(String)textTypeMapping.get(foreign.getRawType()));
  }
  Element body=null;
  if (doc != null) {
    Node node=doc.getFirstChild();
    if (node instanceof Element) {
      body=(Element)node;
    }
  }
  if (body != null) {
    htmlProcessor.execute(body,styleMap);
    processNodes(body,checkEscapeSpace(doc),styleMap,foreign);
  }
}
Program: 77141
Project: 77141
Buggy source:
/** 
 * Outputs the image
 * @param ele the IMG element instance
 */
protected void outputImg(Element ele,HashMap cssStyles,IContent content){
  String src=ele.getAttribute("String_Node_Str");
  if (src != null) {
    IImageContent image=new ImageContent(content);
    addChild(content,image);
    handleStyle(ele,cssStyles,image);
    if (!FileUtil.isLocalResource(src)) {
      image.setImageSource(IImageContent.IMAGE_URL);
      image.setURI(src);
    }
 else {
      src=FileUtil.getAbsolutePath(rootPath,src);
      image.setImageSource(IImageContent.IMAGE_FILE);
      image.setURI(src);
    }
    if (null != ele.getAttribute("String_Node_Str") && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setAltText(ele.getAttribute("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
/** 
 * Outputs the image
 * @param ele the IMG element instance
 */
protected void outputImg(Element ele,HashMap cssStyles,IContent content){
  String src=ele.getAttribute("String_Node_Str");
  if (src != null) {
    IImageContent image=new ImageContent(content);
    addChild(content,image);
    handleStyle(ele,cssStyles,image);
    if (!FileUtil.isLocalResource(src)) {
      image.setImageSource(IImageContent.IMAGE_URL);
      image.setURI(src);
    }
 else {
      ReportDesignHandle handle=content.getReportContent().getDesign().getReportDesign();
      URL url=handle.findResource(src,IResourceLocator.IMAGE);
      if (url != null) {
        src=url.getFile();
      }
      image.setImageSource(IImageContent.IMAGE_FILE);
      image.setURI(src);
    }
    if (null != ele.getAttribute("String_Node_Str") && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setAltText(ele.getAttribute("String_Node_Str"));
    }
  }
}
Program: 77142
Project: 77142
Buggy source:
/** 
 * Constructor
 * @param context the execution context
 */
public HTMLStyleProcessor(String rootPath){
  cssEngine=new BIRTCSSEngine();
  this.rootPath=rootPath;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param context the execution context
 */
public HTMLStyleProcessor(ReportDesignHandle report){
  cssEngine=new BIRTCSSEngine();
  this.report=report;
}
Program: 77144
Project: 77144
Buggy source:
public EditPart createEditPart(EditPart context,Object model){
  EditPart editPart=null;
  if (model instanceof LibRootModel) {
    model=((LibRootModel)model).getModel();
  }
 else   if (model instanceof LibraryHandle) {
    editPart=new EmptyEditPart(model){
      public void activate(){
      }
      public void deactivate(){
      }
    }
;
  }
  if (editPart != null) {
    return editPart;
  }
  editPart=super.createEditPart(context,model);
  if (editPart == null || editPart instanceof DummyEditpart) {
    editPart=new EmptyEditPart(model);
  }
  return editPart;
}

Fixed version (ground truth):
public EditPart createEditPart(EditPart context,Object model){
  EditPart editPart=null;
  if (model instanceof LibRootModel) {
    model=((LibRootModel)model).getModel();
  }
 else   if (model instanceof LibraryHandle) {
    editPart=new EmptyEditPart(model){
      public void activate(){
      }
      public void deactivate(){
      }
    }
;
  }
 else   if (model instanceof MasterPageHandle) {
    return new MasterPageEditPart(model);
  }
  if (editPart != null) {
    return editPart;
  }
  editPart=super.createEditPart(context,model);
  if (editPart == null || editPart instanceof DummyEditpart) {
    editPart=new EmptyEditPart(model);
  }
  return editPart;
}
Program: 77146
Project: 77146
Buggy source:
/** 
 * Copies the value from resultSet to resultSetHints.
 * @param dataSet the data set element
 */
private void doCompatibleDataSetProperty(DesignElement dataSet){
}

Fixed version (ground truth):
/** 
 * Copies the value from resultSet to resultSetHints.
 * @param dataSet the data set element
 */
private void doCompatibleDataSetProperty(OdaDataSet dataSet){
  if (dataSet == null)   return;
  if (handler.versionNumber < VersionUtil.VERSION_3_2_2) {
    List dataSetColumns=(List)dataSet.getLocalProperty(handler.module,IDataSetModel.RESULT_SET_PROP);
    Object dataSetHints=dataSet.getLocalProperty(handler.module,IDataSetModel.RESULT_SET_HINTS_PROP);
    if (dataSetHints == null && dataSetColumns != null)     dataSet.setProperty(IDataSetModel.RESULT_SET_HINTS_PROP,ModelUtil.copyValue(dataSet.getPropertyDefn(IDataSetModel.RESULT_SET_HINTS_PROP),dataSetColumns));
  }
}
Program: 77147
Project: 77147
Buggy source:
public void end() throws SAXException {
  super.end();
  DesignElement tmpElement=getElement();
  doCompatibleDataSetProperty(tmpElement);
  mergeResultSetAndResultSetHints((OdaDataSet)tmpElement);
  TemplateParameterDefinition refTemplateParam=tmpElement.getTemplateParameterElement(handler.getModule());
  if (refTemplateParam == null)   return;
  doCompatibleDataSetProperty(refTemplateParam.getDefaultElement());
  mergeResultSetAndResultSetHints((OdaDataSet)refTemplateParam.getDefaultElement());
}

Fixed version (ground truth):
public void end() throws SAXException {
  super.end();
  OdaDataSet tmpElement=(OdaDataSet)getElement();
  doCompatibleDataSetProperty(tmpElement);
  mergeResultSetAndResultSetHints(tmpElement);
  doCompatibleRemoveResultSetProperty(tmpElement);
  doCompatibleRemoveResultSetHitProperty(tmpElement);
  TemplateParameterDefinition refTemplateParam=tmpElement.getTemplateParameterElement(handler.getModule());
  if (refTemplateParam == null)   return;
  OdaDataSet refDefaultElement=(OdaDataSet)refTemplateParam.getDefaultElement();
  doCompatibleDataSetProperty(refDefaultElement);
  mergeResultSetAndResultSetHints(refDefaultElement);
  doCompatibleRemoveResultSetProperty(refDefaultElement);
  doCompatibleRemoveResultSetHitProperty(refDefaultElement);
}
Program: 77148
Project: 77148
Buggy source:
public void deactivate(){
  if (!isActive())   return;
  removeGuideFeedBack();
  super.deactivate();
  if (isDelete()) {
    HandleAdapterFactory.getInstance().remove(getModel());
  }
}

Fixed version (ground truth):
public void deactivate(){
  if (!isActive())   return;
  removeGuideFeedBack();
  super.deactivate();
  HandleAdapterFactory.getInstance().remove(getModel());
}
Program: 77149
Project: 77149
Buggy source:
private void MergeContent(TableCellEditPart cellPart,List list) throws ContentException {
  CellHandle cellHandle=(CellHandle)cellPart.getModel();
  int size=list.size();
  for (int i=0; i < size; i++) {
    CellHandle handle=(CellHandle)(((TableCellEditPart)list.get(i)).getModel());
    List chList=handle.getSlot(CellHandle.CONTENT_SLOT).getContents();
    for (int j=0; j < chList.size(); j++) {
      DesignElementHandle contentHandle=(DesignElementHandle)chList.get(j);
      handle.getSlot(CellHandle.CONTENT_SLOT).move(contentHandle,cellHandle,CellHandle.CONTENT_SLOT);
    }
  }
}

Fixed version (ground truth):
private void MergeContent(TableCellEditPart cellPart,List list) throws ContentException {
  CellHandle cellHandle=(CellHandle)cellPart.getModel();
  int size=list.size();
  for (int i=0; i < size; i++) {
    CellHandle handle=(CellHandle)(((TableCellEditPart)list.get(i)).getModel());
    List chList=handle.getSlot(CellHandle.CONTENT_SLOT).getContents();
    for (int j=0; j < chList.size(); j++) {
      DesignElementHandle contentHandle=(DesignElementHandle)chList.get(j);
      try {
        DesignElementHandle copy=contentHandle.copy().getHandle(cellHandle.getModule());
        handle.getSlot(CellHandle.CONTENT_SLOT).drop(contentHandle);
        cellHandle.getModuleHandle().rename(copy);
        cellHandle.getSlot(CellHandle.CONTENT_SLOT).add(copy);
      }
 catch (      SemanticException e) {
        ExceptionHandler.handle(e);
      }
    }
  }
}
Program: 77150
Project: 77150
Buggy source:
/** 
 * whether need to use result hint
 * @param dataSetHandle
 * @return
 */
private static boolean checkHandleType(DataSetHandle dataSetHandle){
  if (dataSetHandle instanceof ScriptDataSetHandle)   return true;
 else   if (dataSetHandle instanceof JointDataSetHandle) {
    List dataSets=((JointDataSetHandle)dataSetHandle).getDataSetNames();
    for (int i=0; i < dataSets.size(); i++) {
      DataSetHandle dsHandle=((JointDataSetHandle)dataSetHandle).getModuleHandle().findDataSet(dataSets.get(i).toString());
      if (dsHandle != null && dsHandle instanceof ScriptDataSetHandle) {
        return true;
      }
 else       if (dsHandle instanceof JointDataSetHandle) {
        if (checkHandleType(dsHandle))         return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * whether need to use result hint
 * @param dataSetHandle
 * @return
 */
private static boolean checkHandleType(DataSetHandle dataSetHandle){
  if (dataSetHandle instanceof ScriptDataSetHandle)   return true;
 else   if (dataSetHandle instanceof JointDataSetHandle) {
    Iterator iter=((JointDataSetHandle)dataSetHandle).dataSetsIterator();
    while (iter.hasNext()) {
      DataSetHandle dsHandle=(DataSetHandle)iter.next();
      if (dsHandle != null && dsHandle instanceof ScriptDataSetHandle) {
        return true;
      }
 else       if (dsHandle instanceof JointDataSetHandle) {
        if (checkHandleType(dsHandle))         return true;
      }
    }
  }
  return false;
}
Program: 77151
Project: 77151
Buggy source:
/** 
 * @param dataSet
 * @param dataSetDesign
 * @throws BirtException
 */
private void defineSourceDataSets(JointDataSetHandle jointDataSetHandle) throws BirtException {
  List dataSets=jointDataSetHandle.getDataSetNames();
  for (int i=0; i < dataSets.size(); i++) {
    DataSetHandle dsHandle=jointDataSetHandle.getModuleHandle().findDataSet(dataSets.get(i).toString());
    if (dsHandle != null) {
      defineDataSet(dsHandle);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param dataSet
 * @param dataSetDesign
 * @throws BirtException
 */
private void defineSourceDataSets(JointDataSetHandle jointDataSetHandle) throws BirtException {
  Iterator iter=((JointDataSetHandle)jointDataSetHandle).dataSetsIterator();
  while (iter.hasNext()) {
    DataSetHandle dsHandle=(DataSetHandle)iter.next();
    if (dsHandle != null) {
      defineDataSet(dsHandle);
    }
  }
}
Program: 77152
Project: 77152
Buggy source:
public Collection getSelectionListForCascadingGroup(IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options) throws ReportServiceException {
  IGetParameterDefinitionTask task=getParameterDefinitionTask(design,options);
  ViewerAttributeBean bean=getViewerAttrBean(options);
  if (bean != null)   task.setParameterValues(bean.getParameters());
  task.evaluateQuery(groupName);
  Collection selectionList=task.getSelectionListForCascadingGroup(groupName,groupKeys);
  return convertEngineParameterSelectionChoice(selectionList);
}

Fixed version (ground truth):
public Collection getSelectionListForCascadingGroup(IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  try {
    task=getParameterDefinitionTask(design,options);
    if (task != null) {
      ViewerAttributeBean bean=getViewerAttrBean(options);
      if (bean != null)       task.setParameterValues(bean.getParameters());
      task.evaluateQuery(groupName);
      Collection selectionList=task.getSelectionListForCascadingGroup(groupName,groupKeys);
      return convertEngineParameterSelectionChoice(selectionList);
    }
  }
  finally {
    if (task != null)     task.close();
  }
  return null;
}
Program: 77153
Project: 77153
Buggy source:
private static ParameterGroupDefinition convertParameterGroup(IParameterGroupDefn engineParam,IGetParameterDefinitionTask task){
  boolean cascade=engineParam instanceof ICascadingParameterGroup;
  String name=engineParam.getName();
  String displayName=engineParam.getDisplayName();
  String helpText=engineParam.getHelpText();
  String promptText=engineParam.getPromptText();
  ParameterGroupDefinition paramGroup=new ParameterGroupDefinition(name,displayName,promptText,null,cascade,helpText);
  List contents=convertParametersInGroup(engineParam.getContents(),paramGroup,task);
  paramGroup.setParameters(contents);
  return paramGroup;
}

Fixed version (ground truth):
private static ParameterGroupDefinition convertParameterGroup(IParameterGroupDefn engineParam){
  boolean cascade=engineParam instanceof ICascadingParameterGroup;
  String name=engineParam.getName();
  String displayName=engineParam.getDisplayName();
  String helpText=engineParam.getHelpText();
  String promptText=engineParam.getPromptText();
  ParameterGroupDefinition paramGroup=new ParameterGroupDefinition(name,displayName,promptText,null,cascade,helpText);
  List contents=convertParametersInGroup(engineParam.getContents(),paramGroup);
  paramGroup.setParameters(contents);
  return paramGroup;
}
Program: 77154
Project: 77154
Buggy source:
private static List convertParametersInGroup(Collection scalarParameters,ParameterGroupDefinition group,IGetParameterDefinitionTask task){
  if (scalarParameters == null)   return null;
  List ret=new ArrayList();
  for (Iterator it=scalarParameters.iterator(); it.hasNext(); ) {
    IScalarParameterDefn engineParam=(IScalarParameterDefn)it.next();
    ParameterDefinition param=convertScalarParameter(engineParam,group,task);
    ret.add(param);
  }
  return ret;
}

Fixed version (ground truth):
private static List convertParametersInGroup(Collection scalarParameters,ParameterGroupDefinition group){
  if (scalarParameters == null)   return null;
  List ret=new ArrayList();
  for (Iterator it=scalarParameters.iterator(); it.hasNext(); ) {
    IScalarParameterDefn engineParam=(IScalarParameterDefn)it.next();
    ParameterDefinition param=convertScalarParameter(engineParam,group);
    ret.add(param);
  }
  return ret;
}
Program: 77155
Project: 77155
Buggy source:
public Collection getParameterSelectionList(IViewerReportDesignHandle design,InputOptions runOptions,String paramName) throws ReportServiceException {
  IGetParameterDefinitionTask task=getParameterDefinitionTask(design,runOptions);
  ViewerAttributeBean bean=getViewerAttrBean(runOptions);
  if (bean != null)   task.setParameterValues(bean.getParameters());
  Collection selectionList=task.getSelectionList(paramName);
  return convertEngineParameterSelectionChoice(selectionList);
}

Fixed version (ground truth):
public Collection getParameterSelectionList(IViewerReportDesignHandle design,InputOptions runOptions,String paramName) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  try {
    task=getParameterDefinitionTask(design,runOptions);
    if (task != null) {
      ViewerAttributeBean bean=getViewerAttrBean(runOptions);
      if (bean != null)       task.setParameterValues(bean.getParameters());
      Collection selectionList=task.getSelectionList(paramName);
      return convertEngineParameterSelectionChoice(selectionList);
    }
  }
  finally {
    if (task != null)     task.close();
  }
  return null;
}
Program: 77157
Project: 77157
Buggy source:
private static ParameterDefinition convertScalarParameter(IScalarParameterDefn engineParam,ParameterGroupDefinition group,IGetParameterDefinitionTask task){
  Object handle=engineParam.getHandle();
  ScalarParameterHandle scalarParamHandle=null;
  if (handle instanceof ScalarParameterHandle)   scalarParamHandle=(ScalarParameterHandle)handle;
  String name=engineParam.getName();
  String pattern=scalarParamHandle == null ? "String_Node_Str" : scalarParamHandle.getPattern();
  String displayFormat=engineParam.getDisplayFormat();
  String displayName=engineParam.getDisplayName();
  String helpText=engineParam.getHelpText();
  String promptText=engineParam.getPromptText();
  int dataType=engineParam.getDataType();
  int controlType=engineParam.getControlType();
  boolean hidden=engineParam.isHidden();
  boolean allowNull=engineParam.allowNull();
  boolean allowBlank=engineParam.allowBlank();
  boolean mustMatch=scalarParamHandle == null ? false : scalarParamHandle.isMustMatch();
  boolean concealValue=engineParam.isValueConcealed();
  ParameterDefinition param=new ParameterDefinition(name,pattern,displayFormat,displayName,helpText,promptText,dataType,controlType,hidden,allowNull,allowBlank,mustMatch,concealValue,group,null);
  return param;
}

Fixed version (ground truth):
private static ParameterDefinition convertScalarParameter(IScalarParameterDefn engineParam,ParameterGroupDefinition group){
  Object handle=engineParam.getHandle();
  ScalarParameterHandle scalarParamHandle=null;
  if (handle instanceof ScalarParameterHandle)   scalarParamHandle=(ScalarParameterHandle)handle;
  String name=engineParam.getName();
  String pattern=scalarParamHandle == null ? "String_Node_Str" : scalarParamHandle.getPattern();
  String displayFormat=engineParam.getDisplayFormat();
  String displayName=engineParam.getDisplayName();
  String helpText=engineParam.getHelpText();
  String promptText=engineParam.getPromptText();
  int dataType=engineParam.getDataType();
  int controlType=engineParam.getControlType();
  boolean hidden=engineParam.isHidden();
  boolean allowNull=engineParam.allowNull();
  boolean allowBlank=engineParam.allowBlank();
  boolean mustMatch=scalarParamHandle == null ? false : scalarParamHandle.isMustMatch();
  boolean concealValue=engineParam.isValueConcealed();
  ParameterDefinition param=new ParameterDefinition(name,pattern,displayFormat,displayName,helpText,promptText,dataType,controlType,hidden,allowNull,allowBlank,mustMatch,concealValue,group,null);
  return param;
}
Program: 77158
Project: 77158
Buggy source:
private static Collection convertEngineParameters(Collection params,IGetParameterDefinitionTask task,boolean includeGroups){
  if (params == null)   return Collections.EMPTY_LIST;
  List ret=new ArrayList();
  for (Iterator it=params.iterator(); it.hasNext(); ) {
    Object o=it.next();
    if (o instanceof IScalarParameterDefn) {
      IScalarParameterDefn engineParam=(IScalarParameterDefn)o;
      ParameterGroupDefinition group=null;
      ParameterDefinition param=convertScalarParameter(engineParam,group,task);
      ret.add(param);
    }
 else     if (o instanceof IParameterGroupDefn) {
      IParameterGroupDefn engineParam=(IParameterGroupDefn)o;
      ParameterGroupDefinition paramGroup=convertParameterGroup(engineParam,task);
      ret.add(paramGroup);
    }
  }
  if (includeGroups)   return ret;
  return flattenGroups(ret);
}

Fixed version (ground truth):
/** 
 * Convert engine parameters (IScalarParameterDefn and IParameterGroupDefn) into service api parameters (ParameterDefinition and ParameterGroupDefinition)
 * @param params a Collection of IScalarParameterDefn or IParameterGroupDefn
 * @param includeGroups if true, include groups (ParameterGroupDefinition) in the result, otherwise flatten the result (i.e. include the contents of the groups in the result)
 * @return a Collection of ParameterDefinition and ParameterGroupDefinition,or a Collection of only ParameterDefinition if includeGroups == false
 */
private static Collection convertEngineParameters(Collection params,boolean includeGroups){
  if (params == null)   return Collections.EMPTY_LIST;
  List ret=new ArrayList();
  for (Iterator it=params.iterator(); it.hasNext(); ) {
    Object o=it.next();
    if (o instanceof IScalarParameterDefn) {
      IScalarParameterDefn engineParam=(IScalarParameterDefn)o;
      ParameterGroupDefinition group=null;
      ParameterDefinition param=convertScalarParameter(engineParam,group);
      ret.add(param);
    }
 else     if (o instanceof IParameterGroupDefn) {
      IParameterGroupDefn engineParam=(IParameterGroupDefn)o;
      ParameterGroupDefinition paramGroup=convertParameterGroup(engineParam);
      ret.add(paramGroup);
    }
  }
  if (includeGroups)   return ret;
  return flattenGroups(ret);
}
Program: 77159
Project: 77159
Buggy source:
public Collection getParameterDefinitions(IViewerReportDesignHandle design,InputOptions runOptions,boolean includeGroups) throws ReportServiceException {
  IGetParameterDefinitionTask task=getParameterDefinitionTask(design,runOptions);
  return convertEngineParameters(task.getParameterDefns(true),task,includeGroups);
}

Fixed version (ground truth):
public Collection getParameterDefinitions(IViewerReportDesignHandle design,InputOptions runOptions,boolean includeGroups) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  try {
    task=getParameterDefinitionTask(design,runOptions);
    if (task != null) {
      Collection params=task.getParameterDefns(true);
      return convertEngineParameters(params,includeGroups);
    }
  }
  finally {
    if (task != null)     task.close();
  }
  return null;
}
Program: 77160
Project: 77160
Buggy source:
public Object getParameterDefaultValue(IViewerReportDesignHandle design,String parameterName,InputOptions options) throws ReportServiceException {
  IGetParameterDefinitionTask task=getParameterDefinitionTask(design,options);
  return task.getDefaultValue(parameterName);
}

Fixed version (ground truth):
public Object getParameterDefaultValue(IViewerReportDesignHandle design,String parameterName,InputOptions options) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  Object defaultValue=null;
  try {
    task=getParameterDefinitionTask(design,options);
    if (task != null)     defaultValue=task.getDefaultValue(parameterName);
  }
  finally {
    if (task != null)     task.close();
  }
  return defaultValue;
}
Program: 77161
Project: 77161
Buggy source:
/** 
 * Returns the property value where a library name space is required.
 * @param memberName the structure name
 * @return the property value. If this value is not defined in the currentmodule, the library namespace is added.
 */
private String getPrefixStringProperty(String memberName){
  if (!JoinCondition.LEFT_DATASET_MEMBER.equalsIgnoreCase(memberName) && !JoinCondition.RIGHT_DATASET_MEMBER.equalsIgnoreCase(memberName))   return super.getStringProperty(memberName);
  if (!isExtendedJointDataSet())   return super.getStringProperty(memberName);
  String dataSetName=super.getStringProperty(memberName);
  if (StringUtil.isBlank(dataSetName))   return dataSetName;
  List dataSetRefs=elementHandle.getListProperty(JointDataSetHandle.DATA_SETS_PROP);
  if (dataSetRefs == null || dataSetRefs.isEmpty())   return dataSetName;
  Module tmpRoot=null;
  ElementRefValue refValue=null;
  for (int j=0; j < dataSetRefs.size(); j++) {
    ElementRefValue tmpRefValue=(ElementRefValue)dataSetRefs.get(j);
    if (tmpRefValue.getName().equalsIgnoreCase(dataSetName) && tmpRefValue.getElement() != null) {
      tmpRoot=tmpRefValue.getElement().getRoot();
      refValue=tmpRefValue;
      break;
    }
  }
  if (tmpRoot == null)   return dataSetName;
  return ReferenceValueUtil.needTheNamespacePrefix(refValue,getModule(),getModule());
}

Fixed version (ground truth):
/** 
 * Returns the property value where a library name space is required.
 * @param memberName the structure name
 * @return the property value. If this value is not defined in the currentmodule, the library namespace is added.
 */
private String getPrefixStringProperty(String memberName){
  if (!JoinCondition.LEFT_DATASET_MEMBER.equalsIgnoreCase(memberName) && !JoinCondition.RIGHT_DATASET_MEMBER.equalsIgnoreCase(memberName))   return super.getStringProperty(memberName);
  String dataSetName=super.getStringProperty(memberName);
  if (StringUtil.isBlank(dataSetName))   return dataSetName;
  List dataSetRefs=elementHandle.getListProperty(IJointDataSetModel.DATA_SETS_PROP);
  if (dataSetRefs == null || dataSetRefs.isEmpty())   return dataSetName;
  Module tmpRoot=null;
  for (int j=0; j < dataSetRefs.size(); j++) {
    ElementRefValue tmpRefValue=(ElementRefValue)dataSetRefs.get(j);
    if (tmpRefValue.getName().equalsIgnoreCase(dataSetName) && tmpRefValue.getElement() != null) {
      tmpRoot=tmpRefValue.getElement().getRoot();
      break;
    }
  }
  if (tmpRoot instanceof Library)   return StringUtil.buildQualifiedReference(((Library)tmpRoot).getNamespace(),dataSetName);
  return dataSetName;
}