nus-yam/ex-repair huggingface dataset:
Program: 44588
Project: 44588
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public JCodeModel generateModel() throws IllegalStateException {
  JCodeModel model=super.generateModel();
  JDefinedClass definedClass=model._getClass(this.getClassName());
  JMethod constructor=definedClass.constructor(JMod.PROTECTED);
  constructor.param(JMod.FINAL,Logger.class,LOGGER_PARAMETER_NAME);
  JBlock constructorBody=constructor.body();
  constructorBody.directStatement("String_Node_Str" + LOGGER_PARAMETER_NAME + "String_Node_Str");
  Set<Map.Entry<String,String>> entries=this.translations.entrySet();
  for (  Map.Entry<String,String> entry : entries) {
    String key=entry.getKey();
    String value=entry.getValue();
    JMethod method=addMessageMethod(key,value,-1);
    method.annotate(Override.class);
  }
  return model;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public JCodeModel generateModel() throws IllegalStateException {
  JCodeModel model=super.generateModel();
  JDefinedClass definedClass=model._getClass(this.getClassName());
  JMethod constructor=definedClass.constructor(JMod.PROTECTED);
  constructor.param(JMod.FINAL,Logger.class,LOGGER_PARAMETER_NAME);
  JBlock constructorBody=constructor.body();
  constructorBody.directStatement("String_Node_Str" + LOGGER_PARAMETER_NAME + "String_Node_Str");
  Set<Map.Entry<String,String>> entries=this.translations.entrySet();
  for (  Map.Entry<String,String> entry : entries) {
    String key=entry.getKey();
    String value=entry.getValue();
    JMethod method=addMessageMethod(key,value);
    method.annotate(Override.class);
  }
  return model;
}
Program: 44589
Project: 44589
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void validate() throws ValidationException {
  boolean invalid=true;
  for (  Class<?> clazz : acceptedTypes) {
    try {
      if (clazz.isAssignableFrom(Class.forName(methodDesc.returnTypeAsString()))) {
        invalid=false;
      }
    }
 catch (    ClassNotFoundException e) {
      throw new ValidationException("String_Node_Str",e,methodDesc.method());
    }
  }
  if (invalid) {
    throw new ValidationException("String_Node_Str",methodDesc.method());
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void validate() throws ValidationException {
  boolean invalid=true;
  try {
    if (Throwable.class.isAssignableFrom(Class.forName(methodDesc.returnTypeAsString()))) {
      invalid=false;
    }
    if (Class.forName(methodDesc.returnTypeAsString()).isAssignableFrom(String.class)) {
      invalid=false;
    }
  }
 catch (  ClassNotFoundException e) {
    throw new ValidationException("String_Node_Str",e,methodDesc.method());
  }
  if (invalid) {
    throw new ValidationException("String_Node_Str",methodDesc.method());
  }
}
Program: 44590
Project: 44590
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void validate() throws ValidationException {
  final Set<Integer> messageIds=new HashSet<Integer>();
  final Set<Message> messages=new HashSet<Message>();
  for (  MethodDescriptor md : methodDesc) {
    if (messages.add(md.message())) {
      if (!messageIds.add(md.message().id())) {
        throw new ValidationException("String_Node_Str",md.method());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void validate() throws ValidationException {
  final Set<Integer> messageIds=new HashSet<Integer>();
  final Set<Message> messages=new HashSet<Message>();
  for (  MethodDescriptor md : methodDesc) {
    if (messages.add(md.message())) {
      final int id=md.message().id();
      if (id > Message.NONE && !messageIds.add(id)) {
        throw new ValidationException("String_Node_Str",md.method());
      }
    }
  }
}
Program: 44591
Project: 44591
Buggy source:
/** 
 * Creates the source file. <p> Executes the following methods in the order listed. <ol> <li>Runs validation for each validator.</li> <li>  {@code ClassModel#generateModel()}</li> </ol> </p>
 * @param fileObject the files object to write the source to.
 * @throws Exception if an error occurs creating the source file.
 */
public final void create(final JavaFileObject fileObject) throws IOException, IllegalStateException, ValidationException {
  for (  Validator validator : validators) {
    validator.validate();
  }
  generateModel().build(new JavaFileObjectCodeWriter(fileObject));
}

Fixed version (ground truth):
/** 
 * Creates the source file. <p> Executes the following methods in the order listed. <ol> <li>  {@link ClassModel#preValidation()}</li> <li>Runs validation for each validator.</li> <li>  {@link ClassModel#generateModel()}</li> </ol> </p>
 * @param fileObject the files object to write the source to.
 * @throws Exception if an error occurs creating the source file.
 */
public final void create(final JavaFileObject fileObject) throws IOException, IllegalStateException, ValidationException {
  preValidation();
  for (  Validator validator : validators) {
    validator.validate();
  }
  generateModel().build(new JavaFileObjectCodeWriter(fileObject));
}
Program: 44592
Project: 44592
Buggy source:
/** 
 * Class constructor.
 * @param interfaceName the interface name to implement.
 * @param projectCode the project code to prepend messages with.
 * @param type the type of the implementation.
 */
protected ImplementationClassModel(final String interfaceName,final String projectCode,ImplementationType type){
  super(interfaceName + type.extension(),projectCode,Object.class.getName(),interfaceName,Serializable.class.getName());
  this.interfaceName=interfaceName;
  this.type=type;
}

Fixed version (ground truth):
/** 
 * Class constructor.
 * @param interfaceName the interface name to implement.
 * @param projectCode the project code to prepend messages with.
 * @param type the type of the implementation.
 */
protected ImplementationClassModel(final String interfaceName,final String projectCode,ImplementationType type){
  super(interfaceName + type.extension(),projectCode,Object.class.getName(),interfaceName,Serializable.class.getName());
  this.interfaceName=interfaceName;
  this.type=type;
  methodDescriptor=new MethodDescriptor();
  messageAnnotationValidator=new MessageAnnotationValidator();
}
Program: 44593
Project: 44593
Buggy source:
/** 
 * Adds a method to the class.
 * @param method the method to add.
 */
public abstract void addMethod(final ExecutableElement method);

Fixed version (ground truth):
/** 
 * Adds a method to the class.
 * @param method the method to add.
 */
public void addMethod(final ExecutableElement method){
  methodDescriptor=methodDescriptor.add(method);
  messageAnnotationValidator.addMethod(method);
  addValidator(new MethodParameterValidator(methodDescriptor));
}
Program: 44594
Project: 44594
Buggy source:
/** 
 * Creates a new message bundle code model.
 * @param interfaceName the interface name.
 * @param projectCode the project code from the annotation.
 */
public MessageBundleImplementor(final String interfaceName,final String projectCode){
  super(interfaceName,projectCode,ImplementationType.BUNDLE);
  methodDescriptor=new MethodDescriptor();
}

Fixed version (ground truth):
/** 
 * Creates a new message bundle code model.
 * @param interfaceName the interface name.
 * @param projectCode the project code from the annotation.
 */
public MessageBundleImplementor(final String interfaceName,final String projectCode){
  super(interfaceName,projectCode,ImplementationType.BUNDLE);
}
Program: 44595
Project: 44595
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void addMethod(final ExecutableElement method){
  methodDescriptor=methodDescriptor.add(method);
  addValidator(new MethodParameterValidator(methodDescriptor));
  addValidator(new BundleReturnTypeValidator(methodDescriptor));
  addValidator(new MessageIdValidator(methodDescriptor));
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void addMethod(final ExecutableElement method){
  super.addMethod(method);
  addValidator(new BundleReturnTypeValidator(methodDescriptor));
}
Program: 44596
Project: 44596
Buggy source:
/** 
 * Creates a new message logger code model.
 * @param interfaceName the interface name.
 * @param projectCode the project code from the annotation.
 */
public MessageLoggerImplementor(final String interfaceName,final String projectCode){
  super(interfaceName,projectCode,ImplementationType.LOGGER);
  methodDescriptor=new MethodDescriptor();
}

Fixed version (ground truth):
/** 
 * Creates a new message logger code model.
 * @param interfaceName the interface name.
 * @param projectCode the project code from the annotation.
 */
public MessageLoggerImplementor(final String interfaceName,final String projectCode){
  super(interfaceName,projectCode,ImplementationType.LOGGER);
}
Program: 44597
Project: 44597
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void addMethod(final ExecutableElement method){
  methodDescriptor=methodDescriptor.add(method);
  addValidator(new MethodParameterValidator(methodDescriptor));
  addValidator(new LoggerReturnTypeValidator(methodDescriptor));
  addValidator(new MessageIdValidator(methodDescriptor));
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void addMethod(final ExecutableElement method){
  super.addMethod(method);
  addValidator(new LoggerReturnTypeValidator(methodDescriptor));
}
Program: 44599
Project: 44599
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void validate() throws ValidationException {
  final Set<Integer> messageIds=new HashSet<Integer>();
  final Set<Message> messages=new HashSet<Message>();
  for (  MethodDescriptor md : methodDesc) {
    if (messages.add(md.message())) {
      final int id=md.message().id();
      if (id > Message.NONE && !messageIds.add(id)) {
        throw new ValidationException("String_Node_Str",md.method());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void validate() throws ValidationException {
  final Set<Integer> messageIds=new HashSet<Integer>();
  final Set<String> messages=new HashSet<String>();
  for (  MethodDescriptor md : methodDesc) {
    if (messages.add(md.name())) {
      final int id=md.message().id();
      if (id > Message.NONE && !messageIds.add(id)) {
        throw new ValidationException("String_Node_Str",md.method());
      }
    }
  }
}
Program: 44601
Project: 44601
Buggy source:
/** 
 * Create a translation decorator who adds translation methods.
 * @param model the model to decorate
 * @param translations the translations to add
 */
public TranslationMethods(final ClassModel model,final Map<String,String> translations){
  super(model);
  if (translations == null) {
    this.translations=translations;
  }
 else {
    this.translations=Collections.EMPTY_MAP;
  }
}

Fixed version (ground truth):
/** 
 * Create a translation decorator who adds translation methods.
 * @param model the model to decorate
 * @param translations the translations to add
 */
public TranslationMethods(final ClassModel model,final Map<String,String> translations){
  super(model);
  if (translations != null) {
    this.translations=translations;
  }
 else {
    this.translations=Collections.EMPTY_MAP;
  }
}
Program: 44602
Project: 44602
Buggy source:
private void createClass(final ImplementationClassModel codeModel,final TypeElement type) throws IOException, Exception, ValidationException {
  codeModel.initModel();
  for (  TypeMirror interfaceType : type.getInterfaces()) {
    for (    ExecutableElement method : ElementFilter.methodsIn(processingEnv().getTypeUtils().asElement(interfaceType).getEnclosedElements())) {
      codeModel.addMethod(method);
    }
  }
  for (  ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) {
    codeModel.addMethod(method);
  }
  codeModel.writeClass(filer().createSourceFile(codeModel.getClassName()));
}

Fixed version (ground truth):
private void createClass(final ImplementationClassModel codeModel,final TypeElement type) throws IOException, Exception, ValidationException {
  for (  TypeMirror interfaceType : type.getInterfaces()) {
    for (    ExecutableElement method : ElementFilter.methodsIn(processingEnv().getTypeUtils().asElement(interfaceType).getEnclosedElements())) {
      codeModel.addMethod(method);
    }
  }
  for (  ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) {
    codeModel.addMethod(method);
  }
  codeModel.create(filer().createSourceFile(codeModel.getClassName()));
}
Program: 44603
Project: 44603
Buggy source:
/** 
 * Returns the current date formatted in the ISO 8601 format.
 * @return the current date formatted in ISO 8601.
 */
protected static final String generatedDateValue(){
  final SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  return sdf.format(new Date());
}

Fixed version (ground truth):
/** 
 * Returns the current date formatted in the ISO 8601 format.
 * @return the current date formatted in ISO 8601.
 */
protected static String generatedDateValue(){
  final SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  return sdf.format(new Date());
}
Program: 44604
Project: 44604
Buggy source:
/** 
 * Get the class model.
 * @return the class model
 */
public final JCodeModel codeModel(){
  return this.codeModel;
}

Fixed version (ground truth):
/** 
 * Get the class model.
 * @return the class model
 */
protected final JCodeModel codeModel(){
  return this.codeModel;
}
Program: 44605
Project: 44605
Buggy source:
protected ClassModel(final ToolLogger logger,final String className,final String projectCode,final String superClassName,final String... interfaceNames){
  this.interfaceNames=interfaceNames;
  this.superClassName=superClassName;
  this.className=className;
  this.projectCode=projectCode;
  this.logger=logger;
}

Fixed version (ground truth):
protected ClassModel(final ToolLogger logger,final String className,final String projectCode,final String superClassName,final String... interfaceNames){
  this.interfaceNames=interfaceNames;
  this.superClassName=superClassName;
  this.className=className;
  this.projectCode=projectCode;
  this.logger=logger;
  this.validators=new ArrayList<Validator>();
}
Program: 44606
Project: 44606
Buggy source:
/** 
 * Adds a method to return the message value. The method name should be the method name annotated   {@code org.jboss.logging.Message}. This method will be appended with   {@code $str}. <p/> <p> If the message method has already been defined the previously created method is returned. </p> <p/> <p> Note this method invokes the  {@code addMessageVar(varName,messageValue,id)} to add the variable.</p>
 * @param methodName  the method name.
 * @param returnValue the message value.
 * @param id          the id to prepend the project code/message with.
 * @return the newly created method.
 */
protected JMethod addMessageMethod(final String methodName,final String returnValue,final int id){
  final String internalMethodName=methodName + "String_Node_Str";
  JMethod method=definedClass().getMethod(internalMethodName,EMPTY_TYPE_ARRAY);
  if (method == null) {
    final JClass returnType=codeModel().ref(String.class);
    method=definedClass().method(JMod.PROTECTED,returnType,internalMethodName);
    final JBlock body=method.body();
    final JVar idVar=definedClass.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL,String.class,methodName + "String_Node_Str");
    idVar.init(JExpr.lit(formatMessageId(id)));
    body._return(idVar.plus(addMessageVar(methodName,returnValue)));
  }
  return method;
}

Fixed version (ground truth):
/** 
 * Adds a method to return the message value. The method name should be the method name annotated   {@code org.jboss.logging.Message}. This method will be appended with   {@code $str}. <p/> <p> If the message method has already been defined the previously created method is returned. </p> <p/> <p> Note this method invokes the  {@code addMessageVar(varName,messageValue,id)} to add the variable.</p>
 * @param methodName  the method name.
 * @param returnValue the message value.
 * @param id          the id to prepend the project code/message with.
 * @return the newly created method.
 */
protected JMethod addMessageMethod(final String methodName,final String returnValue,final int id){
  final String internalMethodName=methodName + "String_Node_Str";
  JMethod method=definedClass().getMethod(internalMethodName,EMPTY_TYPE_ARRAY);
  if (method == null) {
    final JClass returnType=codeModel().ref(String.class);
    method=definedClass().method(JMod.PROTECTED,returnType,internalMethodName);
    final JBlock body=method.body();
    if (id > 0) {
      final JVar idVar=definedClass.field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL,String.class,methodName + "String_Node_Str");
      idVar.init(JExpr.lit(formatMessageId(id)));
      body._return(idVar.plus(addMessageVar(methodName,returnValue)));
    }
 else {
      body._return(addMessageVar(methodName,returnValue));
    }
  }
  return method;
}
Program: 44607
Project: 44607
Buggy source:
public void initModel() throws JClassAlreadyExistsException {
  codeModel=new JCodeModel();
  definedClass=codeModel._class(this.className);
  final JAnnotationUse anno=definedClass.annotate(javax.annotation.Generated.class);
  anno.param("String_Node_Str",getClass().getCanonicalName());
  anno.param("String_Node_Str",generatedDateValue());
  final JDocComment docComment=definedClass.javadoc();
  docComment.add("String_Node_Str");
  if (this.superClassName != null) {
    definedClass._extends(codeModel.ref(this.superClassName));
  }
  if (this.interfaceNames != null) {
    for (    String intf : this.interfaceNames) {
      definedClass._implements(codeModel.ref(intf));
    }
  }
}

Fixed version (ground truth):
/** 
 * Initializes the code model. Invoked as the first method in the  {@code ClassModel#create(JavaFileObject)} method.
 * @throws JClassAlreadyExistsException should be never happen, but if thethe class name was already defined.
 */
protected void initModel() throws JClassAlreadyExistsException {
  codeModel=new JCodeModel();
  definedClass=codeModel._class(this.className);
  final JAnnotationUse anno=definedClass.annotate(javax.annotation.Generated.class);
  anno.param("String_Node_Str",getClass().getCanonicalName());
  anno.param("String_Node_Str",generatedDateValue());
  final JDocComment docComment=definedClass.javadoc();
  docComment.add("String_Node_Str");
  if (this.superClassName != null) {
    definedClass._extends(codeModel.ref(this.superClassName));
  }
  if (this.interfaceNames != null) {
    for (    String intf : this.interfaceNames) {
      definedClass._implements(codeModel.ref(intf));
    }
  }
}
Program: 44608
Project: 44608
Buggy source:
/** 
 * Write the class to a file.
 * @param fileObject the file object to write the code model too.
 * @throws IOException if error occurs when writing class
 */
public void writeClass(final JavaFileObject fileObject) throws IOException {
  beforeWrite();
  this.codeModel.build(new JavaFileObjectCodeWriter(fileObject));
}

Fixed version (ground truth):
/** 
 * Write the class to a file.
 * @param fileObject the file object to write the code model too.
 * @throws IOException if error occurs when writing class
 */
public void writeClass(final JavaFileObject fileObject) throws IOException {
  this.codeModel.build(new JavaFileObjectCodeWriter(fileObject));
}
Program: 44609
Project: 44609
Buggy source:
/** 
 * Returns the main enclosing class.
 * @return the main enclosing class.
 */
public final JDefinedClass definedClass(){
  return definedClass;
}

Fixed version (ground truth):
/** 
 * Returns the main enclosing class.
 * @return the main enclosing class.
 */
protected final JDefinedClass definedClass(){
  return definedClass;
}
Program: 44610
Project: 44610
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void initModel() throws JClassAlreadyExistsException {
  super.initModel();
  final JFieldVar serialVersionUID=definedClass().field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL,codeModel().LONG,"String_Node_Str");
  serialVersionUID.init(JExpr.lit(1L));
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected void initModel() throws JClassAlreadyExistsException {
  super.initModel();
  final JFieldVar serialVersionUID=definedClass().field(JMod.PRIVATE | JMod.STATIC | JMod.FINAL,codeModel().LONG,"String_Node_Str");
  serialVersionUID.init(JExpr.lit(1L));
}
Program: 44611
Project: 44611
Buggy source:
/** 
 * Adds a method to the class.
 * @param method the method to add.
 * @throws ValidationException if the method is invalid.
 */
public abstract void addMethod(final ExecutableElement method) throws ValidationException ;

Fixed version (ground truth):
/** 
 * Adds a method to the class.
 * @param method the method to add.
 */
public abstract void addMethod(final ExecutableElement method);
Program: 44612
Project: 44612
Buggy source:
@Override public void initModel() throws JClassAlreadyExistsException {
  super.initModel();
  final JFieldVar instance=definedClass().field(JMod.PUBLIC | JMod.STATIC | JMod.FINAL,definedClass(),INSTANCE_FIELD_NAME);
  instance.init(JExpr._new(definedClass()));
  definedClass().constructor(JMod.PROTECTED);
  final JMethod readResolveMethod=definedClass().method(JMod.PROTECTED,definedClass(),GET_INSTANCE_METHOD_NAME);
  readResolveMethod.body()._return(instance);
}

Fixed version (ground truth):
@Override protected void initModel() throws JClassAlreadyExistsException {
  super.initModel();
  final JFieldVar instance=definedClass().field(JMod.PUBLIC | JMod.STATIC | JMod.FINAL,definedClass(),INSTANCE_FIELD_NAME);
  instance.init(JExpr._new(definedClass()));
  definedClass().constructor(JMod.PROTECTED);
  final JMethod readResolveMethod=definedClass().method(JMod.PROTECTED,definedClass(),GET_INSTANCE_METHOD_NAME);
  readResolveMethod.body()._return(instance);
}
Program: 44613
Project: 44613
Buggy source:
@Override public void addMethod(final ExecutableElement method) throws ValidationException {
  methodDescriptor=methodDescriptor.add(method);
  MethodParameterValidator.create(methodDescriptor).validate();
}

Fixed version (ground truth):
@Override public void addMethod(final ExecutableElement method){
  methodDescriptor=methodDescriptor.add(method);
  addValidator(MethodParameterValidator.create(methodDescriptor));
}
Program: 44614
Project: 44614
Buggy source:
@Override public void initModel() throws JClassAlreadyExistsException {
  super.initModel();
  log=definedClass().field(JMod.PROTECTED | JMod.FINAL,Logger.class,LOG_FIELD_NAME);
  final JMethod constructor=definedClass().constructor(JMod.PROTECTED);
  final JVar param=constructor.param(JMod.FINAL,Logger.class,LOG_FIELD_NAME);
  final JBlock body=constructor.body();
  body.directStatement("String_Node_Str" + log.name() + "String_Node_Str"+ param.name()+ "String_Node_Str");
}

Fixed version (ground truth):
@Override protected void initModel() throws JClassAlreadyExistsException {
  super.initModel();
  log=definedClass().field(JMod.PROTECTED | JMod.FINAL,Logger.class,LOG_FIELD_NAME);
  final JMethod constructor=definedClass().constructor(JMod.PROTECTED);
  final JVar param=constructor.param(JMod.FINAL,Logger.class,LOG_FIELD_NAME);
  final JBlock body=constructor.body();
  body.directStatement("String_Node_Str" + log.name() + "String_Node_Str"+ param.name()+ "String_Node_Str");
}
Program: 44615
Project: 44615
Buggy source:
@Override public void addMethod(final ExecutableElement method) throws ValidationException {
  methodDescriptor=methodDescriptor.add(method);
  MethodParameterValidator.create(methodDescriptor).validate();
}

Fixed version (ground truth):
@Override public void addMethod(final ExecutableElement method){
  methodDescriptor=methodDescriptor.add(method);
  addValidator(MethodParameterValidator.create(methodDescriptor));
}
Program: 44616
Project: 44616
Buggy source:
@Override public void validate() throws ValidationException {
  final Collection<MethodDescriptor> methodDescriptors=methodDescriptor.find(methodDescriptor.name());
  final int paramCount1=methodDescriptor.parameters().size() - ((methodDescriptor.hasClause()) ? 1 : 0);
  for (  MethodDescriptor methodDesc : methodDescriptors) {
    final int paramCount2=methodDesc.parameters().size() - ((methodDesc.hasClause()) ? 1 : 0);
    if (paramCount1 != paramCount2) {
      throw new ValidationException("String_Node_Str",methodDescriptor.method());
    }
  }
}

Fixed version (ground truth):
@Override public void validate() throws ValidationException {
  final Collection<MethodDescriptor> methodDescriptors=methodDescriptor.find(methodDescriptor.name());
  final int paramCount1=methodDescriptor.parameters().size() - ((methodDescriptor.hasClause()) ? 1 : 0);
  for (  MethodDescriptor methodDesc : methodDescriptors) {
    final int paramCount2=methodDesc.parameters().size() - ((methodDesc.hasClause()) ? 1 : 0);
    if (paramCount1 != paramCount2) {
      throw new ValidationException("String_Node_Str",methodDesc.method());
    }
  }
}
Program: 44617
Project: 44617
Buggy source:
/** 
 * The property file filter.
 * @param className the class that have i18n property file
 */
public TranslationFileFilter(final String className){
  this.className=className;
}

Fixed version (ground truth):
/** 
 * The property file filter.
 * @param className the class that have i18n property file
 */
public TranslationFileFilter(final String className){
  this.className=className;
  System.out.println(className);
}
Program: 44621
Project: 44621
Buggy source:
/** 
 * Creates a new message bundle code model.
 * @param interfaceName the interface name.
 * @param projectCode the project code from the annotation.
 * @throws JClassAlreadyExistsException should never happen, but could be thrown if the class has already been defined
 */
public MessageBundleCodeModel(final String interfaceName,final String projectCode) throws JClassAlreadyExistsException {
  super(interfaceName,projectCode);
  init();
}

Fixed version (ground truth):
/** 
 * Creates a new message bundle code model.
 * @param interfaceName the interface name.
 * @param projectCode the project code from the annotation.
 * @throws JClassAlreadyExistsException should never happen, but could be thrown if the class has already been defined
 */
public MessageBundleCodeModel(final String interfaceName,final String projectCode) throws JClassAlreadyExistsException {
  super(interfaceName,projectCode);
  methodDescriptor=new MethodDescriptor();
  init();
}
Program: 44628
Project: 44628
Buggy source:
public void addAllObjectsOfCurrentPage_UIAction(PagedListDataModel pagedListDataModel,HtmlDataTable htmlDataTable){
  selectedContentObjects=(List<ContentObjectUIWrapper>)pagedListDataModel.getWrappedData();
  atLeastOneContentObjectIsSelected=true;
}

Fixed version (ground truth):
public void addAllObjectsOfCurrentPage_UIAction(PagedListDataModel pagedListDataModel,HtmlDataTable htmlDataTable){
  selectedContentObjects=new ArrayList<ContentObjectUIWrapper>((List<ContentObjectUIWrapper>)pagedListDataModel.getWrappedData());
  atLeastOneContentObjectIsSelected=true;
}
Program: 44629
Project: 44629
Buggy source:
/** 
 * If provided value is a valid ISO8601 date then equivalent calendar is returned
 * @param value
 * @return
 * @throws ParseException 
 */
private Calendar checkIfValueIsISO8601Date(String value){
  if (StringUtils.isBlank(value)) {
    return null;
  }
  Calendar date=null;
  try {
    Matcher dateTimeMatcher=ISO8601Pattern.matcher(value);
    if (dateTimeMatcher.matches()) {
      StringBuilder pattern=new StringBuilder("String_Node_Str");
      String timeZoneId=null;
      if (dateTimeMatcher.groupCount() >= 7 && dateTimeMatcher.group(7) != null) {
        pattern.append("String_Node_Str");
      }
      if (dateTimeMatcher.groupCount() >= 8 && dateTimeMatcher.group(8) != null) {
        if (!"String_Node_Str".equals(dateTimeMatcher.group(8))) {
          timeZoneId="String_Node_Str" + dateTimeMatcher.group(8);
          value=value.replace(dateTimeMatcher.group(8),"String_Node_Str");
        }
 else {
          timeZoneId="String_Node_Str";
          value=value.replace("String_Node_Str","String_Node_Str");
        }
      }
      date=(Calendar)DateUtils.fromString(value,pattern.toString());
      if (timeZoneId != null) {
        TimeZone timeZone=TimeZone.getTimeZone(timeZoneId);
        if (!timeZone.getID().equals(timeZoneId)) {
          throw new ParseException("String_Node_Str" + value);
        }
        date.setTimeZone(timeZone);
      }
    }
 else {
      Matcher dateMatcher=ISO8601DatePattern.matcher(value);
      if (dateMatcher.matches()) {
        date=(Calendar)DateUtils.fromString(value,ISO8601_DATE_FORMAT);
      }
    }
  }
 catch (  Exception e) {
    return null;
  }
  return date;
}

Fixed version (ground truth):
/** 
 * If provided value is a valid ISO8601 date then equivalent calendar is returned
 * @param value
 * @return
 * @throws ParseException 
 */
private Calendar checkIfValueIsISO8601Date(String value){
  if (StringUtils.isBlank(value)) {
    return null;
  }
  Calendar date=null;
  try {
    Matcher dateTimeMatcher=ISO8601Pattern.matcher(value);
    if (dateTimeMatcher.matches()) {
      date=ISO8601.parse(value);
    }
 else {
      Matcher dateMatcher=ISO8601DatePattern.matcher(value);
      if (dateMatcher.matches()) {
        date=(Calendar)DateUtils.fromString(value,ISO8601_DATE_FORMAT);
      }
    }
  }
 catch (  Exception e) {
    return null;
  }
  return date;
}
Program: 44630
Project: 44630
Buggy source:
private InputSource locateEntity(String systemId,String publicId) throws IOException {
  URL xsdOrDtdLocation=null;
  if (publicId != null && schemaURLsPerPublicId.containsKey(publicId)) {
    xsdOrDtdLocation=schemaURLsPerPublicId.get(publicId);
  }
  if (systemId == null) {
    return null;
  }
  if (xsdOrDtdLocation == null) {
    String pathToXsdOrDtd=xmlSchemaHomeDir + File.separator + (systemId.contains(CmsConstants.FORWARD_SLASH) ? StringUtils.substringAfterLast(systemId,CmsConstants.FORWARD_SLASH) : systemId);
    xsdOrDtdLocation=this.getClass().getClassLoader().getResource(pathToXsdOrDtd);
  }
  if (xsdOrDtdLocation == null) {
    xsdOrDtdLocation=new URL(systemId);
  }
  try {
    InputSource is=new InputSource(xsdOrDtdLocation.openStream());
    is.setSystemId(xsdOrDtdLocation.toString());
    is.setPublicId(publicId);
    schemaURLsPerPublicId.put(publicId,xsdOrDtdLocation);
    return is;
  }
 catch (  Throwable isEx) {
    LoggerFactory.getLogger(getClass()).warn("String_Node_Str" + publicId + "String_Node_Str"+ systemId+ "String_Node_Str"+ xsdOrDtdLocation.toString(),isEx);
    return null;
  }
}

Fixed version (ground truth):
private InputSource locateEntity(String systemId,String publicId) throws IOException {
  URL xsdOrDtdLocation=null;
  if (publicId != null && schemaURLsPerPublicId.containsKey(publicId)) {
    xsdOrDtdLocation=schemaURLsPerPublicId.get(publicId);
  }
  if (systemId == null) {
    return null;
  }
  String xsdOrDtdFilename=(systemId.contains(CmsConstants.FORWARD_SLASH) ? StringUtils.substringAfterLast(systemId,CmsConstants.FORWARD_SLASH) : systemId);
  if (xsdOrDtdLocation == null) {
    xsdOrDtdLocation=this.getClass().getResource(xmlSchemaHomeDir + CmsConstants.FORWARD_SLASH + xsdOrDtdFilename);
  }
  if (xsdOrDtdLocation == null) {
    xsdOrDtdLocation=new URL(systemId);
  }
  try {
    InputSource is=new InputSource(xsdOrDtdLocation.openStream());
    is.setSystemId(xsdOrDtdLocation.toString());
    is.setPublicId(publicId);
    schemaURLsPerPublicId.put(publicId,xsdOrDtdLocation);
    return is;
  }
 catch (  Throwable isEx) {
    LoggerFactory.getLogger(getClass()).warn("String_Node_Str" + publicId + "String_Node_Str"+ systemId+ "String_Node_Str"+ xsdOrDtdLocation.toString(),isEx);
    return null;
  }
}
Program: 44631
Project: 44631
Buggy source:
private boolean elementExtendsComplexCmsPropertyType(XSComplexType complexType){
  String typeName=complexType.getBaseType().getName();
  String typeNamespace=complexType.getBaseType().getTargetNamespace();
  ItemQName complexTypeAsItemQName=ItemUtils.createNewItem("String_Node_Str",typeNamespace,typeName);
  return complexTypeAsItemQName.equals(CmsDefinitionItem.complexCmsPropertyType);
}

Fixed version (ground truth):
private boolean elementExtendsComplexCmsPropertyType(XSComplexType complexType){
  Boolean elementExtendsComplexCmsPropertyType=null;
  XSType currentElementType=complexType.getBaseType();
  do {
    String typeName=currentElementType.getName();
    String typeNamespace=currentElementType.getTargetNamespace();
    logger.debug("String_Node_Str",new Object[]{"String_Node_Str" + typeNamespace + "String_Node_Str",typeName});
    ItemQName complexTypeAsItemQName=ItemUtils.createNewItem("String_Node_Str",typeNamespace,typeName);
    if (complexTypeAsItemQName.equals(CmsDefinitionItem.complexCmsPropertyType)) {
      elementExtendsComplexCmsPropertyType=true;
    }
 else {
      ItemQName parentTypeAsItemQName=ItemUtils.createNewItem("String_Node_Str",currentElementType.getBaseType().getTargetNamespace(),currentElementType.getBaseType().getName());
      if (!complexTypeAsItemQName.equals(parentTypeAsItemQName)) {
        currentElementType=currentElementType.getBaseType();
      }
 else {
        break;
      }
    }
  }
 while (elementExtendsComplexCmsPropertyType == null);
  return BooleanUtils.isTrue(elementExtendsComplexCmsPropertyType);
}
Program: 44632
Project: 44632
Buggy source:
public boolean deleteTaxonomy(String taxonomyIdOrName){
  if (StringUtils.isBlank(taxonomyIdOrName))   throw new CmsException("String_Node_Str");
  Session session=null;
  Context context=null;
  try {
    session=getSession();
    Node taxonomyNode=getTaxonomyNodeByIdOrName(session,taxonomyIdOrName);
    if (taxonomyNode == null) {
      throw new CmsException("String_Node_Str" + taxonomyIdOrName + "String_Node_Str");
    }
    boolean taxonomyIsAReservedTaxonomy=isTaxonomyNameAReservedName(taxonomyNode.getName());
    if (taxonomyIsAReservedTaxonomy) {
      throw new CmsException("String_Node_Str" + taxonomyNode.getName() + "String_Node_Str");
    }
    Node taxonomyRootNode=JcrNodeUtils.getTaxonomyRootNode(session);
    if (!taxonomyNode.getParent().getPath().equals(taxonomyRootNode.getPath())) {
      throw new CmsException("String_Node_Str" + taxonomyNode.getName() + "String_Node_Str");
    }
    context=new Context(cmsRepositoryEntityUtils,cmsQueryHandler,session);
    NodeIterator rootTopics=taxonomyNode.getNodes(CmsBuiltInItem.Topic.getJcrName());
    while (rootTopics.hasNext()) {
      topicUtils.removeTopicJcrNode(rootTopics.nextNode(),session,false,context);
    }
    taxonomyNode.remove();
    session.save();
    return true;
  }
 catch (  Throwable e) {
    throw new CmsException(e);
  }
 finally {
    if (context != null) {
      context.dispose();
      context=null;
    }
  }
}

Fixed version (ground truth):
public boolean deleteTaxonomy(String taxonomyIdOrName){
  if (StringUtils.isBlank(taxonomyIdOrName))   throw new CmsException("String_Node_Str");
  Session session=null;
  Context context=null;
  try {
    session=getSession();
    Node taxonomyNode=getTaxonomyNodeByIdOrName(session,taxonomyIdOrName);
    if (taxonomyNode == null) {
      logger.info("String_Node_Str",taxonomyIdOrName);
      return false;
    }
    boolean taxonomyIsAReservedTaxonomy=isTaxonomyNameAReservedName(taxonomyNode.getName());
    if (taxonomyIsAReservedTaxonomy) {
      throw new CmsException("String_Node_Str" + taxonomyNode.getName() + "String_Node_Str");
    }
    Node taxonomyRootNode=JcrNodeUtils.getTaxonomyRootNode(session);
    if (!taxonomyNode.getParent().getPath().equals(taxonomyRootNode.getPath())) {
      throw new CmsException("String_Node_Str" + taxonomyNode.getName() + "String_Node_Str");
    }
    context=new Context(cmsRepositoryEntityUtils,cmsQueryHandler,session);
    NodeIterator rootTopics=taxonomyNode.getNodes(CmsBuiltInItem.Topic.getJcrName());
    while (rootTopics.hasNext()) {
      topicUtils.removeTopicJcrNode(rootTopics.nextNode(),session,false,context);
    }
    taxonomyNode.remove();
    session.save();
    return true;
  }
 catch (  Throwable e) {
    throw new CmsException(e);
  }
 finally {
    if (context != null) {
      context.dispose();
      context=null;
    }
  }
}
Program: 44636
Project: 44636
Buggy source:
@Override public <T>T getCmsDefinition(String fullPropertyDefinitionPath,ResourceRepresentationType<T> output,boolean prettyPrint){
  if (definitionServiceSecure != null) {
    if (successfullyConnectedToRemoteService) {
      client.activateClientContext();
    }
    return definitionServiceSecure.getCmsDefinition(fullPropertyDefinitionPath,output,prettyPrint,getAuthenticationToken());
  }
 else {
    throw new CmsException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public <T>T getCmsDefinition(String fullPropertyDefinitionPath,ResourceRepresentationType<T> output,boolean prettyPrint){
  if (definitionServiceSecure != null) {
    if (successfullyConnectedToRemoteService) {
      client.activateClientContext();
    }
    T cmsDefinition=null;
    try {
      if (cachedDefinitionServiceDao != null) {
        logger.debug("String_Node_Str",fullPropertyDefinitionPath);
        cmsDefinition=cachedDefinitionServiceDao.getCmsDefinition(fullPropertyDefinitionPath,output,prettyPrint);
      }
      if (cmsDefinition == null) {
        logger.debug("String_Node_Str",fullPropertyDefinitionPath);
        cmsDefinition=definitionServiceSecure.getCmsDefinition(fullPropertyDefinitionPath,output,prettyPrint,getAuthenticationToken());
        if (cmsDefinition != null && cachedDefinitionServiceDao != null) {
          logger.debug("String_Node_Str",fullPropertyDefinitionPath);
          cachedDefinitionServiceDao.cacheCmsDefinition(fullPropertyDefinitionPath,cmsDefinition,output,prettyPrint);
        }
      }
    }
 catch (    Exception e) {
      throw new CmsException(e);
    }
    return cmsDefinition;
  }
 else {
    throw new CmsException("String_Node_Str");
  }
}
Program: 44637
Project: 44637
Buggy source:
@GET @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str" + CmsConstants.PROPERTY_PATH_REG_EXP_FOR_RESTEASY + "String_Node_Str") public Response getDefinitionAsJson(@PathParam("String_Node_Str") String propertyPath,@QueryParam("String_Node_Str") String output,@QueryParam("String_Node_Str") String callback,@QueryParam("String_Node_Str") String prettyPrint){
  boolean prettyPrintEnabled=ContentApiUtils.isPrettyPrintEnabled(prettyPrint);
  if (StringUtils.equals(propertyPath,CmsConstants.ASTROBOA_MODEL_SCHEMA_FILENAME_WITH_VERSION) || StringUtils.equals(propertyPath,CmsConstants.ASTROBOA_API_SCHEMA_FILENAME_WITH_VERSION)) {
    return getDefinitionInternal(propertyPath,Output.XSD,callback,prettyPrintEnabled);
  }
  Output outputEnum=Output.XML;
  if (StringUtils.isNotBlank(output)) {
    outputEnum=Output.valueOf(output.toUpperCase());
  }
  return getDefinitionInternal(propertyPath,outputEnum,callback,prettyPrintEnabled);
}

Fixed version (ground truth):
@GET @Produces(MediaType.APPLICATION_JSON) @Path("String_Node_Str" + CmsConstants.PROPERTY_PATH_REG_EXP_FOR_RESTEASY + "String_Node_Str") public Response getDefinitionAsJson(@PathParam("String_Node_Str") String propertyPath,@QueryParam("String_Node_Str") String output,@QueryParam("String_Node_Str") String callback,@QueryParam("String_Node_Str") String prettyPrint){
  boolean prettyPrintEnabled=ContentApiUtils.isPrettyPrintEnabled(prettyPrint);
  if (StringUtils.equals(propertyPath,CmsConstants.ASTROBOA_MODEL_SCHEMA_FILENAME_WITH_VERSION) || StringUtils.equals(propertyPath,CmsConstants.ASTROBOA_API_SCHEMA_FILENAME_WITH_VERSION)) {
    return getDefinitionInternal(propertyPath,Output.XSD,callback,prettyPrintEnabled);
  }
  Output outputEnum=Output.JSON;
  if (StringUtils.isNotBlank(output)) {
    outputEnum=Output.valueOf(output.toUpperCase());
  }
  return getDefinitionInternal(propertyPath,outputEnum,callback,prettyPrintEnabled);
}
Program: 44645
Project: 44645
Buggy source:
private String retrieveContentObjectXMLorJSONByIdOrSystemName(String contentObjectIdOrSystemName,String commaDelimitedProjectionPaths,Output output,Date lastModified,boolean prettyPrint){
  try {
    ContentObject contentObject=null;
    if (StringUtils.isBlank(commaDelimitedProjectionPaths)) {
      contentObject=retrieveContentObjectByIdOrSystemName(contentObjectIdOrSystemName,FetchLevel.FULL,null);
    }
 else {
      contentObject=retrieveContentObjectByIdOrSystemName(contentObjectIdOrSystemName,FetchLevel.FULL,commaDelimitedProjectionPaths);
    }
    if (contentObject == null) {
      return null;
    }
    lastModified=((CalendarProperty)contentObject.getCmsProperty("String_Node_Str")).getSimpleTypeValueAsDate();
    if (output == null) {
      return contentObject.xml(prettyPrint);
    }
switch (output) {
case XML:
      return contentObject.xml(prettyPrint);
case JSON:
    return contentObject.json(prettyPrint);
default :
  return contentObject.xml(prettyPrint);
}
}
 catch (Exception e) {
return null;
}
}

Fixed version (ground truth):
private String retrieveContentObjectXMLorJSONByIdOrSystemName(String contentObjectIdOrSystemName,String commaDelimitedProjectionPaths,Output output,Date lastModified,boolean prettyPrint){
  try {
    ContentObject contentObject=null;
    if (StringUtils.isBlank(commaDelimitedProjectionPaths)) {
      contentObject=retrieveContentObjectByIdOrSystemName(contentObjectIdOrSystemName,FetchLevel.FULL,null);
    }
 else {
      contentObject=retrieveContentObjectByIdOrSystemName(contentObjectIdOrSystemName,FetchLevel.ENTITY,commaDelimitedProjectionPaths);
    }
    if (contentObject == null) {
      return null;
    }
    lastModified=((CalendarProperty)contentObject.getCmsProperty("String_Node_Str")).getSimpleTypeValueAsDate();
    if (output == null) {
      return contentObject.xml(prettyPrint);
    }
switch (output) {
case XML:
      return contentObject.xml(prettyPrint);
case JSON:
    return contentObject.json(prettyPrint);
default :
  return contentObject.xml(prettyPrint);
}
}
 catch (Exception e) {
return null;
}
}
Program: 44651
Project: 44651
Buggy source:
public Node insertTopicNode(Session session,Topic topic,Context context) throws RepositoryException {
  if (topic.getTaxonomy() == null) {
    if (topic.getParent() != null && topic.getParent().getTaxonomy() != null) {
      topic.setTaxonomy(topic.getParent().getTaxonomy());
    }
 else {
      Taxonomy defaultTaxonomy=cmsRepositoryEntityFactoryForActiveClient.newTaxonomy();
      defaultTaxonomy.setName(CmsBuiltInItem.SubjectTaxonomy.getJcrName());
      topic.setTaxonomy(defaultTaxonomy);
    }
  }
  Node parentTopicNode=topicUtils.retrieveParentTopicNode(session,topic);
  return topicUtils.addNewTopicJcrNode(parentTopicNode,topic,session,false,context);
}

Fixed version (ground truth):
public Node insertTopicNode(Session session,Topic topic,Context context) throws RepositoryException {
  if (topic.getTaxonomy() == null) {
    if (topic.getParent() != null && topic.getParent().getTaxonomy() != null) {
      topic.setTaxonomy(topic.getParent().getTaxonomy());
    }
 else {
      Taxonomy defaultTaxonomy=cmsRepositoryEntityFactoryForActiveClient.newTaxonomy();
      defaultTaxonomy.setName(CmsBuiltInItem.SubjectTaxonomy.getJcrName());
      topic.setTaxonomy(defaultTaxonomy);
    }
  }
  Node parentTopicNode=topicUtils.retrieveParentTopicNode(session,topic,context);
  return topicUtils.addNewTopicJcrNode(parentTopicNode,topic,session,false,context);
}
Program: 44652
Project: 44652
Buggy source:
/** 
 * retrieve topic's parent. If no id is specified, taxonomy node is returned instead
 * @param session
 * @param parent
 * @return
 * @throws CMSDaoException 
 * @throws Exception 
 */
public Node retrieveParentTopicNode(Session session,Topic topic) throws RepositoryException {
  Node parentTopicNode=null;
  if (topic.getParent() != null && topic.getParent().getId() != null) {
    parentTopicNode=cmsRepositoryEntityUtils.retrieveUniqueNodeForTopic(session,topic.getParent().getId());
    if (parentTopicNode == null) {
      throw new CmsException("String_Node_Str" + topic.getParent().getId());
    }
  }
  if (parentTopicNode != null) {
    return parentTopicNode;
  }
 else {
    return retrieveTaxonomyJcrNodeForTopic(session,topic);
  }
}

Fixed version (ground truth):
/** 
 * retrieve topic's parent. If no id is specified, taxonomy node is returned instead
 * @param session
 * @param parent
 * @return
 * @throws CMSDaoException 
 * @throws Exception 
 */
public Node retrieveParentTopicNode(Session session,Topic topic,Context context) throws RepositoryException {
  Node parentTopicNode=null;
  Topic parentTopic=topic.getParent();
  if (parentTopic != null) {
    if (parentTopic.getId() != null) {
      parentTopicNode=context.retrieveNodeForTopic(parentTopic.getId());
    }
    if (parentTopicNode == null && parentTopic.getName() != null) {
      parentTopicNode=context.retrieveNodeForTopic(parentTopic.getName());
    }
    if (parentTopicNode == null) {
      throw new CmsException("String_Node_Str" + parentTopic.toString());
    }
  }
  if (parentTopicNode != null) {
    return parentTopicNode;
  }
 else {
    return retrieveTaxonomyJcrNodeForTopic(session,topic);
  }
}
Program: 44654
Project: 44654
Buggy source:
@Override public boolean tokenHasExpired(String authenticationToken){
  return authenticationToken == null || (authenticationTokenEntries != null && !authenticationTokenEntries.contains(authenticationToken));
}

Fixed version (ground truth):
@Override public boolean tokenHasExpired(String authenticationToken){
  return authenticationToken == null || (authenticationTokenEntries != null && !authenticationTokenEntries.containsKey(authenticationToken));
}
Program: 44655
Project: 44655
Buggy source:
public void setSystemUserAsTopicOwner(Topic topic,RepositoryUser systemUser){
  if (topic != null) {
    if (topic.getOwner() == null || topic.getOwner() != systemUser || !StringUtils.equals(topic.getOwner().getId(),systemUser.getId())) {
      if (!StringUtils.equals(systemUser.getExternalId(),CmsApiConstants.SYSTEM_REPOSITORY_USER_EXTRENAL_ID)) {
        throw new CmsException("String_Node_Str" + systemUser.getExternalId());
      }
      topic.setOwner(systemUser);
      if (topic.getOwner() != null) {
        logger.info("String_Node_Str",topic.getOwner().getExternalId() + "String_Node_Str" + topic.getOwner().getLabel(),topic.getName());
      }
    }
    if (topic.isChildrenLoaded()) {
      List<Topic> childTopics=topic.getChildren();
      if (CollectionUtils.isNotEmpty(childTopics)) {
        for (        Topic child : childTopics) {
          RepositoryUser childOwner=child.getOwner();
          if (childOwner == null) {
            setSystemUserAsTopicOwner(child,systemUser);
          }
 else {
            if (childOwner != systemUser || !StringUtils.equals(childOwner.getId(),systemUser.getId())) {
              setSystemUserAsTopicOwner(child,systemUser);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void setSystemUserAsTopicOwner(Topic topic,RepositoryUser systemUser){
  if (topic != null) {
    if (!usersAreTheSame(topic.getOwner(),systemUser)) {
      if (!StringUtils.equals(systemUser.getExternalId(),CmsApiConstants.SYSTEM_REPOSITORY_USER_EXTRENAL_ID)) {
        throw new CmsException("String_Node_Str" + systemUser.getExternalId());
      }
      topic.setOwner(systemUser);
    }
    if (topic.isChildrenLoaded()) {
      List<Topic> childTopics=topic.getChildren();
      if (CollectionUtils.isNotEmpty(childTopics)) {
        for (        Topic child : childTopics) {
          RepositoryUser childOwner=child.getOwner();
          if (childOwner == null) {
            setSystemUserAsTopicOwner(child,systemUser);
          }
 else {
            if (childOwner != systemUser || !StringUtils.equals(childOwner.getId(),systemUser.getId())) {
              setSystemUserAsTopicOwner(child,systemUser);
            }
          }
        }
      }
    }
  }
}