Program: 152712
Project: 152712
Buggy source:
@Override public Uri insert(Uri uri,ContentValues values){
  int msgBox=Mms.MESSAGE_BOX_ALL;
  boolean notify=true;
  int match=sURLMatcher.match(uri);
  if (LOCAL_LOGV) {
    Log.v(TAG,"String_Node_Str" + uri + "String_Node_Str"+ match);
  }
  String table=TABLE_PDU;
switch (match) {
case MMS_ALL:
    Object msgBoxObj=values.getAsInteger(Mms.MESSAGE_BOX);
  if (msgBoxObj != null) {
    msgBox=(Integer)msgBoxObj;
  }
 else {
    msgBox=Mms.MESSAGE_BOX_INBOX;
  }
break;
case MMS_INBOX:
msgBox=Mms.MESSAGE_BOX_INBOX;
break;
case MMS_SENT:
msgBox=Mms.MESSAGE_BOX_SENT;
break;
case MMS_DRAFTS:
msgBox=Mms.MESSAGE_BOX_DRAFTS;
break;
case MMS_OUTBOX:
msgBox=Mms.MESSAGE_BOX_OUTBOX;
break;
case MMS_MSG_PART:
notify=false;
table=TABLE_PART;
break;
case MMS_MSG_ADDR:
notify=false;
table=TABLE_ADDR;
break;
case MMS_SENDING_RATE:
notify=false;
table=TABLE_RATE;
break;
case MMS_DRM_STORAGE:
notify=false;
table=TABLE_DRM;
break;
default :
Log.e(TAG,"String_Node_Str" + uri);
return null;
}
SQLiteDatabase db=mOpenHelper.getWritableDatabase();
ContentValues finalValues;
Uri res=Mms.CONTENT_URI;
long rowId;
if (table.equals(TABLE_PDU)) {
boolean addDate=!values.containsKey(Mms.DATE);
boolean addMsgBox=!values.containsKey(Mms.MESSAGE_BOX);
filterUnsupportedKeys(values);
finalValues=new ContentValues(values);
long timeInMillis=System.currentTimeMillis();
if (addDate) {
finalValues.put(Mms.DATE,timeInMillis / 1000L);
}
if (addMsgBox && (msgBox != Mms.MESSAGE_BOX_ALL)) {
finalValues.put(Mms.MESSAGE_BOX,msgBox);
}
if (msgBox != Mms.MESSAGE_BOX_INBOX) {
finalValues.put(Mms.READ,1);
}
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else if (table.equals(TABLE_ADDR)) {
finalValues=new ContentValues(values);
finalValues.put(Addr.MSG_ID,uri.getPathSegments().get(0));
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else if (table.equals(TABLE_PART)) {
finalValues=new ContentValues(values);
if (match == MMS_MSG_PART) {
finalValues.put(Part.MSG_ID,uri.getPathSegments().get(0));
}
String contentType=values.getAsString("String_Node_Str");
if (!"String_Node_Str".equals(contentType) && !"String_Node_Str".equals(contentType)) {
String path=getContext().getDir("String_Node_Str",0).getPath() + "String_Node_Str" + System.currentTimeMillis();
finalValues.put(Part._DATA,path);
File partFile=new File(path);
if (!partFile.exists()) {
try {
if (!partFile.createNewFile()) {
throw new IllegalStateException("String_Node_Str" + path);
}
}
 catch (IOException e) {
Log.e(TAG,"String_Node_Str",e);
throw new IllegalStateException("String_Node_Str" + path);
}
}
}
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else if (table.equals(TABLE_RATE)) {
long now=values.getAsLong(Rate.SENT_TIME);
long oneHourAgo=now - 1000 * 60 * 60;
db.delete(table,Rate.SENT_TIME + "String_Node_Str" + oneHourAgo,null);
db.insert(table,null,values);
}
 else if (table.equals(TABLE_DRM)) {
String path=getContext().getDir("String_Node_Str",0).getPath() + "String_Node_Str" + System.currentTimeMillis();
finalValues=new ContentValues(1);
finalValues.put("String_Node_Str",path);
File partFile=new File(path);
if (!partFile.exists()) {
try {
if (!partFile.createNewFile()) {
throw new IllegalStateException("String_Node_Str" + path);
}
}
 catch (IOException e) {
Log.e(TAG,"String_Node_Str",e);
throw new IllegalStateException("String_Node_Str" + path);
}
}
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else {
throw new AssertionError("String_Node_Str" + table);
}
if (notify) {
notifyChange();
}
return res;
}

Fixed version (ground truth):
@Override public Uri insert(Uri uri,ContentValues values){
  int msgBox=Mms.MESSAGE_BOX_ALL;
  boolean notify=true;
  int match=sURLMatcher.match(uri);
  if (LOCAL_LOGV) {
    Log.v(TAG,"String_Node_Str" + uri + "String_Node_Str"+ match);
  }
  String table=TABLE_PDU;
switch (match) {
case MMS_ALL:
    Object msgBoxObj=values.getAsInteger(Mms.MESSAGE_BOX);
  if (msgBoxObj != null) {
    msgBox=(Integer)msgBoxObj;
  }
 else {
    msgBox=Mms.MESSAGE_BOX_INBOX;
  }
break;
case MMS_INBOX:
msgBox=Mms.MESSAGE_BOX_INBOX;
break;
case MMS_SENT:
msgBox=Mms.MESSAGE_BOX_SENT;
break;
case MMS_DRAFTS:
msgBox=Mms.MESSAGE_BOX_DRAFTS;
break;
case MMS_OUTBOX:
msgBox=Mms.MESSAGE_BOX_OUTBOX;
break;
case MMS_MSG_PART:
notify=false;
table=TABLE_PART;
break;
case MMS_MSG_ADDR:
notify=false;
table=TABLE_ADDR;
break;
case MMS_SENDING_RATE:
notify=false;
table=TABLE_RATE;
break;
case MMS_DRM_STORAGE:
notify=false;
table=TABLE_DRM;
break;
default :
Log.e(TAG,"String_Node_Str" + uri);
return null;
}
SQLiteDatabase db=mOpenHelper.getWritableDatabase();
ContentValues finalValues;
Uri res=Mms.CONTENT_URI;
long rowId;
if (table.equals(TABLE_PDU)) {
boolean addDate=!values.containsKey(Mms.DATE);
boolean addMsgBox=!values.containsKey(Mms.MESSAGE_BOX);
filterUnsupportedKeys(values);
finalValues=new ContentValues(values);
long timeInMillis=System.currentTimeMillis();
if (addDate) {
finalValues.put(Mms.DATE,timeInMillis / 1000L);
}
if (addMsgBox && (msgBox != Mms.MESSAGE_BOX_ALL)) {
finalValues.put(Mms.MESSAGE_BOX,msgBox);
}
if (msgBox != Mms.MESSAGE_BOX_INBOX) {
finalValues.put(Mms.READ,1);
}
Long threadId=values.getAsLong(Mms.THREAD_ID);
String address=values.getAsString(CanonicalAddressesColumns.ADDRESS);
if (((threadId == null) || (threadId == 0)) && (address != null)) {
finalValues.put(Mms.THREAD_ID,Threads.getOrCreateThreadId(getContext(),address));
}
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else if (table.equals(TABLE_ADDR)) {
finalValues=new ContentValues(values);
finalValues.put(Addr.MSG_ID,uri.getPathSegments().get(0));
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else if (table.equals(TABLE_PART)) {
finalValues=new ContentValues(values);
if (match == MMS_MSG_PART) {
finalValues.put(Part.MSG_ID,uri.getPathSegments().get(0));
}
String contentType=values.getAsString("String_Node_Str");
if (!"String_Node_Str".equals(contentType) && !"String_Node_Str".equals(contentType)) {
String path=getContext().getDir("String_Node_Str",0).getPath() + "String_Node_Str" + System.currentTimeMillis();
finalValues.put(Part._DATA,path);
File partFile=new File(path);
if (!partFile.exists()) {
try {
if (!partFile.createNewFile()) {
throw new IllegalStateException("String_Node_Str" + path);
}
}
 catch (IOException e) {
Log.e(TAG,"String_Node_Str",e);
throw new IllegalStateException("String_Node_Str" + path);
}
}
}
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else if (table.equals(TABLE_RATE)) {
long now=values.getAsLong(Rate.SENT_TIME);
long oneHourAgo=now - 1000 * 60 * 60;
db.delete(table,Rate.SENT_TIME + "String_Node_Str" + oneHourAgo,null);
db.insert(table,null,values);
}
 else if (table.equals(TABLE_DRM)) {
String path=getContext().getDir("String_Node_Str",0).getPath() + "String_Node_Str" + System.currentTimeMillis();
finalValues=new ContentValues(1);
finalValues.put("String_Node_Str",path);
File partFile=new File(path);
if (!partFile.exists()) {
try {
if (!partFile.createNewFile()) {
throw new IllegalStateException("String_Node_Str" + path);
}
}
 catch (IOException e) {
Log.e(TAG,"String_Node_Str",e);
throw new IllegalStateException("String_Node_Str" + path);
}
}
if ((rowId=db.insert(table,null,finalValues)) <= 0) {
Log.e(TAG,"String_Node_Str" + finalValues);
return null;
}
res=Uri.parse(res + "String_Node_Str" + rowId);
}
 else {
throw new AssertionError("String_Node_Str" + table);
}
if (notify) {
notifyChange();
}
return res;
}