Program: 68362
Project: 68362
Buggy source:
/** 
 * According to the requirement, correspondingly perform isset, unset or set function.
 * @param frag              one string fragment in the path
 * @param path              the String representation of path based access
 * @param caller            the DataObject that pass path information in
 * @param value             the value to be set as the target property's value
 * @param lastSlashIndex    the last index of '/' in the path string
 * @param convertValue     boolean used for set if we should convert the value
 * @param _case             an int value indicating what kind of operation to use: set, isset or unset.
 * @return                  true if operation is isset and property's value is set, otherwise false.
 */
private boolean setIsSetUnSet(String frag,String path,DataObject caller,Object value,int lastSlashIndex,boolean convertValue,int _case){
  int indexOfDot=frag.lastIndexOf('.');
  int indexOfOpenBracket=frag.lastIndexOf('[');
  int indexOfCloseBracket=frag.lastIndexOf(']');
  int numInLastProperty=getNumberInFrag(frag,indexOfDot,indexOfOpenBracket,indexOfCloseBracket);
  String lastPropertyName=getPropertyNameInFrag(frag,numInLastProperty,indexOfDot,indexOfOpenBracket);
  DataObject lastDataObject;
  if (-1 < lastSlashIndex) {
    lastDataObject=(SDODataObject)get(path.substring(0,lastSlashIndex),caller);
    if (lastDataObject == null) {
      throw SDOException.cannotPerformOperationOnProperty(lastPropertyName,path);
    }
  }
 else {
    lastDataObject=caller;
  }
  Property lastProperty=lastDataObject.getInstanceProperty(lastPropertyName);
switch (_case) {
case SET:
    if (lastProperty == null) {
      lastProperty=((SDODataObject)lastDataObject).defineOpenContentProperty(lastPropertyName,value);
    }
  if (lastProperty != null) {
    set(lastProperty,lastDataObject,numInLastProperty,value,convertValue);
  }
return false;
case ISSET:
if (lastProperty == null) {
return false;
}
return isSet(lastProperty,lastDataObject);
case UNSET:
if (lastProperty == null) {
return false;
}
unSet(lastProperty,lastDataObject,numInLastProperty);
return false;
default :
return false;
}
}

Fixed version (ground truth):
/** 
 * According to the requirement, correspondingly perform isset, unset or set function.
 * @param frag              one string fragment in the path
 * @param path              the String representation of path based access
 * @param caller            the DataObject that pass path information in
 * @param value             the value to be set as the target property's value
 * @param lastSlashIndex    the last index of '/' in the path string
 * @param convertValue     boolean used for set if we should convert the value
 * @param _case             an int value indicating what kind of operation to use: set, isset or unset.
 * @return                  true if operation is isset and property's value is set, otherwise false.
 */
private boolean setIsSetUnSet(String frag,String path,DataObject caller,Object value,int lastSlashIndex,boolean convertValue,int _case){
  int indexOfDot=frag.lastIndexOf('.');
  int indexOfOpenBracket=frag.lastIndexOf('[');
  int indexOfCloseBracket=frag.lastIndexOf(']');
  int numInLastProperty=getNumberInFrag(frag,indexOfDot,indexOfOpenBracket,indexOfCloseBracket);
  String lastPropertyName=getPropertyNameInFrag(frag,numInLastProperty,indexOfDot,indexOfOpenBracket);
  DataObject lastDataObject;
  if (-1 < lastSlashIndex) {
    Object lastObject=get(path.substring(0,lastSlashIndex),caller);
    if (lastObject == null || lastObject instanceof ListWrapper) {
      throw SDOException.cannotPerformOperationOnProperty(lastPropertyName,path);
    }
    lastDataObject=(SDODataObject)lastObject;
  }
 else {
    lastDataObject=caller;
  }
  Property lastProperty=lastDataObject.getInstanceProperty(lastPropertyName);
switch (_case) {
case SET:
    if (lastProperty == null) {
      lastProperty=((SDODataObject)lastDataObject).defineOpenContentProperty(lastPropertyName,value);
    }
  if (lastProperty != null) {
    set(lastProperty,lastDataObject,numInLastProperty,value,convertValue);
  }
return false;
case ISSET:
if (lastProperty == null) {
return false;
}
return isSet(lastProperty,lastDataObject);
case UNSET:
if (lastProperty == null) {
return false;
}
unSet(lastProperty,lastDataObject,numInLastProperty);
return false;
default :
return false;
}
}