nus-yam/ex-repair huggingface dataset:
Program: 146800
Project: 146800
Buggy source:
private static void getTriggers(XPathExpression x,Vector<TreeReference> v,TreeReference contextRef){
  if (x instanceof XPathPathExpr) {
    TreeReference ref=((XPathPathExpr)x).getReference();
    TreeReference contextualized=ref;
    if (contextRef != null) {
      contextualized=ref.contextualize(contextRef);
    }
    if (!v.contains(contextualized)) {
      v.addElement(contextualized);
    }
    for (int i=0; i < ref.size(); i++) {
      Vector<XPathExpression> predicates=ref.getPredicate(i);
      if (predicates == null) {
        continue;
      }
      if (!ref.isAbsolute()) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      TreeReference predicateContext=ref.getSubReference(i);
      for (      XPathExpression predicate : predicates) {
        getTriggers(predicate,v,predicateContext);
      }
    }
  }
 else   if (x instanceof XPathBinaryOpExpr) {
    getTriggers(((XPathBinaryOpExpr)x).a,v,contextRef);
    getTriggers(((XPathBinaryOpExpr)x).b,v,contextRef);
  }
 else   if (x instanceof XPathUnaryOpExpr) {
    getTriggers(((XPathUnaryOpExpr)x).a,v,contextRef);
  }
 else   if (x instanceof XPathFuncExpr) {
    XPathFuncExpr fx=(XPathFuncExpr)x;
    for (int i=0; i < fx.args.length; i++)     getTriggers(fx.args[i],v,contextRef);
  }
}

Fixed version (ground truth):
private static void getTriggers(XPathExpression x,Vector<TreeReference> v,TreeReference contextRef){
  if (x instanceof XPathPathExpr) {
    TreeReference ref=((XPathPathExpr)x).getReference();
    TreeReference contextualized=ref;
    if (contextRef != null) {
      contextualized=ref.contextualize(contextRef);
    }
    if (contextualized.hasPredicates()) {
      contextualized=contextualized.removePredicates();
    }
    if (!v.contains(contextualized)) {
      v.addElement(contextualized);
    }
    for (int i=0; i < ref.size(); i++) {
      Vector<XPathExpression> predicates=ref.getPredicate(i);
      if (predicates == null) {
        continue;
      }
      if (!ref.isAbsolute()) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      TreeReference predicateContext=ref.getSubReference(i);
      for (      XPathExpression predicate : predicates) {
        getTriggers(predicate,v,predicateContext);
      }
    }
  }
 else   if (x instanceof XPathBinaryOpExpr) {
    getTriggers(((XPathBinaryOpExpr)x).a,v,contextRef);
    getTriggers(((XPathBinaryOpExpr)x).b,v,contextRef);
  }
 else   if (x instanceof XPathUnaryOpExpr) {
    getTriggers(((XPathUnaryOpExpr)x).a,v,contextRef);
  }
 else   if (x instanceof XPathFuncExpr) {
    XPathFuncExpr fx=(XPathFuncExpr)x;
    for (int i=0; i < fx.args.length; i++)     getTriggers(fx.args[i],v,contextRef);
  }
}
Program: 146801
Project: 146801
Buggy source:
private boolean command(String command) throws BadPlaybackException {
  environment.recordAction(new Action(new Command(command)));
  if ("String_Node_Str".equalsIgnoreCase(command)) {
    fec.stepToNextEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    forward=false;
    fec.stepToPreviousEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    out.println("String_Node_Str");
    return true;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command) && fec.getModel().getEvent() == FormEntryController.EVENT_END_OF_FORM) {
    out.println("String_Node_Str");
    return true;
  }
 else {
    badInput(command,"String_Node_Str" + command);
    return false;
  }
}

Fixed version (ground truth):
private boolean command(String command) throws BadPlaybackException {
  environment.recordAction(new Action(new Command(command)));
  if ("String_Node_Str".equalsIgnoreCase(command)) {
    fec.stepToNextEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    forward=false;
    fec.stepToPreviousEvent();
    return false;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    out.println("String_Node_Str");
    return true;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command) && fec.getModel().getEvent() == FormEntryController.EVENT_END_OF_FORM) {
    out.println("String_Node_Str");
    return true;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(command)) {
    printInstance(out,fec.getModel().getForm().getInstance());
    return false;
  }
 else {
    badInput(command,"String_Node_Str" + command);
    return false;
  }
}
Program: 146802
Project: 146802
Buggy source:
/** 
 */
private static void init(){
  if (globalLocalizer == null) {
    globalLocalizer=new Localizer(true,true);
  }
}

Fixed version (ground truth):
/** 
 */
private static void init(){
  if (globalLocalizer == null) {
    globalLocalizer=new Localizer(true,false);
  }
}
Program: 146803
Project: 146803
Buggy source:
/** 
 * Retrieve the localized text for a text handle in the given locale. If no mapping is found initially, then, depending on enabled fallback modes, other places will be searched until a mapping is found. <p> The search order is thus: 1) Specified locale, specified text form 2) Specified locale, default text form 3) Default locale, specified text form 4) Default locale, default text form <p> (1) and (3) are only searched if a text form ('long', 'short', etc.) is specified. If a text form is specified, (2) and (4) are only searched if default-form-fallback mode is enabled. (3) and (4) are only searched if default-locale-fallback mode is enabled. It is not an error in this situation if no default locale is set; (3) and (4) will simply not be searched.
 * @param textID Text handle (text ID appended with optional text form). Must not be null.
 * @param locale Locale. Must be defined and not null.
 * @return Localized text. If no text is found after using all fallbacks, return null.
 * @throws UnregisteredLocaleException If the locale is not defined or null.
 * @throws NullPointerException if textID is null
 */
public String getText(String textID,String locale){
  String text=getRawText(locale,textID);
  if (text == null && fallbackDefaultForm && textID.indexOf("String_Node_Str") != -1)   text=getRawText(locale,textID.substring(0,textID.indexOf("String_Node_Str")));
  return text;
}

Fixed version (ground truth):
/** 
 * Retrieve the localized text for a text handle in the given locale. If no mapping is found initially, then, depending on enabled fallback modes, other places will be searched until a mapping is found. <p> The search order is thus: 1) Specified locale, specified text form 2) Specified locale, default text form 3) Default locale, specified text form 4) Default locale, default text form <p> (1) and (3) are only searched if a text form ('long', 'short', etc.) is specified. If a text form is specified, (2) and (4) are only searched if default-form-fallback mode is enabled. (3) and (4) are only searched if default-locale-fallback mode is enabled. It is not an error in this situation if no default locale is set; (3) and (4) will simply not be searched.
 * @param textID Text handle (text ID appended with optional text form). Must not be null.
 * @param locale Locale. Must be defined and not null.
 * @return Localized text. If no text is found after using all fallbacks, return null.
 * @throws UnregisteredLocaleException If the locale is not defined or null.
 * @throws NullPointerException if textID is null
 */
public String getText(String textID,String locale){
  String text=getRawText(locale,textID);
  if (text == null && fallbackDefaultForm && textID.indexOf("String_Node_Str") != -1)   text=getRawText(locale,textID.substring(0,textID.indexOf("String_Node_Str")));
  if (text == null && fallbackDefaultLocale && !locale.equals(defaultLocale) && defaultLocale != null && fallbackDefaultForm)   text=getText(textID,defaultLocale);
  return text;
}
Program: 146804
Project: 146804
Buggy source:
public User getUser(){
  if (loggedInUserID != null) {
    return (User)((IStorageUtilityIndexed)StorageManager.getStorage(User.STORAGE_KEY)).getRecordForValue(User.META_UID,loggedInUserID);
  }
 else   if (loggedInUserID == User.DEMO_USER) {
    return User.FactoryDemoUser();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public User getUser(){
  if (User.DEMO_USER.equals(loggedInUserID)) {
    return User.FactoryDemoUser();
  }
 else   if (loggedInUserID != null) {
    return (User)((IStorageUtilityIndexed)StorageManager.getStorage(User.STORAGE_KEY)).getRecordForValue(User.META_UID,loggedInUserID);
  }
 else {
    return null;
  }
}
Program: 146806
Project: 146806
Buggy source:
public void purge(){
  this.purger.purge(logIDs);
}

Fixed version (ground truth):
public void purge(){
  if (purger != null) {
    this.purger.purge(logIDs);
  }
}
Program: 146807
Project: 146807
Buggy source:
public void serializeLogs(StreamLogSerializer serializer,int limit) throws IOException {
  if (storageBroken) {
    return;
  }
  ;
  int count=0;
  IStorageIterator li;
synchronized (logStorage) {
    li=logStorage.iterate();
  }
  while (li.hasMore() && count < limit) {
    int id=li.peekID();
    LogEntry log=(LogEntry)li.nextRecord();
    serializer.serializeLog(id,log);
    count++;
  }
  serializer.setPurger(new StreamLogSerializer.Purger(){
    public void purge(    SortedIntSet IDs){
      clearLogs(IDs);
    }
  }
);
}

Fixed version (ground truth):
public void serializeLogs(StreamLogSerializer serializer,int limit) throws IOException {
  if (storageBroken) {
    return;
  }
  ;
  Vector<Integer> logIds=new Vector<Integer>();
  Object lock=logStorage.getAccessLock();
synchronized (lock) {
    int count=0;
    IStorageIterator li=logStorage.iterate();
    while (li.hasMore() && count < limit) {
      int id=li.nextID();
      logIds.addElement(DataUtil.integer(id));
      count++;
    }
  }
  System.out.println("String_Node_Str" + logIds.size() + "String_Node_Str");
  for (  Integer logId : logIds) {
    LogEntry log=(LogEntry)logStorage.read(logId.intValue());
    if (log != null) {
      serializer.serializeLog(logId.intValue(),log);
    }
  }
  serializer.setPurger(new StreamLogSerializer.Purger(){
    public void purge(    SortedIntSet IDs){
      clearLogs(IDs);
    }
  }
);
}
Program: 146808
Project: 146808
Buggy source:
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
 else   if (o instanceof TreeReference) {
    TreeReference ref=(TreeReference)o;
    if (this.refLevel == ref.refLevel && this.size() == ref.size()) {
      for (int i=0; i < this.size(); i++) {
        String nameA=this.getName(i);
        String nameB=ref.getName(i);
        int multA=this.getMultiplicity(i);
        int multB=ref.getMultiplicity(i);
        if (!nameA.equals(nameB)) {
          return false;
        }
 else         if (multA != multB) {
          if (i == 0 && (multA == 0 || multA == INDEX_UNBOUND) && (multB == 0 || multB == INDEX_UNBOUND)) {
          }
 else {
            return false;
          }
        }
      }
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
 else   if (o instanceof TreeReference) {
    TreeReference ref=(TreeReference)o;
    if (this.refLevel == ref.refLevel && this.size() == ref.size()) {
      for (int i=0; i < this.size(); i++) {
        String nameA=this.getName(i);
        String nameB=ref.getName(i);
        int multA=this.getMultiplicity(i);
        int multB=ref.getMultiplicity(i);
        Vector<XPathExpression> predA=this.getPredicate(i);
        Vector<XPathExpression> predB=ref.getPredicate(i);
        if (!nameA.equals(nameB)) {
          return false;
        }
 else         if (multA != multB) {
          if (i == 0 && (multA == 0 || multA == INDEX_UNBOUND) && (multB == 0 || multB == INDEX_UNBOUND)) {
          }
 else {
            return false;
          }
        }
 else         if (predA != null && predB != null) {
          if (predA.size() != predB.size()) {
            return false;
          }
          for (int j=0; j < predA.size(); ++j) {
            if (!predA.elementAt(j).equals(predB.elementAt(j))) {
              return false;
            }
          }
        }
 else         if ((predA == null && predB != null) || (predA != null && predB == null)) {
          return false;
        }
      }
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}
Program: 146811
Project: 146811
Buggy source:
private void startOtaProcess(){
  if (authenticator == null) {
    authAttempts=0;
    getCredentials();
  }
 else {
    authAttempts=1;
    listener.refreshView();
    tryDownload(AuthenticatedHttpTransportMessage.AuthenticatedHttpRequest(restoreURI,authenticator,new SecurityFailureListener(){
      public void onSecurityException(      SecurityException e){
        PeriodicEvent.schedule(new PermissionsEvent());
      }
    }
));
  }
}

Fixed version (ground truth):
private void startOtaProcess(){
  if (authenticator == null) {
    getCredentials();
  }
 else {
    listener.refreshView();
    tryDownload(AuthenticatedHttpTransportMessage.AuthenticatedHttpRequest(restoreURI,authenticator,new SecurityFailureListener(){
      public void onSecurityException(      SecurityException e){
        PeriodicEvent.schedule(new PermissionsEvent());
      }
    }
));
  }
}
Program: 146813
Project: 146813
Buggy source:
/** 
 * @return The indices of which fields should be used for sorting and their order
 */
public int[] getSortOrder(){
  Vector<Integer> indices=new Vector<Integer>();
  outer:   for (int i=0; i < fields.length; ++i) {
    int order=fields[i].getSortOrder();
    if (order < 1) {
      continue;
    }
    for (int j=0; j < indices.size(); ++j) {
      if (indices.size() > 0 || order < fields[indices.elementAt(j).intValue()].getSortOrder()) {
        indices.insertElementAt(new Integer(i),j);
        continue outer;
      }
    }
    indices.addElement(new Integer(i));
    continue;
  }
  if (indices.size() == 0) {
    return new int[]{};
  }
 else {
    int[] ret=new int[indices.size()];
    for (int i=0; i < ret.length; ++i) {
      ret[i]=indices.elementAt(i).intValue();
    }
    return ret;
  }
}

Fixed version (ground truth):
/** 
 * @return The indices of which fields should be used for sorting and their order
 */
public int[] getSortOrder(){
  Vector<Integer> indices=new Vector<Integer>();
  outer:   for (int i=0; i < fields.length; ++i) {
    int order=fields[i].getSortOrder();
    if (order < 1) {
      continue;
    }
    for (int j=0; j < indices.size(); ++j) {
      if (order < fields[indices.elementAt(j).intValue()].getSortOrder()) {
        indices.insertElementAt(new Integer(i),j);
        continue outer;
      }
    }
    indices.addElement(new Integer(i));
    continue;
  }
  if (indices.size() == 0) {
    return new int[]{};
  }
 else {
    int[] ret=new int[indices.size()];
    for (int i=0; i < ret.length; ++i) {
      ret[i]=indices.elementAt(i).intValue();
    }
    return ret;
  }
}
Program: 146814
Project: 146814
Buggy source:
public int read() throws IOException {
  if (position == count) {
    fillBuffer();
  }
  if (count == -1) {
    return -1;
  }
  return buffer[position++];
}

Fixed version (ground truth):
public int read() throws IOException {
  if (position == count) {
    fillBuffer();
  }
  if (count == -1) {
    return -1;
  }
  return buffer[position++] & 0xFF;
}
Program: 146815
Project: 146815
Buggy source:
public int available() throws IOException {
  return in.available() + (count - position);
}

Fixed version (ground truth):
public int available() throws IOException {
  if (count == -1) {
    return 0;
  }
  return in.available() + (count - position);
}
Program: 146816
Project: 146816
Buggy source:
public static boolean arraysEqual(Object[] array1,Object[] array2){
  if (array1.length != array2.length) {
    return false;
  }
  boolean retVal=true;
  for (int i=0; i < array1.length; ++i) {
    if (!array1[i].equals(array2[i])) {
      retVal=false;
    }
  }
  return retVal;
}

Fixed version (ground truth):
public static boolean arraysEqual(byte[] array1,byte[] array2){
  if (array1.length != array2.length) {
    return false;
  }
  boolean retVal=true;
  for (int i=0; i < array1.length; ++i) {
    if (array1[i] != array2[i]) {
      retVal=false;
    }
  }
  return retVal;
}
Program: 146817
Project: 146817
Buggy source:
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      newRef.data.setElementAt(newRef.data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}

Fixed version (ground truth):
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  if (this.isAbsolute()) {
    if (this.getInstanceName() == null) {
      if (contextRef.getInstanceName() != null) {
        return this.clone();
      }
    }
 else     if (!this.getInstanceName().equals(contextRef.getInstanceName())) {
      return this.clone();
    }
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      newRef.data.setElementAt(newRef.data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}
Program: 146818
Project: 146818
Buggy source:
private InstanceInitializationFactory createIIF(){
  return new MockupProviderFactory(mockup.getInstances());
}

Fixed version (ground truth):
private InstanceInitializationFactory createIIF(){
  return new MockupProviderFactory(mockup == null ? new Hashtable() : mockup.getInstances());
}
Program: 146820
Project: 146820
Buggy source:
protected void serializeLog(LogEntry log) throws IOException {
  o.startTag(ns,"String_Node_Str");
  o.attribute(null,"String_Node_Str",DateUtils.formatDateTime(log.getTime(),DateUtils.FORMAT_ISO8601));
  o.startTag(ns,"String_Node_Str");
  o.text(log.getType());
  o.endTag(ns,"String_Node_Str");
  o.startTag(ns,"String_Node_Str");
  o.text(log.getMessage());
  o.endTag(ns,"String_Node_Str");
  o.endTag(ns,"String_Node_Str");
}

Fixed version (ground truth):
protected void serializeLog(LogEntry log) throws IOException {
  o.startTag(ns,"String_Node_Str");
  try {
    o.attribute(null,"String_Node_Str",DateUtils.formatDateTime(log.getTime(),DateUtils.FORMAT_ISO8601));
    o.startTag(ns,"String_Node_Str");
    try {
      o.text(log.getType());
    }
  finally {
      o.endTag(ns,"String_Node_Str");
    }
    o.startTag(ns,"String_Node_Str");
    try {
      o.text(log.getMessage());
    }
  finally {
      o.endTag(ns,"String_Node_Str");
    }
  }
  finally {
    o.endTag(ns,"String_Node_Str");
  }
}
Program: 146821
Project: 146821
Buggy source:
/** 
 * Writes the form definition object to the supplied stream.
 * @param dos - the stream to write to.
 * @throws IOException
 */
public void writeExternal(DataOutputStream dos) throws IOException {
  ExtUtil.writeNumeric(dos,getID());
  ExtUtil.writeString(dos,ExtUtil.emptyIfNull(getName()));
  ExtUtil.write(dos,new ExtWrapNullable(getTitle()));
  ExtUtil.write(dos,new ExtWrapListPoly(getChildren()));
  ExtUtil.write(dos,getMainInstance());
  ExtUtil.write(dos,new ExtWrapNullable(localizer));
  Vector conditions=new Vector();
  Vector recalcs=new Vector();
  for (int i=0; i < triggerables.size(); i++) {
    Triggerable t=(Triggerable)triggerables.elementAt(i);
    if (t instanceof Condition) {
      conditions.addElement(t);
    }
 else     if (t instanceof Recalculate) {
      recalcs.addElement(t);
    }
  }
  ExtUtil.write(dos,new ExtWrapList(conditions));
  ExtUtil.write(dos,new ExtWrapList(recalcs));
  ExtUtil.write(dos,new ExtWrapListPoly(outputFragments));
  ExtUtil.write(dos,new ExtWrapMap(submissionProfiles));
  ExtUtil.write(dos,new ExtWrapMap(formInstances,new ExtWrapTagged()));
  ExtUtil.write(dos,new ExtWrapMap(eventListeners,new ExtWrapListPoly()));
}

Fixed version (ground truth):
/** 
 * Writes the form definition object to the supplied stream.
 * @param dos - the stream to write to.
 * @throws IOException
 */
public void writeExternal(DataOutputStream dos) throws IOException {
  ExtUtil.writeNumeric(dos,getID());
  ExtUtil.writeString(dos,ExtUtil.emptyIfNull(getName()));
  ExtUtil.write(dos,new ExtWrapNullable(getTitle()));
  ExtUtil.write(dos,new ExtWrapListPoly(getChildren()));
  ExtUtil.write(dos,getMainInstance());
  ExtUtil.write(dos,new ExtWrapNullable(localizer));
  Vector conditions=new Vector();
  Vector recalcs=new Vector();
  for (int i=0; i < triggerables.size(); i++) {
    Triggerable t=(Triggerable)triggerables.elementAt(i);
    if (t instanceof Condition) {
      conditions.addElement(t);
    }
 else     if (t instanceof Recalculate) {
      recalcs.addElement(t);
    }
  }
  ExtUtil.write(dos,new ExtWrapList(conditions));
  ExtUtil.write(dos,new ExtWrapList(recalcs));
  ExtUtil.write(dos,new ExtWrapListPoly(outputFragments));
  ExtUtil.write(dos,new ExtWrapMap(submissionProfiles));
  ExtUtil.write(dos,new ExtWrapMap(formInstances,new ExtWrapTagged()));
  ExtUtil.write(dos,new ExtWrapMap(eventListeners,new ExtWrapListPoly()));
  ExtUtil.write(dos,new ExtWrapListPoly(extensions));
}
Program: 146823
Project: 146823
Buggy source:
/** 
 */
public FormDef(){
  setID(-1);
  setChildren(null);
  triggerables=new Vector();
  triggerablesInOrder=true;
  triggerIndex=new Hashtable();
  setEvaluationContext(new EvaluationContext(null));
  outputFragments=new Vector();
  submissionProfiles=new Hashtable<String,SubmissionProfile>();
  formInstances=new Hashtable<String,DataInstance>();
  eventListeners=new Hashtable<String,Vector<Action>>();
}

Fixed version (ground truth):
/** 
 */
public FormDef(){
  setID(-1);
  setChildren(null);
  triggerables=new Vector();
  triggerablesInOrder=true;
  triggerIndex=new Hashtable();
  setEvaluationContext(new EvaluationContext(null));
  outputFragments=new Vector();
  submissionProfiles=new Hashtable<String,SubmissionProfile>();
  formInstances=new Hashtable<String,DataInstance>();
  eventListeners=new Hashtable<String,Vector<Action>>();
  extensions=new Vector<XFormExtension>();
}
Program: 146824
Project: 146824
Buggy source:
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      data.setElementAt(data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}

Fixed version (ground truth):
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      newRef.data.setElementAt(newRef.data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}
Program: 146825
Project: 146825
Buggy source:
public void clearCaches(){
}

Fixed version (ground truth):
public void clearCaches(){
  expireReferenceCache();
}
Program: 146826
Project: 146826
Buggy source:
public DataModelSerializer(OutputStream stream,InstanceInitializationFactory factory) throws IOException {
  serializer=new KXmlSerializer();
  serializer.setOutput(stream,"String_Node_Str");
  this.factory=factory;
}

Fixed version (ground truth):
public DataModelSerializer(KXmlSerializer serializer){
  this.serializer=serializer;
}
Program: 146827
Project: 146827
Buggy source:
public static void main(String[] args){
  if (args.length == 0) {
    System.out.println("String_Node_Str");
  }
  if (args.length == 1) {
    XFormPlayer xfp=new XFormPlayer(System.in,System.out);
    try {
      xfp.start(args[0]);
      Session s=xfp.environment.getSessionRecording();
    }
 catch (    FileNotFoundException e) {
      System.out.println("String_Node_Str" + args[0] + "String_Node_Str");
    }
  }
 else   if (args.length == 2) {
    XFormPlayer xfp=new XFormPlayer(System.in,System.out);
    try {
      xfp.start(args[0]);
      Session s=xfp.environment.getSessionRecording();
      xfp=new XFormPlayer(System.in,System.out);
      xfp.start(args[1],s);
    }
 catch (    FileNotFoundException e) {
      System.out.println("String_Node_Str" + args[0] + "String_Node_Str");
    }
  }
  System.exit(0);
}

Fixed version (ground truth):
public static void main(String[] args){
  if (args.length == 0) {
    System.out.println("String_Node_Str");
  }
  if (args.length == 1) {
    XFormPlayer xfp=new XFormPlayer(System.in,System.out,null);
    try {
      xfp.start(args[0]);
      Session s=xfp.environment.getSessionRecording();
    }
 catch (    FileNotFoundException e) {
      System.out.println("String_Node_Str" + args[0] + "String_Node_Str");
    }
  }
 else {
    try {
      if (args[0].equals("String_Node_Str")) {
        Mockup m=getMockup(args[1]);
        XFormPlayer xfp=new XFormPlayer(System.in,System.out,m);
        xfp.start(args[2]);
        Session s=xfp.environment.getSessionRecording();
        MockupEditor e=m.getEditor();
        e.addSession(s);
        e.commit();
        updateMockup(args[1],m);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  System.exit(0);
}
Program: 146828
Project: 146828
Buggy source:
private InstanceInitializationFactory createIIF(){
  return null;
}

Fixed version (ground truth):
private InstanceInitializationFactory createIIF(){
  return new MockupProviderFactory(mockup.getInstances());
}
Program: 146829
Project: 146829
Buggy source:
public XFormEnvironment(FormDef form,Session session){
  this.form=form;
  this.session=session;
  recording=false;
}

Fixed version (ground truth):
public XFormEnvironment(FormDef form,Mockup mockup){
  this(form);
  this.mockup=mockup;
}
Program: 146830
Project: 146830
Buggy source:
public Object eval(Object[] args,EvaluationContext ec){
  return today;
}

Fixed version (ground truth):
public Object eval(Object[] args,EvaluationContext ec){
  if (mockup != null && mockup.getDate() != null) {
    return mockup.getDate();
  }
 else {
    return new Date();
  }
}
Program: 146831
Project: 146831
Buggy source:
public XFormPlayer(InputStream in,PrintStream out){
  this.in=in;
  this.out=out;
}

Fixed version (ground truth):
public XFormPlayer(InputStream in,PrintStream out,Mockup mockup){
  this.in=in;
  this.out=out;
  this.mockup=mockup;
}
Program: 146832
Project: 146832
Buggy source:
public void start(FormDef form){
  this.environment=new XFormEnvironment(form);
  fec=environment.setup();
  reader=new BufferedReader(new InputStreamReader(in));
  processLoop();
}

Fixed version (ground truth):
public void start(FormDef form){
  this.environment=new XFormEnvironment(form,mockup);
  fec=environment.setup();
  reader=new BufferedReader(new InputStreamReader(in));
  processLoop();
}
Program: 146833
Project: 146833
Buggy source:
public Hashtable<String,DataInstance> getInstances(){
  return instances;
}

Fixed version (ground truth):
public Hashtable<String,FormInstance> getInstances(){
  return instances;
}
Program: 146834
Project: 146834
Buggy source:
public void addSession(Session session){
  this.sessions.addElement(session);
}

Fixed version (ground truth):
public void addSession(Session s){
  m.sessions.add(s);
}
Program: 146835
Project: 146835
Buggy source:
public Mockup(){
}

Fixed version (ground truth):
public Mockup(){
  sessions=new Vector<Session>();
  instances=new Hashtable<String,FormInstance>();
}
Program: 146836
Project: 146836
Buggy source:
public Object getValue(){
  return gp;
}

Fixed version (ground truth):
public double[] getValue(){
  return gp;
}
Program: 146837
Project: 146837
Buggy source:
public static XPathPathExpr getPathExpr(String nodeset){
  XPathExpression path;
  boolean validNonPathExpr=false;
  try {
    path=XPathParseTool.parseXPath(nodeset);
    if (!(path instanceof XPathPathExpr)) {
      validNonPathExpr=true;
      throw new XPathSyntaxException();
    }
  }
 catch (  XPathSyntaxException xse) {
    if (validNonPathExpr) {
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str");
    }
 else {
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str");
    }
  }
  return (XPathPathExpr)path;
}

Fixed version (ground truth):
public static XPathPathExpr getPathExpr(String nodeset){
  XPathExpression path;
  boolean validNonPathExpr=false;
  try {
    path=XPathParseTool.parseXPath(nodeset);
    if (!(path instanceof XPathPathExpr)) {
      validNonPathExpr=true;
      throw new XPathSyntaxException();
    }
  }
 catch (  XPathSyntaxException xse) {
    if (validNonPathExpr) {
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str"+ xse.getMessage());
    }
 else {
      xse.printStackTrace();
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str"+ (xse.getMessage() == null ? "String_Node_Str" : "String_Node_Str" + xse.getMessage()));
    }
  }
  return (XPathPathExpr)path;
}
Program: 146838
Project: 146838
Buggy source:
private boolean handled(Object a,Object b,Object sentinal,Vector<Object> pivots) throws UnpivotableExpressionException {
  if (sentinal == a) {
    if (b == null) {
      throw new UnpivotableExpressionException();
    }
 else     if (sentinal == b) {
      throw new UnpivotableExpressionException();
    }
 else {
      Double val=null;
      if (b instanceof Double) {
        val=(Double)b;
      }
 else {
        if (b instanceof Integer) {
          val=new Double(((Integer)b).doubleValue());
        }
        if (b instanceof Long) {
          val=new Double(((Long)b).doubleValue());
        }
        if (b instanceof Float) {
          val=new Double(((Float)b).doubleValue());
        }
        if (b instanceof Short) {
          val=new Double(((Short)b).shortValue());
        }
        if (b instanceof Byte) {
          val=new Double(((Byte)b).byteValue());
        }
 else {
          throw new UnpivotableExpressionException("String_Node_Str" + b);
        }
      }
      pivots.addElement(new CmpPivot(val.doubleValue(),op));
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean handled(Object a,Object b,Object sentinal,Vector<Object> pivots) throws UnpivotableExpressionException {
  if (sentinal == a) {
    if (b == null) {
      throw new UnpivotableExpressionException();
    }
 else     if (sentinal == b) {
      throw new UnpivotableExpressionException();
    }
 else {
      Double val=null;
      if (b instanceof Double) {
        val=(Double)b;
      }
 else {
        if (b instanceof Integer) {
          val=new Double(((Integer)b).doubleValue());
        }
 else         if (b instanceof Long) {
          val=new Double(((Long)b).doubleValue());
        }
 else         if (b instanceof Float) {
          val=new Double(((Float)b).doubleValue());
        }
 else         if (b instanceof Short) {
          val=new Double(((Short)b).shortValue());
        }
 else         if (b instanceof Byte) {
          val=new Double(((Byte)b).byteValue());
        }
 else {
          if (b instanceof String) {
            try {
              val=(Double)new DecimalData().cast(new UncastData((String)b)).getValue();
            }
 catch (            Exception e) {
              throw new UnpivotableExpressionException("String_Node_Str" + b);
            }
          }
 else {
            throw new UnpivotableExpressionException("String_Node_Str" + b);
          }
        }
      }
      pivots.addElement(new CmpPivot(val.doubleValue(),op));
      return true;
    }
  }
  return false;
}
Program: 146839
Project: 146839
Buggy source:
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  Object aval=a.pivot(model,evalContext,pivots,sentinal);
  Object bval=b.pivot(model,evalContext,pivots,sentinal);
  if (handled(aval,bval,sentinal,pivots) || handled(bval,aval,sentinal,pivots)) {
    return null;
  }
  return this.eval(model,evalContext);
}

Fixed version (ground truth):
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  Object aval=a.pivot(model,evalContext,pivots,sentinal);
  Object bval=b.pivot(model,evalContext,pivots,sentinal);
  if (bval instanceof XPathNodeset) {
    bval=((XPathNodeset)bval).unpack();
  }
  if (handled(aval,bval,sentinal,pivots) || handled(bval,aval,sentinal,pivots)) {
    return null;
  }
  return this.eval(model,evalContext);
}
Program: 146840
Project: 146840
Buggy source:
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  TreeReference ref=this.getReference();
  if (ref.equals(sentinal) || (ref.getRefLevel() == 0)) {
    return sentinal;
  }
 else {
    return this.eval(model,evalContext);
  }
}

Fixed version (ground truth):
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  TreeReference ref=this.getReference();
  if (ref.equals(sentinal) || (ref.getRefLevel() == 0)) {
    return sentinal;
  }
 else {
    for (int i=0; i < ref.size(); ++i) {
      if (ref.getPredicate(i) != null && ref.getPredicate(i).size() > 0) {
        throw new UnpivotableExpressionException("String_Node_Str" + ref.toString(true) + "String_Node_Str");
      }
    }
    return this.eval(model,evalContext);
  }
}
Program: 146842
Project: 146842
Buggy source:
private static void parseBalanced(ASTNode node,SubNodeFactory snf,int lToken,int rToken) throws XPathSyntaxException {
  if (node instanceof ASTNodeAbstractExpr) {
    ASTNodeAbstractExpr absNode=(ASTNodeAbstractExpr)node;
    int i=0;
    while (i < absNode.content.size()) {
      int type=absNode.getTokenType(i);
      if (type == rToken) {
        throw new XPathSyntaxException();
      }
 else       if (type == lToken) {
        int j=absNode.indexOfBalanced(i,rToken,lToken,rToken);
        if (j == -1) {
          throw new XPathSyntaxException();
        }
        absNode.condense(snf.newNode(absNode.extract(i + 1,j)),i,j + 1);
      }
      i++;
    }
  }
  for (Enumeration e=node.getChildren().elements(); e.hasMoreElements(); ) {
    parseBalanced((ASTNode)e.nextElement(),snf,lToken,rToken);
  }
}

Fixed version (ground truth):
private static void parseBalanced(ASTNode node,SubNodeFactory snf,int lToken,int rToken) throws XPathSyntaxException {
  if (node instanceof ASTNodeAbstractExpr) {
    ASTNodeAbstractExpr absNode=(ASTNodeAbstractExpr)node;
    int i=0;
    while (i < absNode.content.size()) {
      int type=absNode.getTokenType(i);
      if (type == rToken) {
        throw new XPathSyntaxException("String_Node_Str");
      }
 else       if (type == lToken) {
        int j=absNode.indexOfBalanced(i,rToken,lToken,rToken);
        if (j == -1) {
          throw new XPathSyntaxException();
        }
        absNode.condense(snf.newNode(absNode.extract(i + 1,j)),i,j + 1);
      }
      i++;
    }
  }
  for (Enumeration e=node.getChildren().elements(); e.hasMoreElements(); ) {
    parseBalanced((ASTNode)e.nextElement(),snf,lToken,rToken);
  }
}
Program: 146843
Project: 146843
Buggy source:
protected JrFormEntryController getController(){
  int formID=1;
  Vector<IPreloadHandler> preloaders=JRFormTestUtil.getPreloaders();
  FormDefFetcher fetcher=new FormDefFetcher(new RMSRetreivalMethod(formID),preloaders,null,new InstanceInitializationFactory());
  FormDef form=fetcher.getFormDef();
  JrFormEntryController controller=new JrFormEntryController(new JrFormEntryModel(form,false,FormEntryModel.REPEAT_STRUCTURE_NON_LINEAR));
  controller.setView(new Chatterbox("String_Node_Str",controller));
  return controller;
}

Fixed version (ground truth):
protected JrFormEntryController getController(){
  int formID=1;
  Vector<IPreloadHandler> preloaders=JRFormTestUtil.getPreloaders();
  FormDefFetcher fetcher=new FormDefFetcher(new RMSRetreivalMethod(formID),preloaders,null,new InstanceInitializationFactory());
  FormDef form=fetcher.getFormDef();
  JrFormEntryController controller=new JrFormEntryController(new JrFormEntryModel(form,false,FormEntryModel.REPEAT_STRUCTURE_NON_LINEAR));
  controller.setView(new SingleQuestionView(controller));
  return controller;
}
Program: 146844
Project: 146844
Buggy source:
public V put(K key,V value){
  if (key == null) {
    throw new NullPointerException();
  }
  if (super.containsKey(key)) {
    int i=orderedKeys.indexOf(key);
    if (i == -1) {
      throw new IllegalStateException("String_Node_Str" + key);
    }
    orderedKeys.setElementAt(key,i);
  }
 else {
    orderedKeys.addElement(key);
  }
  return super.put(key,value);
}

Fixed version (ground truth):
public V put(K key,V value){
  if (key == null) {
    throw new NullPointerException();
  }
  V v=super.put(key,value);
  if (super.size() > orderedKeys.size()) {
    orderedKeys.addElement(key);
  }
  return v;
}
Program: 146845
Project: 146845
Buggy source:
public boolean canCreateRepeat(TreeReference repeatRef,FormIndex repeatIndex){
  GroupDef repeat=(GroupDef)this.getChild(repeatIndex);
  if (repeat.noAddRemove) {
    if (repeat.getCountReference() != null) {
      int currentMultiplicity=repeatIndex.getElementMultiplicity();
      AbstractTreeElement countNode=this.getMainInstance().resolveReference(repeat.getCountReference());
      if (countNode == null) {
        throw new RuntimeException("String_Node_Str" + repeat.getCountReference().getReference().toString());
      }
      long fullcount=((Integer)countNode.getValue().getValue()).intValue();
      if (fullcount <= currentMultiplicity) {
        return false;
      }
    }
 else {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean canCreateRepeat(TreeReference repeatRef,FormIndex repeatIndex){
  GroupDef repeat=(GroupDef)this.getChild(repeatIndex);
  if (repeat.noAddRemove) {
    if (repeat.getCountReference() != null) {
      int currentMultiplicity=repeatIndex.getElementMultiplicity();
      AbstractTreeElement countNode=this.getMainInstance().resolveReference(repeat.getCountReference());
      if (countNode == null) {
        throw new RuntimeException("String_Node_Str" + repeat.getCountReference().getReference().toString());
      }
      IAnswerData count=countNode.getValue();
      long fullcount=count == null ? 0 : ((Integer)count.getValue()).intValue();
      if (fullcount <= currentMultiplicity) {
        return false;
      }
    }
 else {
      return false;
    }
  }
  return true;
}
Program: 146847
Project: 146847
Buggy source:
public UnfullfilledRequirementsException(String message,int severity,int requirement,int maR,int miR,int maA,int miA,boolean majorIsProblem){
  super(message);
  this.severity=severity;
  this.requirement=requirement;
  required=maR + "String_Node_Str" + miR;
  available=maA + "String_Node_Str" + miA;
}

Fixed version (ground truth):
public UnfullfilledRequirementsException(String message,int severity,int requirement,int maR,int miR,int maA,int miA,boolean majorIsProblem){
  super(message);
  this.severity=severity;
  this.requirement=requirement;
  required=maR + "String_Node_Str" + miR;
  available=maA + "String_Node_Str" + miA;
  this.majorIsProblem=majorIsProblem;
}
Program: 146849
Project: 146849
Buggy source:
private void syncMeta(){
  meta.clear();
  for (Enumeration en=data.keys(); en.hasMoreElements(); ) {
    Integer i=(Integer)en.nextElement();
    Externalizable e=(Externalizable)data.get(i);
    if (e instanceof IMetaData) {
      IMetaData m=(IMetaData)e;
      for (      String key : m.getMetaDataFields()) {
        if (!meta.containsKey(key)) {
          meta.put(key,new Hashtable<Object,Vector<Integer>>());
        }
      }
      for (      String key : dynamicIndices) {
        if (!meta.containsKey(key)) {
          meta.put(key,new Hashtable<Object,Vector<Integer>>());
        }
      }
      for (Enumeration keys=meta.keys(); en.hasMoreElements(); ) {
        String key=(String)keys.nextElement();
        Object value=m.getMetaData(key);
        Hashtable<Object,Vector<Integer>> records=meta.get(key);
        if (!records.containsKey(value)) {
          records.put(value,new Vector<Integer>());
        }
        Vector<Integer> indices=records.get(value);
        if (!indices.contains(i)) {
          records.get(value).addElement(i);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void syncMeta(){
  meta.clear();
  for (Enumeration en=data.keys(); en.hasMoreElements(); ) {
    Integer i=(Integer)en.nextElement();
    Externalizable e=(Externalizable)data.get(i);
    if (e instanceof IMetaData) {
      IMetaData m=(IMetaData)e;
      for (      String key : m.getMetaDataFields()) {
        if (!meta.containsKey(key)) {
          meta.put(key,new Hashtable<Object,Vector<Integer>>());
        }
      }
      for (      String key : dynamicIndices) {
        if (!meta.containsKey(key)) {
          meta.put(key,new Hashtable<Object,Vector<Integer>>());
        }
      }
      for (Enumeration keys=meta.keys(); keys.hasMoreElements(); ) {
        String key=(String)keys.nextElement();
        Object value=m.getMetaData(key);
        Hashtable<Object,Vector<Integer>> records=meta.get(key);
        if (!records.containsKey(value)) {
          records.put(value,new Vector<Integer>());
        }
        Vector<Integer> indices=records.get(value);
        if (!indices.contains(i)) {
          records.get(value).addElement(i);
        }
      }
    }
  }
}
Program: 146850
Project: 146850
Buggy source:
public void registerIndex(String index){
synchronized (metadataAccessLock) {
    if (dynamicIndices == null) {
      dynamicIndices=new Vector<String>();
    }
    dynamicIndices.addElement(index);
    buildIndex();
  }
}

Fixed version (ground truth):
public void registerIndex(String index){
  if (index == null) {
    throw new NullPointerException("String_Node_Str");
  }
synchronized (metadataAccessLock) {
    if (dynamicIndices == null) {
      dynamicIndices=new Vector<String>();
    }
    dynamicIndices.addElement(index);
    buildIndex();
  }
}
Program: 146851
Project: 146851
Buggy source:
private IMetaData getMetaDataForRecord(int record){
  Hashtable<String,Object> data=null;
synchronized (metadataAccessLock) {
    if (hasMetaData) {
      if (exists(record)) {
        data=new Hashtable<String,Object>();
        Integer recordId=DataUtil.integer(record);
        for (        String s : proto.getMetaDataFields()) {
          Hashtable<Object,Vector<Integer>> values=metaDataIndex.get(s);
          for (Enumeration en=values.keys(); en.hasMoreElements(); ) {
            Object o=en.nextElement();
            Vector<Integer> ids=values.get(o);
            if (ids.contains(recordId)) {
              data.put(s,o);
              break;
            }
          }
        }
      }
    }
  }
  return new MetaDataWrapper(data);
}

Fixed version (ground truth):
private IMetaData getMetaDataForRecord(int record){
  Hashtable<String,Object> data=null;
synchronized (metadataAccessLock) {
    if (hasMetaData) {
      if (exists(record)) {
        data=new Hashtable<String,Object>();
        Integer recordId=DataUtil.integer(record);
        for (        String s : getFields()) {
          Hashtable<Object,Vector<Integer>> values=metaDataIndex.get(s);
          for (Enumeration en=values.keys(); en.hasMoreElements(); ) {
            Object o=en.nextElement();
            Vector<Integer> ids=values.get(o);
            if (ids.contains(recordId)) {
              data.put(s,o);
              break;
            }
          }
        }
      }
    }
  }
  return new MetaDataWrapper(data);
}
Program: 146852
Project: 146852
Buggy source:
private Hashtable<String,Object> getMetaData(IMetaData m,String[] index){
  Hashtable<String,Object> h=new Hashtable<String,Object>();
  for (  String s : index) {
    h.put(s,m.getMetaData(s));
  }
  return h;
}

Fixed version (ground truth):
private Hashtable<String,Object> getMetaData(IMetaData m,String[] index){
  Hashtable<String,Object> h=new Hashtable<String,Object>();
  for (  String s : index) {
    Object o=m.getMetaData(s);
    if (o == null || s == null) {
      "String_Node_Str".charAt(0);
    }
    h.put(s,o);
  }
  return h;
}
Program: 146853
Project: 146853
Buggy source:
public boolean isReadOnly(){
  try {
    FileConnection c=connector();
    if (c.exists()) {
      return c.canWrite();
    }
 else {
      try {
        String local=this.getLocalURI();
        if (local.indexOf("String_Node_Str") == -1) {
          return false;
        }
 else {
          String parent=local.substring(0,local.lastIndexOf('/'));
          FileConnection parentConnector=this.connector(parent,false);
          if (parentConnector.exists() && parentConnector.isDirectory()) {
            boolean result=parentConnector.canWrite();
            parentConnector.close();
            return result;
          }
          return false;
        }
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
    return true;
  }
catch (  SecurityException se) {
    return true;
  }
}

Fixed version (ground truth):
public boolean isReadOnly(){
  try {
    FileConnection c=connector();
    if (c.exists()) {
      return !c.canWrite();
    }
 else {
      try {
        String local=this.getLocalURI();
        if (local.indexOf("String_Node_Str") == -1) {
          return false;
        }
 else {
          String parent=local.substring(0,local.lastIndexOf('/'));
          FileConnection parentConnector=this.connector(parent,false);
          if (parentConnector.exists() && parentConnector.isDirectory()) {
            boolean result=parentConnector.canWrite();
            parentConnector.close();
            return !result;
          }
          return false;
        }
      }
 catch (      Exception e) {
        return false;
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
    return true;
  }
catch (  SecurityException se) {
    return true;
  }
}