auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onReceive(Context context, Intent intent) { Log.i(BackupNotificationAlarmReceiver.class.getName(),"Inside alarm receiver"); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); long masterKeyId = intent.getLongExtra(MASTER_KEY_ID,0); String name = intent.getStringExtra(NAME); String email = intent.getStringExtra(EMAIL); String masterKeyIds = Preferences.getPreferences(context).getBackupReminders(); if (masterKeyIds == null || !masterKeyIds.contains(masterKeyId+"") || masterKeyId == 0) { Intent intentAlarm = new Intent(context, BackupNotificationAlarmReceiver.class); intentAlarm.putExtra(MASTER_KEY_ID, masterKeyId); intentAlarm.putExtra(NAME, name); intentAlarm.putExtra(EMAIL, email); AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(context,1,intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.cancel(pendingIntent); return; } notificationManager.notify(((Long)masterKeyId).hashCode(), getNotification(context, masterKeyId,name,email)); }

Target:
public void onReceive(Context context, Intent intent) { Log.i(Constants.TAG, "Inside backup notification alarm receiver"); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); long masterKeyId = intent.getLongExtra(MASTER_KEY_ID, 0); String name = intent.getStringExtra(NAME); String email = intent.getStringExtra(EMAIL); String masterKeyIds = Preferences.getPreferences(context).getBackupReminders(); if (masterKeyIds == null || !masterKeyIds.contains(Long.toString(masterKeyId)) || masterKeyId == 0) { Intent intentAlarm = new Intent(context, BackupNotificationAlarmReceiver.class); intentAlarm.putExtra(MASTER_KEY_ID, masterKeyId); intentAlarm.putExtra(NAME, name); intentAlarm.putExtra(EMAIL, email); AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 1, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.cancel(pendingIntent); return; } notificationManager.notify(Long.valueOf(masterKeyId).hashCode(), getNotification(context, masterKeyId, name, email)); }
Source:
public void onMoveItem(int fromPosition, int toPosition) { if (fromPosition == toPosition) return; int realFromPosition = items.indexOf(((ReceiptContentItem) listItems.get(fromPosition)).getReceipt()); int realToPosition = items.indexOf(((ReceiptContentItem) listItems.get(toPosition)).getReceipt()); Logger.debug(this, "Moving receipt from position to position {}", realFromPosition, realToPosition); if (!orderingPreferencesManager.isReceiptsTableOrdered()) setDefaultOrderIds(); if (isOldCustomOrderIdFormatUsed()) { setDefaultOrderIds(); writeUpdatedItems(items); Toast.makeText(context, "Sorry, your receipts now are ordered by date.", Toast.LENGTH_SHORT).show(); return; } List<Receipt> originalItemsList = new ArrayList<>(items); final Receipt movedReceipt = items.remove(realFromPosition); items.add(realToPosition, movedReceipt); updateListItems(); final List<Receipt> changedReceipts = ReceiptCustomOrderIdHelper.INSTANCE .updateReceiptsCustomOrderIds(originalItemsList, realFromPosition, realToPosition); writeUpdatedItems(changedReceipts); }

Target:
public void onMoveItem(int fromPosition, int toPosition) { if (fromPosition == toPosition) return; int realFromPosition = items.indexOf(((ReceiptContentItem) listItems.get(fromPosition)).getReceipt()); int realToPosition = items.indexOf(((ReceiptContentItem) listItems.get(toPosition)).getReceipt()); Logger.debug(this, "Moving receipt from position to position {}", realFromPosition, realToPosition); if (!orderingPreferencesManager.isReceiptsTableOrdered()) setDefaultOrderIds(); if (isOldCustomOrderIdFormatUsed()) { setDefaultOrderIds(); writeUpdatedItems(items); return; } List<Receipt> originalItemsList = new ArrayList<>(items); final Receipt movedReceipt = items.remove(realFromPosition); items.add(realToPosition, movedReceipt); updateListItems(); final List<Receipt> changedReceipts = ReceiptCustomOrderIdHelper.INSTANCE .updateReceiptsCustomOrderIds(originalItemsList, realFromPosition, realToPosition); writeUpdatedItems(changedReceipts); }
Source:
public void process(IncomingMessageEnvelope envelope) { SystemStreamPartition envelopeSSP = envelope.getSystemStreamPartition(); String envelopeOffset = envelope.getOffset(); for (String store: this.sspToStores.get(envelopeSSP)) { SideInputsProcessor storeProcessor = this.storeToProcessor.get(store); KeyValueStore keyValueStore = (KeyValueStore) this.taskSideInputStorageManager.getStore(store); Collection<Entry<?, ?>> entriesToBeWritten = storeProcessor.process(envelope, keyValueStore); for (Entry entry : entriesToBeWritten) { if (entry.getKey() != null) { if (entry.getValue() != null) { keyValueStore.put(entry.getKey(), entry.getValue()); } else { keyValueStore.delete(entry.getKey()); } } } } this.lastProcessedOffsets.put(envelopeSSP, envelopeOffset); }

Target:
public synchronized void process(IncomingMessageEnvelope envelope) { SystemStreamPartition envelopeSSP = envelope.getSystemStreamPartition(); String envelopeOffset = envelope.getOffset(); for (String store: this.sspToStores.get(envelopeSSP)) { SideInputsProcessor storeProcessor = this.storeToProcessor.get(store); KeyValueStore keyValueStore = (KeyValueStore) this.taskSideInputStorageManager.getStore(store); Collection<Entry<?, ?>> entriesToBeWritten = storeProcessor.process(envelope, keyValueStore); for (Entry entry : entriesToBeWritten) { if (entry.getKey() != null) { if (entry.getValue() != null) { keyValueStore.put(entry.getKey(), entry.getValue()); } else { keyValueStore.delete(entry.getKey()); } } } } this.lastProcessedOffsets.put(envelopeSSP, envelopeOffset); }
Source:
public void addRowkeyRangesFilter(List<Pair<byte[],byte[]>> rowkeyPairs) throws IOException { if (rowkeyPairs == null || rowkeyPairs.size() < 1) { return; } Filter currentFilter = scan.getFilter(); if (currentFilter != null && !(currentFilter instanceof MultiRowRangeFilter)) return; List<MultiRowRangeFilter.RowRange> ranges = new ArrayList<>(rowkeyPairs.size()); byte[] startKey; byte[] stopKey; for (Pair<byte[],byte[]> startStopKey: rowkeyPairs) { startKey=startStopKey.getFirst(); stopKey=startStopKey.getSecond(); MultiRowRangeFilter.RowRange rr = new MultiRowRangeFilter.RowRange(startKey, true, stopKey, false); ranges.add(rr); } if (ranges.size() > 0) { MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges); scan.setFilter(filter); List<MultiRowRangeFilter.RowRange> sortedRanges = filter.getRowRanges(); scan.withStartRow(sortedRanges.get(0).getStartRow()); scan.withStopRow(sortedRanges.get(sortedRanges.size()-1).getStopRow()); } }

Target:
public void addRowkeyRangesFilter(List<Pair<byte[],byte[]>> rowkeyPairs) throws IOException { if (rowkeyPairs == null || rowkeyPairs.size() < 1) { return; } Filter currentFilter = scan.getFilter(); if (currentFilter != null && !(currentFilter instanceof MultiRowRangeFilter)) return; List<MultiRowRangeFilter.RowRange> ranges = new ArrayList<>(rowkeyPairs.size()); byte[] startKey; byte[] stopKey; for (Pair<byte[],byte[]> startStopKey: rowkeyPairs) { startKey=startStopKey.getFirst(); stopKey=startStopKey.getSecond(); MultiRowRangeFilter.RowRange rr = new MultiRowRangeFilter.RowRange(startKey, true, stopKey, false); ranges.add(rr); } if (ranges.size() > 0) { MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges); scan.setFilter(filter); List<MultiRowRangeFilter.RowRange> sortedRanges = filter.getRowRanges(); byte[] currentStartRow = scan.getStartRow(); byte[] currentStopRow = scan.getStopRow(); byte[] filterStartRow = sortedRanges.get(0).getStartRow(); byte[] filterStopRow = sortedRanges.get(sortedRanges.size()-1).getStopRow(); if (currentStartRow == null || currentStartRow.length == 0 || Bytes.compareTo(currentStartRow, filterStartRow) < 0) scan.withStartRow(filterStartRow); if (currentStopRow == null || currentStopRow.length == 0 || Bytes.compareTo(currentStopRow, filterStopRow) > 0) scan.withStopRow(filterStopRow); } }
Source:
public HostPoller(TimeBoundPollVDSCommandParameters parameters) { Objects.requireNonNull(parameters); this.parameters = parameters; }

Target:
public HostPoller(TimeBoundPollVDSCommandParameters parameters) { this.parameters = Objects.requireNonNull(parameters); }
Source:
static void handleRightClickAir(GlowPlayer player, ItemStack holding, EquipmentSlot slot) { PlayerInteractEvent event = EventFactory.onPlayerInteract( player, Action.RIGHT_CLICK_AIR, slot); if (event.useItemInHand() == null || event.useItemInHand() == Event.Result.DENY) { return; } if (!InventoryUtil.isEmpty(holding)) { ItemType type = ItemTable.instance().getItem(holding.getType()); if (type != null) { if (type.getContext().isAirApplicable()) { type.rightClickAir(player, holding); } else { if ((holding.getType() == Material.WATER_BUCKET || holding.getType() == Material.LAVA_BUCKET) && player.getGameMode() != GameMode.CREATIVE) { holding.setType(Material.BUCKET); } else if (type instanceof ItemTimedUsage) { ((ItemTimedUsage) type).startUse(player, holding); } else if (type instanceof ItemProjectile) { ((ItemProjectile) type).use(player, holding); } } } if (holding.getAmount() <= 0) { holding = InventoryUtil.createEmptyStack(); } player.getInventory().setItem(slot, holding); } }

Target:
static void handleRightClickAir(GlowPlayer player, ItemStack holding, EquipmentSlot slot) { PlayerInteractEvent event = EventFactory.onPlayerInteract( player, Action.RIGHT_CLICK_AIR, slot); if (event.useItemInHand() == null || event.useItemInHand() == Event.Result.DENY) { return; } if (!InventoryUtil.isEmpty(holding)) { ItemType type = ItemTable.instance().getItem(holding.getType()); if (type != null) { if (type.getContext().isAirApplicable()) { type.rightClickAir(player, holding); } } if (holding.getAmount() <= 0) { holding = InventoryUtil.createEmptyStack(); } player.getInventory().setItem(slot, holding); } }
Source:
public void updateNeighbors() { VertexValueWritable vertex = getVertexValue(); short state = vertex.getState(); EDGETYPE edgeType = EDGETYPE.fromByte(state); if ((state & State.MERGE) == 0) { return; } DIR mergeDir = edgeType.dir(); EnumSet<EDGETYPE> mergeEdges = mergeDir.edgeTypes(); DIR updateDir = mergeDir.mirror(); EnumSet<EDGETYPE> updateEdges = updateDir.edgeTypes(); for (EDGETYPE updateEdge : updateEdges) { outgoingMsg.reset(); outgoingMsg.setSourceVertexId(getVertexId()); outFlag = 0; outFlag |= MESSAGETYPE.UPDATE.get() | updateEdge.mirror().get(); outgoingMsg.setFlag(outFlag); for (EDGETYPE mergeEdge : mergeEdges) { EDGETYPE newEdgetype = EDGETYPE.resolveEdgeThroughPath(updateEdge, mergeEdge); for (VKmer dest : vertex.getEdges(updateEdge)) { if (verbose) LOG.fine("Iteration " + getSuperstep() + "\r\n" + "send update message from " + getVertexId() + " to " + dest + ": " + outgoingMsg); for (VKmer kmer : vertex.getEdges(mergeEdge)) { VKmerList msgList = outgoingMsg.getNode().getEdges(updateEdge); msgList.clear(); msgList.append(kmer); sendMsg(dest, outgoingMsg); } } } } }

Target:
public void updateNeighbors() { VertexValueWritable vertex = getVertexValue(); short state = vertex.getState(); EDGETYPE edgeType = EDGETYPE.fromByte(state); if ((state & State.MERGE) == 0) { return; } DIR mergeDir = edgeType.dir(); EDGETYPE[] mergeEdges = mergeDir.edgeTypes(); DIR updateDir = mergeDir.mirror(); EDGETYPE[] updateEdges = updateDir.edgeTypes(); for (EDGETYPE updateEdge : updateEdges) { outgoingMsg.reset(); outgoingMsg.setSourceVertexId(getVertexId()); outFlag = 0; outFlag |= MESSAGETYPE.UPDATE.get() | updateEdge.mirror().get(); outgoingMsg.setFlag(outFlag); for (EDGETYPE mergeEdge : mergeEdges) { EDGETYPE newEdgetype = EDGETYPE.resolveEdgeThroughPath(updateEdge, mergeEdge); for (VKmer dest : vertex.getEdges(updateEdge)) { if (verbose) LOG.fine("Iteration " + getSuperstep() + "\r\n" + "send update message from " + getVertexId() + " to " + dest + ": " + outgoingMsg); for (VKmer kmer : vertex.getEdges(mergeEdge)) { VKmerList msgList = outgoingMsg.getNode().getEdges(updateEdge); msgList.clear(); msgList.append(kmer); sendMsg(dest, outgoingMsg); } } } } }
Source:
public static List<ITmfStateInterval> getStatusIntervalsForThread(KernelAnalysisModule module, Integer threadId, long start, long end, long resolution, IProgressMonitor monitor) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return Collections.EMPTY_LIST; } try { int threadQuark = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString()); List<ITmfStateInterval> statusIntervals = StateSystemUtils.queryHistoryRange(ss, threadQuark, Math.max(start, ss.getStartTime()), Math.min(end - 1, ss.getCurrentEndTime()), resolution, monitor); return statusIntervals; } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { } return Collections.EMPTY_LIST; }

Target:
public static List<ITmfStateInterval> getStatusIntervalsForThread(KernelAnalysisModule module, Integer threadId, long start, long end, long resolution, IProgressMonitor monitor) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return Collections.emptyList(); } try { int threadQuark = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString()); List<ITmfStateInterval> statusIntervals = StateSystemUtils.queryHistoryRange(ss, threadQuark, Math.max(start, ss.getStartTime()), Math.min(end - 1, ss.getCurrentEndTime()), resolution, monitor); return statusIntervals; } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { } return Collections.emptyList(); }
Source:
protected SnapshotImpl doUpdate(SnapshotImpl update) { return managerProvider.get().merge(update); }

Target:
protected SnapshotImpl doUpdate(SnapshotImpl update) throws NotFoundException, SnapshotException, ConflictException { SnapshotImpl oldSnapshot = managerProvider.get().find(SnapshotImpl.class, update.getId()); if (oldSnapshot == null) { throw new NotFoundException(format("Snapshot with id '%s' doesn't exist", update.getId())); } if (!oldSnapshot.getWorkspaceId().equals(update.getWorkspaceId())) { throw new ConflictException(format("Cannot move '%s' snapshot to another workspace", oldSnapshot)); } return managerProvider.get().merge(update); }
Source:
private OnmsNode getNode(final OnmsResource resource, final Source source) { OnmsNode node = null; try { node = ResourceTypeUtils.getNodeFromResourceRoot(resource); } catch (final ObjectRetrievalFailureException e) { } if (node == null) { final String resourceId = source.getResourceId().split("\\.")[0]; final OnmsResource otherResource = m_resourceDao.getResourceById(ResourceId.fromString(resourceId)); node = ResourceTypeUtils.getNodeFromResource(otherResource); } return node; }

Target:
private OnmsNode getNode(final OnmsResource resource, final Source source) { OnmsNode node = null; try { node = ResourceTypeUtils.getNodeFromResourceRoot(resource); } catch (final ObjectRetrievalFailureException e) { } if (node == null) { final OnmsResource otherResource = m_resourceDao.getResourceById(ResourceId.fromString(source.getResourceId()).getParent()); node = ResourceTypeUtils.getNodeFromResource(otherResource); } return node; }
Source:
public JsonNode getBodyJson() { ObjectNode root = JsonNodeFactory.instance.objectNode(); ArrayNode reqs = JsonNodeFactory.instance.arrayNode(); for (AbstractLightblueDataRequest req : requests) { ObjectNode seqNode = JsonNodeFactory.instance.objectNode(); seqNode.set("seq", JsonNodeFactory.instance.numberNode(reqs.size())); String op = ""; if (req instanceof DataDeleteRequest) { op = "delete"; } else if (req instanceof DataFindRequest) { op = "find"; } else if (req instanceof DataInsertRequest) { op = "insert"; } else if (req instanceof DataSaveRequest) { op = "save"; } else if (req instanceof DataUpdateRequest) { op = "update"; } seqNode.set("op", JsonNodeFactory.instance.textNode(op)); ObjectNode request = (ObjectNode) req.getBodyJson(); request.set("entity", JsonNodeFactory.instance.textNode(req.getEntityName())); request.set("entityVersion", JsonNodeFactory.instance.textNode(req.getEntityVersion())); seqNode.set("request", request); reqs.add(seqNode); } root.set("requests", reqs); return root; }

Target:
public JsonNode getBodyJson() { ObjectNode root = JsonNodeFactory.instance.objectNode(); ArrayNode reqs = JsonNodeFactory.instance.arrayNode(); for (AbstractLightblueDataRequest req : requests) { ObjectNode seqNode = JsonNodeFactory.instance.objectNode(); seqNode.set("seq", JsonNodeFactory.instance.numberNode(reqs.size())); seqNode.set("op", JsonNodeFactory.instance.textNode(req.getOperation().name().toLowerCase())); ObjectNode request = (ObjectNode) req.getBodyJson(); request.set("entity", JsonNodeFactory.instance.textNode(req.getEntityName())); request.set("entityVersion", JsonNodeFactory.instance.textNode(req.getEntityVersion())); seqNode.set("request", request); reqs.add(seqNode); } root.set("requests", reqs); return root; }
Source:
protected void addNullToKeep(int position, int inputIndex) { if (nullsToAdd == null || nullsToAdd.length <= numNullsToAdd) { nullsToAdd = resize(nullsToAdd, numNullsToAdd); } if (nullsToAddIndexes == null || nullsToAddIndexes.length < nullsToAdd.length) { nullsToAddIndexes = resize(nullsToAddIndexes, numNullsToAdd); } nullsToAdd[numNullsToAdd] = position; nullsToAddIndexes[numNullsToAdd] = inputIndex; numNullsToAdd++; }

Target:
protected void addNullToKeep(int position, int inputIndex) { if (nullsToAdd == null || nullsToAdd.length <= numNullsToAdd) { nullsToAdd = resize(nullsToAdd, numNullsToAdd); } if (nullsToAddIndexes == null || nullsToAddIndexes.length <= nullsToAdd.length) { nullsToAddIndexes = resize(nullsToAddIndexes, numNullsToAdd); } nullsToAdd[numNullsToAdd] = position; nullsToAddIndexes[numNullsToAdd] = inputIndex; numNullsToAdd++; }
Source:
private Object objectInstance(Class<?> clazz, Boolean bool, Date date, DateTime dateTime, String str) { Object instance; try { instance = clazz.newInstance(); PropertyUtils.setProperty(instance, BOOL_FIELD, bool); PropertyUtils.setProperty(instance, DATE_FIELD, date); PropertyUtils.setProperty(instance, DATETIME_FIELD, dateTime); PropertyUtils.setProperty(instance, STRING_FIELD, str); } catch (Exception e) { LOGGER.error("Cannot create instance", e); return null; } return instance; }

Target:
private Object objectInstance(Class<?> clazz, Boolean bool, Date date, DateTime dateTime, String str) throws Exception { Object instance = clazz.newInstance(); PropertyUtils.setProperty(instance, BOOL_FIELD, bool); PropertyUtils.setProperty(instance, DATE_FIELD, date); PropertyUtils.setProperty(instance, DATETIME_FIELD, dateTime); PropertyUtils.setProperty(instance, STRING_FIELD, str); return instance; }
Source:
public Record putReplicatedRecord(Record replicatedRecord, long nowInMillis, boolean populateIndexes) { Record newRecord = createRecord(replicatedRecord, nowInMillis); markRecordStoreExpirable(replicatedRecord.getTtl(), replicatedRecord.getMaxIdle()); storage.put(replicatedRecord.getKey(), newRecord); mutationObserver.onReplicationPutRecord(newRecord.getKey(), newRecord, !populateIndexes); updateStatsOnPut(replicatedRecord.getHits(), nowInMillis); return newRecord; }

Target:
public Record putReplicatedRecord(Record replicatedRecord, long nowInMillis, boolean populateIndexes) { Record newRecord = createRecord(replicatedRecord, nowInMillis); markRecordStoreExpirable(replicatedRecord.getTtl(), replicatedRecord.getMaxIdle()); storage.put(replicatedRecord.getKey(), newRecord); mutationObserver.onReplicationPutRecord(newRecord.getKey(), newRecord, populateIndexes); updateStatsOnPut(replicatedRecord.getHits(), nowInMillis); return newRecord; }
Source:
public void onHungerDamage(EntityDamageEvent e) { if (cooler == null || cooler.isDisabled()) { return; } if (e.getCause() == EntityDamageEvent.DamageCause.STARVATION) { checkAndConsume((Player) e.getEntity()); } }

Target:
public void onHungerDamage(EntityDamageEvent e) { if (cooler == null || cooler.isDisabled() || !(e.getEntity() instanceof Player)) { return; } if (e.getCause() == DamageCause.STARVATION) { checkAndConsume((Player) e.getEntity()); } }
Source:
public static void startChartboostBanner(Context context, AbstractChartboostAdapterDelegate adapterDelegate, ChartboostBannerErrorListener bannerErrorListener) { String location = adapterDelegate.getChartboostParams().getLocation(); WeakReference<AbstractChartboostAdapterDelegate> delegate = getBannerDelegate(location); if (delegate != null && delegate.get() != null) { Log.w(ChartboostMediationAdapter.TAG, "An ad has already been requested for the location: " + location); bannerErrorListener.notifyBannerInitializationError(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } addBannerDelegate(adapterDelegate.getChartboostParams().getLocation(), adapterDelegate); startChartboost(context, adapterDelegate.getChartboostParams(), adapterDelegate); }

Target:
public static void startChartboostBanner(Context context, AbstractChartboostAdapterDelegate adapterDelegate, ChartboostBannerErrorListener bannerErrorListener) { String location = adapterDelegate.getChartboostParams().getLocation(); WeakReference<AbstractChartboostAdapterDelegate> delegate = getBannerDelegate(location); if (delegate != null && delegate.get() != null) { Log.w(TAG, "An ad has already been requested for the location: " + location); bannerErrorListener.notifyBannerInitializationError(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } addBannerDelegate(location, adapterDelegate); startChartboost(context, adapterDelegate.getChartboostParams(), adapterDelegate); }
Source:
private boolean contains(List<Method> methods, String methodName) { return methods.stream() .map(Method::getName) .anyMatch(name -> name.equals(methodName)); }

Target:
private boolean contains(List<Method> methods, String methodName) { return methods.stream() .map(Method::getName) .anyMatch(methodName::equals); }
Source:
public void testPixmapAndTextureRegionDisposal() { LookData lookData = new LookData(); Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.Alpha); lookData.setPixmap(pixmap); TextureRegion textureRegion = lookData.getTextureRegion(); lookData.setTextureRegion(textureRegion); assertFalse(lookData.getPixmap() == null); assertFalse(lookData.getTextureRegion() == null); assertTrue(lookData.isPixmapDisposed()); assertTrue(lookData.isTextureRegionDisposed()); }

Target:
public void testPixmapAndTextureRegionDisposal() { LookData lookData = new LookData(); Pixmap pixmap = mock(Pixmap.class); Texture texture = mock(Texture.class); TextureRegion textureRegion = new TextureRegion(texture); lookData.setPixmap(pixmap); lookData.setTextureRegion(textureRegion); lookData.resetLookData(); verify(pixmap, times(1)).dispose(); verify(textureRegion.getTexture(), times(1)).dispose(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); realm = Realm.getDefaultInstance(); dbaccess = new RealmHelper(getApplicationContext()); RealmResults<SmsData> msgitems = realm.where(SmsData.class).findAll(); listViewAdv.setAdapter(new SmsDataAdapter(getApplicationContext(), msgitems, true)); listViewAdv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> a, View v, int position, long id) { Object o = listViewAdv.getItemAtPosition(position); SmsData obj_itemDetails = (SmsData) o; obj_itemDetails.removeFromRealm(); Toast.makeText(a.getContext(), "Deleted Sms", LENGTH_SHORT).show(); return true; } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); realm = Realm.getDefaultInstance(); dbaccess = new RealmHelper(getApplicationContext()); RealmResults<SmsData> msgitems = realm.where(SmsData.class).findAllSorted("timestamp"); listViewAdv.setAdapter(new SmsDataAdapter(getApplicationContext(), msgitems, true)); listViewAdv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> a, View v, int position, long id) { final SmsData smsData = (SmsData) listViewAdv.getItemAtPosition(position); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { smsData.removeFromRealm(); } }); Toast.makeText(a.getContext(), "Deleted Sms", LENGTH_SHORT).show(); return true; } }); }
Source:
public void ensureCreated(String path, byte[] value, CreateMode createMode) throws InterruptedException, KeeperException { if (!path.isEmpty() && exists(path, false) == null) { ensureCreated(getParent(path), null, createMode); create(path, value, DEFAULT_ACL, createMode); NodeCreationBarrier.block(ZooKeeperPlus.this, path); } }

Target:
public void ensureCreated(String path, byte[] value, CreateMode createMode) throws InterruptedException, KeeperException { if (!path.isEmpty() && exists(path, false) == null) { ensureCreated(new File(path).getParent(), null, createMode); create(path, value, DEFAULT_ACL, createMode); NodeCreationBarrier.block(ZooKeeperPlus.this, path); } }
Source:
public void testCheckAndUpdateConfigMapWithEmptyResult() throws Exception { this.flinkKubeClient.createConfigMap(buildTestingConfigMap()); this.flinkKubeClient.checkAndUpdateConfigMap(TESTING_CONFIG_MAP_NAME, c -> Optional.empty()).get(); final Optional<KubernetesConfigMap> configMapOpt = this.flinkKubeClient.getConfigMap(TESTING_CONFIG_MAP_NAME); assertThat(configMapOpt.isPresent(), is(true)); assertThat(configMapOpt.get().getData().get(TESTING_CONFIG_MAP_KEY), is(TESTING_CONFIG_MAP_VALUE)); }

Target:
public void testCheckAndUpdateConfigMapWithEmptyResult() throws Exception { this.flinkKubeClient.createConfigMap(buildTestingConfigMap()); final boolean updated = this.flinkKubeClient.checkAndUpdateConfigMap( TESTING_CONFIG_MAP_NAME, c -> Optional.empty()).get(); assertThat(updated, is(false)); final Optional<KubernetesConfigMap> configMapOpt = this.flinkKubeClient.getConfigMap(TESTING_CONFIG_MAP_NAME); assertThat(configMapOpt.isPresent(), is(true)); assertThat(configMapOpt.get().getData().get(TESTING_CONFIG_MAP_KEY), is(TESTING_CONFIG_MAP_VALUE)); }
Source:
private void resume(File file, UploadProgress uploadProgress, String objectId, boolean checksum) throws IOException { log.info("Resume from the previous upload..."); List<Part> parts = uploadProgress.getParts(); int completedParts = numCompletedParts(parts); int totalParts = parts.size(); if (!checksum) { parts.removeIf(new Predicate<Part>() { @Override public boolean test(Part part) { return part.isCompleted(); } }); } val progress = new Progress(terminal, quiet, totalParts, completedParts); uploadParts(parts, file, uploadProgress.getObjectId(), uploadProgress.getUploadId(), progress); cleanupState(file, objectId); }

Target:
private void resume(File file, UploadProgress uploadProgress, String objectId, boolean checksum) throws IOException { log.info("Resume from the previous upload..."); val parts = uploadProgress.getParts(); int completedParts = numCompletedParts(parts); int totalParts = parts.size(); if (!checksum) { parts.removeIf((Part part) -> part.isCompleted()); } if (!checksum) { parts.removeIf((Part part) -> part.isCompleted()); } val progress = new Progress(terminal, quiet, totalParts, completedParts); uploadParts(parts, file, uploadProgress.getObjectId(), uploadProgress.getUploadId(), progress); cleanupState(file, objectId); }
Source:
public GlobMatcher(String pattern) { matcher = getDefault().getPathMatcher(SYNTAX + ":" + pattern); }

Target:
public GlobMatcher(String pattern) { checkArgument(pattern != null, "Pattern should not be null"); matcher = getDefault().getPathMatcher(SYNTAX + ":" + pattern); }
Source:
public Boolean isDir(S3DDF s3DDF) throws DDFException { S3Object s3Object = mConn.getObject(s3DDF.getBucket(), s3DDF.getKey()); List<String> keys = this.listFiles(s3DDF.getBucket(), s3Object.getKey()); for (String key : keys) { if (key.endsWith("/") && !key.equals(s3DDF.getKey())) { throw new DDFException("This folder contains subfolder, please recheck."); } } return s3Object.getKey().endsWith("/"); }

Target:
public Boolean isDir(S3DDF s3DDF) throws DDFException { S3Object s3Object = mConn.getObject(s3DDF.getBucket(), s3DDF.getKey()); List<String> keys = this.listFiles(s3DDF.getBucket(), s3Object.getKey()); for (String key : keys) { if (key.endsWith("/") && !key.equals(s3DDF.getKey())) { throw new DDFException("This folder contains subfolder, S3 DDF does not support nested folders"); } } return s3Object.getKey().endsWith("/"); }
Source:
public Sequence<T> run(final Query<T> query) { final boolean isBySegment = query.getContextBySegment(false); final boolean shouldFinalize = query.getContextFinalize(true); if (shouldFinalize) { Function<T, T> finalizerFn; if (isBySegment) { finalizerFn = new Function<T, T>() { final Function<T, T> baseFinalizer = toolChest.makeFinalizerFn( query, new MetricManipulationFn() { @Override public Object manipulate(AggregatorFactory factory, Object object) { return factory.finalizeComputation(factory.deserialize(object)); } } ); @Override @SuppressWarnings("unchecked") public T apply(@Nullable T input) { Result<BySegmentResultValueClass<T>> result = (Result<BySegmentResultValueClass<T>>) input; BySegmentResultValueClass<T> resultsClass = result.getValue(); return (T) new Result<BySegmentResultValueClass>( result.getTimestamp(), new BySegmentResultValueClass( Lists.transform(resultsClass.getResults(), baseFinalizer), resultsClass.getSegmentId(), resultsClass.getInterval() ) ); } }; } else { finalizerFn = toolChest.makeFinalizerFn( query, new MetricManipulationFn() { @Override public Object manipulate(AggregatorFactory factory, Object object) { return factory.finalizeComputation(object); } } ); } return Sequences.map( baseRunner.run(query.makeNonFinalizedQuery()), finalizerFn ); } return baseRunner.run(query); }

Target:
public Sequence<T> run(final Query<T> query) { final boolean isBySegment = query.getContextBySegment(false); final boolean shouldFinalize = query.getContextFinalize(true); if (shouldFinalize) { Function<T, T> finalizerFn; if (isBySegment) { finalizerFn = new Function<T, T>() { final Function<T, T> baseFinalizer = toolChest.makeFinalizerFn( query, new MetricManipulationFn() { @Override public Object manipulate(AggregatorFactory factory, Object object) { return factory.finalizeComputation(factory.deserialize(object)); } } ); @Override @SuppressWarnings("unchecked") public T apply(@Nullable T input) { Result<BySegmentResultValueClass<T>> result = (Result<BySegmentResultValueClass<T>>) input; BySegmentResultValueClass<T> resultsClass = result.getValue(); return (T) new Result<BySegmentResultValueClass>( result.getTimestamp(), new BySegmentResultValueClass( Lists.transform(resultsClass.getResults(), baseFinalizer), resultsClass.getSegmentId(), resultsClass.getInterval() ) ); } }; } else { finalizerFn = toolChest.makeFinalizerFn( query, new MetricManipulationFn() { @Override public Object manipulate(AggregatorFactory factory, Object object) { return factory.finalizeComputation(object); } } ); } return Sequences.map( baseRunner.run(toolChest.makeNonFinalizedQuery(query)), finalizerFn ); } return baseRunner.run(query); }
Source:
private void checkCellSizeLimit(final HRegion r, final Mutation m) throws IOException { if (r.maxCellSize > 0) { CellScanner cells = m.cellScanner(); while (cells.advance()) { int size = PrivateCellUtil.estimatedSerializedSizeOf(cells.current()); if (size > r.maxCellSize) { String msg = "Cell with size " + size + " exceeds limit of " + r.maxCellSize + " bytes"; if (LOG.isDebugEnabled()) { LOG.debug(msg); } throw new DoNotRetryIOException(msg); } } } else { String msg = "Cell size check is disabled because of maxCellSize is set to" + r.maxCellSize; if (LOG.isDebugEnabled()) { LOG.debug(msg); } } }

Target:
private void checkCellSizeLimit(final HRegion r, final Mutation m) throws IOException { if (r.maxCellSize > 0) { CellScanner cells = m.cellScanner(); while (cells.advance()) { int size = PrivateCellUtil.estimatedSerializedSizeOf(cells.current()); if (size > r.maxCellSize) { String msg = "Cell with size " + size + " exceeds limit of " + r.maxCellSize + " bytes"; LOG.debug(msg); throw new DoNotRetryIOException(msg); } } } }
Source:
public static Configuration injectSystemProperties(Configuration conf) { for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { String prop = propName.substring("hadoop.".length()); if (prop.equals(JobContext.NUM_REDUCES)) { log.warn("Map-Reduce propery [%s] is ignored.", prop); } else { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } } return conf; }

Target:
public static Configuration injectSystemProperties(Configuration conf) { for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } return conf; }
Source:
private void InitializeHelpers() { try { for (String helperName : EnumCompat.GetNames(StorageType.class)) { Class<?> actionType = null; try { actionType = Class.forName(String.format("%1$s.%2$s%3$s", "org.ovirt.engine.core.bll.storage", helperName, "StorageHelper")); } catch (ClassNotFoundException cnfe) { } if (actionType != null) { Constructor<?> info = actionType.getConstructors()[0]; Object tempVar = info.newInstance(null); IStorageHelper currentHelper = (IStorageHelper) ((tempVar instanceof IStorageHelper) ? tempVar : null); if (currentHelper != null) { _helpers.put(StorageType.valueOf(helperName), currentHelper); } } } } catch (Exception ex) { throw new ApplicationException("JTODO missing exception", ex); } }

Target:
private void InitializeHelpers() { try { for (StorageType storageType : StorageType.values()) { Class<?> actionType = null; try { actionType = Class.forName(String.format("%1$s.%2$s%3$s", ACTION_TYPE_PACKAGE, storageType.name(), ACTION_TYPE_CLASS)); } catch (ClassNotFoundException cnfe) { } if (actionType != null) { Constructor<?> info = actionType.getConstructors()[0]; Object tempVar = info.newInstance(null); IStorageHelper currentHelper = (IStorageHelper) tempVar; if (currentHelper != null) { _helpers.put(storageType, currentHelper); } } } } catch (Exception ex) { throw new ApplicationException("JTODO missing exception", ex); } }
Source:
protected boolean checkDomainCanBeAttached(StorageDomain storageDomain) { return checkStorageDomainType(storageDomain) && isStorageDomainFormatCorrectForPool(storageDomain, getStoragePool()) && checkStorageDomainSharedStatusNotLocked(storageDomain) && ((storageDomain.getStorageDomainType() == StorageDomainType.ISO || storageDomain.getStorageDomainType() == StorageDomainType.ImportExport) || isStorageDomainNotInPool(storageDomain)) && isStorageDomainTypeCorrect(storageDomain) && isStorageDomainTypeCompatibleWithPool(storageDomain) && (isMixedTypesAllowedOnPool() || !isStoragePoolContainsOtherTypes(storageDomain)); }

Target:
protected boolean checkDomainCanBeAttached(StorageDomain storageDomain) { if (!validateAmountOfIsoAndExportDomainsInDC(storageDomain)) { return false; } if (!isStorageDomainFormatCorrectForDC(storageDomain, getStoragePool())) { return false; } if (!checkStorageDomainSharedStatusNotLocked(storageDomain)) { return false; } if (!(isStorageDomainOfTypeIsoOrExport(storageDomain) || isStorageDomainNotInPool(storageDomain))) { return false; } if (!isStorageDomainTypeCorrect(storageDomain)) { return false; } if (!isStorageDomainCompatibleWithDC(storageDomain)) { return false; } if (isMixedTypesAllowedInDC() || !isMixedTypeDC(storageDomain)) { return false; } return true; }
Source:
public final void populate() { XYChartConsumer chartConsumer = createChartConsumer(); fChartConsumer = chartConsumer; fData.getDataProvider().getSource().forEach(o -> { chartConsumer.accept(o); }); chartConsumer.finish(); createSeries(fSeriesMap); configureSeries(fObjectMap); getChart().getAxisSet().adjustRange(); configureAxes(); Arrays.stream(getChart().getAxisSet().getXAxes()).forEach(a -> a.enableLogScale(getModel().isXLogscale())); Arrays.stream(getChart().getAxisSet().getYAxes()).forEach(a -> a.enableLogScale(getModel().isYLogscale())); for (IAxis yAxis : getChart().getAxisSet().getYAxes()) { yAxis.getTick().setTickLabelAngle(1); } fXTitle = generateTitle(getXDescriptors(), getChart().getAxisSet().getXAxis(0)); fYTitle = generateTitle(getYDescriptors(), getChart().getAxisSet().getYAxis(0)); refreshDisplayTitles(); }

Target:
protected final void populate() { XYChartConsumer chartConsumer = createChartConsumer(); fChartConsumer = chartConsumer; fData.getDataProvider().getSource().forEach(o -> { chartConsumer.accept(o); }); chartConsumer.finish(); createChartSeries(); configureSeries(fObjectMap); getChart().getAxisSet().adjustRange(); configureAxes(); Arrays.stream(getChart().getAxisSet().getXAxes()).forEach(a -> a.enableLogScale(getModel().isXLogscale())); Arrays.stream(getChart().getAxisSet().getYAxes()).forEach(a -> a.enableLogScale(getModel().isYLogscale())); for (IAxis yAxis : getChart().getAxisSet().getYAxes()) { yAxis.getTick().setTickLabelAngle(1); } fXTitle = generateTitle(getXDescriptors(), getChart().getAxisSet().getXAxis(0)); fYTitle = generateTitle(getYDescriptors(), getChart().getAxisSet().getYAxis(0)); refreshDisplayTitles(); }
Source:
public void updateIdentifiersAssignsExternalIdEvenWhenAlreadyAssigned() { mockHealthCodeAndAccountRetrieval(); AccountSubstudy as = AccountSubstudy.create(STUDY.getIdentifier(), "substudyB", ID); as.setExternalId(EXTERNAL_ID); account.setAccountSubstudies(Sets.newHashSet(as)); BridgeUtils.setRequestContext( new RequestContext.Builder().withCallerSubstudies(ImmutableSet.of("substudyB")).build()); when(accountDao.authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN)).thenReturn(account); ExternalIdentifier newExtId = ExternalIdentifier.create(STUDY.getStudyIdentifier(), "newExternalId"); newExtId.setSubstudyId("substudyA"); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), "newExternalId", false)).thenReturn(newExtId); IdentifierUpdate update = new IdentifierUpdate(EMAIL_PASSWORD_SIGN_IN, null, null, "newExternalId"); participantService.updateIdentifiers(STUDY, CONTEXT, update); verify(accountDao).updateAccount(eq(account), notNull(Consumer.class)); assertEquals("newExternalId", Iterables.getFirst(account.getAccountSubstudies(), null).getExternalId()); assertEquals(ImmutableSet.of("substudyA", "substudyB"), BridgeUtils.getRequestContext().getCallerSubstudies()); }

Target:
public void updateIdentifiersAssignsExternalIdEvenWhenAlreadyAssigned() { mockHealthCodeAndAccountRetrieval(); AccountSubstudy as = AccountSubstudy.create(STUDY.getIdentifier(), "substudyB", ID); as.setExternalId(EXTERNAL_ID); account.setAccountSubstudies(Sets.newHashSet(as)); BridgeUtils.setRequestContext( new RequestContext.Builder().withCallerSubstudies(ImmutableSet.of("substudyB")).build()); when(accountDao.authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN)).thenReturn(account); ExternalIdentifier newExtId = ExternalIdentifier.create(STUDY.getStudyIdentifier(), "newExternalId"); newExtId.setSubstudyId("substudyA"); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), "newExternalId", false)).thenReturn(newExtId); IdentifierUpdate update = new IdentifierUpdate(EMAIL_PASSWORD_SIGN_IN, null, null, "newExternalId"); participantService.updateIdentifiers(STUDY, CONTEXT, update); verify(accountDao).updateAccount(eq(account), notNull(Consumer.class)); assertEquals(2, account.getAccountSubstudies().size()); Set<String> substudyIds = account.getAccountSubstudies().stream() .map(AccountSubstudy::getSubstudyId).collect(Collectors.toSet()); Set<String> externalIds = account.getAccountSubstudies().stream() .map(AccountSubstudy::getExternalId).collect(Collectors.toSet()); assertEquals(ImmutableSet.of("substudyA", "substudyB"), substudyIds); assertEquals(ImmutableSet.of(EXTERNAL_ID, "newExternalId"), externalIds); assertEquals(ImmutableSet.of("substudyA", "substudyB"), BridgeUtils.getRequestContext().getCallerSubstudies()); }
Source:
public long getImposedExpirationDate () { long imposedExpirationDate = -1; if (mCapabilities.getFilesSharingPublicExpireDateEnforced().isTrue()) { imposedExpirationDate = DateUtils.addDaysToDate( new Date(), mCapabilities.getFilesSharingPublicExpireDateDays() ).getTime(); } return imposedExpirationDate; }

Target:
private long getImposedExpirationDate () { long imposedExpirationDate = -1; if (mCapabilities!= null && mCapabilities. getFilesSharingPublicExpireDateEnforced().isTrue()) { imposedExpirationDate = DateUtils.addDaysToDate( new Date(), mCapabilities.getFilesSharingPublicExpireDateDays() ).getTime(); } return imposedExpirationDate; }
Source:
public Map<String, String> getHeaders() { return headers; }

Target:
protected Map<String, String> getHeaders() { return headers; }
Source:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } } EntityResolver resolver = new SimpleIdResolver( org.ovirt.engine.api.model.Disk.class, Disk.class, VdcQueryType.GetDiskByDiskId, IdQueryParameters.class ); return doAction(VdcActionType.ImportRepoImage, importParameters, action, resolver); }

Target:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } } EntityResolver resolver = new SimpleIdResolver( Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class, VdcQueryType.GetDiskByDiskId, IdQueryParameters.class ); return doAction(VdcActionType.ImportRepoImage, importParameters, action, resolver); }
Source:
public static List<Variable> getVariablesByRegex( Collection<Variable> variables, String regex) { List<Variable> shortlistedVariables = new ArrayList<Variable>(); if (variables != null || regex == null) { for (Variable var : variables) { if (var.getTitle().matches(regex)) { shortlistedVariables.add(var); } } } return shortlistedVariables; }

Target:
public static List<Variable> getVariablesByRegex( Collection<Variable> variables, String regex) { List<Variable> shortlistedVariables = new ArrayList<Variable>(); if (variables != null && regex != null) { for (Variable var : variables) { if (var.getTitle().matches(regex)) { shortlistedVariables.add(var); } } } return shortlistedVariables; }
Source:
public Iterable<Notification> iterate() { return Collections.emptyList(); }

Target:
public Iterable<Notification> iterate() { return this.notifications; }
Source:
private void writeObject( final ObjectOutputStream oos ) throws IOException { try { Thread.sleep( 1000L ); oos.writeObject( value ); } catch ( final InterruptedException e ) { e.printStackTrace(); } }

Target:
private void writeObject( final ObjectOutputStream oos ) throws IOException { try { if ( writeStartedSignal != null ) { writeStartedSignal.countDown(); } if ( readStartedSignal != null ) { readStartedSignal.await(); } Thread.sleep( 100 ); oos.writeObject( value ); } catch ( final InterruptedException e ) { e.printStackTrace(); } }
Source:
void populateUidAndFlags(Cursor cursor) throws MessagingException { setUid(cursor.getString(cursor.getColumnIndex("uid"))); String flagList = cursor.getString(cursor.getColumnIndex("flags")); if (flagList != null && flagList.length() > 0) { String[] flags = flagList.split(","); for (String flag : flags) { try { setFlagInternal(Flag.valueOf(flag), true); } catch (Exception e) { if (!"X_BAD_FLAG".equals(flag)) { Timber.w("Unable to parse flag %s", flag); } } } } boolean deleted = (cursor.getInt(cursor.getColumnIndex("deleted")) == 1); boolean read = (cursor.getInt(cursor.getColumnIndex("read")) == 1); boolean flagged = (cursor.getInt(cursor.getColumnIndex("flagged")) == 1); boolean answered = (cursor.getInt(cursor.getColumnIndex("answered")) == 1); boolean forwarded = (cursor.getInt(cursor.getColumnIndex("forwarded")) == 1); setFlagInternal(Flag.DELETED, deleted); setFlagInternal(Flag.SEEN, read); setFlagInternal(Flag.FLAGGED, flagged); setFlagInternal(Flag.ANSWERED, answered); setFlagInternal(Flag.FORWARDED, forwarded); }

Target:
void populateUidAndFlags(Cursor cursor) throws MessagingException { setUid(cursor.getString(cursor.getColumnIndex("uid"))); String flagList = cursor.getString(cursor.getColumnIndex("flags")); if (flagList != null && flagList.length() > 0) { String[] flags = flagList.split(","); for (String flag : flags) { if ("X_BAD_FLAG".equals(flag)) { continue; } try { setFlagInternal(Flag.valueOf(flag), true); } catch (Exception e) { Timber.w("Unable to parse flag %s", flag); } } } boolean deleted = (cursor.getInt(cursor.getColumnIndex("deleted")) == 1); boolean read = (cursor.getInt(cursor.getColumnIndex("read")) == 1); boolean flagged = (cursor.getInt(cursor.getColumnIndex("flagged")) == 1); boolean answered = (cursor.getInt(cursor.getColumnIndex("answered")) == 1); boolean forwarded = (cursor.getInt(cursor.getColumnIndex("forwarded")) == 1); setFlagInternal(Flag.DELETED, deleted); setFlagInternal(Flag.SEEN, read); setFlagInternal(Flag.FLAGGED, flagged); setFlagInternal(Flag.ANSWERED, answered); setFlagInternal(Flag.FORWARDED, forwarded); }
Source:
public void start() { if (running) return; if (!readConfig()) return; if (!openPipe()) return; log.info("Starting watchdog thread"); running = true; Runtime.getRuntime().addShutdownHook(shutdownHook); timer = new Timer("watchdog", true); timer.schedule(tick, 0, intervalMillis); }

Target:
public void start() { if (running) return; if (!readConfig()) return; if (!openPipe()) return; log.info("Starting watchdog thread"); running = true; Runtime.getRuntime().addShutdownHook(shutdownHook); timer = new Timer("watchdog", true); timer.scheduleAtFixedRate(tick, 0, intervalMillis); }