Program: 54331
Project: 54331
Buggy source:
protected Boolean doInBackground(String... args){
  status=args[0];
  try {
    Twitter twitter=Utils.getTwitter(getApplicationContext(),settings);
    Twitter twitter2=Utils.getSecondTwitter(getApplicationContext());
    if (remaining < 0 && !pwiccer && !multiTweet) {
      boolean isDone=false;
      if (useAccOne) {
        isDone=tweetUsingTwitLonger(twitter);
      }
      if (useAccTwo) {
        isDone=tweetUsingTwitLonger(twitter2);
      }
      return isDone;
    }
 else     if (multiTweet && remaining < 0) {
      Pair<String,List<String>> multiTweets=getMultipeTweets(status);
      int noOfTweets=multiTweets.second.size();
      int tweetNo=1;
      for (int i=0; i < noOfTweets; i++) {
        status=multiTweets.first.length() != 0 ? multiTweets.first : "String_Node_Str";
        status+=multiTweets.second.get(i) + "String_Node_Str" + tweetNo+ "String_Node_Str"+ noOfTweets+ "String_Node_Str";
        replyText=status.replace("String_Node_Str","String_Node_Str");
        tweetNo++;
        if (useAccOne) {
          tweetWithoutImages(twitter);
        }
        if (useAccTwo) {
          tweetWithoutImages(twitter2);
        }
      }
      multiTweet=false;
      return true;
    }
 else {
      if (imagesAttached == 0) {
        if (useAccOne) {
          tweetWithoutImages(twitter);
        }
        if (useAccTwo) {
          tweetWithoutImages(twitter2);
        }
        return true;
      }
 else {
        boolean autoPopulateMetadata=false;
        if (replyText != null && !replyText.contains("String_Node_Str")) {
          String replaceable=replyText.replaceAll("String_Node_Str","String_Node_Str");
          status=status.replaceAll(replaceable,"String_Node_Str");
          autoPopulateMetadata=true;
        }
        StatusUpdate media=new StatusUpdate(status);
        media.setAutoPopulateReplyMetadata(autoPopulateMetadata);
        if (notiId != 0) {
          media.setInReplyToStatusId(notiId);
        }
        File[] files=new File[imagesAttached];
        File outputDir=context.getCacheDir();
        if (attachButton.isEnabled()) {
          for (int i=0; i < imagesAttached; i++) {
            files[i]=File.createTempFile("String_Node_Str","String_Node_Str" + i,outputDir);
            Bitmap bitmap=getBitmapToSend(Uri.parse(attachedUri[i]));
            ByteArrayOutputStream bos=new ByteArrayOutputStream();
            if (secondTry) {
              bitmap=Bitmap.createScaledBitmap(bitmap,bitmap.getWidth() / 2,bitmap.getHeight() / 2,true);
            }
            bitmap.compress(Bitmap.CompressFormat.JPEG,100,bos);
            byte[] bitmapdata=bos.toByteArray();
            FileOutputStream fos=new FileOutputStream(files[i]);
            fos.write(bitmapdata);
            fos.flush();
            fos.close();
          }
        }
        if (settings.twitpic && attachButton.isEnabled()) {
          boolean isDone=false;
          if (useAccOne) {
            for (int i=1; i < imagesAttached; i++) {
              TwitPicHelper helper=new TwitPicHelper(twitter,"String_Node_Str",files[i],context);
              text+="String_Node_Str" + helper.uploadForUrl();
            }
            TwitPicHelper helper=new TwitPicHelper(twitter,text,files[0],context);
            if (addLocation) {
              if (waitForLocation()) {
                Location location=mLastLocation;
                GeoLocation geolocation=new GeoLocation(location.getLatitude(),location.getLongitude());
                media.setLocation(geolocation);
              }
            }
            if (helper.createPost() != 0) {
              isDone=true;
            }
          }
          if (useAccTwo) {
            for (int i=1; i < imagesAttached; i++) {
              TwitPicHelper helper=new TwitPicHelper(twitter2,"String_Node_Str",files[i],context);
              text+="String_Node_Str" + helper.uploadForUrl();
            }
            TwitPicHelper helper=new TwitPicHelper(twitter2,text,files[0],context);
            if (addLocation) {
              if (waitForLocation()) {
                Location location=mLastLocation;
                GeoLocation geolocation=new GeoLocation(location.getLatitude(),location.getLongitude());
                media.setLocation(geolocation);
              }
            }
            if (helper.createPost() != 0) {
              isDone=true;
            }
          }
          return isDone;
        }
 else {
          if (attachButton.isEnabled()) {
            if (imagesAttached == 1) {
              media.setMedia(files[0]);
            }
 else {
              long[] mediaIds=new long[files.length];
              for (int i=0; i < files.length; i++) {
                UploadedMedia upload=twitter.uploadMedia(files[i]);
                mediaIds[i]=upload.getMediaId();
              }
              media.setMediaIds(mediaIds);
            }
          }
 else {
            Log.v("String_Node_Str","String_Node_Str" + attachmentType);
            media.setMedia(attachmentType,getContentResolver().openInputStream(Uri.parse(attachedUri[0])));
          }
          if (addLocation) {
            if (waitForLocation()) {
              Location location=mLastLocation;
              GeoLocation geolocation=new GeoLocation(location.getLatitude(),location.getLongitude());
              media.setLocation(geolocation);
            }
          }
          twitter4j.Status s=null;
          if (useAccOne) {
            s=twitter.updateStatus(media);
          }
          if (useAccTwo) {
            s=twitter2.updateStatus(media);
          }
          if (s != null) {
            final String[] hashtags=TweetLinkUtils.getLinksInStatus(s)[3].split("String_Node_Str");
            if (hashtags != null) {
              new Thread(new Runnable(){
                @Override public void run(){
                  ArrayList<String> tags=new ArrayList<String>();
                  if (hashtags != null) {
                    for (                    String s : hashtags) {
                      if (!s.equals("String_Node_Str")) {
                        tags.add("String_Node_Str" + s);
                      }
                    }
                  }
                  HashtagDataSource source=HashtagDataSource.getInstance(context);
                  for (                  String s : tags) {
                    if (s.contains("String_Node_Str")) {
                      source.deleteTag(s);
                      source.createTag(s);
                    }
                  }
                }
              }
).start();
            }
          }
          return true;
        }
      }
    }
  }
 catch (  final Exception e) {
    e.printStackTrace();
    runOnUiThread(new Runnable(){
      @Override public void run(){
        displayErrorNotification(e);
      }
    }
);
    if (e.getMessage() != null && e.getMessage().contains("String_Node_Str")) {
      tryingAgain=true;
      return false;
    }
  }
catch (  OutOfMemoryError e) {
    e.printStackTrace();
    outofmem=true;
  }
  return false;
}

Fixed version (ground truth):
protected Boolean doInBackground(String... args){
  status=args[0];
  try {
    Twitter twitter=Utils.getTwitter(getApplicationContext(),settings);
    Twitter twitter2=Utils.getSecondTwitter(getApplicationContext());
    if (remaining < 0 && !pwiccer && !multiTweet) {
      boolean isDone=false;
      if (useAccOne) {
        isDone=tweetUsingTwitLonger(twitter);
      }
      if (useAccTwo) {
        isDone=tweetUsingTwitLonger(twitter2);
      }
      return isDone;
    }
 else     if (multiTweet && remaining < 0) {
      Pair<String,List<String>> multiTweets=getMultipeTweets(status);
      int noOfTweets=multiTweets.second.size();
      int tweetNo=1;
      for (int i=0; i < noOfTweets; i++) {
        status=multiTweets.first.length() != 0 ? multiTweets.first : "String_Node_Str";
        status+=multiTweets.second.get(i) + "String_Node_Str" + tweetNo+ "String_Node_Str"+ noOfTweets+ "String_Node_Str";
        tweetNo++;
        if (useAccOne) {
          tweetWithoutImages(twitter);
        }
        if (useAccTwo) {
          tweetWithoutImages(twitter2);
        }
      }
      multiTweet=false;
      return true;
    }
 else {
      if (imagesAttached == 0) {
        if (useAccOne) {
          tweetWithoutImages(twitter);
        }
        if (useAccTwo) {
          tweetWithoutImages(twitter2);
        }
        return true;
      }
 else {
        boolean autoPopulateMetadata=false;
        if (replyText != null && !replyText.contains("String_Node_Str")) {
          String replaceable=replyText.replaceAll("String_Node_Str","String_Node_Str");
          status=status.replaceAll(replaceable,"String_Node_Str");
          autoPopulateMetadata=true;
        }
        StatusUpdate media=new StatusUpdate(status);
        media.setAutoPopulateReplyMetadata(autoPopulateMetadata);
        if (notiId != 0) {
          media.setInReplyToStatusId(notiId);
        }
        File[] files=new File[imagesAttached];
        File outputDir=context.getCacheDir();
        if (attachButton.isEnabled()) {
          for (int i=0; i < imagesAttached; i++) {
            files[i]=File.createTempFile("String_Node_Str","String_Node_Str" + i,outputDir);
            Bitmap bitmap=getBitmapToSend(Uri.parse(attachedUri[i]));
            ByteArrayOutputStream bos=new ByteArrayOutputStream();
            if (secondTry) {
              bitmap=Bitmap.createScaledBitmap(bitmap,bitmap.getWidth() / 2,bitmap.getHeight() / 2,true);
            }
            bitmap.compress(Bitmap.CompressFormat.JPEG,100,bos);
            byte[] bitmapdata=bos.toByteArray();
            FileOutputStream fos=new FileOutputStream(files[i]);
            fos.write(bitmapdata);
            fos.flush();
            fos.close();
          }
        }
        if (settings.twitpic && attachButton.isEnabled()) {
          boolean isDone=false;
          if (useAccOne) {
            for (int i=1; i < imagesAttached; i++) {
              TwitPicHelper helper=new TwitPicHelper(twitter,"String_Node_Str",files[i],context);
              text+="String_Node_Str" + helper.uploadForUrl();
            }
            TwitPicHelper helper=new TwitPicHelper(twitter,text,files[0],context);
            if (addLocation) {
              if (waitForLocation()) {
                Location location=mLastLocation;
                GeoLocation geolocation=new GeoLocation(location.getLatitude(),location.getLongitude());
                media.setLocation(geolocation);
              }
            }
            if (helper.createPost() != 0) {
              isDone=true;
            }
          }
          if (useAccTwo) {
            for (int i=1; i < imagesAttached; i++) {
              TwitPicHelper helper=new TwitPicHelper(twitter2,"String_Node_Str",files[i],context);
              text+="String_Node_Str" + helper.uploadForUrl();
            }
            TwitPicHelper helper=new TwitPicHelper(twitter2,text,files[0],context);
            if (addLocation) {
              if (waitForLocation()) {
                Location location=mLastLocation;
                GeoLocation geolocation=new GeoLocation(location.getLatitude(),location.getLongitude());
                media.setLocation(geolocation);
              }
            }
            if (helper.createPost() != 0) {
              isDone=true;
            }
          }
          return isDone;
        }
 else {
          if (attachButton.isEnabled()) {
            if (imagesAttached == 1) {
              media.setMedia(files[0]);
            }
 else {
              long[] mediaIds=new long[files.length];
              for (int i=0; i < files.length; i++) {
                UploadedMedia upload=twitter.uploadMedia(files[i]);
                mediaIds[i]=upload.getMediaId();
              }
              media.setMediaIds(mediaIds);
            }
          }
 else {
            Log.v("String_Node_Str","String_Node_Str" + attachmentType);
            media.setMedia(attachmentType,getContentResolver().openInputStream(Uri.parse(attachedUri[0])));
          }
          if (addLocation) {
            if (waitForLocation()) {
              Location location=mLastLocation;
              GeoLocation geolocation=new GeoLocation(location.getLatitude(),location.getLongitude());
              media.setLocation(geolocation);
            }
          }
          twitter4j.Status s=null;
          if (useAccOne) {
            s=twitter.updateStatus(media);
          }
          if (useAccTwo) {
            s=twitter2.updateStatus(media);
          }
          if (s != null) {
            final String[] hashtags=TweetLinkUtils.getLinksInStatus(s)[3].split("String_Node_Str");
            if (hashtags != null) {
              new Thread(new Runnable(){
                @Override public void run(){
                  ArrayList<String> tags=new ArrayList<String>();
                  if (hashtags != null) {
                    for (                    String s : hashtags) {
                      if (!s.equals("String_Node_Str")) {
                        tags.add("String_Node_Str" + s);
                      }
                    }
                  }
                  HashtagDataSource source=HashtagDataSource.getInstance(context);
                  for (                  String s : tags) {
                    if (s.contains("String_Node_Str")) {
                      source.deleteTag(s);
                      source.createTag(s);
                    }
                  }
                }
              }
).start();
            }
          }
          return true;
        }
      }
    }
  }
 catch (  final Exception e) {
    e.printStackTrace();
    runOnUiThread(new Runnable(){
      @Override public void run(){
        displayErrorNotification(e);
      }
    }
);
    if (e.getMessage() != null && e.getMessage().contains("String_Node_Str")) {
      tryingAgain=true;
      return false;
    }
  }
catch (  OutOfMemoryError e) {
    e.printStackTrace();
    outofmem=true;
  }
  return false;
}