auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void refreshCanvas() { MockCanvas mockCanvas = (MockCanvas) getContainer(); if (mockCanvas != null) { mockCanvas.refreshForm(); } }

Target:
private void refreshCanvas() { MockCanvas mockCanvas = (MockCanvas) getContainer(); if (mockCanvas != null) { mockCanvas.reorderComponents(this); } }
Source:
public EClassSelectionStrategy create() { return new EClassSelectionStrategy() { @Override public Collection<EClass> collectEClasses(EObject owner, EReference reference, Collection<EClass> eclasses) { return EMFUtils.getSubClasses(EcorePackage.eINSTANCE.getEObject()); } }; }

Target:
public EClassSelectionStrategy create() { return new EClassSelectionStrategy() { @Override public Collection<EClass> collectEClasses(EObject owner, EReference reference, Collection<EClass> eclasses) { return EMFUtils.getSubClasses(reference.getEReferenceType()); } }; }
Source:
protected boolean IsUserAutorizedToRunAction() { if (isInternalExecution) { if (log.isDebugEnabled()) { log.debugFormat("Permission check skipped for internal action {0}.", getActionType()); } return true; } if (!Config.<Boolean> GetValue(ConfigValues.IsMultilevelAdministrationOn)) { if (log.isDebugEnabled()) { log.debugFormat("Permission check for action {0} skipped because multilevel administration is disabled.", getActionType()); } return true; } if (getCurrentUser() == null) { addCanDoActionMessage(VdcBllMessages.USER_IS_NOT_LOGGED_IN); return false; } final Map<Guid, VdcObjectType> permSubjects = getPermissionCheckSubjects(); if (permSubjects == null || permSubjects.isEmpty()) { if (log.isDebugEnabled()) { log.debugFormat("The set of objects to check is null or empty for action {0}.", getActionType()); } addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } for (Map.Entry<Guid, VdcObjectType> entry : permSubjects.entrySet()) { final Guid objectId = entry.getKey(); final VdcObjectType objectType = entry.getValue(); if (objectId == null) { if (log.isDebugEnabled()) { log.debugFormat("The object to check is null for action {0}.", getActionType()); } addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } if (!checkUserAuthorization(getActionType().getActionGroup(), objectId, objectType)) { addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } } return true; }

Target:
protected boolean IsUserAutorizedToRunAction() { if (isInternalExecution) { if (log.isDebugEnabled()) { log.debugFormat("Permission check skipped for internal action {0}.", getActionType()); } return true; } if (!Config.<Boolean> GetValue(ConfigValues.IsMultilevelAdministrationOn)) { if (log.isDebugEnabled()) { log.debugFormat("Permission check for action {0} skipped because multilevel administration is disabled.", getActionType()); } return true; } if (getActionType().getActionGroup() == null) { if (log.isDebugEnabled()) { log.debugFormat("No action group is defined for action {0}.", getActionType()); } return false; } if (getCurrentUser() == null) { addCanDoActionMessage(VdcBllMessages.USER_IS_NOT_LOGGED_IN); return false; } final Map<Guid, VdcObjectType> permSubjects = getPermissionCheckSubjects(); if (permSubjects == null || permSubjects.isEmpty()) { if (log.isDebugEnabled()) { log.debugFormat("The set of objects to check is null or empty for action {0}.", getActionType()); } addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } for (Map.Entry<Guid, VdcObjectType> entry : permSubjects.entrySet()) { final Guid objectId = entry.getKey(); final VdcObjectType objectType = entry.getValue(); if (objectId == null) { if (log.isDebugEnabled()) { log.debugFormat("The object to check is null for action {0}.", getActionType()); } addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } if (!checkUserAuthorization(getActionType().getActionGroup(), objectId, objectType)) { addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } } return true; }
Source:
public static long clockUrlDownload( URL url, int speedLimit ) throws IOException { long t = System.currentTimeMillis(); HttpClient client = new HttpClient(); GetMethod get = new GetMethod( url.toString() ); int result = client.executeMethod( get ); assertThat( result, ResponseMatchers.isSuccessfulCode() ); InputStream in = get.getResponseBodyAsStream(); byte[] b; if ( speedLimit != -1 ) { b = new byte[speedLimit * 1024]; } else { b = new byte[1024]; } while ( in.read( b ) != -1 ) { if ( speedLimit != -1 ) { try { Thread.sleep( 1000 ); } catch ( InterruptedException e ) { } } } in.close(); get.releaseConnection(); return System.currentTimeMillis() - t; }

Target:
public static long clockUrlDownload( URL url, int speedLimit ) throws IOException { long t = System.currentTimeMillis(); GetMethod get = null; InputStream in = null; try { HttpClient client = new HttpClient(); get = new GetMethod( url.toString() ); int result = client.executeMethod( get ); assertThat( result, ResponseMatchers.isSuccessfulCode() ); in = get.getResponseBodyAsStream(); byte[] b; if ( speedLimit != -1 ) { b = new byte[speedLimit * 1024]; } else { b = new byte[1024]; } while ( in.read( b ) != -1 ) { if ( speedLimit != -1 ) { try { Thread.sleep( 1000 ); } catch ( InterruptedException e ) { } } } } finally { IOUtil.close( in ); if ( get != null ) { get.releaseConnection(); } } return System.currentTimeMillis() - t; }
Source:
public void showPayment(BufferedPayment payment) { if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline() || !payment.containsPayment()) return; UUID playerUUID = payment.getOfflinePlayer().getUniqueId(); Boolean ActionBarsDefaultOn = Jobs.getGCManager().ActionBarsMessageByDefault; Boolean show = ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID.toString(), ActionBarsDefaultOn); Player abp = Bukkit.getPlayer(playerUUID); if (abp != null) { String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main"); if (payment.get(CurrencyType.MONEY) != 0D) { Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(), payment.get(CurrencyType.MONEY))); } if (payment.get(CurrencyType.POINTS) != 0D) { Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(), payment.get(CurrencyType.POINTS))); } if (payment.get(CurrencyType.EXP) != 0D) { Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), payment.get(CurrencyType.EXP))); } if (show.booleanValue()) { ActionBarManager.send(abp, Message); } else abp.sendMessage(Message); } }

Target:
public void showPayment(BufferedPayment payment) { if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline() || !payment.containsPayment()) return; UUID playerUUID = payment.getOfflinePlayer().getUniqueId(); Boolean actionBarsDefaultOn = Jobs.getGCManager().ActionBarsMessageByDefault; Boolean show = ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID.toString(), ActionBarsDefaultOn); Player abp = Bukkit.getPlayer(playerUUID); if (abp != null) { String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main"); if (payment.get(CurrencyType.MONEY) != 0D) { Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(), payment.get(CurrencyType.MONEY))); } if (payment.get(CurrencyType.POINTS) != 0D) { Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(), payment.get(CurrencyType.POINTS))); } if (payment.get(CurrencyType.EXP) != 0D) { Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), payment.get(CurrencyType.EXP))); } if (show.booleanValue()) { ActionBarManager.send(abp, Message); } else abp.sendMessage(Message); } }
Source:
protected void notifySelect(boolean first) { int stateMask1 = (first) ? SWT.NONE : (SWT.NONE | SWT.CTRL); int stateMask2 = (first) ? SWT.BUTTON1 : (SWT.BUTTON1 | SWT.CTRL); if (first) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); } notify(SWT.MouseMove); notify(SWT.MouseDown, createMouseEvent(1, stateMask1, 1)); notify(SWT.Selection, createSelectionEvent(stateMask1)); notify(SWT.MouseUp, createMouseEvent(1, stateMask2, 1)); }

Target:
protected void notifySelect(boolean first) { int stateMask1 = (first) ? SWT.NONE : (SWT.NONE | SWT.CTRL); int stateMask2 = (first) ? SWT.BUTTON1 : (SWT.BUTTON1 | SWT.CTRL); if (first) { notify(SWT.MouseEnter); notify(SWT.Activate); notify(SWT.FocusIn); } notify(SWT.MouseDown, createMouseEvent(1, stateMask1, 1)); notify(SWT.Selection, createSelectionEvent(stateMask1)); notify(SWT.MouseUp, createMouseEvent(1, stateMask2, 1)); }
Source:
public OrderedDistinctMap(String lastHash) { mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); this.lastHash = lastHash; }

Target:
public OrderedDistinctMap(String lastHash) { this.lastHash = lastHash; }
Source:
protected void initWidget(IsWidget widget) { if (widget == null) { throw new NullPointerException("Widget cannot be null."); } this.widget = widget.asWidget(); asWidget().addAttachHandler(this); }

Target:
protected void initWidget(IsWidget widget) { if (this.widget != null) { throw new IllegalStateException("ViewImpl.initWidget() may only be called once."); } else if (widget == null) { throw new NullPointerException("widget cannot be null"); } this.widget = widget.asWidget(); asWidget().addAttachHandler(this); }
Source:
public void stateChanged(TaskStatus taskStatus) { try { if (taskStatus.getState().isDone()) { doneTasks.add(taskStatus.getTaskId()); } updateMemoryUsage(taskStatus); updateCompletedDriverGroups(taskStatus); StageState stageState = getState(); if (stageState.isDone()) { return; } TaskState taskState = taskStatus.getState(); if (taskState == TaskState.FAILED) { RuntimeException failure = taskStatus.getFailures().stream() .findFirst() .map(this::rewriteTransportFailure) .map(ExecutionFailureInfo::toException) .orElse(new PrestoException(StandardErrorCode.GENERIC_INTERNAL_ERROR, "A task failed for an unknown reason")); stateMachine.transitionToFailed(failure); } else if (taskState == TaskState.ABORTED) { stateMachine.transitionToFailed(new PrestoException(StandardErrorCode.GENERIC_INTERNAL_ERROR, "A task is in the ABORTED state but stage is " + stageState)); } else if (taskState == TaskState.FINISHED) { finishedTasks.add(taskStatus.getTaskId()); } if (stageState == StageState.SCHEDULED || stageState == StageState.RUNNING) { if (taskState == TaskState.RUNNING) { stateMachine.transitionToRunning(); } if (finishedTasks.containsAll(allTasks)) { stateMachine.transitionToFinished(); } } } finally { if (stateMachine.getState().isDone() && doneTasks.containsAll(allTasks)) { stateMachine.setAllTasksFinal(); } } }

Target:
public void stateChanged(TaskStatus taskStatus) { try { if (taskStatus.getState().isDone()) { doneTasks.add(taskStatus.getTaskId()); } updateMemoryUsage(taskStatus); updateCompletedDriverGroups(taskStatus); StageState stageState = getState(); if (stageState.isDone()) { return; } TaskState taskState = taskStatus.getState(); if (taskState == TaskState.FAILED) { RuntimeException failure = taskStatus.getFailures().stream() .findFirst() .map(this::rewriteTransportFailure) .map(ExecutionFailureInfo::toException) .orElse(new PrestoException(GENERIC_INTERNAL_ERROR, "A task failed for an unknown reason")); stateMachine.transitionToFailed(failure); } else if (taskState == TaskState.ABORTED) { stateMachine.transitionToFailed(new PrestoException(GENERIC_INTERNAL_ERROR, "A task is in the ABORTED state but stage is " + stageState)); } else if (taskState == TaskState.FINISHED) { finishedTasks.add(taskStatus.getTaskId()); } if (stageState == StageState.SCHEDULED || stageState == StageState.RUNNING) { if (taskState == TaskState.RUNNING) { stateMachine.transitionToRunning(); } if (finishedTasks.containsAll(allTasks)) { stateMachine.transitionToFinished(); } } } finally { if (stateMachine.getState().isDone() && doneTasks.containsAll(allTasks)) { stateMachine.setAllTasksFinal(); } } }
Source:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.deleteAllIndexes(); } catch (IOException | NoSuchAlgorithmException | JAXBException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } }; }

Target:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.deleteAllIndexes(); XDMConstants.setTrue(result); } catch (IOException | NoSuchAlgorithmException | JAXBException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } }; }
Source:
public static String format(Date when) { long age = (System.currentTimeMillis() - when.getTime()) / 1000; if (age < 0) return JGitText.get().inTheFuture; if (age < 90) return MessageFormat.format(JGitText.get().secondsAgo, age); age = (age + 30) / 60; if (age < 90) return MessageFormat.format(JGitText.get().minutesAgo, age); age = (age + 30) / 60; if (age < 36) return MessageFormat.format(JGitText.get().hoursAgo, age); age = (age + 12) / 24; if (age < 14) return MessageFormat.format(JGitText.get().daysAgo, age); if (age < 70) return MessageFormat.format(JGitText.get().weeksAgo, (age + 3) / 7); if (age < 365) return MessageFormat.format(JGitText.get().monthsAgo, (age + 15) / 30); if (age < 1825) { long years = age / 365; String yearLabel = (years > 1) ? JGitText.get().years : JGitText.get().year; long months = (age % 365 + 15) / 30; String monthLabel = (months > 1) ? JGitText.get().months : JGitText.get().month; return MessageFormat.format(JGitText.get().yearsMonthsAgo, new Object[] { years, yearLabel, months, monthLabel }); } return MessageFormat.format(JGitText.get().yearsAgo, (age + 183) / 365); }

Target:
public static String format(Date when) { long ageMillis = (System.currentTimeMillis() - when.getTime()); if (ageMillis < 0) return JGitText.get().inTheFuture; if (ageMillis < upperLimit(MINUTE_IN_MILLIS)) return MessageFormat.format(JGitText.get().secondsAgo, round(ageMillis, SECOND_IN_MILLIS)); if (ageMillis < upperLimit(HOUR_IN_MILLIS)) return MessageFormat.format(JGitText.get().minutesAgo, round(ageMillis, MINUTE_IN_MILLIS)); if (ageMillis < upperLimit(DAY_IN_MILLIS)) return MessageFormat.format(JGitText.get().hoursAgo, round(ageMillis, HOUR_IN_MILLIS)); if (ageMillis < 14 * DAY_IN_MILLIS) return MessageFormat.format(JGitText.get().daysAgo, round(ageMillis, DAY_IN_MILLIS)); if (ageMillis < 10 * WEEK_IN_MILLIS) return MessageFormat.format(JGitText.get().weeksAgo, round(ageMillis, WEEK_IN_MILLIS)); if (ageMillis < YEAR_IN_MILLIS) return MessageFormat.format(JGitText.get().monthsAgo, round(ageMillis, MONTH_IN_MILLIS)); if (ageMillis < 5 * YEAR_IN_MILLIS) { long years = ageMillis / YEAR_IN_MILLIS; String yearLabel = (years > 1) ? JGitText.get().years : JGitText.get().year; long months = round(ageMillis % YEAR_IN_MILLIS, MONTH_IN_MILLIS); String monthLabel = (months > 1) ? JGitText.get().months : JGitText.get().month; return MessageFormat.format(JGitText.get().yearsMonthsAgo, new Object[] { years, yearLabel, months, monthLabel }); } return MessageFormat.format(JGitText.get().yearsAgo, round(ageMillis, YEAR_IN_MILLIS)); }
Source:
public void trackSent(long timestamp) { if (enabled) sentBuffer.write(new BufferedMessage(timestamp)); }

Target:
public void trackSent(long timestamp) { if (enabled) { sentBuffer.write(new BufferedMessage(timestamp)); } }
Source:
public boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters) { final PipeFlowPower flow = (PipeFlowPower) ((IPipeHolder) source.getTile()).getPipe().getFlow(); return flow.getPowerRequested(null) > 0; }

Target:
public boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters) { if (!(source instanceof IGate)) { return false; } PipeFlow f = ((IGate) source).getPipeHolder().getPipe().getFlow(); if (!(f instanceof PipeFlowPower)) { return false; } final PipeFlowPower flow = (PipeFlowPower) f; return flow.getPowerRequested(null) > 0; }
Source:
public void stopSpooling() { doSpool = false; this.out.flush(); this.out = new LocalizedOutput(System.out); }

Target:
public void stopSpooling() { doSpool = false; this.out.flush(); this.out.close(); this.out = new LocalizedOutput(System.out); }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); if (locationName != null && !locationName.isEmpty()) { builder.append(locationName); builder.append("\n"); } if (line1 != null && !line1.isEmpty()) { builder.append(line1); builder.append("\n"); } if (line2 != null && !line2.isEmpty()) { builder.append(line2); builder.append("\n"); } if (line3 != null && !line3.isEmpty()) { builder.append(line3); builder.append("\n"); } if (city != null && !city.isEmpty()) { builder.append(city); builder.append(", "); } if (state != null && !state.isEmpty()) { builder.append(state); builder.append(" "); } if (zip != null && !zip.isEmpty()) { builder.append(zip); } return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); if (locationName != null && !locationName.isEmpty()) { builder.append(locationName); builder.append("\n"); } if (line1 != null && !line1.isEmpty()) { builder.append(line1); builder.append("\n"); } if (line2 != null && !line2.isEmpty()) { builder.append(line2); builder.append("\n"); } if (line3 != null && !line3.isEmpty()) { builder.append(line3); builder.append("\n"); } if (city != null && !city.isEmpty()) { builder.append(city); builder.append(", "); } if (state != null && !state.isEmpty()) { builder.append(state); builder.append(" "); } else if (city != null && !city.isEmpty()) { builder.deleteCharAt(builder.length() - 2); } if (zip != null && !zip.isEmpty()) { builder.append(zip); } return builder.toString(); }
Source:
protected CacheQuery<?> makeCacheQuery(IckleParsingResult<Descriptor> ickleParsingResult, Query luceneQuery, IndexedQueryMode queryMode, Map<String, Object> namedParameters) { IndexingMetadata indexingMetadata = ickleParsingResult.getTargetEntityMetadata().getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION); final Set<String> sortableFields = indexingMetadata != null ? indexingMetadata.getSortableFields() : Collections.emptySet(); IndexedTypeMap<CustomTypeMetadata> queryMetadata = IndexedTypeMaps.singletonMapping(ProtobufValueWrapper.INDEXING_TYPE, () -> sortableFields); RemoteQueryDefinition queryDefinition; if (queryMode == IndexedQueryMode.BROADCAST) { queryDefinition = new RemoteQueryDefinition(ickleParsingResult.getQueryString()); } else { queryDefinition = new RemoteQueryDefinition(getSearchFactory().createHSQuery(luceneQuery, queryMetadata)); } queryDefinition.setNamedParameters(namedParameters); SearchManagerImplementor searchManager = getSearchManager().unwrap(SearchManagerImplementor.class); return searchManager.getQuery(queryDefinition, queryMode, queryMetadata); }

Target:
protected CacheQuery<?> makeCacheQuery(IckleParsingResult<Descriptor> ickleParsingResult, Query luceneQuery, IndexedQueryMode queryMode, Map<String, Object> namedParameters) { IndexingMetadata indexingMetadata = ickleParsingResult.getTargetEntityMetadata().getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION); final Set<String> sortableFields = indexingMetadata != null ? indexingMetadata.getSortableFields() : Collections.emptySet(); IndexedTypeMap<CustomTypeMetadata> queryMetadata = IndexedTypeMaps.singletonMapping(ProtobufValueWrapper.INDEXING_TYPE, () -> sortableFields); RemoteQueryDefinition queryDefinition; if (queryMode == IndexedQueryMode.BROADCAST) { queryDefinition = new RemoteQueryDefinition(ickleParsingResult.getQueryString()); } else { queryDefinition = new RemoteQueryDefinition(getSearchFactory().createHSQuery(luceneQuery, queryMetadata)); } queryDefinition.setNamedParameters(namedParameters); return getSearchManager().getQuery(queryDefinition, queryMode, queryMetadata); }
Source:
private static void openUrlExternal(Context context, @NonNull String url) { try { ActivityLauncher.disableDeepLinking(context); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(intent); AppLockManager.getInstance().setExtendedTimeout(); ActivityLauncher.enableDeepLinking(context); } catch (ActivityNotFoundException e) { String readerToastErrorUrlIntent = context.getString(R.string.reader_toast_err_url_intent); ToastUtils.showToast(context, String.format(readerToastErrorUrlIntent, url), ToastUtils.Duration.LONG); } }

Target:
private static void openUrlExternal(Context context, @NonNull String url) { try { WPActivityUtils.disableComponent(context, ReaderPostPagerActivity.class); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(intent); AppLockManager.getInstance().setExtendedTimeout(); } catch (ActivityNotFoundException e) { String readerToastErrorUrlIntent = context.getString(R.string.reader_toast_err_url_intent); ToastUtils.showToast(context, String.format(readerToastErrorUrlIntent, url), ToastUtils.Duration.LONG); } finally { WPActivityUtils.enableComponent(context, ReaderPostPagerActivity.class); } }
Source:
public void singletonInputSingletonOutput() { Dominoes dominoes = new Dominoes(); Domino[] dominoesList = {new Domino(1, 1)}; ArrayList<Domino> dominoesArray = new ArrayList<>(Arrays.asList(dominoesList)); List<Domino> chain = dominoes.formChain(dominoesArray); assertValidChain(dominoesArray, chain); }

Target:
public void singletonInputSingletonOutput() throws ChainNotFoundException { Dominoes dominoes = new Dominoes(); Domino[] dominoesArray = {new Domino(1, 1)}; List<Domino> dominoesList = Arrays.asList(dominoesArray); List<Domino> chain = dominoes.formChain(dominoesList); assertValidChain(dominoesList, chain); }
Source:
public boolean apply(ServerPrivateNetworkRef networkRef) { checkNotNull(networkRef, "ServerPrivateNetworkRef"); PrivateNetwork server = api.serverApi().getPrivateNetwork(networkRef.serverId(), networkRef.privateNetworkId()); if (server.state() != Types.GenericState.ACTIVE) { return false; } else { return true; } }

Target:
public boolean apply(ServerPrivateNetworkRef networkRef) { checkNotNull(networkRef, "ServerPrivateNetworkRef"); PrivateNetwork server = api.serverApi().getPrivateNetwork(networkRef.serverId(), networkRef.privateNetworkId()); return server.state() != Types.GenericState.ACTIVE; }
Source:
public void testRepositoryNotInitialized() throws Exception { Properties properties = new Properties(); properties.put("spring.cloud.task.tablePrefix", "foobarless"); PropertiesPropertySource propertiesSource = new PropertiesPropertySource("test", properties); this.context = new AnnotationConfigApplicationContext(); this.context.getEnvironment().getPropertySources().addLast(propertiesSource); ((AnnotationConfigApplicationContext)context).register(SimpleTaskConfiguration.class); ((AnnotationConfigApplicationContext)context).register(PropertyPlaceholderAutoConfiguration.class); ((AnnotationConfigApplicationContext)context).register(EmbeddedDataSourceConfiguration.class); boolean wasExceptionThrown = false; try { this.context.refresh(); } catch (ApplicationContextException ex) { assertThat(ex.getMessage(), equalTo("Failed to start bean " + "'taskLifecycleListener'; nested exception is " + "org.springframework.dao.DataAccessResourceFailureException: " + "Could not obtain sequence value; nested exception is " + "org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement " + "\"SELECT FOOBARLESSSEQ.NEXTVAL FROM[*] DUAL \"; expected " + "\"identifier\"; SQL statement:\n" + "select foobarlessSEQ.nextval from dual [42001-193]")); wasExceptionThrown = true; } assertTrue("Expected ApplicationContextException to be thrown", wasExceptionThrown); }

Target:
public void testRepositoryNotInitialized() throws Exception { Properties properties = new Properties(); properties.put("spring.cloud.task.tablePrefix", "foobarless"); PropertiesPropertySource propertiesSource = new PropertiesPropertySource("test", properties); this.context = new AnnotationConfigApplicationContext(); this.context.getEnvironment().getPropertySources().addLast(propertiesSource); ((AnnotationConfigApplicationContext)context).register(SimpleTaskConfiguration.class); ((AnnotationConfigApplicationContext)context).register(PropertyPlaceholderAutoConfiguration.class); ((AnnotationConfigApplicationContext)context).register(EmbeddedDataSourceConfiguration.class); boolean wasExceptionThrown = false; try { this.context.refresh(); } catch (ApplicationContextException ex) { wasExceptionThrown = true; } assertTrue("Expected ApplicationContextException to be thrown", wasExceptionThrown); }
Source:
public void testSolibLinkDefault() throws Exception { setUpCcLinkingContextTest(); scratch.file( "foo/BUILD", "load(' "cc_binary(name='bin',", " deps = [':a'],", ")", "crule(name='a',", " dynamic_library = 'a.so',", " interface_library = 'a.ifso',", ")"); ConfiguredTarget a = getConfiguredTarget(" RuleContext ruleContext = getRuleContext(a); CcToolchainProvider toolchain = CppHelper.getToolchain( ruleContext, ruleContext.getPrerequisite("$cc_toolchain", Mode.TARGET)); StructImpl info = ((StructImpl) getMyInfoFromTarget(a).getValue("info")); SkylarkNestedSet librariesToLink = info.getValue("libraries_to_link", SkylarkNestedSet.class); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getDynamicLibrary() != null) .map(x -> x.getDynamicLibrary().getRootRelativePath().relativeTo(toolchain.getSolibDirectory()).toString()) .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.so"); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getInterfaceLibrary() != null) .map(x -> x.getInterfaceLibrary().getRootRelativePath().relativeTo(toolchain.getSolibDirectory()).toString()) .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.ifso"); }

Target:
public void testSolibLinkDefault() throws Exception { setUpCcLinkingContextTest(); scratch.file( "foo/BUILD", "load(' "cc_binary(name='bin',", " deps = [':a'],", ")", "crule(name='a',", " dynamic_library = 'a.so',", " interface_library = 'a.ifso',", ")"); ConfiguredTarget a = getConfiguredTarget(" RuleContext ruleContext = getRuleContext(a); CcToolchainProvider toolchain = CppHelper.getToolchain( ruleContext, ruleContext.getPrerequisite("$cc_toolchain", Mode.TARGET)); StructImpl info = ((StructImpl) getMyInfoFromTarget(a).getValue("info")); SkylarkNestedSet librariesToLink = info.getValue("libraries_to_link", SkylarkNestedSet.class); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getDynamicLibrary() != null) .map(x -> getSolibRelativePath(x.getDynamicLibrary(), toolchain)) .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.so"); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getInterfaceLibrary() != null) .map(x -> getSolibRelativePath(x.getInterfaceLibrary(), toolchain)) .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.ifso"); }
Source:
public Long allocateTimestamp() { synchronized(status) { Preconditions.checkState(status != TrackerStatus.CLOSED, "tracker is closed"); if ((status == TrackerStatus.IDLE) && (node == null)) { Long initialTs = getTimestamp(); if (node == null) { updateZkNode(initialTs); } } Long ts = getTimestamp(); timestamps.add(ts); status = TrackerStatus.BUSY; return ts; } }

Target:
public synchronized long allocateTimestamp() { Preconditions.checkState(status != TrackerStatus.CLOSED, "tracker is closed"); if ((status == TrackerStatus.IDLE) && (node == null)) { long initialTs = getTimestamp(); if (node == null) { updateZkNode(initialTs); } } long ts = getTimestamp(); timestamps.add(ts); status = TrackerStatus.BUSY; return ts; }
Source:
private void processPartitionedJob(Module module, DeploymentMetadata md, MessageBus bus) { if (logger.isDebugEnabled()) { logger.debug("binding job partitioning channels for " + module); } MessageChannel partitionsOut = module.getComponent(JOB_PARTIONER_REQUEST_CHANNEL, MessageChannel.class); Assert.notNull(partitionsOut, "Partitioned jobs must have a " + JOB_PARTIONER_REQUEST_CHANNEL); MessageChannel partitionsIn = module.getComponent(JOB_PARTIONER_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(partitionsIn, "Partitioned jobs must have a " + JOB_PARTIONER_REPLY_CHANNEL); String name = md.getGroup() + "." + md.getIndex(); bus.bindRequestor(name, partitionsOut, partitionsIn); MessageChannel stepExcutionsIn = module.getComponent(JOB_STEP_EXECUTION_REQUEST_CHANNEL, MessageChannel.class); Assert.notNull(stepExcutionsIn, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REQUEST_CHANNEL); MessageChannel stepExecutionResultsOut = module.getComponent(JOB_STEP_EXECUTION_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(stepExecutionResultsOut, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REPLY_CHANNEL); bus.bindReplier(name, stepExcutionsIn, stepExecutionResultsOut); }

Target:
private void processPartitionedJob(Module module, DeploymentMetadata md, MessageBus bus) { if (logger.isDebugEnabled()) { logger.debug("binding job partitioning channels for " + module); } MessageChannel partitionsOut = module.getComponent(JOB_PARTIONER_REQUEST_CHANNEL, MessageChannel.class); Assert.notNull(partitionsOut, "Partitioned jobs must have a " + JOB_PARTIONER_REQUEST_CHANNEL); MessageChannel partitionsIn = module.getComponent(JOB_PARTIONER_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(partitionsIn, "Partitioned jobs must have a " + JOB_PARTIONER_REPLY_CHANNEL); String name = md.getGroup() + "." + md.getIndex(); bus.bindRequestor(name, partitionsOut, partitionsIn); MessageChannel stepExecutionsIn = module.getComponent(JOB_STEP_EXECUTION_REQUEST_CHANNEL, MessageChannel.class); Assert.notNull(stepExecutionsIn, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REQUEST_CHANNEL); MessageChannel stepExecutionResultsOut = module.getComponent(JOB_STEP_EXECUTION_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(stepExecutionResultsOut, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REPLY_CHANNEL); bus.bindReplier(name, stepExecutionsIn, stepExecutionResultsOut); }
Source:
private Ehcache<String, String> getEhcache(final CacheLoaderWriter<String, String> cacheLoaderWriter) { ExecutorService orderedExecutor = Executors.newSingleThreadExecutor(); ExecutorService unorderedExecutor = Executors.newCachedThreadPool(); cacheEventNotificationService = new CacheEventNotificationServiceImpl<String, String>(orderedExecutor, unorderedExecutor); final Ehcache<String, String> ehcache = new Ehcache<String, String>(CACHE_CONFIGURATION, this.store, cacheLoaderWriter,cacheEventNotificationService,null, LoggerFactory.getLogger(Ehcache.class + "-" + "EhcacheBasicPutAllEventsTest")); ehcache.init(); assertThat("cache not initialized", ehcache.getStatus(), is(Status.AVAILABLE)); this.spiedResilienceStrategy = this.setResilienceStrategySpy(ehcache); EhcacheBasicTestUtil.registerCacheEventListener(ehcache, testCacheEventListener); return ehcache; }

Target:
private Ehcache<String, String> getEhcache(final CacheLoaderWriter<String, String> cacheLoaderWriter) { ExecutorService orderedExecutor = Executors.newSingleThreadExecutor(); ExecutorService unorderedExecutor = Executors.newCachedThreadPool(); cacheEventNotificationService = new CacheEventNotificationServiceImpl<String, String>(orderedExecutor, unorderedExecutor); final Ehcache<String, String> ehcache = new Ehcache<String, String>(CACHE_CONFIGURATION, this.store, cacheLoaderWriter,cacheEventNotificationService,null, LoggerFactory.getLogger(Ehcache.class + "-" + "EhcacheBasicPutAllEventsTest")); ehcache.init(); assertThat("cache not initialized", ehcache.getStatus(), is(Status.AVAILABLE)); registerCacheEventListener(ehcache, cacheEventListener); return ehcache; }
Source:
private void reportIssueIfNotInExcludedContext(Tree tree, String recommendedType) { Tree current = tree.parent(); boolean foundClass = false; while (!foundClass) { switch (current.kind()) { case LAMBDA_EXPRESSION: case SYNCHRONIZED_STATEMENT: return; case METHOD: if (ModifiersUtils.hasModifier(((MethodTree) current).modifiers(), Modifier.SYNCHRONIZED)) { return; } break; case CLASS: if (((ClassTree) current).simpleName() == null) { return; } foundClass = true; break; } current = current.parent(); } reportIssue(tree, String.format("Use an \"%s\" for this field; its operations are atomic.", recommendedType)); }

Target:
private void reportIssueIfNotInExcludedContext(Tree tree, String recommendedType) { Tree current = tree.parent(); boolean foundClass = false; while (!foundClass) { switch (current.kind()) { case LAMBDA_EXPRESSION: case SYNCHRONIZED_STATEMENT: case COMPILATION_UNIT: return; case METHOD: if (ModifiersUtils.hasModifier(((MethodTree) current).modifiers(), Modifier.SYNCHRONIZED)) { return; } break; case ENUM: case CLASS: if (((ClassTree) current).simpleName() == null) { return; } foundClass = true; break; } current = current.parent(); } reportIssue(tree, String.format("Use an \"%s\" for this field; its operations are atomic.", recommendedType)); }
Source:
private void printJson(HttpServletResponse response, String finalLocation) throws IOException { response.setStatus(HttpServletResponse.SC_OK); response.setContentType("application/json"); response.setHeader("Location", finalLocation); PrintWriter writer = response.getWriter(); writer.write("{\"location\": \""); writer.write(finalLocation); writer.write("\"}"); writer.close(); }

Target:
protected void printJson(HttpServletResponse response, String finalLocation) throws IOException { response.setStatus(HttpServletResponse.SC_OK); response.setContentType("application/json"); response.setHeader("Location", finalLocation); PrintWriter writer = response.getWriter(); writer.write("{\"location\": \""); writer.write(finalLocation); writer.write("\"}"); writer.close(); }
Source:
private static void stow(StowRS instance, Attributes metadata, List<String> files) throws Exception { OutputStream out = null; try { URL newUrl = new URL(instance.URL); final HttpURLConnection connection = (HttpURLConnection) newUrl.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "multipart/related; type=" + instance.contentType + "; boundary=" + boundary); connection.setRequestProperty("Accept", instance.accept); logOutgoing(connection); if (instance.user != null) { String basicAuth = basicAuth(instance.user); LOG.info("> Authorization: " + basicAuth); connection.setRequestProperty("Authorization", basicAuth); } out = connection.getOutputStream(); out.write(("\r\n--" + boundary + "\r\n").getBytes()); out.write(("Content-Type: " + instance.contentType + "\r\n").getBytes()); out.write("\r\n".getBytes()); writeData(instance, metadata, files, out); out.write(("\r\n--" + boundary + "--\r\n").getBytes()); out.flush(); logIncoming(connection); connection.disconnect(); LOG.info("STOW successful!"); } catch (Exception e) { LOG.error("Exception : " + e.getMessage()); e.printStackTrace(); } finally { if (out != null) out.close(); } }

Target:
private static void stow(StowRS instance, Attributes metadata, List<String> files) throws Exception { OutputStream out = null; try { URL newUrl = new URL(instance.URL); final HttpURLConnection connection = (HttpURLConnection) newUrl.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "multipart/related; type=" + instance.contentType + "; boundary=" + boundary); connection.setRequestProperty("Accept", instance.accept); logOutgoing(connection); if (instance.user != null) { String basicAuth = basicAuth(instance.user); LOG.info("> Authorization: " + basicAuth); connection.setRequestProperty("Authorization", basicAuth); } out = connection.getOutputStream(); out.write(("\r\n--" + boundary + "\r\n").getBytes()); out.write(("Content-Type: " + instance.contentType + "\r\n").getBytes()); out.write("\r\n".getBytes()); writeData(instance, metadata, files, out); out.write(("\r\n--" + boundary + "--\r\n").getBytes()); out.flush(); logIncoming(connection); connection.disconnect(); LOG.info("STOW successful!"); } catch (Exception e) { LOG.error("Stow: ", e); } finally { if (out != null) out.close(); } }
Source:
private void unregisterNotification(SensorListener sensorListener) { if (sensorListener.getXdk().isConnected()) { switch (sensorListener.getSensorType()) { case "ACCELERATION_X": unregisterSensorNotification(sensorListener); break; case "ACCELERATION_Y": unregisterSensorNotification(sensorListener); break; case "ACCELERATION_Z": unregisterSensorNotification(sensorListener); break; case "GYROSCOPE_X": unregisterSensorNotification(sensorListener); break; case "GYROSCOPE_Y": unregisterSensorNotification(sensorListener); break; case "GYROSCOPE_Z": unregisterSensorNotification(sensorListener); break; case "LIGHT": unregisterSensorNotification(sensorListener); break; case "PRESSURE": unregisterSensorNotification(sensorListener); break; case "TEMPERATURE": unregisterSensorNotification(sensorListener); break; case "HUMIDITY": unregisterSensorNotification(sensorListener); break; case "SD_CARD_DETECT_STATUS": unregisterSensorNotification(sensorListener); break; case "BUTTON_STATUS": unregisterSensorNotification(sensorListener); break; case "MAGNETIC_X": unregisterSensorNotification(sensorListener); break; case "MAGNETIC_Y": unregisterSensorNotification(sensorListener); break; case "MAGNETIC_Z": unregisterSensorNotification(sensorListener); break; case "MAGNETOMETER_RESISTENCE": unregisterSensorNotification(sensorListener); break; case "LED_STATUS": unregisterSensorNotification(sensorListener); break; case "VOLTAGE_LEM": unregisterSensorNotification(sensorListener); break; default: } } else { logger.info("Listener unregistation failed: TiSensorTag not connected"); } }

Target:
private void unregisterNotification(SensorListener sensorListener) { if (sensorListener.getXdk().isConnected()) { unregisterSensorNotification(sensorListener); } else { logger.info("Listener unregistation failed: TiSensorTag not connected"); } }
Source:
private static String constructorName(TypeTree typeTree) { if (typeTree.is(Tree.Kind.PARAMETERIZED_TYPE)) { return constructorName(((ParameterizedTypeTree) typeTree).type()); } else if (typeTree.is(Tree.Kind.MEMBER_SELECT)) { return ((MemberSelectExpressionTree) typeTree).identifier().name(); } else { return ((IdentifierTree) typeTree).name(); } }

Target:
private static String constructorName(TypeTree typeTree) { switch (typeTree.kind()) { case PARAMETERIZED_TYPE: return constructorName(((ParameterizedTypeTree) typeTree).type()); case MEMBER_SELECT: return ((MemberSelectExpressionTree) typeTree).identifier().name(); case IDENTIFIER: return ((IdentifierTree) typeTree).name(); default: throw new IllegalStateException("Unexpected TypeTree used as constructor."); } }
Source:
private static void modifyCassandraRackdc( @NotNull final Marker taskIdMarker, @NotNull final String version, @NotNull final CassandraServerConfig serverConfig ) throws IOException { LOGGER.info(taskIdMarker, "Building cassandra-rackdc.properties"); final Properties props = new Properties(); RackDc rackDc = serverConfig.getRackDc(); props.put("dc", rackDc.getDc()); props.put("rack", rackDc.getRack()); final File cassandraRackDc = new File("apache-cassandra-" + version + "/conf/cassandra-rackdc.properties"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(cassandraRackDc))) { props.store(bw, "Created by Apache Mesos Cassandra framework"); } }

Target:
private static void modifyCassandraRackdc( @NotNull final Marker taskIdMarker, @NotNull final String version, @NotNull final CassandraServerConfig serverConfig ) throws IOException { LOGGER.info(taskIdMarker, "Building cassandra-rackdc.properties"); final Properties props = new Properties(); final RackDc rackDc = serverConfig.getRackDc(); props.put("dc", rackDc.getDc()); props.put("rack", rackDc.getRack()); final File cassandraRackDc = new File("apache-cassandra-" + version + "/conf/cassandra-rackdc.properties"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(cassandraRackDc))) { props.store(bw, "Created by Apache Mesos Cassandra framework"); } }
Source:
public boolean isSuccessful() { return false; }

Target:
public boolean isSuccessful() { return true; }
Source:
@Override public void run(JsonNode jsonNode) { IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(jsonNode.get("cacheName").asText()); int warmup = jsonNode.get("warmup").asInt(); int key = 0; int cnt = 0; long initTime = 0; long maxLatency = -1; boolean record = false; while (!terminated()) { cnt++; long start = System.currentTimeMillis(); cache.put(key++ % 100, key); long latency = System.currentTimeMillis() - start; if (!record && cnt > warmup) { record = true; initTime = System.currentTimeMillis(); markInitialized(); } if (record) { if (maxLatency < latency) maxLatency = latency; } if (cnt % 1000 == 0) log.info("APPLICATION_STREAMED " + cnt + " transactions [max=" + maxLatency + "]"); } recordResult("WORST_LATENCY", maxLatency); recordResult("STREAMED", cnt - warmup); recordResult("MEASURE_DURATION", System.currentTimeMillis() - initTime); markFinished(); }

Target:
@Override public void run(JsonNode jsonNode) { IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(jsonNode.get("cacheName").asText()); int warmup = jsonNode.get("warmup").asInt(); int key = 0; int cnt = 0; long initTime = 0; long maxLatency = -1; boolean record = false; while (!terminated()) { cnt++; long from = System.nanoTime(); cache.put(key++ % 100, key); long latency = System.nanoTime() - from; if (!record && cnt > warmup) { record = true; initTime = System.currentTimeMillis(); markInitialized(); } if (record) { if (maxLatency < latency) maxLatency = latency; } if (cnt % 1000 == 0) log.info("APPLICATION_STREAMED " + cnt + " transactions [max=" + maxLatency + "]"); } recordResult("WORST_LATENCY", Duration.ofNanos(maxLatency).toMillis()); recordResult("STREAMED", cnt - warmup); recordResult("MEASURE_DURATION", System.currentTimeMillis() - initTime); markFinished(); }
Source:
<R> R performOperation(Function<S, ? extends R> function, ResultsAccumulator<R> remoteResults, Predicate<? super R> earlyTerminatePredicate) { ConsistentHash ch = dm.getConsistentHash(); TerminalOperation<R> op = new SingleRunOperation<>(intermediateOperations, supplierForSegments(ch, segmentsToFilter, null), function); UUID id = csm.remoteStreamOperation(getParallelDistribution(), parallel, ch, segmentsToFilter, keysToFilter, Collections.emptyMap(), includeLoader, op, remoteResults, earlyTerminatePredicate); try { R localValue = op.performOperation(); remoteResults.onCompletion(null, Collections.emptySet(), localValue); try { if ((earlyTerminatePredicate == null || !earlyTerminatePredicate.test(localValue)) && !csm.awaitCompletion(id, timeout, timeoutUnit)) { new TimeoutException(); } } catch (InterruptedException e) { throw new CacheException(e); } log.tracef("Finished operation for id %s", id); return remoteResults.currentValue; } finally { csm.forgetOperation(id); } }

Target:
<R> R performOperation(Function<S, ? extends R> function, ResultsAccumulator<R> remoteResults, Predicate<? super R> earlyTerminatePredicate) { ConsistentHash ch = dm.getConsistentHash(); TerminalOperation<R> op = new SingleRunOperation<>(intermediateOperations, supplierForSegments(ch, segmentsToFilter, null), function); UUID id = csm.remoteStreamOperation(getParallelDistribution(), parallel, ch, segmentsToFilter, keysToFilter, Collections.emptyMap(), includeLoader, op, remoteResults, earlyTerminatePredicate); try { R localValue = op.performOperation(); remoteResults.onCompletion(null, Collections.emptySet(), localValue); try { if ((earlyTerminatePredicate == null || !earlyTerminatePredicate.test(localValue)) && !csm.awaitCompletion(id, timeout, timeoutUnit)) { throw new TimeoutException(); } } catch (InterruptedException e) { throw new CacheException(e); } log.tracef("Finished operation for id %s", id); return remoteResults.currentValue; } finally { csm.forgetOperation(id); } }
Source:
public void refreshLightWeightData() { log.info("Refreshing Gluster Data [lightweight]"); List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (cluster.supportsGlusterService()) { log.debugFormat("Refreshing Gluter Data for cluster {0}", cluster.getname()); refreshClusterData(cluster); } } }

Target:
public void refreshLightWeightData() { log.debug("Refreshing Gluster Data [lightweight]"); List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (cluster.supportsGlusterService()) { log.debugFormat("Refreshing Gluter Data for cluster {0}", cluster.getname()); refreshClusterData(cluster); } } }
Source:
public void removeIfDone() throws IOException { if (isGenAvailableNowForCurrentSearcher()) { if (!isCancelled()) { notDoneNrtFutures.remove(this); set(null); } } }

Target:
void removeIfDone() { if (isGenAvailableNowForCurrentSearcher()) { notDoneNrtFutures.remove(this); if (!isCancelled()) { set(null); } } }