Program: 179944
Project: 179944
Buggy source:
private void loadWorkspace(){
  long t=SystemClock.uptimeMillis();
  final Context context=mContext;
  final ContentResolver contentResolver=context.getContentResolver();
  final PackageManager manager=context.getPackageManager();
  mItems.clear();
  final Cursor c=contentResolver.query(LauncherSettings.Favorites.CONTENT_URI,null,null,null,null);
  try {
    final int idIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites._ID);
    final int intentIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.INTENT);
    final int titleIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.TITLE);
    final int iconTypeIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_TYPE);
    final int iconIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON);
    final int iconPackageIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_PACKAGE);
    final int iconResourceIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_RESOURCE);
    final int containerIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.CONTAINER);
    final int itemTypeIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ITEM_TYPE);
    final int appWidgetIdIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.APPWIDGET_ID);
    final int screenIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.SCREEN);
    final int cellXIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLX);
    final int cellYIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLY);
    final int spanXIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANX);
    final int spanYIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANY);
    final int uriIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.URI);
    final int displayModeIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.DISPLAY_MODE);
    ApplicationInfo info;
    String intentDescription;
    Widget widgetInfo;
    LauncherAppWidgetInfo appWidgetInfo;
    int container;
    long id;
    Intent intent;
    while (!mStopped && c.moveToNext()) {
      try {
        int itemType=c.getInt(itemTypeIndex);
switch (itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
          intentDescription=c.getString(intentIndex);
        try {
          intent=Intent.parseUri(intentDescription,0);
        }
 catch (        URISyntaxException e) {
          continue;
        }
      if (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
        info=getApplicationInfo(manager,intent,context);
      }
 else {
        info=getApplicationInfoShortcut(c,context,iconTypeIndex,iconPackageIndex,iconResourceIndex,iconIndex);
      }
    if (info == null) {
      info=new ApplicationInfo();
      info.icon=manager.getDefaultActivityIcon();
    }
  if (info != null) {
    info.title=c.getString(titleIndex);
    info.intent=intent;
    info.id=c.getLong(idIndex);
    container=c.getInt(containerIndex);
    info.container=container;
    info.screen=c.getInt(screenIndex);
    info.cellX=c.getInt(cellXIndex);
    info.cellY=c.getInt(cellYIndex);
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
      mItems.add(info);
    break;
default :
  UserFolderInfo folderInfo=findOrMakeUserFolder(folders,container);
folderInfo.add(info);
break;
}
}
break;
case LauncherSettings.Favorites.ITEM_TYPE_USER_FOLDER:
id=c.getLong(idIndex);
UserFolderInfo folderInfo=findOrMakeUserFolder(folders,id);
folderInfo.title=c.getString(titleIndex);
folderInfo.id=id;
container=c.getInt(containerIndex);
folderInfo.container=container;
folderInfo.screen=c.getInt(screenIndex);
folderInfo.cellX=c.getInt(cellXIndex);
folderInfo.cellY=c.getInt(cellYIndex);
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
mItems.add(folderInfo);
break;
}
break;
case LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER:
id=c.getLong(idIndex);
LiveFolderInfo liveFolderInfo=findOrMakeLiveFolder(folders,id);
intentDescription=c.getString(intentIndex);
intent=null;
if (intentDescription != null) {
try {
intent=Intent.parseUri(intentDescription,0);
}
 catch (URISyntaxException e) {
}
}
liveFolderInfo.title=c.getString(titleIndex);
liveFolderInfo.id=id;
container=c.getInt(containerIndex);
liveFolderInfo.container=container;
liveFolderInfo.screen=c.getInt(screenIndex);
liveFolderInfo.cellX=c.getInt(cellXIndex);
liveFolderInfo.cellY=c.getInt(cellYIndex);
liveFolderInfo.uri=Uri.parse(c.getString(uriIndex));
liveFolderInfo.baseIntent=intent;
liveFolderInfo.displayMode=c.getInt(displayModeIndex);
loadLiveFolderIcon(context,c,iconTypeIndex,iconPackageIndex,iconResourceIndex,liveFolderInfo);
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
mItems.add(liveFolderInfo);
break;
}
break;
case LauncherSettings.Favorites.ITEM_TYPE_WIDGET_SEARCH:
widgetInfo=Widget.makeSearch();
container=c.getInt(containerIndex);
if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
Log.e(TAG,"String_Node_Str" + "String_Node_Str");
continue;
}
widgetInfo.id=c.getLong(idIndex);
widgetInfo.screen=c.getInt(screenIndex);
widgetInfo.container=container;
widgetInfo.cellX=c.getInt(cellXIndex);
widgetInfo.cellY=c.getInt(cellYIndex);
mItems.add(widgetInfo);
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
int appWidgetId=c.getInt(appWidgetIdIndex);
appWidgetInfo=new LauncherAppWidgetInfo(appWidgetId);
appWidgetInfo.id=c.getLong(idIndex);
appWidgetInfo.screen=c.getInt(screenIndex);
appWidgetInfo.cellX=c.getInt(cellXIndex);
appWidgetInfo.cellY=c.getInt(cellYIndex);
appWidgetInfo.spanX=c.getInt(spanXIndex);
appWidgetInfo.spanY=c.getInt(spanYIndex);
container=c.getInt(containerIndex);
if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
Log.e(TAG,"String_Node_Str" + "String_Node_Str");
continue;
}
appWidgetInfo.container=c.getInt(containerIndex);
mAppWidgets.add(appWidgetInfo);
break;
}
}
 catch (Exception e) {
Log.w(TAG,"String_Node_Str",e);
}
}
}
  finally {
c.close();
}
Log.d(TAG,"String_Node_Str" + (SystemClock.uptimeMillis() - t) + "String_Node_Str");
}

Fixed version (ground truth):
private void loadWorkspace(){
  long t=SystemClock.uptimeMillis();
  final Context context=mContext;
  final ContentResolver contentResolver=context.getContentResolver();
  final PackageManager manager=context.getPackageManager();
  mItems.clear();
  final Cursor c=contentResolver.query(LauncherSettings.Favorites.CONTENT_URI,null,null,null,null);
  try {
    final int idIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites._ID);
    final int intentIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.INTENT);
    final int titleIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.TITLE);
    final int iconTypeIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_TYPE);
    final int iconIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON);
    final int iconPackageIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_PACKAGE);
    final int iconResourceIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_RESOURCE);
    final int containerIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.CONTAINER);
    final int itemTypeIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.ITEM_TYPE);
    final int appWidgetIdIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.APPWIDGET_ID);
    final int screenIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.SCREEN);
    final int cellXIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLX);
    final int cellYIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLY);
    final int spanXIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANX);
    final int spanYIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANY);
    final int uriIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.URI);
    final int displayModeIndex=c.getColumnIndexOrThrow(LauncherSettings.Favorites.DISPLAY_MODE);
    ApplicationInfo info;
    String intentDescription;
    Widget widgetInfo;
    LauncherAppWidgetInfo appWidgetInfo;
    int container;
    long id;
    Intent intent;
    while (!mStopped && c.moveToNext()) {
      try {
        int itemType=c.getInt(itemTypeIndex);
switch (itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
          intentDescription=c.getString(intentIndex);
        try {
          intent=Intent.parseUri(intentDescription,0);
        }
 catch (        URISyntaxException e) {
          continue;
        }
      if (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
        info=getApplicationInfo(manager,intent,context);
      }
 else {
        info=getApplicationInfoShortcut(c,context,iconTypeIndex,iconPackageIndex,iconResourceIndex,iconIndex);
      }
    if (info == null) {
      info=new ApplicationInfo();
      info.icon=manager.getDefaultActivityIcon();
    }
  if (info != null) {
    info.title=c.getString(titleIndex);
    info.intent=intent;
    info.id=c.getLong(idIndex);
    container=c.getInt(containerIndex);
    info.container=container;
    info.screen=c.getInt(screenIndex);
    info.cellX=c.getInt(cellXIndex);
    info.cellY=c.getInt(cellYIndex);
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
      mItems.add(info);
    break;
default :
  UserFolderInfo folderInfo=findOrMakeUserFolder(mFolders,container);
folderInfo.add(info);
break;
}
}
break;
case LauncherSettings.Favorites.ITEM_TYPE_USER_FOLDER:
id=c.getLong(idIndex);
UserFolderInfo folderInfo=findOrMakeUserFolder(mFolders,id);
folderInfo.title=c.getString(titleIndex);
folderInfo.id=id;
container=c.getInt(containerIndex);
folderInfo.container=container;
folderInfo.screen=c.getInt(screenIndex);
folderInfo.cellX=c.getInt(cellXIndex);
folderInfo.cellY=c.getInt(cellYIndex);
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
mItems.add(folderInfo);
break;
}
mFolders.put(folderInfo.id,folderInfo);
break;
case LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER:
id=c.getLong(idIndex);
LiveFolderInfo liveFolderInfo=findOrMakeLiveFolder(mFolders,id);
intentDescription=c.getString(intentIndex);
intent=null;
if (intentDescription != null) {
try {
intent=Intent.parseUri(intentDescription,0);
}
 catch (URISyntaxException e) {
}
}
liveFolderInfo.title=c.getString(titleIndex);
liveFolderInfo.id=id;
container=c.getInt(containerIndex);
liveFolderInfo.container=container;
liveFolderInfo.screen=c.getInt(screenIndex);
liveFolderInfo.cellX=c.getInt(cellXIndex);
liveFolderInfo.cellY=c.getInt(cellYIndex);
liveFolderInfo.uri=Uri.parse(c.getString(uriIndex));
liveFolderInfo.baseIntent=intent;
liveFolderInfo.displayMode=c.getInt(displayModeIndex);
loadLiveFolderIcon(context,c,iconTypeIndex,iconPackageIndex,iconResourceIndex,liveFolderInfo);
switch (container) {
case LauncherSettings.Favorites.CONTAINER_DESKTOP:
mItems.add(liveFolderInfo);
break;
}
mFolders.put(liveFolderInfo.id,liveFolderInfo);
break;
case LauncherSettings.Favorites.ITEM_TYPE_WIDGET_SEARCH:
widgetInfo=Widget.makeSearch();
container=c.getInt(containerIndex);
if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
Log.e(TAG,"String_Node_Str" + "String_Node_Str");
continue;
}
widgetInfo.id=c.getLong(idIndex);
widgetInfo.screen=c.getInt(screenIndex);
widgetInfo.container=container;
widgetInfo.cellX=c.getInt(cellXIndex);
widgetInfo.cellY=c.getInt(cellYIndex);
mItems.add(widgetInfo);
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
int appWidgetId=c.getInt(appWidgetIdIndex);
appWidgetInfo=new LauncherAppWidgetInfo(appWidgetId);
appWidgetInfo.id=c.getLong(idIndex);
appWidgetInfo.screen=c.getInt(screenIndex);
appWidgetInfo.cellX=c.getInt(cellXIndex);
appWidgetInfo.cellY=c.getInt(cellYIndex);
appWidgetInfo.spanX=c.getInt(spanXIndex);
appWidgetInfo.spanY=c.getInt(spanYIndex);
container=c.getInt(containerIndex);
if (container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
Log.e(TAG,"String_Node_Str" + "String_Node_Str");
continue;
}
appWidgetInfo.container=c.getInt(containerIndex);
mAppWidgets.add(appWidgetInfo);
break;
}
}
 catch (Exception e) {
Log.w(TAG,"String_Node_Str",e);
}
}
}
  finally {
c.close();
}
Log.d(TAG,"String_Node_Str" + (SystemClock.uptimeMillis() - t) + "String_Node_Str");
}