nus-yam/ex-repair huggingface dataset:
Program: 8799
Project: 8799
Buggy source:
protected Repository createRepository(String url,String username,String password){
  String prefix="String_Node_Str" + UUID.randomUUID().toString().replace("String_Node_Str","String_Node_Str");
  RDBOptions options=new RDBOptions().tablePrefix(prefix).dropTablesOnClose(true);
  DocumentNodeStore m=new DocumentMK.Builder().setClusterId(1).memoryCacheSize(64 * 1024 * 1024).setPersistentCache("String_Node_Str").setRDBConnection(RDBDataSourceFactory.forJdbcUrl(url,username,password),options).getNodeStore();
  QueryEngineSettings qs=new QueryEngineSettings();
  qs.setFullTextComparisonWithoutIndex(true);
  return new Jcr(m).with(qs).createRepository();
}

Fixed version (ground truth):
protected Repository createRepository(String url,String username,String password){
  String prefix="String_Node_Str" + UUID.randomUUID().toString().replace("String_Node_Str","String_Node_Str");
  RDBOptions options=new RDBOptions().tablePrefix(prefix).dropTablesOnClose(true);
  DocumentNodeStore m=new DocumentMK.Builder().memoryCacheSize(64 * 1024 * 1024).setPersistentCache("String_Node_Str").setRDBConnection(RDBDataSourceFactory.forJdbcUrl(url,username,password),options).getNodeStore();
  QueryEngineSettings qs=new QueryEngineSettings();
  qs.setFullTextComparisonWithoutIndex(true);
  return new Jcr(m).with(qs).createRepository();
}
Program: 8800
Project: 8800
Buggy source:
private static Repository createRepository(MongoConnection connection){
  DocumentNodeStore store=new DocumentMK.Builder().setClusterId(1).memoryCacheSize(64 * 1024 * 1024).setPersistentCache("String_Node_Str").setMongoDB(connection.getDB()).getNodeStore();
  QueryEngineSettings qs=new QueryEngineSettings();
  qs.setFullTextComparisonWithoutIndex(true);
  return new Jcr(store).with(qs).createRepository();
}

Fixed version (ground truth):
private static Repository createRepository(MongoConnection connection){
  DocumentNodeStore store=new DocumentMK.Builder().memoryCacheSize(64 * 1024 * 1024).setPersistentCache("String_Node_Str").setMongoDB(connection.getDB()).getNodeStore();
  QueryEngineSettings qs=new QueryEngineSettings();
  qs.setFullTextComparisonWithoutIndex(true);
  return new Jcr(store).with(qs).createRepository();
}
Program: 8801
Project: 8801
Buggy source:
private DocumentNodeStore createNodeStore(String workingDir) throws SecurityException, Exception {
  setFinalStatic(ClusterNodeInfo.class.getDeclaredField("String_Node_Str"),workingDir);
  DocumentMK mk1=createMK(0,500);
  logger.info("String_Node_Str" + mk1.nodeStore.getClusterId() + "String_Node_Str"+ workingDir);
  return mk1.nodeStore;
}

Fixed version (ground truth):
private DocumentNodeStore createNodeStore(String workingDir) throws SecurityException, Exception {
  Object prevWorkingDir=System.getProperty("String_Node_Str","String_Node_Str");
  try {
    prevWorkingDir=setFinalStatic(ClusterNodeInfo.class.getDeclaredField("String_Node_Str"),workingDir);
    DocumentMK mk1=createMK(0,500);
    logger.info("String_Node_Str" + mk1.nodeStore.getClusterId() + "String_Node_Str"+ workingDir);
    return mk1.nodeStore;
  }
  finally {
    setFinalStatic(ClusterNodeInfo.class.getDeclaredField("String_Node_Str"),prevWorkingDir);
  }
}
Program: 8802
Project: 8802
Buggy source:
/** 
 * Borrowed from http://stackoverflow.com/questions/3301635/change-private-static-final- field-using-java-reflection
 */
static void setFinalStatic(Field field,Object newValue) throws Exception {
  field.setAccessible(true);
  Field modifiersField=Field.class.getDeclaredField("String_Node_Str");
  modifiersField.setAccessible(true);
  modifiersField.setInt(field,field.getModifiers() & ~Modifier.FINAL);
  field.set(null,newValue);
}

Fixed version (ground truth):
/** 
 * Borrowed from http://stackoverflow.com/questions/3301635/change-private-static-final- field-using-java-reflection
 */
static Object setFinalStatic(Field field,Object newValue) throws Exception {
  field.setAccessible(true);
  Field modifiersField=Field.class.getDeclaredField("String_Node_Str");
  modifiersField.setAccessible(true);
  modifiersField.setInt(field,field.getModifiers() & ~Modifier.FINAL);
  Object prev=field.get(null);
  field.set(null,newValue);
  return prev;
}
Program: 8803
Project: 8803
Buggy source:
public void performLeaseCheck(){
  if (leaseCheckDisabled || !renewed) {
    return;
  }
  if (leaseCheckFailed) {
    LOG.error(LEASE_CHECK_FAILED_MSG);
    throw new AssertionError(LEASE_CHECK_FAILED_MSG);
  }
  long now=getCurrentTime();
  if (now < (leaseEndTime - leaseFailureMargin)) {
    return;
  }
synchronized (this) {
    if (leaseCheckFailed) {
      LOG.error(LEASE_CHECK_FAILED_MSG);
      throw new AssertionError(LEASE_CHECK_FAILED_MSG);
    }
    for (int i=0; i < MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE; i++) {
      now=getCurrentTime();
      if (now < (leaseEndTime - leaseFailureMargin)) {
        return;
      }
      try {
        LOG.info("String_Node_Str" + leaseFailureMargin + "String_Node_Str"+ (leaseEndTime - now)+ "String_Node_Str"+ "String_Node_Str"+ (MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE - 1 - i)+ "String_Node_Str");
        Thread.sleep(1000);
      }
 catch (      InterruptedException e) {
        LOG.warn("String_Node_Str" + e,e);
        break;
      }
    }
    leaseCheckFailed=true;
  }
  final String errorMsg=LEASE_CHECK_FAILED_MSG + "String_Node_Str" + leaseEndTime+ "String_Node_Str"+ leaseTime+ "String_Node_Str"+ leaseFailureMargin+ "String_Node_Str"+ (leaseEndTime - leaseFailureMargin)+ "String_Node_Str"+ now+ "String_Node_Str"+ ((leaseEndTime - leaseFailureMargin) - now)+ "String_Node_Str";
  LOG.error(errorMsg);
  handleLeaseFailure(errorMsg);
}

Fixed version (ground truth):
public void performLeaseCheck(){
  if (leaseCheckDisabled || !renewed) {
    return;
  }
  if (leaseCheckFailed) {
    LOG.error(LEASE_CHECK_FAILED_MSG);
    throw new AssertionError(LEASE_CHECK_FAILED_MSG);
  }
  long now=getCurrentTime();
  if (now < (leaseEndTime - leaseFailureMargin)) {
    return;
  }
synchronized (this) {
    if (leaseCheckFailed) {
      LOG.error(LEASE_CHECK_FAILED_MSG);
      throw new AssertionError(LEASE_CHECK_FAILED_MSG);
    }
    for (int i=0; i < MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE; i++) {
      now=getCurrentTime();
      if (now < (leaseEndTime - leaseFailureMargin)) {
        return;
      }
      try {
        LOG.info("String_Node_Str" + leaseFailureMargin + "String_Node_Str"+ (leaseEndTime - now)+ "String_Node_Str"+ "String_Node_Str"+ (MAX_RETRY_SLEEPS_BEFORE_LEASE_FAILURE - 1 - i)+ "String_Node_Str");
        wait(1000);
      }
 catch (      InterruptedException e) {
        LOG.warn("String_Node_Str" + e,e);
        break;
      }
    }
    leaseCheckFailed=true;
  }
  final String errorMsg=LEASE_CHECK_FAILED_MSG + "String_Node_Str" + leaseEndTime+ "String_Node_Str"+ leaseTime+ "String_Node_Str"+ leaseFailureMargin+ "String_Node_Str"+ (leaseEndTime - leaseFailureMargin)+ "String_Node_Str"+ now+ "String_Node_Str"+ ((leaseEndTime - leaseFailureMargin) - now)+ "String_Node_Str";
  LOG.error(errorMsg);
  handleLeaseFailure(errorMsg);
}
Program: 8804
Project: 8804
Buggy source:
@SuppressWarnings("String_Node_Str") ClusterViewDocument(Document doc){
  if (doc == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.clusterViewId=(String)doc.get(CLUSTER_VIEW_ID_KEY);
  this.viewSeqNum=(Long)doc.get(VIEW_SEQ_NUM_KEY);
  this.createdAt=(String)doc.get(CREATED_KEY);
  this.createdBy=(Long)doc.get(CREATOR_KEY);
  Object obj=doc.get(ACTIVE_KEY);
  if (obj == null || !(obj instanceof String)) {
    logger.trace("String_Node_Str",ACTIVE_KEY,obj);
    this.activeIds=new Integer[0];
  }
 else {
    this.activeIds=csvToIntegerArray((String)obj);
  }
  Object obj2=doc.get(RECOVERING_KEY);
  if (obj2 == null || !(obj2 instanceof String)) {
    logger.trace("String_Node_Str",RECOVERING_KEY,obj2);
    this.recoveringIds=new Integer[0];
  }
 else {
    this.recoveringIds=csvToIntegerArray((String)obj2);
  }
  Object obj3=doc.get(INACTIVE_KEY);
  if (obj3 == null || !(obj3 instanceof String)) {
    logger.trace("String_Node_Str",INACTIVE_KEY,obj3);
    this.inactiveIds=new Integer[0];
  }
 else {
    this.inactiveIds=csvToIntegerArray((String)obj3);
  }
  Object obj4=doc.get(CLUSTER_VIEW_HISTORY_KEY);
  if (obj4 == null || !(obj4 instanceof Map)) {
    logger.trace("String_Node_Str");
    this.viewHistory=null;
  }
 else {
    this.viewHistory=((Map<Object,String>)obj4);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") ClusterViewDocument(Document doc){
  if (doc == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.clusterViewId=(String)doc.get(CLUSTER_VIEW_ID_KEY);
  this.viewSeqNum=(Long)doc.get(VIEW_SEQ_NUM_KEY);
  this.createdAt=(String)doc.get(CREATED_KEY);
  Object creatorId=doc.get(CREATOR_KEY);
  if (creatorId instanceof Long) {
    this.createdBy=(Long)creatorId;
  }
 else   if (creatorId instanceof Integer) {
    this.createdBy=(long)((Integer)creatorId);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + creatorId);
  }
  Object obj=doc.get(ACTIVE_KEY);
  if (obj == null || !(obj instanceof String)) {
    logger.trace("String_Node_Str",ACTIVE_KEY,obj);
    this.activeIds=new Integer[0];
  }
 else {
    this.activeIds=csvToIntegerArray((String)obj);
  }
  Object obj2=doc.get(RECOVERING_KEY);
  if (obj2 == null || !(obj2 instanceof String)) {
    logger.trace("String_Node_Str",RECOVERING_KEY,obj2);
    this.recoveringIds=new Integer[0];
  }
 else {
    this.recoveringIds=csvToIntegerArray((String)obj2);
  }
  Object obj3=doc.get(INACTIVE_KEY);
  if (obj3 == null || !(obj3 instanceof String)) {
    logger.trace("String_Node_Str",INACTIVE_KEY,obj3);
    this.inactiveIds=new Integer[0];
  }
 else {
    this.inactiveIds=csvToIntegerArray((String)obj3);
  }
  Object obj4=doc.get(CLUSTER_VIEW_HISTORY_KEY);
  if (obj4 == null || !(obj4 instanceof Map)) {
    logger.trace("String_Node_Str");
    this.viewHistory=null;
  }
 else {
    this.viewHistory=((Map<Object,String>)obj4);
  }
}
Program: 8805
Project: 8805
Buggy source:
/** 
 * Returns the parameter as an integer or the <code>defaultValue</code> if the parameter is <code>null</code> or if the parameter is not an <code>Integer</code> and cannot be converted to an <code>Integer</code> from the parameter's string value.
 * @param propValue the property value or <code>null</code>
 * @param defaultValue the default integer value
 */
public static int toInteger(Object propValue,int defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Integer) {
    return (Integer)propValue;
  }
 else   if (propValue != null) {
    try {
      return Integer.parseInt(String.valueOf(propValue));
    }
 catch (    NumberFormatException nfe) {
    }
  }
  return defaultValue;
}

Fixed version (ground truth):
/** 
 * Returns the parameter as an integer or the  {@code defaultValue} if the parameter is {@code null} or ifthe parameter is not an  {@code Integer} and cannot be converted toan  {@code Integer} from the parameter's string value.
 * @param propValue the property value or {@code null}
 * @param defaultValue the default integer value
 */
public static int toInteger(Object propValue,int defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Integer) {
    return (Integer)propValue;
  }
 else   if (propValue != null) {
    try {
      return Integer.parseInt(String.valueOf(propValue));
    }
 catch (    NumberFormatException nfe) {
    }
  }
  return defaultValue;
}
Program: 8806
Project: 8806
Buggy source:
/** 
 * Populates the bean properties from config instance. It supports coercing values for simple types like Number, Integer, Long, Boolean etc. Complex objects are not supported
 * @param instance bean to populate
 * @param config propertires to set in the passed bean
 * @param validate Flag to validate the configured bean property names againstthe configured bean class
 */
@SuppressWarnings("String_Node_Str") public static void populate(Object instance,Map<String,?> config,boolean validate){
  Class<?> objectClass=instance.getClass();
  Map<String,Method> setters=getSetters(objectClass);
  ToStringHelper toStringHelper=Objects.toStringHelper(instance);
  for (  Map.Entry<String,?> e : config.entrySet()) {
    String name=e.getKey();
    Method setter=setters.get(name);
    if (setter != null) {
      if (setter.getAnnotation(Deprecated.class) != null) {
        log.warn("String_Node_Str",name,objectClass.getName());
      }
      Object value=e.getValue();
      setProperty(instance,name,setter,value);
      toStringHelper.add(name,value);
    }
 else     if (validate) {
      throw new IllegalArgumentException("String_Node_Str" + objectClass.getName() + "String_Node_Str"+ name);
    }
  }
  log.debug("String_Node_Str",toStringHelper);
}

Fixed version (ground truth):
/** 
 * Populates the bean properties from config instance. It supports coercing values for simple types like Number, Integer, Long, Boolean etc. Complex objects are not supported
 * @param instance bean to populate
 * @param config properties to set in the passed bean
 * @param validate Flag to validate the configured bean property names againstthe configured bean class
 */
@SuppressWarnings("String_Node_Str") public static void populate(Object instance,Map<String,?> config,boolean validate){
  Class<?> objectClass=instance.getClass();
  Map<String,Method> setters=getSetters(objectClass);
  ToStringHelper toStringHelper=Objects.toStringHelper(instance);
  for (  Map.Entry<String,?> e : config.entrySet()) {
    String name=e.getKey();
    Method setter=setters.get(name);
    if (setter != null) {
      if (setter.getAnnotation(Deprecated.class) != null) {
        log.warn("String_Node_Str",name,objectClass.getName());
      }
      Object value=e.getValue();
      setProperty(instance,name,setter,value);
      toStringHelper.add(name,value);
    }
 else     if (validate) {
      throw new IllegalArgumentException("String_Node_Str" + objectClass.getName() + "String_Node_Str"+ name);
    }
  }
  log.debug("String_Node_Str",toStringHelper);
}
Program: 8807
Project: 8807
Buggy source:
/** 
 * Returns the parameter as a double or the <code>defaultValue</code> if the parameter is <code>null</code> or if the parameter is not a <code>Double</code> and cannot be converted to a <code>Double</code> from the parameter's string value.
 * @param propValue the property value or <code>null</code>
 * @param defaultValue the default double value
 */
public static double toDouble(Object propValue,double defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Double) {
    return (Double)propValue;
  }
 else   if (propValue != null) {
    try {
      return Double.parseDouble(String.valueOf(propValue));
    }
 catch (    NumberFormatException nfe) {
    }
  }
  return defaultValue;
}

Fixed version (ground truth):
/** 
 * Returns the parameter as a double or the  {@code defaultValue} if the parameter is {@code null} or ifthe parameter is not a  {@code Double} and cannot be converted toa  {@code Double} from the parameter's string value.
 * @param propValue the property value or {@code null}
 * @param defaultValue the default double value
 */
public static double toDouble(Object propValue,double defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Double) {
    return (Double)propValue;
  }
 else   if (propValue != null) {
    try {
      return Double.parseDouble(String.valueOf(propValue));
    }
 catch (    NumberFormatException nfe) {
    }
  }
  return defaultValue;
}
Program: 8808
Project: 8808
Buggy source:
/** 
 * Returns the boolean value of the parameter or the <code>defaultValue</code> if the parameter is <code>null</code>. If the parameter is not a <code>Boolean</code> it is converted by calling <code>Boolean.valueOf</code> on the string value of the object.
 * @param propValue the property value or <code>null</code>
 * @param defaultValue the default boolean value
 */
public static boolean toBoolean(Object propValue,boolean defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Boolean) {
    return (Boolean)propValue;
  }
 else   if (propValue != null) {
    return Boolean.parseBoolean(String.valueOf(propValue));
  }
  return defaultValue;
}

Fixed version (ground truth):
/** 
 * Returns the boolean value of the parameter or the  {@code defaultValue} if the parameter is {@code null}. If the parameter is not a   {@code Boolean} it is convertedby calling  {@code Boolean.valueOf} on the string value of theobject.
 * @param propValue the property value or {@code null}
 * @param defaultValue the default boolean value
 */
public static boolean toBoolean(Object propValue,boolean defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Boolean) {
    return (Boolean)propValue;
  }
 else   if (propValue != null) {
    return Boolean.parseBoolean(String.valueOf(propValue));
  }
  return defaultValue;
}
Program: 8809
Project: 8809
Buggy source:
/** 
 * Returns the parameter as a long or the <code>defaultValue</code> if the parameter is <code>null</code> or if the parameter is not a <code>Long</code> and cannot be converted to a <code>Long</code> from the parameter's string value.
 * @param propValue the property value or <code>null</code>
 * @param defaultValue the default long value
 */
public static long toLong(Object propValue,long defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Long) {
    return (Long)propValue;
  }
 else   if (propValue != null) {
    try {
      return Long.parseLong(String.valueOf(propValue));
    }
 catch (    NumberFormatException nfe) {
    }
  }
  return defaultValue;
}

Fixed version (ground truth):
/** 
 * Returns the parameter as a long or the  {@code defaultValue} if the parameter is {@code null} or ifthe parameter is not a  {@code Long} and cannot be converted toa  {@code Long} from the parameter's string value.
 * @param propValue the property value or {@code null}
 * @param defaultValue the default long value
 */
public static long toLong(Object propValue,long defaultValue){
  propValue=toObject(propValue);
  if (propValue instanceof Long) {
    return (Long)propValue;
  }
 else   if (propValue != null) {
    try {
      return Long.parseLong(String.valueOf(propValue));
    }
 catch (    NumberFormatException nfe) {
    }
  }
  return defaultValue;
}
Program: 8811
Project: 8811
Buggy source:
/** 
 * Returns the parameter as a string or the <code>defaultValue</code> if the parameter is <code>null</code>.
 * @param propValue the property value or <code>null</code>
 * @param defaultValue the default string value
 */
public static String toString(Object propValue,String defaultValue){
  propValue=toObject(propValue);
  return (propValue != null) ? propValue.toString() : defaultValue;
}

Fixed version (ground truth):
/** 
 * Returns the parameter as a string or the  {@code defaultValue} if the parameter is {@code null}.
 * @param propValue the property value or {@code null}
 * @param defaultValue the default string value
 */
public static String toString(Object propValue,String defaultValue){
  propValue=toObject(propValue);
  return (propValue != null) ? propValue.toString() : defaultValue;
}
Program: 8812
Project: 8812
Buggy source:
/** 
 * Returns the parameter as a single value. If the parameter is neither an array nor a <code>java.util.Collection</code> the parameter is returned unmodified. If the parameter is a non-empty array, the first array element is returned. If the property is a non-empty <code>java.util.Collection</code>, the first collection element is returned. Otherwise <code>null</code> is returned.
 * @param propValue the parameter to convert.
 */
public static Object toObject(Object propValue){
  if (propValue == null) {
    return null;
  }
 else   if (propValue.getClass().isArray()) {
    Object[] prop=(Object[])propValue;
    return prop.length > 0 ? prop[0] : null;
  }
 else   if (propValue instanceof Collection<?>) {
    Collection<?> prop=(Collection<?>)propValue;
    return prop.isEmpty() ? null : prop.iterator().next();
  }
 else {
    return propValue;
  }
}

Fixed version (ground truth):
/** 
 * Returns the parameter as a single value. If the parameter is neither an array nor a   {@code java.util.Collection} theparameter is returned unmodified. If the parameter is a non-empty array, the first array element is returned. If the property is a non-empty {@code java.util.Collection}, the first collection element is returned. Otherwise   {@code null} is returned.
 * @param propValue the parameter to convert.
 */
public static Object toObject(Object propValue){
  if (propValue == null) {
    return null;
  }
 else   if (propValue.getClass().isArray()) {
    Object[] prop=(Object[])propValue;
    return prop.length > 0 ? prop[0] : null;
  }
 else   if (propValue instanceof Collection<?>) {
    Collection<?> prop=(Collection<?>)propValue;
    return prop.isEmpty() ? null : prop.iterator().next();
  }
 else {
    return propValue;
  }
}
Program: 8814
Project: 8814
Buggy source:
protected NamedTemplate(NameMapper mapper,String jcrName) throws ConstraintViolationException {
  this(mapper);
  if (jcrName != null) {
    setName(jcrName);
  }
}

Fixed version (ground truth):
protected NamedTemplate(@Nonnull NameMapper mapper,@Nullable String jcrName) throws ConstraintViolationException {
  this(mapper);
  if (jcrName != null) {
    setName(jcrName);
  }
}
Program: 8815
Project: 8815
Buggy source:
NodeTypeTemplateImpl(NameMapper mapper,NodeTypeDefinition definition) throws ConstraintViolationException {
  super(mapper,definition.getName());
  setMixin(definition.isMixin());
  setOrderableChildNodes(definition.hasOrderableChildNodes());
  setAbstract(definition.isAbstract());
  setQueryable(definition.isQueryable());
  String primaryItemName=definition.getPrimaryItemName();
  if (primaryItemName != null) {
    setPrimaryItemName(primaryItemName);
  }
  setDeclaredSuperTypeNames(definition.getDeclaredSupertypeNames());
  PropertyDefinition[] pds=definition.getDeclaredPropertyDefinitions();
  if (pds != null) {
    propertyDefinitionTemplates=Lists.newArrayListWithCapacity(pds.length);
    for (    PropertyDefinition pd : pds) {
      propertyDefinitionTemplates.add(new PropertyDefinitionTemplateImpl(mapper,pd));
    }
  }
  NodeDefinition[] nds=definition.getDeclaredChildNodeDefinitions();
  if (nds != null) {
    nodeDefinitionTemplates=Lists.newArrayListWithCapacity(nds.length);
    for (    NodeDefinition nd : nds) {
      nodeDefinitionTemplates.add(new NodeDefinitionTemplateImpl(mapper,nd));
    }
  }
}

Fixed version (ground truth):
NodeTypeTemplateImpl(@Nonnull NameMapper mapper,@Nonnull NodeTypeDefinition definition) throws ConstraintViolationException {
  super(mapper,definition.getName());
  setMixin(definition.isMixin());
  setOrderableChildNodes(definition.hasOrderableChildNodes());
  setAbstract(definition.isAbstract());
  setQueryable(definition.isQueryable());
  String primaryItemName=definition.getPrimaryItemName();
  if (primaryItemName != null) {
    setPrimaryItemName(primaryItemName);
  }
  setDeclaredSuperTypeNames(definition.getDeclaredSupertypeNames());
  PropertyDefinition[] pds=definition.getDeclaredPropertyDefinitions();
  if (pds != null) {
    propertyDefinitionTemplates=Lists.newArrayListWithCapacity(pds.length);
    for (    PropertyDefinition pd : pds) {
      propertyDefinitionTemplates.add(new PropertyDefinitionTemplateImpl(mapper,pd));
    }
  }
  NodeDefinition[] nds=definition.getDeclaredChildNodeDefinitions();
  if (nds != null) {
    nodeDefinitionTemplates=Lists.newArrayListWithCapacity(nds.length);
    for (    NodeDefinition nd : nds) {
      nodeDefinitionTemplates.add(new NodeDefinitionTemplateImpl(mapper,nd));
    }
  }
}
Program: 8819
Project: 8819
Buggy source:
@Nonnull private static Result searchAces(@Nonnull Set<Principal> principals,@Nonnull Root root) throws RepositoryException {
  StringBuilder stmt=new StringBuilder("String_Node_Str");
  stmt.append("String_Node_Str");
  stmt.append(NT_REP_ACE);
  stmt.append("String_Node_Str");
  int i=0;
  for (  Principal principal : principals) {
    if (i > 0) {
      stmt.append("String_Node_Str");
    }
    stmt.append('@');
    stmt.append(ISO9075.encode(REP_PRINCIPAL_NAME));
    stmt.append("String_Node_Str");
    stmt.append(principal.getName().replaceAll("String_Node_Str","String_Node_Str"));
    stmt.append('\'');
    i++;
  }
  stmt.append(']');
  stmt.append("String_Node_Str");
  try {
    QueryEngine queryEngine=root.getQueryEngine();
    return queryEngine.executeQuery(stmt.toString(),Query.XPATH,Long.MAX_VALUE,0,QueryEngine.NO_BINDINGS,QueryEngine.NO_MAPPINGS);
  }
 catch (  ParseException e) {
    String msg="String_Node_Str";
    log.error(msg,e.getMessage());
    throw new RepositoryException(msg,e);
  }
}

Fixed version (ground truth):
@Nonnull private static Result searchAces(@Nonnull Set<Principal> principals,@Nonnull Root root) throws RepositoryException {
  StringBuilder stmt=new StringBuilder("String_Node_Str");
  stmt.append("String_Node_Str");
  stmt.append(NT_REP_ACE);
  stmt.append("String_Node_Str");
  int i=0;
  for (  Principal principal : principals) {
    if (i > 0) {
      stmt.append("String_Node_Str");
    }
    stmt.append('@');
    stmt.append(ISO9075.encode(REP_PRINCIPAL_NAME));
    stmt.append("String_Node_Str");
    stmt.append(principal.getName().replaceAll("String_Node_Str","String_Node_Str"));
    stmt.append('\'');
    i++;
  }
  stmt.append(']');
  stmt.append("String_Node_Str");
  try {
    QueryEngine queryEngine=root.getQueryEngine();
    return queryEngine.executeQuery(stmt.toString(),Query.XPATH,Long.MAX_VALUE,0,QueryEngine.NO_BINDINGS,QueryEngine.NO_MAPPINGS);
  }
 catch (  ParseException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RepositoryException(msg,e);
  }
}
Program: 8820
Project: 8820
Buggy source:
@CheckForNull private String saveGetId(@Nonnull Authorizable authorizable){
  try {
    return authorizable.getID();
  }
 catch (  RepositoryException e) {
    log.debug("String_Node_Str",authorizable,e.getMessage());
  }
  return null;
}

Fixed version (ground truth):
@CheckForNull private String saveGetId(@Nonnull Authorizable authorizable){
  try {
    return authorizable.getID();
  }
 catch (  RepositoryException e) {
    log.debug("String_Node_Str",authorizable,e);
  }
  return null;
}
Program: 8821
Project: 8821
Buggy source:
@Override public boolean apply(@Nullable Authorizable authorizable){
  if (authorizable != null) {
    try {
      String id=authorizable.getID();
      if (memberIds.contains(id)) {
        return true;
      }
 else {
        while (membersIterator.hasNext()) {
          String memberId=saveGetId(membersIterator.next());
          if (memberId != null) {
            memberIds.add(memberId);
            if (memberId.equals(id)) {
              return true;
            }
          }
        }
      }
    }
 catch (    RepositoryException e) {
      log.debug("String_Node_Str",authorizable,e.getMessage());
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(@Nullable Authorizable authorizable){
  if (authorizable != null) {
    try {
      String id=authorizable.getID();
      if (memberIds.contains(id)) {
        return true;
      }
 else {
        while (membersIterator.hasNext()) {
          String memberId=saveGetId(membersIterator.next());
          if (memberId != null) {
            memberIds.add(memberId);
            if (memberId.equals(id)) {
              return true;
            }
          }
        }
      }
    }
 catch (    RepositoryException e) {
      log.debug("String_Node_Str",authorizable,e);
    }
  }
  return false;
}
Program: 8822
Project: 8822
Buggy source:
/** 
 * Get a possibly non existing tree.
 * @param path the path to the tree
 * @return a {@link Tree} instance for the child at {@code path}.
 */
@CheckForNull MutableTree getTree(@Nonnull String path){
  checkArgument(isAbsolute(checkNotNull(path)));
  beforeRead();
  MutableTree child=this;
  for (  String name : elements(path)) {
    child=new MutableTree(root,pendingMoves,child,child.nodeBuilder.getChildNode(name),name);
  }
  return child;
}

Fixed version (ground truth):
/** 
 * Get a possibly non existing tree.
 * @param path the path to the tree
 * @return a {@link Tree} instance for the child at {@code path}.
 */
@Nonnull MutableTree getTree(@Nonnull String path){
  checkArgument(isAbsolute(checkNotNull(path)));
  beforeRead();
  MutableTree child=this;
  for (  String name : elements(path)) {
    child=new MutableTree(root,pendingMoves,child,child.nodeBuilder.getChildNode(name),name);
  }
  return child;
}
Program: 8823
Project: 8823
Buggy source:
@Test public void testCombinedOr() throws ParseException {
  StringBuilder buff=new StringBuilder("String_Node_Str");
  StringBuilder buff2=new StringBuilder("String_Node_Str");
  int step=111;
  for (int i=0; i < 5000; i++) {
    if (i % step == 2) {
      if (i > 0) {
        buff.append("String_Node_Str");
      }
      buff.append("String_Node_Str").append(i);
      buff2.append("String_Node_Str" + "String_Node_Str").append(i);
      buff2.append("String_Node_Str" + "String_Node_Str");
    }
 else {
      if (i > 0) {
        buff.append("String_Node_Str");
      }
      buff.append("String_Node_Str").append(i);
      if (i > 0 && i % step != 3) {
        buff2.append("String_Node_Str");
      }
      buff2.append(i);
    }
  }
  buff.append("String_Node_Str");
  buff2.append("String_Node_Str");
  String xpath=buff.toString();
  XPathToSQL2Converter conv=new XPathToSQL2Converter();
  long start=System.currentTimeMillis();
  Profiler prof=new Profiler().startCollecting();
  String sql2=conv.convert(xpath);
  long time=System.currentTimeMillis() - start;
  System.out.println("String_Node_Str" + time);
  System.out.println(prof.getTop(5));
  buff2.append("String_Node_Str").append(xpath).append("String_Node_Str");
  assertEquals(buff2.toString(),sql2);
}

Fixed version (ground truth):
@Test public void testCombinedOr() throws ParseException {
  StringBuilder buff=new StringBuilder("String_Node_Str");
  StringBuilder buff2=new StringBuilder("String_Node_Str");
  int step=111;
  for (int i=0; i < 5000; i++) {
    if (i % step == 2) {
      if (i > 0) {
        buff.append("String_Node_Str");
      }
      buff.append("String_Node_Str").append(i);
      buff2.append("String_Node_Str" + "String_Node_Str").append(i);
      buff2.append("String_Node_Str" + "String_Node_Str");
    }
 else {
      if (i > 0) {
        buff.append("String_Node_Str");
      }
      buff.append("String_Node_Str").append(i);
      if (i > 0 && i % step != 3) {
        buff2.append("String_Node_Str");
      }
      buff2.append(i);
    }
  }
  buff.append("String_Node_Str");
  buff2.append("String_Node_Str");
  String xpath=buff.toString();
  XPathToSQL2Converter conv=new XPathToSQL2Converter();
  String sql2=conv.convert(xpath);
  buff2.append("String_Node_Str").append(xpath).append("String_Node_Str");
  assertEquals(buff2.toString(),sql2);
}
Program: 8824
Project: 8824
Buggy source:
@Override public Principal apply(Authorizable authorizable){
  if (authorizable == null) {
    return null;
  }
  try {
    return authorizable.getPrincipal();
  }
 catch (  RepositoryException e) {
    String msg="String_Node_Str" + e.getMessage();
    log.error(msg);
    throw new IllegalStateException(msg);
  }
}

Fixed version (ground truth):
@Override public Principal apply(Authorizable authorizable){
  if (authorizable == null) {
    return null;
  }
  try {
    return authorizable.getPrincipal();
  }
 catch (  RepositoryException e) {
    String msg="String_Node_Str" + e.getMessage();
    log.error(msg);
    throw new IllegalStateException(msg,e);
  }
}
Program: 8825
Project: 8825
Buggy source:
@Override public Enumeration<? extends Principal> members(){
  final Iterator<Authorizable> members;
  try {
    members=getMembers();
  }
 catch (  RepositoryException e) {
    String msg="String_Node_Str" + e.getMessage();
    log.error(msg);
    throw new IllegalStateException(msg);
  }
  Iterator<Principal> principals=Iterators.transform(members,new Function<Authorizable,Principal>(){
    @Override public Principal apply(    Authorizable authorizable){
      if (authorizable == null) {
        return null;
      }
      try {
        return authorizable.getPrincipal();
      }
 catch (      RepositoryException e) {
        String msg="String_Node_Str" + e.getMessage();
        log.error(msg);
        throw new IllegalStateException(msg);
      }
    }
  }
);
  return Iterators.asEnumeration(Iterators.filter(principals,Predicates.<Object>notNull()));
}

Fixed version (ground truth):
@Override public Enumeration<? extends Principal> members(){
  final Iterator<Authorizable> members;
  try {
    members=getMembers();
  }
 catch (  RepositoryException e) {
    String msg="String_Node_Str" + e.getMessage();
    log.error(msg);
    throw new IllegalStateException(msg,e);
  }
  Iterator<Principal> principals=Iterators.transform(members,new Function<Authorizable,Principal>(){
    @Override public Principal apply(    Authorizable authorizable){
      if (authorizable == null) {
        return null;
      }
      try {
        return authorizable.getPrincipal();
      }
 catch (      RepositoryException e) {
        String msg="String_Node_Str" + e.getMessage();
        log.error(msg);
        throw new IllegalStateException(msg,e);
      }
    }
  }
);
  return Iterators.asEnumeration(Iterators.filter(principals,Predicates.<Object>notNull()));
}
Program: 8826
Project: 8826
Buggy source:
public static boolean notMatch(PropertyValue p1,PropertyValue p2){
  if (p1.getType().tag() != p2.getType().tag()) {
    return true;
  }
switch (p1.getType().tag()) {
case PropertyType.BINARY:
    if (p1.isArray() && !p2.isArray()) {
      if (p1.count() > 1) {
        return true;
      }
      return !contains(p1.getValue(Type.BINARIES),p2.getValue(Type.BINARY));
    }
  if (!p1.isArray() && p2.isArray()) {
    if (p2.count() > 1) {
      return true;
    }
    return !contains(p2.getValue(Type.BINARIES),p1.getValue(Type.BINARY));
  }
break;
default :
if (p1.isArray() && !p2.isArray()) {
if (p1.count() > 1) {
  return true;
}
return !contains(p1.getValue(Type.STRINGS),p2.getValue(Type.STRING));
}
if (!p1.isArray() && p2.isArray()) {
if (p2.count() > 1) {
return true;
}
return !contains(p2.getValue(Type.STRINGS),p1.getValue(Type.STRING));
}
}
return p1.compareTo(p2) != 0;
}

Fixed version (ground truth):
public static boolean notMatch(@Nonnull PropertyValue p1,@Nonnull PropertyValue p2){
  if (p1.getType().tag() != p2.getType().tag()) {
    return true;
  }
switch (p1.getType().tag()) {
case PropertyType.BINARY:
    if (p1.isArray() && !p2.isArray()) {
      if (p1.count() > 1) {
        return true;
      }
      return !contains(p1.getValue(Type.BINARIES),p2.getValue(Type.BINARY));
    }
  if (!p1.isArray() && p2.isArray()) {
    if (p2.count() > 1) {
      return true;
    }
    return !contains(p2.getValue(Type.BINARIES),p1.getValue(Type.BINARY));
  }
break;
default :
if (p1.isArray() && !p2.isArray()) {
if (p1.count() > 1) {
  return true;
}
return !contains(p1.getValue(Type.STRINGS),p2.getValue(Type.STRING));
}
if (!p1.isArray() && p2.isArray()) {
if (p2.count() > 1) {
return true;
}
return !contains(p2.getValue(Type.STRINGS),p1.getValue(Type.STRING));
}
}
return p1.compareTo(p2) != 0;
}
Program: 8827
Project: 8827
Buggy source:
@Nonnull public static PropertyValue newLong(Long value){
  return new PropertyStateValue(LongPropertyState.createLongProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newLong(@Nonnull Long value){
  return new PropertyStateValue(LongPropertyState.createLongProperty("String_Node_Str",value));
}
Program: 8828
Project: 8828
Buggy source:
@Nonnull public static PropertyValue newWeakReference(String value){
  return new PropertyStateValue(GenericPropertyState.weakreferenceProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newWeakReference(@Nonnull String value){
  return new PropertyStateValue(GenericPropertyState.weakreferenceProperty("String_Node_Str",value));
}
Program: 8829
Project: 8829
Buggy source:
public static boolean match(PropertyValue p1,PropertyValue p2){
  if (p1.getType().tag() != p2.getType().tag()) {
    return false;
  }
switch (p1.getType().tag()) {
case PropertyType.BINARY:
    if (p1.isArray() && !p2.isArray()) {
      return contains(p1.getValue(Type.BINARIES),p2.getValue(Type.BINARY));
    }
  if (!p1.isArray() && p2.isArray()) {
    return contains(p2.getValue(Type.BINARIES),p1.getValue(Type.BINARY));
  }
break;
default :
if (p1.isArray() && !p2.isArray()) {
return contains(p1.getValue(Type.STRINGS),p2.getValue(Type.STRING));
}
if (!p1.isArray() && p2.isArray()) {
return contains(p2.getValue(Type.STRINGS),p1.getValue(Type.STRING));
}
}
return p1.compareTo(p2) == 0;
}

Fixed version (ground truth):
public static boolean match(@Nonnull PropertyValue p1,@Nonnull PropertyValue p2){
  if (p1.getType().tag() != p2.getType().tag()) {
    return false;
  }
switch (p1.getType().tag()) {
case PropertyType.BINARY:
    if (p1.isArray() && !p2.isArray()) {
      return contains(p1.getValue(Type.BINARIES),p2.getValue(Type.BINARY));
    }
  if (!p1.isArray() && p2.isArray()) {
    return contains(p2.getValue(Type.BINARIES),p1.getValue(Type.BINARY));
  }
break;
default :
if (p1.isArray() && !p2.isArray()) {
return contains(p1.getValue(Type.STRINGS),p2.getValue(Type.STRING));
}
if (!p1.isArray() && p2.isArray()) {
return contains(p2.getValue(Type.STRINGS),p1.getValue(Type.STRING));
}
}
return p1.compareTo(p2) == 0;
}
Program: 8830
Project: 8830
Buggy source:
@Nonnull public static PropertyValue newReference(String value){
  return new PropertyStateValue(GenericPropertyState.referenceProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newReference(@Nonnull String value){
  return new PropertyStateValue(GenericPropertyState.referenceProperty("String_Node_Str",value));
}
Program: 8832
Project: 8832
Buggy source:
@Nonnull public static PropertyValue newDecimal(BigDecimal value){
  return new PropertyStateValue(DecimalPropertyState.decimalProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newDecimal(@Nonnull BigDecimal value){
  return new PropertyStateValue(DecimalPropertyState.decimalProperty("String_Node_Str",value));
}
Program: 8833
Project: 8833
Buggy source:
@Nonnull public static PropertyValue newString(Iterable<String> value){
  return new PropertyStateValue(MultiStringPropertyState.stringProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newString(@Nonnull Iterable<String> value){
  return new PropertyStateValue(MultiStringPropertyState.stringProperty("String_Node_Str",value));
}
Program: 8834
Project: 8834
Buggy source:
@Nonnull public static PropertyValue newDouble(Double value){
  return new PropertyStateValue(DoublePropertyState.doubleProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newDouble(@Nonnull Double value){
  return new PropertyStateValue(DoublePropertyState.doubleProperty("String_Node_Str",value));
}
Program: 8835
Project: 8835
Buggy source:
@Nonnull public static PropertyValue newName(Iterable<String> value){
  return new PropertyStateValue(MultiGenericPropertyState.nameProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newName(@Nonnull Iterable<String> value){
  return new PropertyStateValue(MultiGenericPropertyState.nameProperty("String_Node_Str",value));
}
Program: 8836
Project: 8836
Buggy source:
@Nonnull public static PropertyValue newUri(String value){
  return new PropertyStateValue(GenericPropertyState.uriProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newUri(@Nonnull String value){
  return new PropertyStateValue(GenericPropertyState.uriProperty("String_Node_Str",value));
}
Program: 8837
Project: 8837
Buggy source:
public static String getOakPath(String jcrPath,NamePathMapper mapper){
  if (mapper == null) {
    return jcrPath;
  }
  String p=mapper.getOakPath(jcrPath);
  if (p == null) {
    throw new IllegalArgumentException("String_Node_Str" + jcrPath);
  }
  return p;
}

Fixed version (ground truth):
public static String getOakPath(@Nonnull String jcrPath,@CheckForNull NamePathMapper mapper){
  if (mapper == null) {
    return jcrPath;
  }
  String p=mapper.getOakPath(jcrPath);
  if (p == null) {
    throw new IllegalArgumentException("String_Node_Str" + jcrPath);
  }
  return p;
}
Program: 8838
Project: 8838
Buggy source:
@CheckForNull public static PropertyState create(PropertyValue value){
  if (value == null) {
    return null;
  }
  if (value instanceof PropertyStateValue) {
    return ((PropertyStateValue)value).unwrap();
  }
  return null;
}

Fixed version (ground truth):
@CheckForNull public static PropertyState create(@CheckForNull PropertyValue value){
  if (value == null) {
    return null;
  }
  if (value instanceof PropertyStateValue) {
    return ((PropertyStateValue)value).unwrap();
  }
  return null;
}
Program: 8839
Project: 8839
Buggy source:
@Nonnull public static PropertyValue newDate(String value){
  return new PropertyStateValue(GenericPropertyState.dateProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newDate(@Nonnull String value){
  return new PropertyStateValue(GenericPropertyState.dateProperty("String_Node_Str",value));
}
Program: 8840
Project: 8840
Buggy source:
@Nonnull public static PropertyValue newPath(String value){
  return new PropertyStateValue(GenericPropertyState.pathProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newPath(@Nonnull String value){
  return new PropertyStateValue(GenericPropertyState.pathProperty("String_Node_Str",value));
}
Program: 8841
Project: 8841
Buggy source:
@Nonnull public static PropertyValue newBinary(Blob value){
  return new PropertyStateValue(BinaryPropertyState.binaryProperty("String_Node_Str",value));
}

Fixed version (ground truth):
@Nonnull public static PropertyValue newBinary(@Nonnull Blob value){
  return new PropertyStateValue(BinaryPropertyState.binaryProperty("String_Node_Str",value));
}
Program: 8842
Project: 8842
Buggy source:
/** 
 * Returns   {@code true} if the given {@code tree} is of type{@code mix:versionable};   {@code false} otherwise.
 * @param tree the tree to check.
 * @return whether the {@code tree} is versionable.
 * @throws RepositoryException if an error occurs while checking the nodetype of the tree.
 */
protected boolean isVersionable(@Nonnull Tree tree){
  return getNodeTypeManager().isNodeType(checkNotNull(tree),VersionConstants.MIX_VERSIONABLE);
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the given {@code tree} is of type{@code mix:versionable};   {@code false} otherwise.
 * @param tree the tree to check.
 * @return whether the {@code tree} is versionable.
 */
protected boolean isVersionable(@Nonnull Tree tree){
  return getNodeTypeManager().isNodeType(checkNotNull(tree),VersionConstants.MIX_VERSIONABLE);
}
Program: 8843
Project: 8843
Buggy source:
@Override public int getAction(NodeBuilder src,NodeBuilder dest,PropertyState prop) throws RepositoryException {
  return COPY;
}

Fixed version (ground truth):
@Override public int getAction(NodeBuilder src,NodeBuilder dest,PropertyState prop){
  return COPY;
}
Program: 8844
Project: 8844
Buggy source:
public void removeVersion(@Nonnull VersionStorage versionStorage,@Nonnull String versionHistoryOakRelPath,@Nonnull String oakVersionName) throws RepositoryException {
  Tree versionHistory=TreeUtil.getTree(versionStorage.getTree(),versionHistoryOakRelPath);
  if (!versionHistory.exists()) {
    throw new VersionException("String_Node_Str" + versionHistoryOakRelPath + "String_Node_Str");
  }
  Tree version=versionHistory.getChild(oakVersionName);
  if (!version.exists()) {
    throw new VersionException("String_Node_Str" + oakVersionName + "String_Node_Str");
  }
  version.remove();
  try {
    sessionDelegate.commit(versionStorage.getRoot());
    refresh();
  }
 catch (  CommitFailedException e) {
    versionStorage.refresh();
    throw e.asRepositoryException();
  }
}

Fixed version (ground truth):
public void removeVersion(@Nonnull VersionStorage versionStorage,@Nonnull String versionHistoryOakRelPath,@Nonnull String oakVersionName) throws RepositoryException {
  Tree versionHistory=TreeUtil.getTree(versionStorage.getTree(),versionHistoryOakRelPath);
  if (versionHistory == null || !versionHistory.exists()) {
    throw new VersionException("String_Node_Str" + versionHistoryOakRelPath + "String_Node_Str");
  }
  Tree version=versionHistory.getChild(oakVersionName);
  if (!version.exists()) {
    throw new VersionException("String_Node_Str" + oakVersionName + "String_Node_Str");
  }
  version.remove();
  try {
    sessionDelegate.commit(versionStorage.getRoot());
    refresh();
  }
 catch (  CommitFailedException e) {
    versionStorage.refresh();
    throw e.asRepositoryException();
  }
}
Program: 8845
Project: 8845
Buggy source:
/** 
 * Performs a checkin on a versionable tree and returns the tree that represents the created version.
 * @param versionable the versionable node to check in.
 * @return the created version.
 * @throws InvalidItemStateException if the current root has pendingchanges.
 * @throws UnsupportedRepositoryOperationException if the versionable tree isn't actually versionable.
 * @throws RepositoryException       if an error occurs while checking thenode type of the tree.
 */
@Nonnull public Tree checkin(@Nonnull Tree versionable) throws RepositoryException, InvalidItemStateException, UnsupportedRepositoryOperationException {
  if (sessionDelegate.hasPendingChanges()) {
    throw new InvalidItemStateException("String_Node_Str" + "String_Node_Str");
  }
  if (!isVersionable(versionable)) {
    throw new UnsupportedRepositoryOperationException(versionable.getPath() + "String_Node_Str");
  }
  if (isCheckedOut(versionable)) {
    versionable.setProperty(JCR_ISCHECKEDOUT,Boolean.FALSE,Type.BOOLEAN);
    Tree baseVersion=getBaseVersion(versionable);
    PropertyState created=baseVersion.getProperty(JCR_CREATED);
    if (created != null) {
      long c=ISO8601.parse(created.getValue(Type.DATE)).getTimeInMillis();
      while (System.currentTimeMillis() == c) {
      }
    }
    try {
      sessionDelegate.commit();
      refresh();
    }
 catch (    CommitFailedException e) {
      sessionDelegate.refresh(true);
      throw e.asRepositoryException();
    }
  }
  return getBaseVersion(getWorkspaceRoot().getTree(versionable.getPath()));
}

Fixed version (ground truth):
/** 
 * Performs a checkin on a versionable tree and returns the tree that represents the created version.
 * @param versionable the versionable node to check in.
 * @return the created version.
 * @throws InvalidItemStateException if the current root has pendingchanges.
 * @throws UnsupportedRepositoryOperationException if the versionable tree isn't actually versionable.
 * @throws RepositoryException       if an error occurs while checking thenode type of the tree.
 */
@Nonnull public Tree checkin(@Nonnull Tree versionable) throws RepositoryException, InvalidItemStateException, UnsupportedRepositoryOperationException {
  if (sessionDelegate.hasPendingChanges()) {
    throw new InvalidItemStateException("String_Node_Str" + "String_Node_Str");
  }
  if (!isVersionable(versionable)) {
    throw new UnsupportedRepositoryOperationException(versionable.getPath() + "String_Node_Str");
  }
  if (isCheckedOut(versionable)) {
    Tree baseVersion=getExistingBaseVersion(versionable);
    versionable.setProperty(JCR_ISCHECKEDOUT,Boolean.FALSE,Type.BOOLEAN);
    PropertyState created=baseVersion.getProperty(JCR_CREATED);
    if (created != null) {
      long c=ISO8601.parse(created.getValue(Type.DATE)).getTimeInMillis();
      while (System.currentTimeMillis() == c) {
      }
    }
    try {
      sessionDelegate.commit();
      refresh();
    }
 catch (    CommitFailedException e) {
      sessionDelegate.refresh(true);
      throw e.asRepositoryException();
    }
  }
  return getExistingBaseVersion(getWorkspaceRoot().getTree(versionable.getPath()));
}