Program: 84947
Project: 84947
Buggy source:
/** 
 * Function to send vcard data to client 
 */
private final int pushBytes(Operation op,final String vcardString){
  if (vcardString == null) {
    Log.w(TAG,"String_Node_Str");
    return ResponseCodes.OBEX_HTTP_OK;
  }
  int vcardStringLen=vcardString.length();
  if (D)   Log.d(TAG,"String_Node_Str" + vcardStringLen);
  OutputStream outputStream=null;
  int pushResult=ResponseCodes.OBEX_HTTP_OK;
  try {
    outputStream=op.openOutputStream();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e.toString());
    return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
  }
  int position=0;
  long timestamp=0;
  int outputBufferSize=op.getMaxPacketSize();
  if (V)   Log.v(TAG,"String_Node_Str" + outputBufferSize);
  while (position != vcardStringLen) {
    if (sIsAborted) {
      ((ServerOperation)op).isAborted=true;
      sIsAborted=false;
      break;
    }
    if (V)     timestamp=System.currentTimeMillis();
    int readLength=outputBufferSize;
    if (vcardStringLen - position < outputBufferSize) {
      readLength=vcardStringLen - position;
    }
    String subStr=vcardString.substring(position,position + readLength);
    try {
      outputStream.write(subStr.getBytes(),0,readLength);
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str" + e.toString());
      pushResult=ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
      break;
    }
    if (V) {
      Log.v(TAG,"String_Node_Str" + position + "String_Node_Str"+ readLength+ "String_Node_Str"+ (System.currentTimeMillis() - timestamp)+ "String_Node_Str");
    }
    position+=readLength;
  }
  if (V)   Log.v(TAG,"String_Node_Str");
  if (!closeStream(outputStream,op)) {
    pushResult=ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
  }
  return pushResult;
}

Fixed version (ground truth):
/** 
 * Function to send vcard data to client 
 */
private final int pushBytes(Operation op,final String vcardString){
  if (vcardString == null) {
    Log.w(TAG,"String_Node_Str");
    return ResponseCodes.OBEX_HTTP_OK;
  }
  byte[] vcardBytes=vcardString.getBytes();
  int vcardStringLen=vcardBytes.length;
  if (D)   Log.d(TAG,"String_Node_Str" + vcardStringLen);
  OutputStream outputStream=null;
  int pushResult=ResponseCodes.OBEX_HTTP_OK;
  try {
    outputStream=op.openOutputStream();
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str" + e.toString());
    return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
  }
  int position=0;
  long timestamp=0;
  int outputBufferSize=op.getMaxPacketSize();
  if (V)   Log.v(TAG,"String_Node_Str" + outputBufferSize);
  while (position != vcardStringLen) {
    if (sIsAborted) {
      ((ServerOperation)op).isAborted=true;
      sIsAborted=false;
      break;
    }
    if (V)     timestamp=System.currentTimeMillis();
    int readLength=outputBufferSize;
    if (vcardStringLen - position < outputBufferSize) {
      readLength=vcardStringLen - position;
    }
    byte[] subByteArray=Arrays.copyOfRange(vcardBytes,position,position + readLength);
    try {
      outputStream.write(subByteArray,0,readLength);
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str" + e.toString());
      pushResult=ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
      break;
    }
    if (V) {
      Log.v(TAG,"String_Node_Str" + position + "String_Node_Str"+ readLength+ "String_Node_Str"+ (System.currentTimeMillis() - timestamp)+ "String_Node_Str");
    }
    position+=readLength;
  }
  if (V)   Log.v(TAG,"String_Node_Str");
  if (!closeStream(outputStream,op)) {
    pushResult=ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
  }
  return pushResult;
}