nus-yam/ex-repair huggingface dataset:
Program: 21675
Project: 21675
Buggy source:
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    folderTreeArea=new JTree(folderTreeModel);
    folderTreeArea.setEditable(true);
    folderTreeArea.addTreeSelectionListener(this);
    JScrollPane folderTreeScrollPane=new JScrollPane(folderTreeArea);
    dataTreeArea=new JTree(dataTreeModel);
    dataTreeArea.setEditable(true);
    dataTreeArea.addTreeSelectionListener(this);
    JScrollPane dataTreeScrollPane=new JScrollPane(dataTreeArea);
    JTabbedPane tabbedPane=new JTabbedPane();
    tabbedPane.add("String_Node_Str",folderTreeScrollPane);
    tabbedPane.add("String_Node_Str",dataTreeScrollPane);
    splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,tabbedPane,bodyPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(200);
    Dimension minimumSize=new Dimension(100,50);
    folderTreeScrollPane.setMinimumSize(minimumSize);
    dataTreeScrollPane.setMinimumSize(minimumSize);
    tabbedPane.setMinimumSize(minimumSize);
    bodyPanel.setMinimumSize(minimumSize);
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  setBounds(100,100,875,600);
  setVisible(true);
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}

Fixed version (ground truth):
public void init(String url){
  initMenuBar();
  setJMenuBar(menuBar);
  bodyPanel=new OTViewContainerPanel(this,null);
  if (showTree) {
    dataTreeModel=new SimpleTreeModel();
    folderTreeModel=new SimpleTreeModel();
    updateTreePane();
    getContentPane().add(splitPane);
  }
 else {
    getContentPane().add(bodyPanel);
  }
  setBounds(100,100,875,600);
  setVisible(true);
  if (url != null) {
    try {
      loadURL(new URL(url));
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
      return;
    }
  }
}
Program: 21676
Project: 21676
Buggy source:
public void actionPerformed(ActionEvent arg0){
  Frame frame=(Frame)SwingUtilities.getRoot(OTViewer.this);
  FileDialog dialog=new FileDialog(frame,"String_Node_Str",FileDialog.SAVE);
  if (currentFile != null) {
    dialog.setDirectory(currentFile.getParentFile().getAbsolutePath());
    dialog.setFile(currentFile.getName());
  }
  dialog.show();
  String fileName=dialog.getFile();
  if (fileName == null) {
    return;
  }
  fileName=dialog.getDirectory() + fileName;
  currentFile=new File(fileName);
  if (!fileName.toLowerCase().endsWith("String_Node_Str")) {
    currentFile=new File(currentFile.getAbsolutePath() + "String_Node_Str");
  }
  if (!currentFile.exists() || checkForReplace(currentFile)) {
    try {
      Exporter.export(currentFile,xmlDB.getRoot(),xmlDB);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  frame.setTitle(fileName);
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  Object source=e.getSource();
  if (((JCheckBoxMenuItem)source).isSelected()) {
    System.setProperty("String_Node_Str","String_Node_Str");
  }
 else {
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  updateTreePane();
}
Program: 21678
Project: 21678
Buggy source:
public OTXMLElement getParentElement(){
  Element parent=element.getParentElement();
  return new JDOMElement(parent);
}

Fixed version (ground truth):
public OTXMLElement getParentElement(){
  Element parent=element.getParentElement();
  if (parent == null)   return null;
  return new JDOMElement(parent);
}
Program: 21679
Project: 21679
Buggy source:
/** 
 * @param publishDate - string publish date formatted "yyyy-MM-dd HH:mm:ss" 
 */
public void setPublishDate(String publishDate){
  try {
    SimpleDateFormat simple=new SimpleDateFormat("String_Node_Str");
    this.publishDate=simple.parse(publishDate);
  }
 catch (  ParseException e) {
  }
}

Fixed version (ground truth):
/** 
 * @param publishDate - string publish date formatted "yyyy-MM-dd HH:mm:ss" 
 */
public void setPublishDate(String publishDate){
  try {
    this.publishDate=sf2.parse(publishDate);
  }
 catch (  ParseException e) {
  }
}
Program: 21680
Project: 21680
Buggy source:
/** 
 * If you have a valid accessToken, use this constructor
 * @param apiKey - your API-KEY
 * @param secretKey - your SECRET-KEY
 * @param accessToken - a valid accessToken
 * @param endpoint - the endpoint URL for the client to connect to
 * @param ssl - should use SSL?
 * @throws HttpException
 * @throws IOException
 * @throws JSONException
 * @throws SaploClientException 
 */
public SaploClient(String apiKey,String secretKey,String accessToken,String endpoint,boolean ssl) throws JSONException, SaploClientException {
  if (endpoint == null || !endpoint.startsWith("String_Node_Str"))   throw new ClientError("String_Node_Str");
  if (ssl && !endpoint.startsWith("String_Node_Str"))   throw new ClientError("String_Node_Str");
  if (!ssl && !endpoint.startsWith("String_Node_Str"))   throw new ClientError("String_Node_Str");
  this.ssl=ssl;
  this.apiKey=apiKey;
  this.secretKey=secretKey;
  this.endpoint=endpoint;
  this.setupServerEnvironment();
  createSession(accessToken);
}

Fixed version (ground truth):
/** 
 * If you have a valid accessToken, use this constructor
 * @param apiKey - your API-KEY
 * @param secretKey - your SECRET-KEY
 * @param accessToken - a valid accessToken
 * @param endpoint - the endpoint URL for the client to connect to
 * @param ssl - should use SSL?
 * @throws HttpException
 * @throws IOException
 * @throws JSONException
 * @throws SaploClientException 
 */
public SaploClient(String apiKey,String secretKey,String accessToken,String endpoint,boolean ssl) throws JSONException, SaploClientException {
  if (endpoint == null || !endpoint.startsWith("String_Node_Str"))   throw new ClientError("String_Node_Str");
  if (ssl && !endpoint.startsWith("String_Node_Str"))   throw new ClientError("String_Node_Str");
  if (!ssl && !endpoint.startsWith("String_Node_Str"))   throw new ClientError("String_Node_Str");
  this.ssl=ssl;
  this.apiKey=apiKey;
  this.secretKey=secretKey;
  this.endpoint=endpoint;
  this.setupServerEnvironment();
  createSession(accessToken);
  lock=new ReentrantLock();
  sleeping=lock.newCondition();
}
Program: 21681
Project: 21681
Buggy source:
protected boolean reCreateSession() throws SaploClientException {
synchronized (this) {
    long now=System.currentTimeMillis();
    if ((now - lastReconnectAttempt) < reconnectTimeout * maxReconnectCount || reconnectCount > maxReconnectCount)     return false;
    if ((now - lastSuccessfulReconnect) < 10000 && reconnectCount == 0)     return true;
    logger.info("String_Node_Str");
    while (reconnectCount <= maxReconnectCount) {
      try {
        long toSleep=(reconnectCount + 1) * reconnectTimeout;
        this.wait(toSleep);
        authenticateSession();
        reconnectCount=0;
        lastReconnectAttempt=System.currentTimeMillis();
        lastSuccessfulReconnect=System.currentTimeMillis();
        logger.info("String_Node_Str");
        return true;
      }
 catch (      SaploClientException e) {
        reconnectCount++;
      }
catch (      InterruptedException e) {
        e.printStackTrace();
        return false;
      }
    }
    lastReconnectAttempt=System.currentTimeMillis();
    logger.warn("String_Node_Str" + reconnectCount + "String_Node_Str");
    throw new SaploClientException(ResponseCodes.MSG_ERR_NOSESSION,ResponseCodes.CODE_ERR_NOSESSION);
  }
}

Fixed version (ground truth):
protected synchronized boolean reCreateSession() throws SaploClientException {
  lock.lock();
  try {
    long now=System.currentTimeMillis();
    if ((now - lastReconnectAttempt) < reconnectTimeout * maxReconnectCount || reconnectCount > maxReconnectCount)     return false;
    if ((now - lastSuccessfulReconnect) < 10000 && reconnectCount == 0)     return true;
    logger.info("String_Node_Str");
    while (reconnectCount <= maxReconnectCount) {
      try {
        long toSleep=(reconnectCount + 1) * reconnectTimeout;
        sleeping.await(toSleep,TimeUnit.MILLISECONDS);
        authenticateSession();
        reconnectCount=0;
        lastReconnectAttempt=0;
        lastSuccessfulReconnect=System.currentTimeMillis();
        logger.info("String_Node_Str");
        return true;
      }
 catch (      SaploClientException e) {
        reconnectCount++;
      }
catch (      InterruptedException e) {
        e.printStackTrace();
        return false;
      }
    }
    lastReconnectAttempt=System.currentTimeMillis();
    logger.warn("String_Node_Str" + reconnectCount + "String_Node_Str");
    throw new SaploClientException(ResponseCodes.MSG_ERR_NOSESSION,ResponseCodes.CODE_ERR_NOSESSION);
  }
  finally {
    lock.unlock();
  }
}
Program: 21682
Project: 21682
Buggy source:
/** 
 * A convenient way of deleting SaploText by textId
 * @param textId
 * @return success?
 * @throws JSONException
 * @throws SaploClientException
 */
public boolean delete(int textId) throws JSONException, SaploClientException {
  SaploText text=new SaploText();
  text.setId(textId);
  return delete(text);
}

Fixed version (ground truth):
/** 
 * A convenient way of deleting SaploText by textId
 * @param textId
 * @return success?
 * @throws JSONException
 * @throws SaploClientException
 */
public boolean delete(int collectionId,int textId) throws JSONException, SaploClientException {
  SaploCollection collection=new SaploCollection();
  collection.setId(collectionId);
  SaploText text=new SaploText();
  text.setId(textId);
  text.setCollection(collection);
  return delete(text);
}
Program: 21684
Project: 21684
Buggy source:
public HeaderChapter(){
  presentationHeader=new PresentationHeader();
}

Fixed version (ground truth):
public HeaderChapter(){
  if (presentationHeader == null) {
    presentationHeader=new PresentationHeader();
  }
}
Program: 21685
Project: 21685
Buggy source:
public static void trackModuleRelativePageView(String page){
  trackPageView(GWT.getModuleName() + "String_Node_Str" + page);
}

Fixed version (ground truth):
public static void trackModuleRelativePageView(String page){
  trackPageViewAsync(GWT.getModuleName() + "String_Node_Str" + page);
}
Program: 21686
Project: 21686
Buggy source:
public void updateSlides(String chapterName,Chapter chapter){
  index=0;
  this.chapterName=chapterName;
  this.chapter=chapter;
  slidesPanel.clear();
  for (  Presentable presentable : chapter) {
    slidesPanel.add(presentable.asWidget());
  }
}

Fixed version (ground truth):
public void updateSlides(String chapterName,Chapter chapter){
  index=0;
  this.chapterName=chapterName;
  this.chapter=chapter;
  slidesPanel.clear();
  for (  Presentable presentable : chapter) {
    Widget slideWidget=presentable.asWidget();
    slideWidget.setStyleName("String_Node_Str");
    slidesPanel.add(slideWidget);
  }
}
Program: 21687
Project: 21687
Buggy source:
@Override protected void buildSlides(){
  addSlide(GWT.create(Titre.class));
  addSlide(GWT.create(AQuoi.class));
  addSlide(GWT.create(Fonctionnement.class));
  addSlide(GWT.create(Compilation.class));
  addPresentable(new TropSimple());
  addSlide(FormationGwt.PLAN);
}

Fixed version (ground truth):
@Override protected void buildSlides(){
  addSlide(GWT.create(Titre.class));
  addSlide(GWT.create(AQuoi.class));
  addSlide(GWT.create(Fonctionnement.class));
  addSlide(GWT.create(Compilation.class));
  addPresentable(new TropSimple(GWT.<UiBinder<Widget,CodeSlide>>create(TropSimpleBinder.class)));
  addSlide(FormationGwt.PLAN);
}
Program: 21688
Project: 21688
Buggy source:
public TropSimple(){
  initWidget(uiBinder.createAndBindUi(this));
  sourceCode.setText(codeSample.getInnerText());
}

Fixed version (ground truth):
public TropSimple(UiBinder<Widget,CodeSlide> uiBinder){
  super(uiBinder);
}
Program: 21689
Project: 21689
Buggy source:
private String computeBaseFilename(@NotNull final String filename){
  final int dotPosition=filename.indexOf('.');
  final String baseFilename;
  if (dotPosition >= 0) {
    baseFilename=filename.substring(0,dotPosition);
  }
 else {
    baseFilename=filename;
  }
  return baseFilename;
}

Fixed version (ground truth):
@NotNull private String computeBaseFilename(@NotNull final String filename){
  final int dotPosition=filename.indexOf('.');
  final String baseFilename;
  if (dotPosition >= 0) {
    baseFilename=filename.substring(0,dotPosition);
  }
 else {
    baseFilename=filename;
  }
  return baseFilename;
}
Program: 21690
Project: 21690
Buggy source:
private File[] getFilesWithSameBaseFilename(final String baseFilename){
  lock.lock();
  try {
    return dataFileDirectory.listFiles(new FilenameFilter(){
      private final String baseFilenameUppercase=baseFilename.toUpperCase();
      @Override public boolean accept(      final File file,      final String filename){
        return file != null && filename != null && filename.toUpperCase().startsWith(baseFilenameUppercase);
      }
    }
);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
private File[] getFilesWithSameBaseFilename(final String baseFilename){
  lock.lock();
  try {
    return dataFileDirectory.listFiles(new FilenameFilter(){
      private final String baseFilenameUppercase=baseFilename.toUpperCase();
      @Override public boolean accept(      final File file,      final String filename){
        return file != null && baseFilenameUppercase.equals(computeBaseFilename(filename).toUpperCase());
      }
    }
);
  }
  finally {
    lock.unlock();
  }
}
Program: 21691
Project: 21691
Buggy source:
/** 
 * Changes the file extension on the given <code>file</code> from the <code>existingFilenameExtension</code> to the <code>newFilenameExtension</code>.  Returns the new   {@link File} upon success, <code>null</code> on failure.
 */
@Nullable private File changeFileExtension(@NotNull final File file,@NotNull final String existingFilenameExtension,@NotNull final String newFilenameExtension){
  lock.lock();
  try {
    final int extensionPosition=file.getName().indexOf(existingFilenameExtension);
    if (extensionPosition >= 0) {
      final String filenameWithoutOldExtension=file.getName().substring(0,extensionPosition);
      final File newFilename=new File(file.getParentFile(),filenameWithoutOldExtension + newFilenameExtension);
      if (file.renameTo(newFilename)) {
        if (LOG.isTraceEnabled()) {
          LOG.trace("String_Node_Str" + file.getName() + "String_Node_Str"+ newFilename.getName()+ "String_Node_Str");
        }
        return newFilename;
      }
 else {
        if (LOG.isEnabledFor(Level.ERROR)) {
          LOG.error("String_Node_Str" + file.getName() + "String_Node_Str"+ newFilename.getName()+ "String_Node_Str");
        }
      }
    }
  }
  finally {
    lock.unlock();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Changes the file extension on the given <code>file</code> from the <code>existingFilenameExtension</code> to the <code>newFilenameExtension</code>.  Returns the new   {@link File} upon success, <code>null</code> on failure.
 */
@Nullable private File changeFileExtension(@NotNull final File file,@NotNull final String existingFilenameExtension,@NotNull final String newFilenameExtension){
  lock.lock();
  try {
    final int extensionPosition=file.getName().toLowerCase().indexOf(existingFilenameExtension.toLowerCase());
    if (extensionPosition >= 0) {
      final String filenameWithoutOldExtension=file.getName().substring(0,extensionPosition);
      final File newFilename=new File(file.getParentFile(),filenameWithoutOldExtension + newFilenameExtension);
      if (file.renameTo(newFilename)) {
        if (LOG.isTraceEnabled()) {
          LOG.trace("String_Node_Str" + file.getName() + "String_Node_Str"+ newFilename.getName()+ "String_Node_Str");
        }
        return newFilename;
      }
 else {
        if (LOG.isEnabledFor(Level.ERROR)) {
          LOG.error("String_Node_Str" + file.getName() + "String_Node_Str"+ newFilename.getName()+ "String_Node_Str");
        }
      }
    }
  }
  finally {
    lock.unlock();
  }
  return null;
}
Program: 21693
Project: 21693
Buggy source:
@Nullable protected abstract ReturnType executionWorkhorse();

Fixed version (ground truth):
@Nullable protected abstract ReturnType executionWorkhorse(final int attemptNumber,final int maxNumberOfAttempts);
Program: 21694
Project: 21694
Buggy source:
/** 
 * Executes an action and returns the result, retrying if necessary up to three times.  Returns <code>null</code> only if it fails to get a non-<code>null</code> result.
 */
@SuppressWarnings({"String_Node_Str"}) @Nullable protected final ReturnType execute(){
  int retryCount=0;
  do {
    try {
      final ReturnType val=executionWorkhorse();
      if (val != null) {
        return val;
      }
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
    retryCount++;
    if (retryCount < MAX_RETRIES) {
      try {
        Thread.sleep(200);
      }
 catch (      InterruptedException e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
 while (retryCount < MAX_RETRIES);
  return null;
}

Fixed version (ground truth):
/** 
 * Executes an action and returns the result, retrying if necessary up to three times.  Returns <code>null</code> only if it fails to get a non-<code>null</code> result.
 */
@SuppressWarnings({"String_Node_Str"}) @Nullable protected final ReturnType execute(){
  int retryCount=0;
  do {
    try {
      final ReturnType val=executionWorkhorse(retryCount + 1,MAX_RETRIES);
      if (val != null) {
        return val;
      }
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
    }
    retryCount++;
    if (retryCount < MAX_RETRIES) {
      try {
        Thread.sleep(200);
      }
 catch (      InterruptedException e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
 while (retryCount < MAX_RETRIES);
  return null;
}
Program: 21698
Project: 21698
Buggy source:
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}

Fixed version (ground truth):
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      if (mActiveDefaultNetwork != -1) {
        String defaultIface=mNetTrackers[mActiveDefaultNetwork].getInterfaceName();
        if (defaultIface != null && !defaultIface.equals(mNetTrackers[netType].getInterfaceName())) {
          mNetTrackers[netType].removeDefaultRoute();
        }
      }
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}
Program: 21699
Project: 21699
Buggy source:
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
    if (mNetAttributes[type] == null || !mNetAttributes[type].isDefault()) {
      continue;
    }
    NetworkStateTracker t=mNetTrackers[type];
    NetworkInfo info=t.getNetworkInfo();
    if (info.isConnected()) {
      if (DBG && type != mActiveDefaultNetwork)       Slog.e(TAG,"String_Node_Str" + "String_Node_Str");
      return info;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  if (mActiveDefaultNetwork != -1) {
    return mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
  }
  return null;
}
Program: 21700
Project: 21700
Buggy source:
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}

Fixed version (ground truth):
/** 
 * After a change in the connectivity state of any network, We're mainly concerned with making sure that the list of DNS servers is setupup according to which networks are connected, and ensuring that the right routing table entries exist.
 */
private void handleConnectivityChange(int netType){
  handleDnsConfigurationChange(netType);
  if (mNetTrackers[netType].getNetworkInfo().isConnected()) {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].addDefaultRoute();
    }
 else {
      if (mActiveDefaultNetwork != -1) {
        String defaultIface=mNetTrackers[mActiveDefaultNetwork].getInterfaceName();
        if (defaultIface != null && !defaultIface.equals(mNetTrackers[netType].getInterfaceName())) {
          mNetTrackers[netType].removeDefaultRoute();
        }
      }
      mNetTrackers[netType].addPrivateDnsRoutes();
    }
  }
 else {
    if (mNetAttributes[netType].isDefault()) {
      mNetTrackers[netType].removeDefaultRoute();
    }
 else {
      mNetTrackers[netType].removePrivateDnsRoutes();
    }
  }
}
Program: 21701
Project: 21701
Buggy source:
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
    if (mNetAttributes[type] == null || !mNetAttributes[type].isDefault()) {
      continue;
    }
    NetworkStateTracker t=mNetTrackers[type];
    NetworkInfo info=t.getNetworkInfo();
    if (info.isConnected()) {
      if (DBG && type != mActiveDefaultNetwork)       Slog.e(TAG,"String_Node_Str" + "String_Node_Str");
      return info;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return NetworkInfo for the active (i.e., connected) network interface. It is assumed that at most one network is active at a time. If more than one is active, it is indeterminate which will be returned.
 * @return the info for the active network, or {@code null} if none isactive
 */
public NetworkInfo getActiveNetworkInfo(){
  enforceAccessPermission();
  if (mActiveDefaultNetwork != -1) {
    return mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
  }
  return null;
}
Program: 21704
Project: 21704
Buggy source:
@Override public void onDetached(){
  removeCallbacks(mHider);
}

Fixed version (ground truth):
@Override public void onDetached(){
}
Program: 21705
Project: 21705
Buggy source:
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        deliveryPendingList.remove(i);
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}

Fixed version (ground truth):
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  int tpStatus=sms.getStatus();
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        if (tpStatus >= Sms.STATUS_FAILED || tpStatus < Sms.STATUS_PENDING) {
          deliveryPendingList.remove(i);
        }
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}
Program: 21708
Project: 21708
Buggy source:
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  mRemainingMessages=msgCount;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}
Program: 21711
Project: 21711
Buggy source:
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
protected void sendMultipartText(String destinationAddress,String scAddress,ArrayList<String> parts,ArrayList<PendingIntent> sentIntents,ArrayList<PendingIntent> deliveryIntents){
  int refNumber=getNextConcatenatedRef() & 0x00FF;
  int msgCount=parts.size();
  int encoding=android.telephony.SmsMessage.ENCODING_UNKNOWN;
  mRemainingMessages=msgCount;
  for (int i=0; i < msgCount; i++) {
    TextEncodingDetails details=SmsMessage.calculateLength(parts.get(i),false);
    if (encoding != details.codeUnitSize && (encoding == android.telephony.SmsMessage.ENCODING_UNKNOWN || encoding == android.telephony.SmsMessage.ENCODING_7BIT)) {
      encoding=details.codeUnitSize;
    }
  }
  for (int i=0; i < msgCount; i++) {
    SmsHeader.ConcatRef concatRef=new SmsHeader.ConcatRef();
    concatRef.refNumber=refNumber;
    concatRef.seqNumber=i + 1;
    concatRef.msgCount=msgCount;
    concatRef.isEightBits=true;
    SmsHeader smsHeader=new SmsHeader();
    smsHeader.concatRef=concatRef;
    PendingIntent sentIntent=null;
    if (sentIntents != null && sentIntents.size() > i) {
      sentIntent=sentIntents.get(i);
    }
    PendingIntent deliveryIntent=null;
    if (deliveryIntents != null && deliveryIntents.size() > i) {
      deliveryIntent=deliveryIntents.get(i);
    }
    SmsMessage.SubmitPdu pdus=SmsMessage.getSubmitPdu(scAddress,destinationAddress,parts.get(i),deliveryIntent != null,SmsHeader.toByteArray(smsHeader),encoding);
    sendRawPdu(pdus.encodedScAddress,pdus.encodedMessage,sentIntent,deliveryIntent);
  }
}
Program: 21712
Project: 21712
Buggy source:
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        deliveryPendingList.remove(i);
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}

Fixed version (ground truth):
/** 
 * Called when a status report is received.  This should correspond to a previously successful SEND.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldbe a String representing the status report PDU, as ASCII hex.
 */
protected void handleStatusReport(AsyncResult ar){
  String pduString=(String)ar.result;
  SmsMessage sms=SmsMessage.newFromCDS(pduString);
  int tpStatus=sms.getStatus();
  if (sms != null) {
    int messageRef=sms.messageRef;
    for (int i=0, count=deliveryPendingList.size(); i < count; i++) {
      SmsTracker tracker=deliveryPendingList.get(i);
      if (tracker.mMessageRef == messageRef) {
        if (tpStatus >= Sms.STATUS_FAILED || tpStatus < Sms.STATUS_PENDING) {
          deliveryPendingList.remove(i);
        }
        PendingIntent intent=tracker.mDeliveryIntent;
        Intent fillIn=new Intent();
        fillIn.putExtra("String_Node_Str",IccUtils.hexStringToBytes(pduString));
        try {
          intent.send(mContext,Activity.RESULT_OK,fillIn);
        }
 catch (        CanceledException ex) {
        }
        break;
      }
    }
  }
  acknowledgeLastIncomingSms(true,Intents.RESULT_SMS_HANDLED,null);
}
Program: 21713
Project: 21713
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags){
  if (p == null)   return null;
  if (!copyNeeded(flags,p,null)) {
    if (!sCompatibilityModeEnabled) {
      p.applicationInfo.disableCompatibilityMode();
    }
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (!sCompatibilityModeEnabled) {
    ai.disableCompatibilityMode();
  }
  ai.enabled=p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(Package p,int flags){
  if (p == null)   return null;
  if (!copyNeeded(flags,p,null)) {
    if (!sCompatibilityModeEnabled) {
      p.applicationInfo.disableCompatibilityMode();
    }
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (!sCompatibilityModeEnabled) {
    ai.disableCompatibilityMode();
  }
  if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
    ai.enabled=true;
  }
 else   if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
    ai.enabled=false;
  }
  return ai;
}
Program: 21716
Project: 21716
Buggy source:
PackageSetting(String name,String realName,File codePath,File resourcePath,String nativeLibraryPathString,int pVersionCode,int pkgFlags){
  super(name,realName,codePath,resourcePath,nativeLibraryPathString,pVersionCode,pkgFlags);
}

Fixed version (ground truth):
PackageSetting(PackageSetting orig){
  super(orig.name,orig.realName,orig.codePath,orig.resourcePath,orig.nativeLibraryPathString,orig.versionCode,orig.pkgFlags);
  copyFrom(orig);
}
Program: 21718
Project: 21718
Buggy source:
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  final boolean deleteCodeAndResources;
  if (ps.versionCode < p.mVersionCode) {
    deleteCodeAndResources=true;
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    deleteCodeAndResources=false;
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,deleteCodeAndResources,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  if (ps.versionCode < p.mVersionCode) {
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,true,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}
Program: 21719
Project: 21719
Buggy source:
int disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return -1;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
  }
  return removePackageLP(name);
}

Fixed version (ground truth):
boolean disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return false;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
    PackageSetting newp=new PackageSetting(p);
    replacePackageLP(name,newp);
    return true;
  }
  return false;
}
Program: 21723
Project: 21723
Buggy source:
PackageSetting(String name,String realName,File codePath,File resourcePath,String nativeLibraryPathString,int pVersionCode,int pkgFlags){
  super(name,realName,codePath,resourcePath,nativeLibraryPathString,pVersionCode,pkgFlags);
}

Fixed version (ground truth):
PackageSetting(PackageSetting orig){
  super(orig.name,orig.realName,orig.codePath,orig.resourcePath,orig.nativeLibraryPathString,orig.versionCode,orig.pkgFlags);
  copyFrom(orig);
}
Program: 21725
Project: 21725
Buggy source:
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  final boolean deleteCodeAndResources;
  if (ps.versionCode < p.mVersionCode) {
    deleteCodeAndResources=true;
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    deleteCodeAndResources=false;
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,deleteCodeAndResources,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo,boolean writeSettings){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  if (ps.versionCode < p.mVersionCode) {
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,true,flags,outInfo,writeSettings);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    NativeLibraryHelper.removeNativeBinariesLI(p.applicationInfo.nativeLibraryDir);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS,0);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    if (writeSettings) {
      mSettings.writeLP();
    }
  }
  return true;
}
Program: 21726
Project: 21726
Buggy source:
int disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return -1;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
  }
  return removePackageLP(name);
}

Fixed version (ground truth):
boolean disableSystemPackageLP(String name){
  PackageSetting p=mPackages.get(name);
  if (p == null) {
    Log.w(TAG,"String_Node_Str" + name + "String_Node_Str");
    return false;
  }
  PackageSetting dp=mDisabledSysPackages.get(name);
  if (dp == null) {
    if ((p.pkg != null) && (p.pkg.applicationInfo != null)) {
      p.pkg.applicationInfo.flags|=ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
    }
    mDisabledSysPackages.put(name,p);
    PackageSetting newp=new PackageSetting(p);
    replacePackageLP(name,newp);
    return true;
  }
  return false;
}