nus-yam/ex-repair huggingface dataset:
Program: 73142
Project: 73142
Buggy source:
/** 
 * Initializes the given document from the given editor input using the given character encoding.
 * @param document the document to be initialized
 * @param editorInput the input from which to derive the content of the document
 * @param encoding the character encoding used to read the editor input
 * @return <code>true</code> if the document content could be set,<code>false</code> otherwise
 * @throws CoreException if the given editor input cannot be accessed
 */
protected boolean setDocumentContent(IDocument document,IEditorInput editorInput,String encoding) throws CoreException {
  ModuleHandle moduleHandle=SessionHandleAdapter.getInstance().getReportDesignHandle();
  File file=new File(moduleHandle.getFileName());
  if (file.exists()) {
    try {
      InputStream stream=new FileInputStream(file);
      setDocumentContent(document,stream,encoding);
      stream.close();
      return true;
    }
 catch (    FileNotFoundException e) {
    }
catch (    IOException e) {
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Initializes the given document from the given editor input using the given character encoding.
 * @param document the document to be initialized
 * @param editorInput the input from which to derive the content of the document
 * @param encoding the character encoding used to read the editor input
 * @return <code>true</code> if the document content could be set,<code>false</code> otherwise
 * @throws CoreException if the given editor input cannot be accessed
 */
protected boolean setDocumentContent(IDocument document,IEditorInput editorInput,String encoding) throws CoreException {
  InputStream stream=null;
  if (editorInput instanceof IStorageEditorInput) {
    IStorage storage=((IStorageEditorInput)editorInput).getStorage();
    if (storage != null) {
      stream=storage.getContents();
    }
  }
  if (stream == null) {
    ModuleHandle moduleHandle=SessionHandleAdapter.getInstance().getReportDesignHandle();
    if (moduleHandle != null) {
      File file=new File(moduleHandle.getFileName());
      ;
      if (file.exists()) {
        try {
          stream=new FileInputStream(file);
        }
 catch (        FileNotFoundException e) {
        }
      }
    }
  }
  if (stream != null) {
    try {
      setDocumentContent(document,stream,encoding);
      stream.close();
      return true;
    }
 catch (    FileNotFoundException e) {
    }
catch (    IOException e) {
    }
  }
  return false;
}
Program: 73143
Project: 73143
Buggy source:
public IPath getInputPath(IEditorInput input){
  if (input instanceof FileEditorInput) {
    return ((FileEditorInput)input).getPath();
  }
 else   if (input instanceof IURIEditorInput) {
    return new Path(((IURIEditorInput)input).getURI().getPath());
  }
  return null;
}

Fixed version (ground truth):
public IPath getInputPath(IEditorInput input){
  if (input instanceof IPathEditorInput) {
    return ((IPathEditorInput)input).getPath();
  }
 else   if (input instanceof IURIEditorInput) {
    return new Path(((IURIEditorInput)input).getURI().getPath());
  }
  return null;
}
Program: 73144
Project: 73144
Buggy source:
protected void addColumBinding(IBaseQueryDefinition transfer,ComputedColumnHandle columnBinding) throws BirtException {
  String name=columnBinding.getName();
  String expr=columnBinding.getExpression();
  String type=columnBinding.getDataType();
  String displayName=columnBinding.getDisplayName();
  int dbType=ModelDteApiAdapter.toDteDataType(type);
  IBaseExpression dbExpr=new ScriptExpression(expr,dbType);
  if (columnBinding.getAggregateOn() != null) {
    dbExpr.setGroupName(columnBinding.getAggregateOn());
  }
  IBinding binding=new Binding(name,dbExpr);
  binding.setDisplayName(displayName);
  if (columnBinding.getAggregateOn() != null)   binding.addAggregateOn(columnBinding.getAggregateOn());
  if (columnBinding.getAggregateFunction() != null) {
    binding.setAggrFunction(columnBinding.getAggregateFunction());
  }
  String filter=columnBinding.getFilterExpression();
  if (filter != null) {
    binding.setFilter(new ScriptExpression(filter));
  }
  Iterator arguments=columnBinding.argumentsIterator();
  if (arguments != null) {
    while (arguments.hasNext()) {
      AggregationArgumentHandle argumentHandle=(AggregationArgumentHandle)arguments.next();
      String argument=argumentHandle.getValue();
      if (argument != null) {
        binding.addArgument(new ScriptExpression(argument));
      }
    }
  }
  transfer.addBinding(binding);
}

Fixed version (ground truth):
protected void addColumBinding(IBaseQueryDefinition transfer,ComputedColumnHandle columnBinding) throws BirtException {
  String name=columnBinding.getName();
  String expr=columnBinding.getExpression();
  String type=columnBinding.getDataType();
  String displayName=columnBinding.getDisplayName();
  int dbType=ModelDteApiAdapter.toDteDataType(type);
  IBaseExpression dbExpr=new ScriptExpression(expr,dbType);
  if (columnBinding.getAggregateOn() != null) {
    dbExpr.setGroupName(columnBinding.getAggregateOn());
  }
  IBinding binding=new Binding(name,dbExpr);
  binding.setDisplayName(displayName);
  if (columnBinding.getAggregateOn() != null)   binding.addAggregateOn(columnBinding.getAggregateOn());
  if (columnBinding.getAggregateFunction() != null) {
    binding.setAggrFunction(DataAdapterUtil.adaptModelAggregationType(columnBinding.getAggregateFunction()));
  }
  String filter=columnBinding.getFilterExpression();
  if (filter != null) {
    binding.setFilter(new ScriptExpression(filter));
  }
  Iterator arguments=columnBinding.argumentsIterator();
  if (arguments != null) {
    while (arguments.hasNext()) {
      AggregationArgumentHandle argumentHandle=(AggregationArgumentHandle)arguments.next();
      String argument=argumentHandle.getValue();
      if (argument != null) {
        binding.addArgument(new ScriptExpression(argument));
      }
    }
  }
  transfer.addBinding(binding);
}
Program: 73145
Project: 73145
Buggy source:
public void testExecutionOptimize() throws Exception {
  ReportRunnable reportRunnable=(ReportRunnable)engine.openReportDesign(REPORT_DESIGN);
  Report report=reportRunnable.getReportIR();
  ExecutionOptimize executionOpt=new ExecutionOptimize();
  ExecutionPolicy policy=executionOpt.optimize(report);
  validatePolicy(report,policy);
}

Fixed version (ground truth):
public void testExecutionOptimize() throws Exception {
  ReportRunnable reportRunnable=(ReportRunnable)engine.openReportDesign(REPORT_DESIGN);
  Report report=new ReportParser().parse((ReportDesignHandle)reportRunnable.getDesignHandle());
  ExecutionOptimize executionOpt=new ExecutionOptimize();
  ExecutionPolicy policy=executionOpt.optimize(report);
  validatePolicy(report,policy);
}
Program: 73146
Project: 73146
Buggy source:
protected void createDocument(){
  try {
    IDocArchiveWriter archive=new FileArchiveWriter(REPORT_DOCUMENT);
    ReportDocumentWriter document=new ReportDocumentWriter(engine,archive);
    ReportRunnable runnable=(ReportRunnable)engine.openReportDesign(REPORT_DESIGN);
    document.saveDesign(runnable);
    HashMap parameters=createParamters();
    document.saveParamters(parameters);
    TOCTree tocTree=createTOC();
    document.saveTOC(tocTree);
    HashMap bookmarks=createBookmarks();
    document.saveBookmarks(bookmarks);
    Map map=createPersistentObjects();
    document.savePersistentObjects(map);
    document.close();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail();
  }
}

Fixed version (ground truth):
protected void createDocument(){
  try {
    IDocArchiveWriter archive=new FileArchiveWriter(REPORT_DOCUMENT);
    ReportDocumentWriter document=new ReportDocumentWriter(engine,archive);
    ReportRunnable runnable=(ReportRunnable)engine.openReportDesign(REPORT_DESIGN);
    Report reportIR=new ReportParser().parse((ReportDesignHandle)runnable.getDesignHandle());
    document.saveDesign(runnable,null,reportIR);
    HashMap parameters=createParamters();
    document.saveParamters(parameters);
    TOCTree tocTree=createTOC();
    document.saveTOC(tocTree);
    HashMap bookmarks=createBookmarks();
    document.saveBookmarks(bookmarks);
    Map map=createPersistentObjects();
    document.savePersistentObjects(map);
    document.close();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    fail();
  }
}
Program: 73147
Project: 73147
Buggy source:
/** 
 * The report runnable is used to create the report document while writing. If the report document is open with, the report runnable is used to render or extract data from the report document.
 * @return the runnable report design. It is available because a reportdocument must be run with a report design
 */
public abstract IReportRunnable getReportRunnable();

Fixed version (ground truth):
/** 
 * The report runnable is used to create the report document while writing. If the report document is open with, the report runnable is used to render or extract data from the report document. user always get a new instance from this interface.
 * @return the runnable report design. It is available because a reportdocument must be run with a report design
 */
public abstract IReportRunnable getReportRunnable();
Program: 73148
Project: 73148
Buggy source:
/** 
 * creates a task that renders the report to a specific output format.
 * @param reportDocument a handle to an IReportDocument object
 * @return a task that renders a report to an output format
 */
public IRenderTask createRenderTask(IReportDocument reportDocument){
  return engine.createRenderTask(reportDocument);
}

Fixed version (ground truth):
public IRenderTask createRenderTask(IReportDocument reportDocument,IReportRunnable reportRunnable){
  return engine.createRenderTask(reportDocument,reportRunnable);
}
Program: 73149
Project: 73149
Buggy source:
protected void setupExecutionContext(){
  executionContext.getConfigs().putAll(runnable.getTestConfig());
  executionContext.getConfigs().putAll(System.getProperties());
}

Fixed version (ground truth):
protected void setupExecutionContext(){
  IReportRunnable runnable=executionContext.getRunnable();
  executionContext.getConfigs().putAll(runnable.getTestConfig());
  executionContext.getConfigs().putAll(System.getProperties());
}
Program: 73150
Project: 73150
Buggy source:
public DataExtractionTask(ReportEngine engine,IReportRunnable runnable,IReportDocument reader) throws EngineException {
  String version=reader.getProperty(ReportDocumentConstants.DATA_EXTRACTION_TASK_VERSION_KEY);
  if (ReportDocumentConstants.DATA_EXTRACTION_TASK_VERSION_0.equals(version)) {
    task=new DataExtractionTaskV0(engine,runnable,reader);
  }
 else   if (ReportDocumentConstants.DATA_EXTRACTION_TASK_VERSION_1.equals(version)) {
    task=new DataExtractionTaskV1(engine,runnable,reader);
  }
}

Fixed version (ground truth):
public DataExtractionTask(ReportEngine engine,IReportDocument reader) throws EngineException {
  String version=reader.getProperty(ReportDocumentConstants.DATA_EXTRACTION_TASK_VERSION_KEY);
  if (ReportDocumentConstants.DATA_EXTRACTION_TASK_VERSION_0.equals(version)) {
    task=new DataExtractionTaskV0(engine,reader);
  }
 else   if (ReportDocumentConstants.DATA_EXTRACTION_TASK_VERSION_1.equals(version)) {
    task=new DataExtractionTaskV1(engine,reader);
  }
}
Program: 73151
Project: 73151
Buggy source:
public DataExtractionTaskV0(ReportEngine engine,IReportRunnable runnable,IReportDocument reader) throws EngineException {
  super(engine,runnable,IEngineTask.TASK_DATAEXTRACTION);
  this.report=((ReportRunnable)runnable).getReportIR();
  this.reportDocReader=reader;
  executionContext.setReportDocument(reportDocReader);
  executionContext.setFactoryMode(false);
  executionContext.setPresentationMode(true);
}

Fixed version (ground truth):
public DataExtractionTaskV0(ReportEngine engine,IReportDocument reader) throws EngineException {
  super(engine,IEngineTask.TASK_DATAEXTRACTION);
  IReportRunnable runnable=getOnPreparedRunnable(reader);
  setReportRunnable(runnable);
  setReportIR(reader);
  this.report=executionContext.getReport();
  this.reportDocReader=reader;
  executionContext.setReportDocument(reportDocReader);
  executionContext.setFactoryMode(false);
  executionContext.setPresentationMode(true);
}
Program: 73152
Project: 73152
Buggy source:
public DataExtractionTaskV1(ReportEngine engine,IReportRunnable runnable,IReportDocument reader) throws EngineException {
  super(engine,runnable);
  this.report=((ReportRunnable)runnable).getReportIR();
  this.reportDocReader=reader;
  executionContext.setReportDocument(reportDocReader);
  executionContext.setFactoryMode(false);
  executionContext.setPresentationMode(true);
  setParameterValues(reportDocReader.getParameterValues());
  setParameterDisplayTexts(reportDocReader.getParameterDisplayTexts());
  usingParameterValues();
  executionContext.registerGlobalBeans(reportDocReader.getGlobalVariables(null));
  Map appContext=executionContext.getAppContext();
  IDataEngine dataEngine=executionContext.getDataEngine();
  dataEngine.prepare(report,appContext);
}

Fixed version (ground truth):
public DataExtractionTaskV1(ReportEngine engine,IReportDocument reader) throws EngineException {
  super(engine,IEngineTask.TASK_DATAEXTRACTION);
  IReportRunnable runnable=getOnPreparedRunnable(reader);
  setReportRunnable(runnable);
  setReportIR(reader);
  this.report=executionContext.getReport();
  this.reportDocReader=reader;
  executionContext.setReportDocument(reportDocReader);
  executionContext.setFactoryMode(false);
  executionContext.setPresentationMode(true);
  setParameterValues(reportDocReader.getParameterValues());
  setParameterDisplayTexts(reportDocReader.getParameterDisplayTexts());
  usingParameterValues();
  executionContext.registerGlobalBeans(reportDocReader.getGlobalVariables(null));
  Map appContext=executionContext.getAppContext();
  IDataEngine dataEngine=executionContext.getDataEngine();
  dataEngine.prepare(report,appContext);
}
Program: 73153
Project: 73153
Buggy source:
protected void prepareDesign(){
  ReportDesignHandle reportDesign=executionContext.getDesign();
  ScriptedDesignVisitor visitor=new ScriptedDesignVisitor(reportDesign,executionContext);
  visitor.apply(reportDesign.getRoot());
  runnable.setDesignHandle(reportDesign);
}

Fixed version (ground truth):
protected void prepareDesign(){
  ReportDesignHandle reportDesign=executionContext.getDesign();
  ScriptedDesignSearcher searcher=new ScriptedDesignSearcher(reportDesign);
  searcher.apply(reportDesign);
  boolean hasOnprepare=searcher.hasOnPrepareScript();
  if (hasOnprepare) {
    ReportRunnable newRunnable=executionContext.getRunnable().cloneRunnable();
    ReportDesignHandle newDesign=newRunnable.designHandle;
    ScriptedDesignVisitor visitor=new ScriptedDesignHandler(newDesign,executionContext);
    visitor.apply(newDesign.getRoot());
    executionContext.updateRunnable(newRunnable);
  }
}
Program: 73154
Project: 73154
Buggy source:
public IReportRunnable getReportRunnable(){
  return runnable;
}

Fixed version (ground truth):
public IReportRunnable getReportRunnable(){
  return executionContext.getOriginalRunnable();
}
Program: 73155
Project: 73155
Buggy source:
public void setReportRunnable(IReportRunnable runnable){
  if (runnable != null) {
    this.runnable=runnable;
    executionContext.setRunnable(runnable);
    executionContext.registerBeans(System.getProperties());
    executionContext.registerBeans(runnable.getTestConfig());
    executionContext.getConfigs().putAll(System.getProperties());
    executionContext.getConfigs().putAll(runnable.getTestConfig());
  }
}

Fixed version (ground truth):
public void setReportRunnable(IReportRunnable runnable){
  if (runnable != null) {
    executionContext.setRunnable(runnable);
    executionContext.registerBeans(System.getProperties());
    executionContext.registerBeans(runnable.getTestConfig());
    executionContext.getConfigs().putAll(System.getProperties());
    executionContext.getConfigs().putAll(runnable.getTestConfig());
  }
}
Program: 73156
Project: 73156
Buggy source:
protected void loggerParamters(){
  if (log.isLoggable(Level.FINE)) {
    final StringBuffer buffer=new StringBuffer();
    new ParameterVisitor(){
      boolean visitScalarParameter(      ScalarParameterHandle param,      Object value){
        String paramName=param.getName();
        Object paramValue=runValues.get(paramName);
        buffer.append(paramName);
        buffer.append("String_Node_Str");
        buffer.append(paramValue);
        buffer.append("String_Node_Str");
        return true;
      }
      boolean visitParameterGroup(      ParameterGroupHandle group,      Object value){
        return visitParametersInGroup(group,value);
      }
    }
.visit((ReportDesignHandle)runnable.getDesignHandle(),null);
    log.log(Level.FINE,"String_Node_Str",buffer);
  }
}

Fixed version (ground truth):
protected void loggerParamters(){
  if (log.isLoggable(Level.FINE)) {
    final StringBuffer buffer=new StringBuffer();
    new ParameterVisitor(){
      boolean visitScalarParameter(      ScalarParameterHandle param,      Object value){
        String paramName=param.getName();
        Object paramValue=runValues.get(paramName);
        buffer.append(paramName);
        buffer.append("String_Node_Str");
        buffer.append(paramValue);
        buffer.append("String_Node_Str");
        return true;
      }
      boolean visitParameterGroup(      ParameterGroupHandle group,      Object value){
        return visitParametersInGroup(group,value);
      }
    }
.visit(executionContext.getDesign(),null);
    log.log(Level.FINE,"String_Node_Str",buffer);
  }
}
Program: 73157
Project: 73157
Buggy source:
protected EngineTask(ReportEngine engine,IReportRunnable runnable,int taskType){
  this(engine,runnable);
  this.taskType=taskType;
}

Fixed version (ground truth):
protected EngineTask(ReportEngine engine,int taskType){
  this.engine=engine;
  this.taskType=taskType;
  taskID=id++;
  this.log=engine.getLogger();
  executionContext=new ExecutionContext(this);
  executionContext.setReportContext(new ReportContextImpl(executionContext));
  setAppContext(engine.getConfig().getAppContext());
  cancelFlag=false;
  runningStatus=STATUS_NOT_STARTED;
}
Program: 73158
Project: 73158
Buggy source:
protected boolean doValidateParameters() throws ParameterValidationException {
  usingParameterValues();
  if (log.isLoggable(Level.FINE)) {
    loggerParamters();
  }
  ParameterValidationVisitor pv=new ParameterValidationVisitor();
  boolean result=pv.visit((ReportDesignHandle)runnable.getDesignHandle(),null);
  if (pv.engineException != null) {
    throw pv.engineException;
  }
  return result;
}

Fixed version (ground truth):
protected boolean doValidateParameters() throws ParameterValidationException {
  usingParameterValues();
  if (log.isLoggable(Level.FINE)) {
    loggerParamters();
  }
  ParameterValidationVisitor pv=new ParameterValidationVisitor();
  boolean result=pv.visit(executionContext.getDesign(),null);
  if (pv.engineException != null) {
    throw pv.engineException;
  }
  return result;
}
Program: 73159
Project: 73159
Buggy source:
/** 
 * use the user setting parameters values to setup the execution context. the user setting values and default values are merged here.
 */
protected void usingParameterValues(){
  if (!parameterChanged) {
    return;
  }
  parameterChanged=false;
  executionContext.clearParameters();
  runValues.clear();
  Iterator iterator=inputValues.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry=(Map.Entry)iterator.next();
    Object key=entry.getKey();
    ParameterAttribute attribute=(ParameterAttribute)entry.getValue();
    runValues.put(key,attribute.getValue());
    executionContext.setParameter((String)key,attribute.getValue(),attribute.getDisplayText());
  }
  if (runnable == null) {
    return;
  }
  new ParameterVisitor(){
    boolean visitScalarParameter(    ScalarParameterHandle param,    Object userData){
      String name=param.getName();
      if (!inputValues.containsKey(name)) {
        Object value=convertToType(param.getDefaultValue(),param.getDataType());
        executionContext.setParameterValue(name,value);
        runValues.put(name,value);
      }
      return true;
    }
    boolean visitParameterGroup(    ParameterGroupHandle group,    Object value){
      return visitParametersInGroup(group,value);
    }
  }
.visit((ReportDesignHandle)runnable.getDesignHandle());
}

Fixed version (ground truth):
/** 
 * use the user setting parameters values to setup the execution context. the user setting values and default values are merged here.
 */
protected void usingParameterValues(){
  if (!parameterChanged) {
    return;
  }
  parameterChanged=false;
  executionContext.clearParameters();
  runValues.clear();
  Iterator iterator=inputValues.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry=(Map.Entry)iterator.next();
    Object key=entry.getKey();
    ParameterAttribute attribute=(ParameterAttribute)entry.getValue();
    runValues.put(key,attribute.getValue());
    executionContext.setParameter((String)key,attribute.getValue(),attribute.getDisplayText());
  }
  IReportRunnable runnable=executionContext.getRunnable();
  if (runnable == null) {
    return;
  }
  new ParameterVisitor(){
    boolean visitScalarParameter(    ScalarParameterHandle param,    Object userData){
      String name=param.getName();
      if (!inputValues.containsKey(name)) {
        Object value=convertToType(param.getDefaultValue(),param.getDataType());
        executionContext.setParameterValue(name,value);
        runValues.put(name,value);
      }
      return true;
    }
    boolean visitParameterGroup(    ParameterGroupHandle group,    Object value){
      return visitParametersInGroup(group,value);
    }
  }
.visit((ReportDesignHandle)runnable.getDesignHandle());
}
Program: 73160
Project: 73160
Buggy source:
public boolean validateParameters(){
  if (runnable == null) {
    return false;
  }
  try {
    doValidateParameters();
    return true;
  }
 catch (  ParameterValidationException ex) {
    log.log(Level.SEVERE,ex.getMessage(),ex);
  }
  return false;
}

Fixed version (ground truth):
public boolean validateParameters(){
  IReportRunnable runnable=executionContext.getRunnable();
  if (runnable == null) {
    return false;
  }
  try {
    doValidateParameters();
    return true;
  }
 catch (  ParameterValidationException ex) {
    log.log(Level.SEVERE,ex.getMessage(),ex);
  }
  return false;
}
Program: 73161
Project: 73161
Buggy source:
protected void loadDesign(){
  if (runnable != null) {
    ReportDesignHandle reportDesign=executionContext.getDesign();
    Iterator iter=reportDesign.includeLibraryScriptsIterator();
    while (iter.hasNext()) {
      IncludeScriptHandle includeScript=(IncludeScriptHandle)iter.next();
      String fileName=includeScript.getFileName();
      executionContext.loadScript(fileName);
    }
    iter=reportDesign.includeScriptsIterator();
    while (iter.hasNext()) {
      IncludeScriptHandle includeScript=(IncludeScriptHandle)iter.next();
      String fileName=includeScript.getFileName();
      executionContext.loadScript(fileName);
    }
    ReportScriptExecutor.handleInitialize(reportDesign,executionContext);
  }
}

Fixed version (ground truth):
protected void loadDesign(){
  IReportRunnable runnable=executionContext.getRunnable();
  if (runnable != null) {
    ReportDesignHandle reportDesign=executionContext.getDesign();
    Iterator iter=reportDesign.includeLibraryScriptsIterator();
    while (iter.hasNext()) {
      IncludeScriptHandle includeScript=(IncludeScriptHandle)iter.next();
      String fileName=includeScript.getFileName();
      executionContext.loadScript(fileName);
    }
    iter=reportDesign.includeScriptsIterator();
    while (iter.hasNext()) {
      IncludeScriptHandle includeScript=(IncludeScriptHandle)iter.next();
      String fileName=includeScript.getFileName();
      executionContext.loadScript(fileName);
    }
    ReportScriptExecutor.handleInitialize(reportDesign,executionContext);
  }
}
Program: 73162
Project: 73162
Buggy source:
/** 
 * Creates unique result set column names if column names are <code>null</code> or empty string.
 * @param resultSetColumn a list containing result set columns
 */
private static void createUniqueResultSetColumnNames(List columnInfo){
  if (columnInfo == null || columnInfo.isEmpty())   return;
  Set names=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    if (nativeName != null)     names.add(nativeName);
  }
  Set newNames=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    String name=column.getColumnName();
    if (!StringUtil.isBlank(name))     continue;
    String newName=IdentifierUtility.getUniqueColumnName(names,newNames,nativeName,i);
    column.setColumnName(newName);
    if (tmpInfo.hint != null)     tmpInfo.hint.setProperty(ColumnHint.COLUMN_NAME_MEMBER,newName);
  }
  names.clear();
  newNames.clear();
}

Fixed version (ground truth):
/** 
 * Creates unique result set column names if column names are <code>null</code> or empty string.
 * @param resultSetColumn a list containing result set columns
 */
private static void createUniqueResultSetColumnNames(List columnInfo){
  if (columnInfo == null || columnInfo.isEmpty())   return;
  Set names=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    if (nativeName != null)     names.add(nativeName);
  }
  Set newNames=new HashSet();
  for (int i=0; i < columnInfo.size(); i++) {
    ResultSetColumnInfo tmpInfo=(ResultSetColumnInfo)columnInfo.get(i);
    OdaResultSetColumn column=tmpInfo.column;
    String nativeName=column.getNativeName();
    String name=column.getColumnName();
    if (!StringUtil.isBlank(name))     continue;
    String newName=IdentifierUtility.getUniqueColumnName(names,newNames,nativeName,i);
    newNames.add(newName);
    column.setColumnName(newName);
    if (tmpInfo.hint != null)     tmpInfo.hint.setProperty(ColumnHint.COLUMN_NAME_MEMBER,newName);
  }
  names.clear();
  newNames.clear();
}
Program: 73163
Project: 73163
Buggy source:
/** 
 * Test setRenderOption(IRenderOption) method Test getRenderOption() method
 */
public void testGetRenderOption(){
  RenderOptionBase rendop=new RenderOptionBase();
  rendop.setOutputFormat("String_Node_Str");
  rendop.setOutputFileName("String_Node_Str");
  HTMLRenderContext context=new HTMLRenderContext();
  context.SetRenderOption(rendop);
  RenderOptionBase ropb=(RenderOptionBase)(context.getRenderOption());
  assertEquals("String_Node_Str",ropb.getOutputFormat());
  HashMap outsetting=new HashMap();
  outsetting=ropb.getOutputSetting();
  assertFalse(outsetting.isEmpty());
  assertEquals(2,outsetting.size());
  ropb.getOutputSetting().put(HTMLRenderOption.URL_ENCODING,"String_Node_Str");
  assertEquals(3,outsetting.size());
}

Fixed version (ground truth):
/** 
 * Test setRenderOption(IRenderOption) method Test getRenderOption() method
 */
public void testGetRenderOption(){
  RenderOptionBase rendop=new RenderOptionBase();
  rendop.setOutputFormat("String_Node_Str");
  rendop.setOutputFileName("String_Node_Str");
  HTMLRenderContext context=new HTMLRenderContext();
  context.SetRenderOption(rendop);
  RenderOptionBase ropb=(RenderOptionBase)(context.getRenderOption());
  assertEquals("String_Node_Str",ropb.getOutputFormat());
  Map outsetting=new HashMap();
  outsetting=ropb.getOutputSetting();
  assertFalse(outsetting.isEmpty());
  assertEquals(2,outsetting.size());
  ropb.getOutputSetting().put(HTMLRenderOption.URL_ENCODING,"String_Node_Str");
  assertEquals(3,outsetting.size());
}
Program: 73164
Project: 73164
Buggy source:
private void configEngine(){
  HTMLRenderOption emitterConfig=new HTMLRenderOption();
  emitterConfig.setActionHandler(new HTMLActionHandler(){
    public String getURL(    IAction actionDefn,    Object context){
      if (actionDefn.getType() == IAction.ACTION_DRILLTHROUGH)       return "String_Node_Str" + URLEncoder.encode(super.getURL(actionDefn,context));
      return super.getURL(actionDefn,context);
    }
  }
);
  engineConfig.getEmitterConfigs().put(RenderOption.OUTPUT_FORMAT_HTML,emitterConfig);
  String userClassPath=getUserClassPath();
  logger.info("String_Node_Str" + userClassPath);
  if (userClassPath != null) {
    engineConfig.getAppContext().put(EngineConstants.PROJECT_CLASSPATH_KEY,userClassPath);
  }
}

Fixed version (ground truth):
private void configEngine(){
  HTMLRenderOption emitterConfig=new HTMLRenderOption();
  emitterConfig.setActionHandler(new HTMLActionHandler(){
    public String getURL(    IAction actionDefn,    Object context){
      if (actionDefn.getType() == IAction.ACTION_DRILLTHROUGH)       return "String_Node_Str" + URLEncoder.encode(super.getURL(actionDefn,context));
      return super.getURL(actionDefn,context);
    }
  }
);
  engineConfig.getEmitterConfigs().put(RenderOption.OUTPUT_FORMAT_HTML,emitterConfig);
  String userClassPath=getUserClassPath();
  logger.info("String_Node_Str" + userClassPath);
  System.clearProperty(EngineConstants.PROJECT_CLASSPATH_KEY);
  if (userClassPath != null) {
    engineConfig.getAppContext().put(EngineConstants.PROJECT_CLASSPATH_KEY,userClassPath);
    System.setProperty(EngineConstants.PROJECT_CLASSPATH_KEY,userClassPath);
  }
}
Program: 73165
Project: 73165
Buggy source:
private static Class getClassUsingCustomClassPath(String className,String classPathKey,ClassLoader parentLoader){
  String classPath=System.getProperty(classPathKey);
  if (classPath == null || classPath.length() == 0 || className == null)   return null;
  String[] classPathArray=classPath.split(PROPERTYSEPARATOR,-1);
  URL[] urls=null;
  if (classPathArray.length != 0) {
    List l=new ArrayList();
    for (int i=0; i < classPathArray.length; i++) {
      String cpValue=classPathArray[i];
      File file=new File(cpValue);
      try {
        l.add(file.toURL());
      }
 catch (      MalformedURLException e) {
        e.printStackTrace();
      }
    }
    urls=(URL[])l.toArray(new URL[l.size()]);
  }
  if (urls != null) {
    ClassLoader cl=new URLClassLoader(urls,parentLoader);
    try {
      return cl.loadClass(className);
    }
 catch (    ClassNotFoundException e) {
    }
  }
  return null;
}

Fixed version (ground truth):
private static Class getClassUsingCustomClassPath(String className,String classPathKey,ClassLoader parentLoader){
  String classPath=System.getProperty(classPathKey);
  if (classPath == null || classPath.length() == 0 || className == null)   return null;
  String[] classPathArray=classPath.split(EngineConstants.PROPERTYSEPARATOR,-1);
  URL[] urls=null;
  if (classPathArray.length != 0) {
    List l=new ArrayList();
    for (int i=0; i < classPathArray.length; i++) {
      String cpValue=classPathArray[i];
      File file=new File(cpValue);
      try {
        l.add(file.toURL());
      }
 catch (      MalformedURLException e) {
        e.printStackTrace();
      }
    }
    urls=(URL[])l.toArray(new URL[l.size()]);
  }
  if (urls != null) {
    ClassLoader cl=new URLClassLoader(urls,parentLoader);
    try {
      return cl.loadClass(className);
    }
 catch (    ClassNotFoundException e) {
    }
  }
  return null;
}
Program: 73166
Project: 73166
Buggy source:
public Class loadClass(String className,ClassLoader parentLoader) throws ClassNotFoundException {
  if (className == null)   return null;
  Class c=null;
  ClassNotFoundException ex=null;
  if (this.classLoader != null) {
    c=this.classLoader.loadClass(className);
    if (c != null) {
      return c;
    }
  }
  try {
    c=Class.forName(className);
  }
 catch (  ClassNotFoundException e) {
    ex=e;
    c=getClassUsingCustomClassPath(className,WEBAPP_CLASSPATH_KEY,parentLoader);
    if (c == null) {
      c=getClassUsingCustomClassPath(className,PROJECT_CLASSPATH_KEY,parentLoader);
      if (c == null) {
        c=getClassUsingCustomClassPath(className,WORKSPACE_CLASSPATH_KEY,parentLoader);
      }
    }
  }
  if (c == null) {
    throw ex;
  }
  return c;
}

Fixed version (ground truth):
public Class loadClass(String className,ClassLoader parentLoader) throws ClassNotFoundException {
  if (className == null)   return null;
  Class c=null;
  ClassNotFoundException ex=null;
  if (this.classLoader != null) {
    try {
      c=this.classLoader.loadClass(className);
      if (c != null) {
        return c;
      }
    }
 catch (    Throwable e) {
    }
  }
  try {
    c=Class.forName(className);
  }
 catch (  ClassNotFoundException e) {
    ex=e;
    c=getClassUsingCustomClassPath(className,EngineConstants.WEBAPP_CLASSPATH_KEY,parentLoader);
    if (c == null) {
      c=getClassUsingCustomClassPath(className,EngineConstants.PROJECT_CLASSPATH_KEY,parentLoader);
      if (c == null) {
        c=getClassUsingCustomClassPath(className,EngineConstants.WORKSPACE_CLASSPATH_KEY,parentLoader);
      }
    }
  }
  if (c == null) {
    throw ex;
  }
  return c;
}
Program: 73167
Project: 73167
Buggy source:
protected void setupGroup(GroupDesign group,GroupHandle handle){
  group.setID(handle.getID());
  setupElementIDMap(group);
  group.setName(handle.getName());
  String pageBreakBefore=handle.getStringProperty(StyleHandle.PAGE_BREAK_BEFORE_PROP);
  String pageBreakAfter=handle.getStringProperty(StyleHandle.PAGE_BREAK_AFTER_PROP);
  String pageBreakInside=handle.getStringProperty(StyleHandle.PAGE_BREAK_INSIDE_PROP);
  group.setPageBreakBefore(pageBreakBefore);
  group.setPageBreakAfter(pageBreakAfter);
  group.setPageBreakInside(pageBreakInside);
  TOCHandle tocHandle=handle.getTOC();
  if (tocHandle != null) {
    String toc=tocHandle.getExpression();
    group.setTOC(createExpression(toc));
  }
  String bookmark=handle.getBookmark();
  group.setBookmark(bookmark);
  String scriptText=handle.getOnPageBreak();
  if (null != scriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(IGroupElementModel.ON_PAGE_BREAK_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(scriptText,id);
    group.setOnPageBreak(scriptExpr);
  }
  group.setHandle(handle);
  group.setJavaClass(handle.getEventHandlerClass());
}

Fixed version (ground truth):
protected void setupGroup(GroupDesign group,GroupHandle handle){
  group.setID(handle.getID());
  setupElementIDMap(group);
  group.setName(handle.getName());
  String pageBreakBefore=handle.getStringProperty(StyleHandle.PAGE_BREAK_BEFORE_PROP);
  String pageBreakAfter=handle.getStringProperty(StyleHandle.PAGE_BREAK_AFTER_PROP);
  String pageBreakInside=handle.getStringProperty(StyleHandle.PAGE_BREAK_INSIDE_PROP);
  group.setPageBreakBefore(pageBreakBefore);
  group.setPageBreakAfter(pageBreakAfter);
  group.setPageBreakInside(pageBreakInside);
  TOCHandle tocHandle=handle.getTOC();
  if (tocHandle != null) {
    String toc=tocHandle.getExpression();
    group.setTOC(createExpression(toc));
  }
  String bookmark=handle.getBookmark();
  group.setBookmark(bookmark);
  String scriptText=handle.getOnCreate();
  if (null != scriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(IGroupElementModel.ON_CREATE_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(scriptText,id);
    group.setOnCreate(scriptExpr);
  }
  scriptText=handle.getOnRender();
  if (null != scriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(IGroupElementModel.ON_RENDER_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(scriptText,id);
    group.setOnRender(scriptExpr);
  }
  scriptText=handle.getOnPageBreak();
  if (null != scriptText) {
    String id=ModuleUtil.getScriptUID(handle.getPropertyHandle(IGroupElementModel.ON_PAGE_BREAK_METHOD));
    ScriptExpression scriptExpr=new ScriptExpression(scriptText,id);
    group.setOnPageBreak(scriptExpr);
  }
  group.setHandle(handle);
  group.setJavaClass(handle.getEventHandlerClass());
}
Program: 73168
Project: 73168
Buggy source:
/** 
 * set input parameter bindings
 */
private void setInputParameterBinding() throws DataException {
  Iterator inputParamValueslist=getInputParamValues().iterator();
  while (inputParamValueslist.hasNext()) {
    ParameterBinding paramBind=(ParameterBinding)inputParamValueslist.next();
    if (isParameterPositionValid(paramBind.getPosition()))     odaStatement.setParameterValue(paramBind.getPosition(),paramBind.getValue());
 else     odaStatement.setParameterValue(paramBind.getName(),paramBind.getValue());
  }
}

Fixed version (ground truth):
/** 
 * set input parameter bindings
 */
private void setInputParameterBinding() throws DataException {
  Iterator inputParamValueslist=getInputParamValues().iterator();
  while (inputParamValueslist.hasNext()) {
    ParameterBinding paramBind=(ParameterBinding)inputParamValueslist.next();
    if (supportNamedParameter(paramBind.getName()))     odaStatement.setParameterValue(paramBind.getName(),paramBind.getValue());
 else     odaStatement.setParameterValue(paramBind.getPosition(),paramBind.getValue());
  }
}
Program: 73169
Project: 73169
Buggy source:
/** 
 * Adds input and output parameter hints to odaStatement
 */
private void addParameterDefns() throws DataException {
  if (this.parameterHints == null)   return;
  Iterator it=this.parameterHints.iterator();
  while (it.hasNext()) {
    ParameterHint parameterHint=(ParameterHint)it.next();
    odaStatement.addParameterHint(parameterHint);
    if (parameterHint.isInputMode()) {
      Class paramHintDataType=parameterHint.getDataType();
      if (paramHintDataType == Date.class)       paramHintDataType=parameterHint.getEffectiveDataType(dataSource.getDriverName(),queryType);
      Object inputValue=parameterHint.getDefaultInputValue();
      if (paramHintDataType != IBlob.class && paramHintDataType != IClob.class)       inputValue=convertToValue(parameterHint.getDefaultInputValue(),paramHintDataType);
      if (isParameterPositionValid(parameterHint.getPosition()))       this.setInputParamValue(parameterHint.getPosition(),inputValue);
 else       this.setInputParamValue(parameterHint.getName(),inputValue);
    }
  }
  this.setInputParameterBinding();
}

Fixed version (ground truth):
/** 
 * Adds input and output parameter hints to odaStatement
 */
private void addParameterDefns() throws DataException {
  if (this.parameterHints == null)   return;
  Iterator it=this.parameterHints.iterator();
  while (it.hasNext()) {
    ParameterHint parameterHint=(ParameterHint)it.next();
    odaStatement.addParameterHint(parameterHint);
    if (parameterHint.isInputMode()) {
      Class paramHintDataType=parameterHint.getDataType();
      if (paramHintDataType == Date.class)       paramHintDataType=parameterHint.getEffectiveDataType(dataSource.getDriverName(),queryType);
      Object inputValue=parameterHint.getDefaultInputValue();
      if (paramHintDataType != IBlob.class && paramHintDataType != IClob.class)       inputValue=convertToValue(parameterHint.getDefaultInputValue(),paramHintDataType);
      if (supportNamedParameter(parameterHint.getName()))       this.setInputParamValue(parameterHint.getName(),inputValue);
 else       this.setInputParamValue(parameterHint.getPosition(),inputValue);
    }
  }
  this.setInputParameterBinding();
}
Program: 73173
Project: 73173
Buggy source:
/** 
 * Returns appcontext
 * @param request
 * @return
 */
public static Map getAppContext(HttpServletRequest request){
  HashMap context=new HashMap();
  Boolean isDesigner=Boolean.valueOf(ParameterAccessor.isDesigner(request));
  context.put("String_Node_Str",isDesigner);
  context.put(EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST,request);
  context.put(EngineConstants.APPCONTEXT_CHART_RESOLUTION,ParameterAccessor.getDpi(request));
  int maxCubeRowLevels=ParameterAccessor.getMaxCubeRowLevels(request);
  if (maxCubeRowLevels >= 0)   context.put(DataEngine.CUBECUSROR_FETCH_LIMIT_ON_ROW_EDGE,new Integer(maxCubeRowLevels));
  int maxCubeColumnLevels=ParameterAccessor.getMaxCubeColumnLevels(request);
  if (maxCubeColumnLevels >= 0)   context.put(DataEngine.CUBECURSOR_FETCH_LIMIT_ON_COLUMN_EDGE,new Integer(maxCubeColumnLevels));
  int cubeMemorySize=ParameterAccessor.getCubeMemorySize(request);
  if (cubeMemorySize >= 0)   context.put(DataEngine.IN_MEMORY_CUBE_SIZE,new Integer(cubeMemorySize));
  context.put(IBirtConstants.APPCONTEXT_BIRT_RESOURCE_PATH,ParameterAccessor.getResourceFolder(request));
  ParameterAccessor.pushAppContext(context,request);
  if (isDesigner) {
    String appContextName=ParameterAccessor.getAppContextName(request);
    getAppContextFromExtension(appContextName,context);
  }
  return context;
}

Fixed version (ground truth):
/** 
 * Returns appcontext
 * @param request
 * @return
 */
public static Map getAppContext(HttpServletRequest request){
  HashMap context=new HashMap();
  Boolean isDesigner=Boolean.valueOf(ParameterAccessor.isDesigner(request));
  context.put("String_Node_Str",isDesigner);
  context.put(EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST,request);
  context.put(EngineConstants.APPCONTEXT_CHART_RESOLUTION,ParameterAccessor.getDpi(request));
  int maxCubeRowLevels=ParameterAccessor.getMaxCubeRowLevels(request);
  if (maxCubeRowLevels >= 0)   context.put(DataEngine.CUBECUSROR_FETCH_LIMIT_ON_ROW_EDGE,new Integer(maxCubeRowLevels));
  int maxCubeColumnLevels=ParameterAccessor.getMaxCubeColumnLevels(request);
  if (maxCubeColumnLevels >= 0)   context.put(DataEngine.CUBECURSOR_FETCH_LIMIT_ON_COLUMN_EDGE,new Integer(maxCubeColumnLevels));
  int cubeMemorySize=ParameterAccessor.getCubeMemorySize(request);
  if (cubeMemorySize >= 0)   context.put(DataEngine.IN_MEMORY_CUBE_SIZE,new Integer(cubeMemorySize));
  context.put(IBirtConstants.APPCONTEXT_BIRT_RESOURCE_PATH,ParameterAccessor.getResourceFolder(request));
  ParameterAccessor.pushAppContext(context,request);
  if (isDesigner.booleanValue()) {
    String appContextName=ParameterAccessor.getAppContextName(request);
    getAppContextFromExtension(appContextName,context);
  }
  return context;
}
Program: 73174
Project: 73174
Buggy source:
private void handleChartInXTab(final DesignElementHandle handle){
  if (ChartXTabUtil.isPlotChart(handle)) {
    HostChartsManager.addPlotChart(handle);
  }
 else   if (ChartXTabUtil.isAxisChart(handle)) {
    final DesignElementHandle plotChartHandle=HostChartsManager.findUnhostChart();
    if (plotChartHandle != null) {
      HostChartsManager.hostChart(plotChartHandle,handle);
      Display.getCurrent().asyncExec(new Runnable(){
        public void run(){
          try {
            handle.setProperty(ChartReportItemConstants.PROPERTY_HOST_CHART,plotChartHandle);
          }
 catch (          SemanticException e) {
            logger.log(e);
          }
        }
      }
);
    }
  }
}

Fixed version (ground truth):
private void handleChartInXTab(final DesignElementHandle handle){
  if (ChartXTabUtil.isPlotChart(handle)) {
    HostChartManager.addPlotChart(handle);
  }
 else   if (ChartXTabUtil.isAxisChart(handle)) {
    final DesignElementHandle plotChartHandle=HostChartManager.findUnhostChart();
    if (plotChartHandle != null) {
      HostChartManager.hostChart(plotChartHandle,handle);
      Display.getCurrent().asyncExec(new Runnable(){
        public void run(){
          try {
            handle.setProperty(ChartReportItemConstants.PROPERTY_HOST_CHART,plotChartHandle);
          }
 catch (          SemanticException e) {
            logger.log(e);
          }
        }
      }
);
    }
  }
}
Program: 73175
Project: 73175
Buggy source:
public final void disposeFigure(ExtendedItemHandle eih,IFigure ifg){
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
  ((DesignerRepresentation)ifg).dispose();
  HostChartsManager.dispose(eih);
}

Fixed version (ground truth):
public final void disposeFigure(ExtendedItemHandle eih,IFigure ifg){
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
  ((DesignerRepresentation)ifg).dispose();
  HostChartManager.dispose(eih);
}
Program: 73176
Project: 73176
Buggy source:
private void initHostChart(){
  if (ChartXTabUtil.isAxisChart(handle)) {
    hostChartHandle=(ExtendedItemHandle)handle.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
    HostChartsManager.hostChart(hostChartHandle,handle);
    cm=ChartReportItemUtil.getChartFromHandle(hostChartHandle);
    if (cm instanceof ChartWithAxes) {
      int axisType=((ChartWithAxes)cm).isTransposed() ? ICrosstabConstants.ROW_AXIS_TYPE : ICrosstabConstants.COLUMN_AXIS_TYPE;
      hostChartHandle.addListener(ChartXTabUtil.createSyncChartListener(hostChartHandle,(ExtendedItemHandle)handle,axisType));
      handle.addListener(ChartXTabUtil.createSyncChartListener((ExtendedItemHandle)handle,hostChartHandle,axisType));
      hostChartHandle.getContainer().addListener(ChartXTabUtil.createDeleteChartListener(hostChartHandle,handle));
      handle.getContainer().addListener(ChartXTabUtil.createDeleteChartListener(handle,hostChartHandle));
    }
  }
}

Fixed version (ground truth):
private void initHostChart(){
  if (ChartXTabUtil.isAxisChart(handle)) {
    hostChartHandle=(ExtendedItemHandle)handle.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
    cm=ChartReportItemUtil.getChartFromHandle(hostChartHandle);
    if (cm instanceof ChartWithAxes) {
      int axisType=((ChartWithAxes)cm).isTransposed() ? ICrosstabConstants.ROW_AXIS_TYPE : ICrosstabConstants.COLUMN_AXIS_TYPE;
      hostChartHandle.addListener(ChartXTabUtil.createSyncChartListener(hostChartHandle,(ExtendedItemHandle)handle,axisType));
      handle.addListener(ChartXTabUtil.createSyncChartListener((ExtendedItemHandle)handle,hostChartHandle,axisType));
      hostChartHandle.getContainer().addListener(ChartXTabUtil.createDeleteChartListener(hostChartHandle,handle));
      handle.getContainer().addListener(ChartXTabUtil.createDeleteChartListener(handle,hostChartHandle));
    }
  }
}
Program: 73177
Project: 73177
Buggy source:
/** 
 * Copy new handle
 * @param element The elemnent to copy
 * @param currentDesignHandle Current design handle
 * @return The copied handle
 * @throws CloneNotSupportedException
 */
private IDesignElement copyNewHandle(IDesignElement element) throws CloneNotSupportedException {
  IDesignElement newElement=isCloned ? element : (IDesignElement)element.clone();
  return newElement;
}

Fixed version (ground truth):
/** 
 * Copy new handle
 * @param element The elemnent to copy
 * @param currentDesignHandle Current design handle
 * @return The copied handle
 * @throws CloneNotSupportedException
 */
private DesignElementHandle copyNewHandle(IDesignElement element,ModuleHandle currentDesignHandle) throws CloneNotSupportedException {
  IDesignElement newElement=isCloned ? element : (IDesignElement)element.clone();
  DesignElementHandle handle=newElement.getHandle(currentDesignHandle.getModule());
  if (newContainer instanceof ThemeHandle) {
    currentDesignHandle.rename((ThemeHandle)newContainer,handle);
  }
 else   if (newContainer instanceof SlotHandle && ((SlotHandle)newContainer).getElementHandle() instanceof ThemeHandle) {
    currentDesignHandle.rename(((SlotHandle)newContainer).getElementHandle(),handle);
  }
 else {
    currentDesignHandle.rename(handle);
  }
  return handle;
}