nus-yam/ex-repair huggingface dataset:
Program: 8846
Project: 8846
Buggy source:
/** 
 * Performs a checkout on a versionable tree.
 * @param workspaceRoot a fresh workspace root without pending changes.
 * @param versionablePath the absolute path to the versionable node to check out.
 * @throws UnsupportedRepositoryOperationException if the versionable tree isn't actually versionable.
 * @throws RepositoryException if an error occurs while checking thenode type of the tree.
 * @throws IllegalStateException if the workspaceRoot has pending changes.
 * @throws IllegalArgumentException if the <code>versionablePath</code> isnot absolute.
 */
public void checkout(@Nonnull Root workspaceRoot,@Nonnull String versionablePath) throws UnsupportedRepositoryOperationException, InvalidItemStateException, RepositoryException {
  checkState(!workspaceRoot.hasPendingChanges());
  checkArgument(PathUtils.isAbsolute(versionablePath));
  Tree versionable=workspaceRoot.getTree(versionablePath);
  if (!isVersionable(versionable)) {
    throw new UnsupportedRepositoryOperationException(versionable.getPath() + "String_Node_Str");
  }
  if (!isCheckedOut(versionable)) {
    versionable.setProperty(JCR_ISCHECKEDOUT,Boolean.TRUE,Type.BOOLEAN);
    try {
      workspaceRoot.commit();
      refresh();
    }
 catch (    CommitFailedException e) {
      workspaceRoot.refresh();
      throw e.asRepositoryException();
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs a checkout on a versionable tree.
 * @param workspaceRoot a fresh workspace root without pending changes.
 * @param versionablePath the absolute path to the versionable node to check out.
 * @throws UnsupportedRepositoryOperationException if the versionable tree isn't actually versionable.
 * @throws RepositoryException if an error occurs while checking thenode type of the tree.
 * @throws IllegalStateException if the workspaceRoot has pending changes.
 * @throws IllegalArgumentException if the {@code versionablePath} isnot absolute.
 */
public void checkout(@Nonnull Root workspaceRoot,@Nonnull String versionablePath) throws UnsupportedRepositoryOperationException, InvalidItemStateException, RepositoryException {
  checkState(!workspaceRoot.hasPendingChanges());
  checkArgument(PathUtils.isAbsolute(versionablePath));
  Tree versionable=workspaceRoot.getTree(versionablePath);
  if (!isVersionable(versionable)) {
    throw new UnsupportedRepositoryOperationException(versionable.getPath() + "String_Node_Str");
  }
  if (!isCheckedOut(versionable)) {
    versionable.setProperty(JCR_ISCHECKEDOUT,Boolean.TRUE,Type.BOOLEAN);
    try {
      workspaceRoot.commit();
      refresh();
    }
 catch (    CommitFailedException e) {
      workspaceRoot.refresh();
      throw e.asRepositoryException();
    }
  }
}
Program: 8847
Project: 8847
Buggy source:
/** 
 * Checks if the provided directory is a valid FileStore
 * @return true if the provided directory is a valid FileStore
 */
private static boolean isValidFileStore(String path){
  File store=new File(path);
  if (store == null || !store.isDirectory()) {
    return false;
  }
  for (  String f : store.list()) {
    if ("String_Node_Str".equals(f)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the provided directory is a valid FileStore
 * @return true if the provided directory is a valid FileStore
 */
private static boolean isValidFileStore(String path){
  File store=new File(path);
  if (!store.isDirectory()) {
    return false;
  }
  for (  String f : store.list()) {
    if ("String_Node_Str".equals(f)) {
      return true;
    }
  }
  return false;
}
Program: 8849
Project: 8849
Buggy source:
/** 
 * Creates a new property mapping map from a list of patterns.
 * @param patterns the patterns
 * @return the mapping map
 */
private static Map<String,String> createMapping(String[] patterns){
  Map<String,String> mapping=new HashMap<String,String>();
  for (  String pattern : patterns) {
    int idx=pattern.indexOf('=');
    if (idx > 0) {
      String relPath=pattern.substring(0,idx).trim();
      String value=pattern.substring(idx + 1).trim();
      mapping.put(relPath,value);
    }
  }
  return mapping;
}

Fixed version (ground truth):
/** 
 * Creates a new property mapping map from a list of patterns.
 * @param patterns the patterns
 * @return the mapping map
 */
private static Map<String,String> createMapping(@Nonnull String[] patterns){
  Map<String,String> mapping=new HashMap<String,String>();
  for (  String pattern : patterns) {
    int idx=pattern.indexOf('=');
    if (idx > 0) {
      String relPath=pattern.substring(0,idx).trim();
      String value=pattern.substring(idx + 1).trim();
      mapping.put(relPath,value);
    }
  }
  return mapping;
}
Program: 8851
Project: 8851
Buggy source:
@Override public Session run() throws LoginException, RepositoryException {
  if (repository instanceof JackrabbitRepository) {
    return ((JackrabbitRepository)repository).login(null,null,null);
  }
 else {
    return repository.login(null,null);
  }
}

Fixed version (ground truth):
@Override public Session run() throws RepositoryException {
  if (repository instanceof JackrabbitRepository) {
    return ((JackrabbitRepository)repository).login(null,null,null);
  }
 else {
    return repository.login(null,null);
  }
}
Program: 8852
Project: 8852
Buggy source:
private Delegatee(SyncHandler handler,ExternalIdentityProvider idp) throws SyncException {
  this.handler=handler;
  this.idp=idp;
  try {
    systemSession=Subject.doAs(SystemSubject.INSTANCE,new PrivilegedExceptionAction<Session>(){
      @Override public Session run() throws LoginException, RepositoryException {
        if (repository instanceof JackrabbitRepository) {
          return ((JackrabbitRepository)repository).login(null,null,null);
        }
 else {
          return repository.login(null,null);
        }
      }
    }
);
  }
 catch (  PrivilegedActionException e) {
    throw new SyncException(e);
  }
  try {
    context=handler.createContext(idp,userMgr=((JackrabbitSession)systemSession).getUserManager(),systemSession.getValueFactory());
  }
 catch (  Exception e) {
    systemSession.logout();
    throw new SyncException(e);
  }
  log.info("String_Node_Str",systemSession,systemSession.getUserID());
}

Fixed version (ground truth):
private Delegatee(@Nonnull SyncHandler handler,@Nonnull ExternalIdentityProvider idp) throws SyncException {
  this.handler=handler;
  this.idp=idp;
  try {
    systemSession=Subject.doAs(SystemSubject.INSTANCE,new PrivilegedExceptionAction<Session>(){
      @Override public Session run() throws RepositoryException {
        if (repository instanceof JackrabbitRepository) {
          return ((JackrabbitRepository)repository).login(null,null,null);
        }
 else {
          return repository.login(null,null);
        }
      }
    }
);
  }
 catch (  PrivilegedActionException e) {
    throw new SyncException(e);
  }
  try {
    context=handler.createContext(idp,userMgr=((JackrabbitSession)systemSession).getUserManager(),systemSession.getValueFactory());
  }
 catch (  Exception e) {
    systemSession.logout();
    throw new SyncException(e);
  }
  log.info("String_Node_Str",systemSession,systemSession.getUserID());
}
Program: 8853
Project: 8853
Buggy source:
private boolean isMyIDP(SyncedIdentity id){
  String idpName=id.getExternalIdRef() == null ? null : id.getExternalIdRef().getProviderName();
  return (idpName == null || idpName.length() == 0 || idpName.equals(idp.getName()));
}

Fixed version (ground truth):
private boolean isMyIDP(@Nonnull SyncedIdentity id){
  String idpName=id.getExternalIdRef() == null ? null : id.getExternalIdRef().getProviderName();
  return (idpName == null || idpName.isEmpty() || idpName.equals(idp.getName()));
}
Program: 8854
Project: 8854
Buggy source:
private static boolean importPwdNodeProperty(@Nonnull Tree parent,@Nonnull PropInfo propInfo,@Nonnull PropertyDefinition def) throws RepositoryException {
  String propName=propInfo.getName();
  int targetType=def.getRequiredType();
  if (targetType == PropertyType.UNDEFINED) {
    targetType=(REP_PASSWORD_LAST_MODIFIED.equals(propName)) ? PropertyType.LONG : PropertyType.STRING;
  }
  PropertyState property;
  if (def.isMultiple()) {
    property=PropertyStates.createProperty(propName,propInfo.getValues(targetType));
  }
 else {
    property=PropertyStates.createProperty(propName,propInfo.getValue(targetType));
  }
  parent.setProperty(property);
  return true;
}

Fixed version (ground truth):
private static boolean importPwdNodeProperty(@Nonnull Tree parent,@Nonnull PropInfo propInfo,@Nonnull PropertyDefinition def) throws RepositoryException {
  String propName=propInfo.getName();
  if (propName == null) {
    propName=def.getName();
    if (propName == null || NodeTypeConstants.RESIDUAL_NAME.equals(propName)) {
      return false;
    }
  }
  int targetType=def.getRequiredType();
  if (targetType == PropertyType.UNDEFINED) {
    targetType=(REP_PASSWORD_LAST_MODIFIED.equals(propName)) ? PropertyType.LONG : PropertyType.STRING;
  }
  PropertyState property;
  if (def.isMultiple()) {
    property=PropertyStates.createProperty(propName,propInfo.getValues(targetType));
  }
 else {
    property=PropertyStates.createProperty(propName,propInfo.getValue(targetType));
  }
  parent.setProperty(property);
  return true;
}
Program: 8855
Project: 8855
Buggy source:
@Override public Node storeAsNode(String absPath) throws RepositoryException {
  manager.ensureIsAlive();
  String oakPath=sessionContext.getOakPathOrThrow(absPath);
  String parent=PathUtils.getParentPath(oakPath);
  NodeDelegate parentDelegate=sessionContext.getSessionDelegate().getNode(parent);
  if (parentDelegate == null) {
    throw new PathNotFoundException("String_Node_Str" + parent);
  }
  Node parentNode=NodeImpl.createNodeOrNull(parentDelegate,sessionContext);
  if (!parentNode.isCheckedOut()) {
    throw new VersionException("String_Node_Str" + absPath + "String_Node_Str");
  }
  String nodeName=PathUtils.getName(oakPath);
  ValueFactory vf=sessionContext.getValueFactory();
  Node n=parentNode.addNode(nodeName,JcrConstants.NT_QUERY);
  n.setProperty(JcrConstants.JCR_STATEMENT,vf.createValue(statement));
  n.setProperty(JcrConstants.JCR_LANGUAGE,vf.createValue(language));
  setStoredQueryPath(oakPath);
  return n;
}

Fixed version (ground truth):
@Override public Node storeAsNode(String absPath) throws RepositoryException {
  manager.ensureIsAlive();
  String oakPath=sessionContext.getOakPathOrThrow(absPath);
  String parent=PathUtils.getParentPath(oakPath);
  NodeDelegate parentDelegate=sessionContext.getSessionDelegate().getNode(parent);
  if (parentDelegate == null) {
    throw new PathNotFoundException("String_Node_Str" + parent);
  }
  Node parentNode=NodeImpl.createNode(parentDelegate,sessionContext);
  if (!parentNode.isCheckedOut()) {
    throw new VersionException("String_Node_Str" + absPath + "String_Node_Str");
  }
  String nodeName=PathUtils.getName(oakPath);
  ValueFactory vf=sessionContext.getValueFactory();
  Node n=parentNode.addNode(nodeName,JcrConstants.NT_QUERY);
  n.setProperty(JcrConstants.JCR_STATEMENT,vf.createValue(statement));
  n.setProperty(JcrConstants.JCR_LANGUAGE,vf.createValue(language));
  setStoredQueryPath(oakPath);
  return n;
}
Program: 8856
Project: 8856
Buggy source:
@CheckForNull private ItemImpl<?> getItemInternal(@Nonnull String oakPath) throws RepositoryException {
  ItemDelegate item=sd.getItem(oakPath);
  if (item instanceof NodeDelegate) {
    return NodeImpl.createNodeOrNull((NodeDelegate)item,sessionContext);
  }
 else   if (item instanceof PropertyDelegate) {
    return new PropertyImpl((PropertyDelegate)item,sessionContext);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@CheckForNull private ItemImpl<?> getItemInternal(@Nonnull String oakPath) throws RepositoryException {
  ItemDelegate item=sd.getItem(oakPath);
  if (item instanceof NodeDelegate) {
    return NodeImpl.createNode((NodeDelegate)item,sessionContext);
  }
 else   if (item instanceof PropertyDelegate) {
    return new PropertyImpl((PropertyDelegate)item,sessionContext);
  }
 else {
    return null;
  }
}
Program: 8858
Project: 8858
Buggy source:
/** 
 * Parses a value string into a duration. the String has the following format: <xmp> format:= (value [ unit ])+; value:= float value; unit: "ms" | "s" | "m" | "h" | "d"; </xmp> Example: <xmp> "100", "100ms" : 100 milliseconds "1s 50ms": 1050 milliseconds "1.5d":  1 1/2 days == 36 hours. </xmp>
 * @param str the string to parse
 * @return the new Milliseconds object or null.
 */
@CheckForNull public static Milliseconds of(@Nullable String str){
  if (str == null) {
    return null;
  }
  Matcher m=pattern.matcher(str);
  long current=-1;
  while (m.find()) {
    String number=m.group(1);
    String decimal=m.group(2);
    if (decimal != null) {
      number+=decimal;
    }
    String unit=m.group(3);
    double value=Double.valueOf(number);
    if ("String_Node_Str".equals(unit)) {
      value*=1000.0;
    }
 else     if ("String_Node_Str".equals(unit)) {
      value*=60 * 1000.0;
    }
 else     if ("String_Node_Str".equals(unit)) {
      value*=60 * 60 * 1000.0;
    }
 else     if ("String_Node_Str".equals(unit)) {
      value*=24 * 60 * 60* 1000.0;
    }
    current+=value;
  }
  return current < 0 ? null : new Milliseconds(current + 1);
}

Fixed version (ground truth):
@Nonnull public static Milliseconds of(@Nullable String str,@Nonnull Milliseconds defaultValue){
  if (str == null) {
    return defaultValue;
  }
  Matcher m=pattern.matcher(str);
  long current=-1;
  while (m.find()) {
    String number=m.group(1);
    String decimal=m.group(2);
    if (decimal != null) {
      number+=decimal;
    }
    String unit=m.group(3);
    double value=Double.valueOf(number);
    if ("String_Node_Str".equals(unit)) {
      value*=1000.0;
    }
 else     if ("String_Node_Str".equals(unit)) {
      value*=60 * 1000.0;
    }
 else     if ("String_Node_Str".equals(unit)) {
      value*=60 * 60 * 1000.0;
    }
 else     if ("String_Node_Str".equals(unit)) {
      value*=24 * 60 * 60* 1000.0;
    }
    current+=value;
  }
  return current < 0 ? defaultValue : new Milliseconds(current + 1);
}
Program: 8860
Project: 8860
Buggy source:
@Override @Nonnull public <T extends Document>List<T> query(Collection<T> collection,String fromKey,String toKey,String indexedProperty,long startValue,int limit){
  Lock lock=rwLock.readLock();
  lock.lock();
  try {
    ConcurrentSkipListMap<String,T> map=getMap(collection);
    ConcurrentNavigableMap<String,T> sub=map.subMap(fromKey + "String_Node_Str",toKey);
    ArrayList<T> list=new ArrayList<T>();
    for (    T doc : sub.values()) {
      if (indexedProperty != null) {
        Object value=doc.get(indexedProperty);
        if (value instanceof Boolean) {
          long test=(value != null && ((Boolean)value).booleanValue()) ? 1 : 0;
          if (test < startValue) {
            continue;
          }
        }
 else         if (value instanceof Long) {
          if (value == null || ((Long)value < startValue)) {
            continue;
          }
        }
 else         if (value != null) {
          throw new DocumentStoreException("String_Node_Str" + indexedProperty + "String_Node_Str"+ value.getClass());
        }
      }
      list.add(doc);
      if (list.size() >= limit) {
        break;
      }
    }
    return list;
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override @Nonnull public <T extends Document>List<T> query(Collection<T> collection,String fromKey,String toKey,String indexedProperty,long startValue,int limit){
  Lock lock=rwLock.readLock();
  lock.lock();
  try {
    ConcurrentSkipListMap<String,T> map=getMap(collection);
    ConcurrentNavigableMap<String,T> sub=map.subMap(fromKey + "String_Node_Str",toKey);
    ArrayList<T> list=new ArrayList<T>();
    for (    T doc : sub.values()) {
      if (indexedProperty != null) {
        Object value=doc.get(indexedProperty);
        if (value instanceof Boolean) {
          long test=((Boolean)value) ? 1 : 0;
          if (test < startValue) {
            continue;
          }
        }
 else         if (value instanceof Long) {
          if ((Long)value < startValue) {
            continue;
          }
        }
 else         if (value != null) {
          throw new DocumentStoreException("String_Node_Str" + indexedProperty + "String_Node_Str"+ value.getClass());
        }
      }
      list.add(doc);
      if (list.size() >= limit) {
        break;
      }
    }
    return list;
  }
  finally {
    lock.unlock();
  }
}
Program: 8861
Project: 8861
Buggy source:
@Override public boolean apply(@Nonnull PropertyState property){
  return getTreePermission().canRead(property) || isNew(property.getName());
}

Fixed version (ground truth):
@Override public boolean apply(@Nullable PropertyState property){
  if (property != null) {
    return getTreePermission().canRead(property) || isNew(property.getName());
  }
 else {
    return false;
  }
}
Program: 8862
Project: 8862
Buggy source:
@Override public void execute(Runnable command){
  for (  Executor executor : getServices()) {
    executor.execute(command);
    return;
  }
  command.run();
}

Fixed version (ground truth):
@Override public void execute(@Nonnull Runnable command){
  for (  Executor executor : getServices()) {
    executor.execute(command);
    return;
  }
  command.run();
}
Program: 8863
Project: 8863
Buggy source:
/** 
 * Synchronizes an authorizable with the corresponding external identity with the repository based on the respective configuration.
 * @param id the id of the authorizable
 * @return the result of the operation
 * @throws SyncException if an error occurrs
 */
SyncResult sync(@Nonnull String id) throws SyncException ;

Fixed version (ground truth):
/** 
 * Synchronizes an authorizable with the corresponding external identity with the repository based on the respective configuration.
 * @param id the id of the authorizable
 * @return the result of the operation
 * @throws SyncException if an error occurrs
 */
@Nonnull SyncResult sync(@Nonnull String id) throws SyncException ;
Program: 8864
Project: 8864
Buggy source:
/** 
 * Sets the auto membership
 * @param autoMembership the membership
 * @return {@code this}
 * @see #getAutoMembership()
 */
@Nonnull public Authorizable setAutoMembership(String... autoMembership){
  this.autoMembership=new HashSet<String>();
  for (  String groupName : autoMembership) {
    if (groupName.trim().length() > 0) {
      this.autoMembership.add(groupName.trim());
    }
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the auto membership
 * @param autoMembership the membership
 * @return {@code this}
 * @see #getAutoMembership()
 */
@Nonnull public Authorizable setAutoMembership(String... autoMembership){
  this.autoMembership=new HashSet<String>();
  for (  String groupName : autoMembership) {
    if (!groupName.trim().isEmpty()) {
      this.autoMembership.add(groupName.trim());
    }
  }
  return this;
}
Program: 8865
Project: 8865
Buggy source:
/** 
 * Returns the sync configuration for users.
 * @return the user sync configuration.
 */
public User user(){
  return user;
}

Fixed version (ground truth):
/** 
 * Returns the sync configuration for users.
 * @return the user sync configuration.
 */
@Nonnull public User user(){
  return user;
}
Program: 8866
Project: 8866
Buggy source:
/** 
 * Returns the sync configuration for groups.
 * @return the group sync configuration.
 */
public Group group(){
  return group;
}

Fixed version (ground truth):
/** 
 * Returns the sync configuration for groups.
 * @return the group sync configuration.
 */
@Nonnull public Group group(){
  return group;
}
Program: 8867
Project: 8867
Buggy source:
private SyncResultImpl syncGroup(ExternalGroup external,Group group) throws RepositoryException {
  if (!forceGroupSync && !isExpired(group,config.group().getExpirationTime(),"String_Node_Str")) {
    SyncedIdentityImpl syncId=createSyncedIdentity(group);
    return new SyncResultImpl(syncId,SyncResult.Status.NOP);
  }
  syncProperties(external,group,config.group().getPropertyMapping());
  applyMembership(group,config.group().getAutoMembership());
  group.setProperty(REP_LAST_SYNCED,nowValue);
  SyncedIdentityImpl syncId=createSyncedIdentity(group);
  return new SyncResultImpl(syncId,SyncResult.Status.UPDATE);
}

Fixed version (ground truth):
@Nonnull private SyncResultImpl syncGroup(@Nonnull ExternalGroup external,@Nonnull Group group) throws RepositoryException {
  if (!forceGroupSync && !isExpired(group,config.group().getExpirationTime(),"String_Node_Str")) {
    SyncedIdentityImpl syncId=createSyncedIdentity(group);
    return new SyncResultImpl(syncId,SyncResult.Status.NOP);
  }
  syncProperties(external,group,config.group().getPropertyMapping());
  applyMembership(group,config.group().getAutoMembership());
  group.setProperty(REP_LAST_SYNCED,nowValue);
  SyncedIdentityImpl syncId=createSyncedIdentity(group);
  return new SyncResultImpl(syncId,SyncResult.Status.UPDATE);
}
Program: 8868
Project: 8868
Buggy source:
private SyncResultImpl syncUser(@Nonnull ExternalUser external,@Nonnull User user) throws RepositoryException {
  if (!forceUserSync && !isExpired(user,config.user().getExpirationTime(),"String_Node_Str")) {
    SyncedIdentityImpl syncId=createSyncedIdentity(user);
    return new SyncResultImpl(syncId,SyncResult.Status.NOP);
  }
  syncProperties(external,user,config.user().getPropertyMapping());
  applyMembership(user,config.user().getAutoMembership());
  if (isExpired(user,config.user().getMembershipExpirationTime(),"String_Node_Str")) {
    syncMembership(external,user,config.user().getMembershipNestingDepth());
  }
  user.setProperty(REP_LAST_SYNCED,nowValue);
  SyncedIdentityImpl syncId=createSyncedIdentity(user);
  return new SyncResultImpl(syncId,SyncResult.Status.UPDATE);
}

Fixed version (ground truth):
@Nonnull private SyncResultImpl syncUser(@Nonnull ExternalUser external,@Nonnull User user) throws RepositoryException {
  if (!forceUserSync && !isExpired(user,config.user().getExpirationTime(),"String_Node_Str")) {
    SyncedIdentityImpl syncId=createSyncedIdentity(user);
    return new SyncResultImpl(syncId,SyncResult.Status.NOP);
  }
  syncProperties(external,user,config.user().getPropertyMapping());
  applyMembership(user,config.user().getAutoMembership());
  if (isExpired(user,config.user().getMembershipExpirationTime(),"String_Node_Str")) {
    syncMembership(external,user,config.user().getMembershipNestingDepth());
  }
  user.setProperty(REP_LAST_SYNCED,nowValue);
  SyncedIdentityImpl syncId=createSyncedIdentity(user);
  return new SyncResultImpl(syncId,SyncResult.Status.UPDATE);
}
Program: 8869
Project: 8869
Buggy source:
/** 
 * Creates a new repository group for the given external one. Note that this method only creates the authorizable but does not perform any synchronization.
 * @param externalGroup the external group
 * @return the repository group
 * @throws RepositoryException if an error occurs
 */
@CheckForNull private Group createGroup(ExternalGroup externalGroup) throws RepositoryException {
  Principal principal=new PrincipalImpl(externalGroup.getPrincipalName());
  Group group=userManager.createGroup(externalGroup.getId(),principal,joinPaths(config.group().getPathPrefix(),externalGroup.getIntermediatePath()));
  group.setProperty(REP_EXTERNAL_ID,valueFactory.createValue(externalGroup.getExternalId().getString()));
  return group;
}

Fixed version (ground truth):
/** 
 * Creates a new repository group for the given external one. Note that this method only creates the authorizable but does not perform any synchronization.
 * @param externalGroup the external group
 * @return the repository group
 * @throws RepositoryException if an error occurs
 */
@Nonnull private Group createGroup(@Nonnull ExternalGroup externalGroup) throws RepositoryException {
  Principal principal=new PrincipalImpl(externalGroup.getPrincipalName());
  Group group=userManager.createGroup(externalGroup.getId(),principal,joinPaths(config.group().getPathPrefix(),externalGroup.getIntermediatePath()));
  group.setProperty(REP_EXTERNAL_ID,valueFactory.createValue(externalGroup.getExternalId().getString()));
  return group;
}
Program: 8870
Project: 8870
Buggy source:
/** 
 * Creates a synced identity from the given authorizable.
 * @param auth the authorizable
 * @return the id
 * @throws RepositoryException if an error occurrs
 */
@CheckForNull private static SyncedIdentityImpl createSyncedIdentity(@Nullable Authorizable auth) throws RepositoryException {
  ExternalIdentityRef ref=auth == null ? null : getIdentityRef(auth);
  if (ref == null) {
    return null;
  }
 else {
    Value[] lmValues=auth.getProperty(REP_LAST_SYNCED);
    long lastModified=-1;
    if (lmValues != null && lmValues.length > 0) {
      lastModified=lmValues[0].getLong();
    }
    return new SyncedIdentityImpl(auth.getID(),ref,auth.isGroup(),lastModified);
  }
}

Fixed version (ground truth):
/** 
 * Creates a synced identity from the given authorizable.
 * @param auth the authorizable
 * @return the id
 * @throws RepositoryException if an error occurs
 */
@CheckForNull private static SyncedIdentityImpl createSyncedIdentity(@Nullable Authorizable auth) throws RepositoryException {
  ExternalIdentityRef ref=(auth == null) ? null : getIdentityRef(auth);
  if (ref == null) {
    return null;
  }
 else {
    Value[] lmValues=auth.getProperty(REP_LAST_SYNCED);
    long lastModified=-1;
    if (lmValues != null && lmValues.length > 0) {
      lastModified=lmValues[0].getLong();
    }
    return new SyncedIdentityImpl(auth.getID(),ref,auth.isGroup(),lastModified);
  }
}
Program: 8872
Project: 8872
Buggy source:
/** 
 * Creates a new repository user for the given external one. Note that this method only creates the authorizable but does not perform any synchronization.
 * @param externalUser the external user
 * @return the repository user
 * @throws RepositoryException if an error occurs
 */
@CheckForNull private User createUser(ExternalUser externalUser) throws RepositoryException {
  Principal principal=new PrincipalImpl(externalUser.getPrincipalName());
  User user=userManager.createUser(externalUser.getId(),null,principal,joinPaths(config.user().getPathPrefix(),externalUser.getIntermediatePath()));
  user.setProperty(REP_EXTERNAL_ID,valueFactory.createValue(externalUser.getExternalId().getString()));
  return user;
}

Fixed version (ground truth):
/** 
 * Creates a new repository user for the given external one. Note that this method only creates the authorizable but does not perform any synchronization.
 * @param externalUser the external user
 * @return the repository user
 * @throws RepositoryException if an error occurs
 */
@Nonnull private User createUser(@Nonnull ExternalUser externalUser) throws RepositoryException {
  Principal principal=new PrincipalImpl(externalUser.getPrincipalName());
  User user=userManager.createUser(externalUser.getId(),null,principal,joinPaths(config.user().getPathPrefix(),externalUser.getIntermediatePath()));
  user.setProperty(REP_EXTERNAL_ID,valueFactory.createValue(externalUser.getExternalId().getString()));
  return user;
}
Program: 8873
Project: 8873
Buggy source:
@Activate private void activate(ComponentContext ctx){
  start(new OsgiWhiteboard(ctx.getBundleContext()));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Activate private void activate(ComponentContext ctx){
  start(new OsgiWhiteboard(ctx.getBundleContext()));
}
Program: 8874
Project: 8874
Buggy source:
@Deactivate private void deactivate(){
  stop();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Deactivate private void deactivate(){
  stop();
}
Program: 8875
Project: 8875
Buggy source:
@Override public void initialize(Subject subject,CallbackHandler callbackHandler,Map<String,?> ss,Map<String,?> opts){
  super.initialize(subject,callbackHandler,ss,opts);
  if (osgiConfig != null) {
    options=ConfigurationParameters.of(osgiConfig,options);
  }
  Whiteboard whiteboard=getWhiteboard();
  if (whiteboard == null) {
    log.error("String_Node_Str");
    return;
  }
  String idpName=options.getConfigValue(PARAM_IDP_NAME,"String_Node_Str");
  if (idpName.length() == 0) {
    log.error("String_Node_Str");
  }
 else {
    ExternalIdentityProviderManager idpMgr=WhiteboardUtils.getService(whiteboard,ExternalIdentityProviderManager.class);
    if (idpMgr == null) {
      log.error("String_Node_Str");
    }
 else {
      idp=idpMgr.getProvider(idpName);
      if (idp == null) {
        log.error("String_Node_Str",idpName);
      }
    }
  }
  String syncHandlerName=options.getConfigValue(PARAM_SYNC_HANDLER_NAME,"String_Node_Str");
  if (syncHandlerName.length() == 0) {
    log.error("String_Node_Str");
  }
 else {
    SyncManager syncMgr=WhiteboardUtils.getService(whiteboard,SyncManager.class);
    if (syncMgr == null) {
      log.error("String_Node_Str");
    }
 else {
      syncHandler=syncMgr.getSyncHandler(syncHandlerName);
      if (syncHandler == null) {
        log.error("String_Node_Str",syncHandlerName);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void initialize(Subject subject,CallbackHandler callbackHandler,Map<String,?> ss,Map<String,?> opts){
  super.initialize(subject,callbackHandler,ss,opts);
  if (osgiConfig != null) {
    options=ConfigurationParameters.of(osgiConfig,options);
  }
  Whiteboard whiteboard=getWhiteboard();
  if (whiteboard == null) {
    log.error("String_Node_Str");
    return;
  }
  String idpName=options.getConfigValue(PARAM_IDP_NAME,"String_Node_Str");
  if (idpName.isEmpty()) {
    log.error("String_Node_Str");
  }
 else {
    ExternalIdentityProviderManager idpMgr=WhiteboardUtils.getService(whiteboard,ExternalIdentityProviderManager.class);
    if (idpMgr == null) {
      log.error("String_Node_Str");
    }
 else {
      idp=idpMgr.getProvider(idpName);
      if (idp == null) {
        log.error("String_Node_Str",idpName);
      }
    }
  }
  String syncHandlerName=options.getConfigValue(PARAM_SYNC_HANDLER_NAME,"String_Node_Str");
  if (syncHandlerName.isEmpty()) {
    log.error("String_Node_Str");
  }
 else {
    SyncManager syncMgr=WhiteboardUtils.getService(whiteboard,SyncManager.class);
    if (syncMgr == null) {
      log.error("String_Node_Str");
    }
 else {
      syncHandler=syncMgr.getSyncHandler(syncHandlerName);
      if (syncHandler == null) {
        log.error("String_Node_Str",syncHandlerName);
      }
    }
  }
}
Program: 8876
Project: 8876
Buggy source:
@Activate private void activate(ComponentContext ctx){
  start(new OsgiWhiteboard(ctx.getBundleContext()));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Activate private void activate(ComponentContext ctx){
  start(new OsgiWhiteboard(ctx.getBundleContext()));
}
Program: 8877
Project: 8877
Buggy source:
@Deactivate private void deactivate(){
  stop();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Deactivate private void deactivate(){
  stop();
}
Program: 8878
Project: 8878
Buggy source:
@Override public ExternalIdentityRef getExternalIdRef(){
  return ref;
}

Fixed version (ground truth):
@CheckForNull @Override public ExternalIdentityRef getExternalIdRef(){
  return ref;
}
Program: 8879
Project: 8879
Buggy source:
public SyncedIdentityImpl(String id,ExternalIdentityRef ref,boolean isGroup,long lastSynced){
  this.id=id;
  this.ref=ref;
  this.isGroup=isGroup;
  this.lastSynced=lastSynced;
}

Fixed version (ground truth):
public SyncedIdentityImpl(@Nonnull String id,@Nullable ExternalIdentityRef ref,boolean isGroup,long lastSynced){
  this.id=id;
  this.ref=ref;
  this.isGroup=isGroup;
  this.lastSynced=lastSynced;
}
Program: 8880
Project: 8880
Buggy source:
@Nonnull @Override public Collection<String> getIgnoredProperties(){
  Collection<String> ignoredProperties;
  Iterable<String> ignoredPropertiesValues=getStringValuesFor(Properties.IGNORED_PROPERTIES);
  if (ignoredPropertiesValues != null) {
    ignoredProperties=new LinkedList<String>();
    for (    String ignoredProperty : ignoredPropertiesValues) {
      ignoredProperties.add(ignoredProperty);
    }
  }
 else {
    ignoredProperties=Arrays.asList(SolrServerConfigurationDefaults.IGNORED_PROPERTIES);
  }
  return ignoredProperties;
}

Fixed version (ground truth):
@Nonnull @Override public Collection<String> getIgnoredProperties(){
  Collection<String> ignoredProperties;
  Iterable<String> ignoredPropertiesValues=getStringValuesFor(Properties.IGNORED_PROPERTIES);
  if (ignoredPropertiesValues != null) {
    ignoredProperties=new LinkedList<String>();
    for (    String ignoredProperty : ignoredPropertiesValues) {
      ignoredProperties.add(ignoredProperty);
    }
  }
 else {
    ignoredProperties=SolrServerConfigurationDefaults.IGNORED_PROPERTIES;
  }
  return ignoredProperties;
}
Program: 8881
Project: 8881
Buggy source:
@Override public IndexRow next(){
  final IndexRow pathRow=pathCursor.next();
  return new IndexRow(){
    @Override public String getPath(){
      return pathRow.getPath();
    }
    @Override public PropertyValue getValue(    String columnName){
      if (QueryImpl.JCR_SCORE.equals(columnName)) {
        return PropertyValues.newDouble(currentRow.score);
      }
      Collection<Object> fieldValues=currentRow.doc.getFieldValues(columnName);
      return currentRow.doc != null ? PropertyValues.newString(Iterables.toString(fieldValues != null ? fieldValues : Collections.emptyList())) : null;
    }
  }
;
}

Fixed version (ground truth):
@Override public IndexRow next(){
  final IndexRow pathRow=pathCursor.next();
  return new IndexRow(){
    @Override public String getPath(){
      return pathRow.getPath();
    }
    @Override public PropertyValue getValue(    String columnName){
      if (QueryImpl.JCR_SCORE.equals(columnName)) {
        return PropertyValues.newDouble(currentRow.score);
      }
      Collection<Object> fieldValues=currentRow.doc.getFieldValues(columnName);
      return PropertyValues.newString(Iterables.toString(fieldValues != null ? fieldValues : Collections.emptyList()));
    }
  }
;
}
Program: 8882
Project: 8882
Buggy source:
@Override public PropertyValue getValue(String columnName){
  if (QueryImpl.JCR_SCORE.equals(columnName)) {
    return PropertyValues.newDouble(currentRow.score);
  }
  Collection<Object> fieldValues=currentRow.doc.getFieldValues(columnName);
  return currentRow.doc != null ? PropertyValues.newString(Iterables.toString(fieldValues != null ? fieldValues : Collections.emptyList())) : null;
}

Fixed version (ground truth):
@Override public PropertyValue getValue(String columnName){
  if (QueryImpl.JCR_SCORE.equals(columnName)) {
    return PropertyValues.newDouble(currentRow.score);
  }
  Collection<Object> fieldValues=currentRow.doc.getFieldValues(columnName);
  return PropertyValues.newString(Iterables.toString(fieldValues != null ? fieldValues : Collections.emptyList()));
}
Program: 8884
Project: 8884
Buggy source:
private SolrResultRow convertToRow(SolrDocument doc){
  String path=String.valueOf(doc.getFieldValue(configuration.getPathField()));
  if (path != null) {
    if ("String_Node_Str".equals(path)) {
      path="String_Node_Str";
    }
    if (!parent.isEmpty()) {
      path=getAncestorPath(path,parentDepth);
      if (seenPaths.contains(path)) {
        return null;
      }
      seenPaths.add(path);
    }
    float score=0f;
    Object scoreObj=doc.get("String_Node_Str");
    if (scoreObj != null) {
      score=(Float)scoreObj;
    }
    return new SolrResultRow(path,score,doc);
  }
  return null;
}

Fixed version (ground truth):
private SolrResultRow convertToRow(SolrDocument doc){
  String path=String.valueOf(doc.getFieldValue(configuration.getPathField()));
  if ("String_Node_Str".equals(path)) {
    path="String_Node_Str";
  }
  if (!parent.isEmpty()) {
    path=getAncestorPath(path,parentDepth);
    if (seenPaths.contains(path)) {
      return null;
    }
    seenPaths.add(path);
  }
  float score=0f;
  Object scoreObj=doc.get("String_Node_Str");
  if (scoreObj != null) {
    score=(Float)scoreObj;
  }
  return new SolrResultRow(path,score,doc);
}
Program: 8885
Project: 8885
Buggy source:
@Override public void close() throws IOException {
  try {
    getSolrServer().shutdown();
  }
 catch (  Exception e) {
  }
  try {
    getIndexingSolrServer().shutdown();
  }
 catch (  Exception e) {
  }
  try {
    getSearchingSolrServer().shutdown();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  try {
    SolrServer solrServer=getSolrServer();
    if (solrServer != null) {
      solrServer.shutdown();
    }
  }
 catch (  Exception e) {
  }
  try {
    SolrServer indexingSolrServer=getIndexingSolrServer();
    if (indexingSolrServer != null) {
      indexingSolrServer.shutdown();
    }
  }
 catch (  Exception e) {
  }
  try {
    getSearchingSolrServer().shutdown();
  }
 catch (  Exception e) {
  }
}
Program: 8886
Project: 8886
Buggy source:
@Override public void close() throws IOException {
  try {
    if (solrServer != null) {
      solrServer.shutdown();
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  try {
synchronized (this) {
      if (solrServer != null) {
        solrServer.shutdown();
      }
    }
  }
 catch (  Exception e) {
  }
}
Program: 8888
Project: 8888
Buggy source:
boolean isMandatoryChildNode(String name){
  return nameSetContains(REP_MANDATORY_CHILD_NODES,name);
}

Fixed version (ground truth):
boolean isMandatoryChildNode(@Nonnull String name){
  return nameSetContains(REP_MANDATORY_CHILD_NODES,name);
}
Program: 8889
Project: 8889
Buggy source:
private boolean nameSetContains(String set,String name){
  for (  NodeState type : types) {
    if (contains(type.getNames(set),name)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean nameSetContains(@Nonnull String set,@Nonnull String name){
  for (  NodeState type : types) {
    if (contains(type.getNames(set),name)) {
      return true;
    }
  }
  return false;
}
Program: 8890
Project: 8890
Buggy source:
/** 
 * Checks whether this effective type contains the named type.
 * @param name node type name
 * @return {@code true} if the named type is included,{@code false} otherwise
 */
boolean isNodeType(String name){
  for (  NodeState type : types) {
    if (name.equals(type.getName(JCR_NODETYPENAME)) || contains(type.getNames(REP_SUPERTYPES),name)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks whether this effective type contains the named type.
 * @param name node type name
 * @return {@code true} if the named type is included,{@code false} otherwise
 */
boolean isNodeType(@Nonnull String name){
  for (  NodeState type : types) {
    if (name.equals(type.getName(JCR_NODETYPENAME)) || contains(type.getNames(REP_SUPERTYPES),name)) {
      return true;
    }
  }
  return false;
}
Program: 8891
Project: 8891
Buggy source:
/** 
 * Finds the default node type for a child node with the given name.
 * @param nameWithIndex child node name, possibly with an SNS index
 * @return default type, or {@code null} if not found
 */
@CheckForNull String getDefaultType(String nameWithIndex){
  String name=dropIndexFromName(nameWithIndex);
  boolean sns=!name.equals(nameWithIndex);
  for (  NodeState type : types) {
    NodeState named=type.getChildNode(REP_NAMED_CHILD_NODE_DEFINITIONS).getChildNode(name);
    NodeState residual=type.getChildNode(REP_RESIDUAL_CHILD_NODE_DEFINITIONS);
    for (    ChildNodeEntry entry : concat(named.getChildNodeEntries(),residual.getChildNodeEntries())) {
      NodeState definition=entry.getNodeState();
      String defaultType=definition.getName(JCR_DEFAULTPRIMARYTYPE);
      if (defaultType != null && snsMatch(sns,definition)) {
        return defaultType;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Finds the default node type for a child node with the given name.
 * @param nameWithIndex child node name, possibly with an SNS index
 * @return default type, or {@code null} if not found
 */
@CheckForNull String getDefaultType(@Nonnull String nameWithIndex){
  String name=dropIndexFromName(nameWithIndex);
  boolean sns=!name.equals(nameWithIndex);
  for (  NodeState type : types) {
    NodeState named=type.getChildNode(REP_NAMED_CHILD_NODE_DEFINITIONS).getChildNode(name);
    NodeState residual=type.getChildNode(REP_RESIDUAL_CHILD_NODE_DEFINITIONS);
    for (    ChildNodeEntry entry : concat(named.getChildNodeEntries(),residual.getChildNodeEntries())) {
      NodeState definition=entry.getNodeState();
      String defaultType=definition.getName(JCR_DEFAULTPRIMARYTYPE);
      if (defaultType != null && snsMatch(sns,definition)) {
        return defaultType;
      }
    }
  }
  return null;
}
Program: 8892
Project: 8892
Buggy source:
@Nonnull private Set<String> getNameSet(String set){
  Set<String> names=newHashSet();
  for (  NodeState type : types) {
    addAll(names,type.getNames(set));
  }
  return names;
}

Fixed version (ground truth):
@Nonnull private Set<String> getNameSet(@Nonnull String set){
  Set<String> names=newHashSet();
  for (  NodeState type : types) {
    addAll(names,type.getNames(set));
  }
  return names;
}
Program: 8893
Project: 8893
Buggy source:
boolean isMandatoryProperty(String name){
  return nameSetContains(REP_MANDATORY_PROPERTIES,name);
}

Fixed version (ground truth):
boolean isMandatoryProperty(@Nonnull String name){
  return nameSetContains(REP_MANDATORY_PROPERTIES,name);
}
Program: 8894
Project: 8894
Buggy source:
/** 
 * Depending on the given SNS flag, checks whether the given child node definition allows same-name-siblings.
 * @param sns SNS flag, {@code true} if processing an SNS node
 * @param definition child node definition
 */
private boolean snsMatch(boolean sns,NodeState definition){
  return !sns || definition.getBoolean(JCR_SAMENAMESIBLINGS);
}

Fixed version (ground truth):
/** 
 * Depending on the given SNS flag, checks whether the given child node definition allows same-name-siblings.
 * @param sns SNS flag, {@code true} if processing an SNS node
 * @param definition child node definition
 */
private boolean snsMatch(boolean sns,@Nonnull NodeState definition){
  return !sns || definition.getBoolean(JCR_SAMENAMESIBLINGS);
}
Program: 8895
Project: 8895
Buggy source:
/** 
 * Finds a matching definition for a child node with the given name and types.
 * @param nameWithIndex child node name, possibly with an SNS index
 * @param effective effective types of the child node
 * @return {@code true} if there's a matching child node definition,{@code false} otherwise
 */
boolean isValidChildNode(String nameWithIndex,EffectiveType effective){
  String name=dropIndexFromName(nameWithIndex);
  boolean sns=!name.equals(nameWithIndex);
  Set<String> typeNames=effective.getTypeNames();
  for (  NodeState type : types) {
    NodeState definitions=type.getChildNode(REP_NAMED_CHILD_NODE_DEFINITIONS).getChildNode(name);
    for (    String typeName : typeNames) {
      NodeState definition=definitions.getChildNode(typeName);
      if (definition.exists() && snsMatch(sns,definition)) {
        return true;
      }
    }
    for (    ChildNodeEntry entry : definitions.getChildNodeEntries()) {
      NodeState definition=entry.getNodeState();
      if (definition.getBoolean(JCR_MANDATORY)) {
        return false;
      }
    }
  }
  for (  NodeState type : types) {
    NodeState residual=type.getChildNode(REP_RESIDUAL_CHILD_NODE_DEFINITIONS);
    for (    String typeName : typeNames) {
      NodeState definition=residual.getChildNode(typeName);
      if (definition.exists() && snsMatch(sns,definition)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Finds a matching definition for a child node with the given name and types.
 * @param nameWithIndex child node name, possibly with an SNS index
 * @param effective effective types of the child node
 * @return {@code true} if there's a matching child node definition,{@code false} otherwise
 */
boolean isValidChildNode(@Nonnull String nameWithIndex,@Nonnull EffectiveType effective){
  String name=dropIndexFromName(nameWithIndex);
  boolean sns=!name.equals(nameWithIndex);
  Set<String> typeNames=effective.getTypeNames();
  for (  NodeState type : types) {
    NodeState definitions=type.getChildNode(REP_NAMED_CHILD_NODE_DEFINITIONS).getChildNode(name);
    for (    String typeName : typeNames) {
      NodeState definition=definitions.getChildNode(typeName);
      if (definition.exists() && snsMatch(sns,definition)) {
        return true;
      }
    }
    for (    ChildNodeEntry entry : definitions.getChildNodeEntries()) {
      NodeState definition=entry.getNodeState();
      if (definition.getBoolean(JCR_MANDATORY)) {
        return false;
      }
    }
  }
  for (  NodeState type : types) {
    NodeState residual=type.getChildNode(REP_RESIDUAL_CHILD_NODE_DEFINITIONS);
    for (    String typeName : typeNames) {
      NodeState definition=residual.getChildNode(typeName);
      if (definition.exists() && snsMatch(sns,definition)) {
        return true;
      }
    }
  }
  return false;
}
Program: 8896
Project: 8896
Buggy source:
Set<String> getTypeNames(){
  Set<String> names=newHashSet();
  for (  NodeState type : types) {
    names.add(type.getName(JCR_NODETYPENAME));
    addAll(names,type.getNames(REP_SUPERTYPES));
  }
  return names;
}

Fixed version (ground truth):
@Nonnull Set<String> getTypeNames(){
  Set<String> names=newHashSet();
  for (  NodeState type : types) {
    names.add(type.getName(JCR_NODETYPENAME));
    addAll(names,type.getNames(REP_SUPERTYPES));
  }
  return names;
}
Program: 8897
Project: 8897
Buggy source:
EffectiveType(List<NodeState> types){
  this.types=checkNotNull(types);
}

Fixed version (ground truth):
EffectiveType(@Nonnull List<NodeState> types){
  this.types=checkNotNull(types);
}
Program: 8898
Project: 8898
Buggy source:
/** 
 * Throws or logs the specified constraint violation.
 * @param code code of this violation
 * @param message description of the violation
 * @throws CommitFailedException the constraint violation
 */
private void constraintViolation(int code,String message) throws CommitFailedException {
  String path=getPath();
  if (effective != null) {
    path=path + "String_Node_Str" + effective+ "String_Node_Str";
  }
  CommitFailedException exception=new CommitFailedException(CONSTRAINT,code,path + "String_Node_Str" + message);
  if (strict) {
    throw exception;
  }
 else {
    log.warn(exception.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Throws or logs the specified constraint violation.
 * @param code code of this violation
 * @param message description of the violation
 * @throws CommitFailedException the constraint violation
 */
private void constraintViolation(int code,String message) throws CommitFailedException {
  String path=getPath();
  path=path + '[' + getEffective()+ ']';
  CommitFailedException exception=new CommitFailedException(CONSTRAINT,code,path + "String_Node_Str" + message);
  if (strict) {
    throw exception;
  }
 else {
    log.warn(exception.getMessage());
  }
}
Program: 8899
Project: 8899
Buggy source:
private String getPath(){
  if (parent == null) {
    return "String_Node_Str";
  }
 else   if (parent.parent == null) {
    return "String_Node_Str" + nodeName;
  }
 else {
    return parent.getPath() + "String_Node_Str" + nodeName;
  }
}

Fixed version (ground truth):
private String getPath(){
  if (parent == null) {
    return "String_Node_Str";
  }
 else   if (parent.parent == null) {
    return '/' + nodeName;
  }
 else {
    return parent.getPath() + '/' + nodeName;
  }
}