auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<ExceptionInfo> getThrowed(DetailAST methodAst) { final List<ExceptionInfo> returnValue = new ArrayList<>(); final DetailAST blockAst = methodAst.findFirstToken(TokenTypes.SLIST); if (blockAst != null) { final List<DetailAST> throwLiterals = findTokensInAstByType(blockAst, TokenTypes.LITERAL_THROW); for (DetailAST throwAst : throwLiterals) { DetailAST ancestor = throwAst; while (ancestor != blockAst) { if (ancestor.getType() == TokenTypes.LITERAL_TRY || ancestor.getType() == TokenTypes.LAMBDA) { break; } if (ancestor.getType() == TokenTypes.LITERAL_CATCH || ancestor.getType() == TokenTypes.LITERAL_FINALLY) { ancestor = ancestor.getParent(); } ancestor = ancestor.getParent(); } if (ancestor == blockAst) { final DetailAST newAst = throwAst.getFirstChild().getFirstChild(); if (newAst.getType() == TokenTypes.LITERAL_NEW) { final FullIdent ident = FullIdent.createFullIdent(newAst.getFirstChild()); final ExceptionInfo exceptionInfo = new ExceptionInfo( createClassInfo(new Token(ident), currentClassName)); returnValue.add(exceptionInfo); } } } } return returnValue; }

Target:
private List<ExceptionInfo> getThrowed(DetailAST methodAst) { final List<ExceptionInfo> returnValue = new ArrayList<>(); final DetailAST blockAst = methodAst.findFirstToken(TokenTypes.SLIST); if (blockAst != null) { final List<DetailAST> throwLiterals = findTokensInAstByType(blockAst, TokenTypes.LITERAL_THROW); for (DetailAST throwAst : throwLiterals) { if (!isInIgnoreBlock(blockAst, throwAst)) { final DetailAST newAst = throwAst.getFirstChild().getFirstChild(); if (newAst.getType() == TokenTypes.LITERAL_NEW) { final FullIdent ident = FullIdent.createFullIdent(newAst.getFirstChild()); final ExceptionInfo exceptionInfo = new ExceptionInfo( createClassInfo(new Token(ident), currentClassName)); returnValue.add(exceptionInfo); } } } } return returnValue; }
Source:
private String getThreeWayOverlay(final Diff diff) { final Conflict conflict = diff.getConflict(); final DifferenceKind diffKind = diff.getKind(); final DifferenceSource source = diff.getSource(); ConflictKind conflictKind = null; if (hasDirectOrIndirectConflict(REAL).apply(diff)) { conflictKind = REAL; } else if (or(hasConflict(PSEUDO), allAtomicRefining(hasConflict(PSEUDO))).apply(diff)) { conflictKind = PSEUDO; } String path = ""; if (conflict != null || conflictKind != null) { if ((conflict != null && conflict.getKind() == PSEUDO) || conflictKind == PSEUDO) { path += "p"; } path += "conf"; if (source == DifferenceSource.RIGHT) { path += "r_"; } } else { switch (source) { case LEFT: path += "r_out"; break; case RIGHT: path += "r_in"; break; default: break; } } switch (diffKind) { case ADD: path += ADD_OV; break; case DELETE: path += DEL_OV; break; case CHANGE: case MOVE: path += CHG_OV; break; default: break; } return path; }

Target:
private String getThreeWayOverlay(final Diff diff) { final Conflict conflict = diff.getConflict(); final DifferenceKind diffKind = diff.getKind(); final DifferenceSource source = diff.getSource(); ConflictKind conflictKind = null; if (hasDirectOrIndirectConflict(REAL).apply(diff)) { conflictKind = REAL; } else if (canBeConsideredAsPseudoConflicting().apply(diff)) { conflictKind = PSEUDO; } String path = ""; if (conflict != null || conflictKind != null) { if ((conflict != null && conflict.getKind() == PSEUDO) || conflictKind == PSEUDO) { path += "p"; } path += "conf"; if (source == DifferenceSource.RIGHT) { path += "r_"; } } else { switch (source) { case LEFT: path += "r_out"; break; case RIGHT: path += "r_in"; break; default: break; } } switch (diffKind) { case ADD: path += ADD_OV; break; case DELETE: path += DEL_OV; break; case CHANGE: case MOVE: path += CHG_OV; break; default: break; } return path; }
Source:
private void setCurrentLocale(Locale locale) { if (locale.equals(mCurrentLocale)) { return; } mCurrentLocale = locale; mTempDate = getCalendarForLocale(mTempDate, locale); mMinDate = getCalendarForLocale(mMinDate, locale); mMaxDate = getCalendarForLocale(mMaxDate, locale); mCurrentDate = getCalendarForLocale(mCurrentDate, locale); mNumberOfMonths = mTempDate.getActualMaximum(Calendar.MONTH) + 1; mShortMonths = new String[mNumberOfMonths]; String january = DateUtils.getMonthString(Calendar.JANUARY, DateUtils.LENGTH_MEDIUM); if (Character.isDigit(january.charAt(0))) { for (int i = 0; i < mNumberOfMonths; ++i) { mShortMonths[i] = String.format("%d", i + 1); } } else { for (int i = 0; i < mNumberOfMonths; ++i) { mShortMonths[i] = DateUtils.getMonthString(Calendar.JANUARY + i, DateUtils.LENGTH_MEDIUM); } } }

Target:
private void setCurrentLocale(Locale locale) { if (locale.equals(mCurrentLocale)) { return; } mCurrentLocale = locale; mTempDate = getCalendarForLocale(mTempDate, locale); mMinDate = getCalendarForLocale(mMinDate, locale); mMaxDate = getCalendarForLocale(mMaxDate, locale); mCurrentDate = getCalendarForLocale(mCurrentDate, locale); mNumberOfMonths = mTempDate.getActualMaximum(Calendar.MONTH) + 1; if (useNumericMonths()) { mShortMonths = new String[mNumberOfMonths]; for (int i = 0; i < mNumberOfMonths; ++i) { mShortMonths[i] = String.format("%d", i + 1); } } else { mShortMonths = LocaleData.get(Locale.getDefault()).shortMonthNames.clone(); } }
Source:
private CompletableFuture<List<MesosWorkerStore.Worker>> getWorkersAsync() { return CompletableFuture.supplyAsync(() -> { try { final List<MesosWorkerStore.Worker> tasksFromPreviousAttempts = workerStore.recoverWorkers(); for (final MesosWorkerStore.Worker worker : tasksFromPreviousAttempts) { if (worker.state() == MesosWorkerStore.WorkerState.New) { workerStore.removeWorker(worker.taskID()); } } return tasksFromPreviousAttempts; } catch (final Exception e) { throw new CompletionException(new ResourceManagerException(e)); } }); }

Target:
private CompletableFuture<List<MesosWorkerStore.Worker>> getWorkersAsync() { return CompletableFuture.supplyAsync(() -> { try { final List<MesosWorkerStore.Worker> tasksFromPreviousAttempts = workerStore.recoverWorkers(); for (final MesosWorkerStore.Worker worker : tasksFromPreviousAttempts) { if (worker.state() == MesosWorkerStore.WorkerState.New) { workerStore.removeWorker(worker.taskID()); } } return tasksFromPreviousAttempts; } catch (final Exception e) { throw new CompletionException(new ResourceManagerException(e)); } }, getIoExecutor()); }
Source:
public void no_effect_when_removing_any_permission_from_group_AnyOne_on_a_private_project() { ComponentDto project = db.components().insertPrivateProject(); userSession.logIn().addProjectPermission(UserRole.ADMIN, project); ProjectPermissions.ALL .forEach(permission -> { newRequest() .setParam(PARAM_GROUP_NAME, "anyone") .setParam(PARAM_PROJECT_ID, project.uuid()) .setParam(PARAM_PERMISSION, permission) .execute(); }); }

Target:
public void no_effect_when_removing_any_permission_from_group_AnyOne_on_a_private_project() { ComponentDto project = db.components().insertPrivateProject(); ProjectPermissions.ALL .forEach(perm -> unsafeInsertProjectPermissionOnAnyone(perm, project)); userSession.logIn().addProjectPermission(UserRole.ADMIN, project); ProjectPermissions.ALL .forEach(permission -> { newRequest() .setParam(PARAM_GROUP_NAME, "anyone") .setParam(PARAM_PROJECT_ID, project.uuid()) .setParam(PARAM_PERMISSION, permission) .execute(); assertThat(db.users().selectAnyonePermissions(db.getDefaultOrganization(), project)).contains(permission); }); }
Source:
public void onEnter() { final String kafkaFlushedBytesMetricName = MetricUtils.metricNameForHiLAStream( this.getContext().getParameters().getConsumingAppId(), this.getContext().getSubscriptionId() ); bytesSentMeter = this.getContext().getMetricRegistry().meter(kafkaFlushedBytesMetricName); this.kafkaConsumer = getKafka().createKafkaConsumer(); this.topologyChangeSubscription = getZk().subscribeForTopologyChanges(() -> addTask(this::topologyChanged)); reactOnTopologyChange(); addTask(this::pollDataFromKafka); scheduleTask(this::checkBatchTimeouts, getParameters().batchTimeoutMillis, TimeUnit.MILLISECONDS); getParameters().streamTimeoutMillis.ifPresent( timeout -> scheduleTask(() -> { final String debugMessage = "Stream timeout reached"; this.sendMetadata(debugMessage); this.shutdownGracefully(debugMessage); }, timeout, TimeUnit.MILLISECONDS)); this.lastCommitMillis = System.currentTimeMillis(); scheduleTask(this::checkCommitTimeout, getParameters().commitTimeoutMillis, TimeUnit.MILLISECONDS); getLog().debug("Register cursor reset listener"); cursorResetSubscription = getZk().subscribeForCursorsReset(() -> { final String message = "Resetting subscription cursors"; sendMetadata(message); shutdownGracefully(message); }); }

Target:
public void onEnter() { final String kafkaFlushedBytesMetricName = MetricUtils.metricNameForHiLAStream( this.getContext().getParameters().getConsumingAppId(), this.getContext().getSubscriptionId() ); bytesSentMeter = this.getContext().getMetricRegistry().meter(kafkaFlushedBytesMetricName); this.kafkaConsumer = getKafka().createKafkaConsumer(); this.topologyChangeSubscription = getZk().subscribeForTopologyChanges(() -> addTask(this::topologyChanged)); reactOnTopologyChange(); addTask(this::pollDataFromKafka); scheduleTask(this::checkBatchTimeouts, getParameters().batchTimeoutMillis, TimeUnit.MILLISECONDS); getParameters().streamTimeoutMillis.ifPresent( timeout -> scheduleTask(() -> { final String debugMessage = "Stream timeout reached"; this.sendMetadata(debugMessage); this.shutdownGracefully(debugMessage); }, timeout, TimeUnit.MILLISECONDS)); this.lastCommitMillis = System.currentTimeMillis(); scheduleTask(this::checkCommitTimeout, getParameters().commitTimeoutMillis, TimeUnit.MILLISECONDS); cursorResetSubscription = getZk().subscribeForCursorsReset( () -> addTask(this::resetSubscriptionCursorsCallback)); }
Source:
private boolean isTtlUpdateEntryValid(StoreKey key, Offset indexSegmentStartOffset) throws StoreException { boolean valid = false; FileSpan srcSearchSpan = new FileSpan(srcIndex.getStartOffset(), indexSegmentStartOffset); IndexValue srcValue = srcIndex.findKey(key, srcSearchSpan, EnumSet.of(PersistentIndex.IndexEntryType.PUT)); if (srcValue == null) { logger.trace( "Skipping copying TTL update of in segment with start offset in because the corresponding PUT entry " + "does not exist anymore", key, indexSegmentStartOffset, storeId); } else { IndexValue tgtValue = tgtIndex.findKey(key, null, EnumSet.of(PersistentIndex.IndexEntryType.PUT)); if (tgtValue == null && isOffsetInCurrentCycle(srcValue.getOffset())) { logger.trace( "Skipping copying TTL update of in segment with start offset in because the corresponding PUT entry" + " will be compacted in this cycle ({} are being compacted in this cycle)", key, indexSegmentStartOffset, storeId, srcValue, compactionLog.getCompactionDetails().getLogSegmentsUnderCompaction()); } else { valid = true; } } return valid; }

Target:
private boolean isTtlUpdateEntryValid(StoreKey key, Offset indexSegmentStartOffset) throws StoreException { boolean valid = false; FileSpan srcSearchSpan = new FileSpan(srcIndex.getStartOffset(), indexSegmentStartOffset); IndexValue srcValue = srcIndex.findKey(key, srcSearchSpan, EnumSet.of(PersistentIndex.IndexEntryType.PUT)); if (srcValue == null) { logger.trace("TTL update of in segment with start offset in is not valid the corresponding PUT entry " + "does not exist anymore", key, indexSegmentStartOffset, storeId); } else { IndexValue tgtValue = tgtIndex.findKey(key, null, EnumSet.of(PersistentIndex.IndexEntryType.PUT)); if (tgtValue == null && isOffsetUnderCompaction(srcValue.getOffset())) { logger.trace( "TTL update of in segment with start offset in is not valid because the corresponding PUT entry" + " will be compacted in this cycle ({} are being compacted in this cycle)", key, indexSegmentStartOffset, storeId, srcValue, compactionLog.getCompactionDetails().getLogSegmentsUnderCompaction()); } else { valid = true; } } return valid; }
Source:
public ConfigurationNode getNode(Locale locale) { ConfigurationNode node = this.nodes.get(locale); if (node == null) { throw new IllegalStateException("Tried to read MultiSourceConfigTranslationDictionary before locale " + locale + " was loaded."); } return node; }

Target:
public ConfigurationNode getNode(Locale locale) { ConfigurationNode node = this.nodes.get(locale); checkState(node != null, "Tried to read MultiSourceConfigTranslationDictionary before locale %s was loaded.", locale); return node; }
Source:
public List<DiffEntry> scan(AbstractTreeIterator a, AbstractTreeIterator b) throws IOException { assertHaveRepository(); TreeWalk walk = new TreeWalk(db, reader); walk.addTree(a); walk.addTree(b); walk.setRecursive(true); TreeFilter filter = getDiffTreeFilterFor(a, b); if (pathFilter instanceof FollowFilter) { walk.setFilter(AndTreeFilter.create( PathFilter.create(((FollowFilter) pathFilter).getPath()), filter)); } else { walk.setFilter(AndTreeFilter.create(pathFilter, filter)); } source = new ContentSource.Pair(source(a), source(b)); List<DiffEntry> files = DiffEntry.scan(walk); if (pathFilter instanceof FollowFilter && isAdd(files)) { a.reset(); b.reset(); walk.reset(); walk.addTree(a); walk.addTree(b); walk.setFilter(filter); if (renameDetector == null) setDetectRenames(true); files = updateFollowFilter(detectRenames(DiffEntry.scan(walk))); } else if (renameDetector != null) files = detectRenames(files); return files; }

Target:
public List<DiffEntry> scan(AbstractTreeIterator a, AbstractTreeIterator b) throws IOException { assertHaveRepository(); TreeWalk walk = new TreeWalk(reader); walk.addTree(a); walk.addTree(b); walk.setRecursive(true); TreeFilter filter = getDiffTreeFilterFor(a, b); if (pathFilter instanceof FollowFilter) { walk.setFilter(AndTreeFilter.create( PathFilter.create(((FollowFilter) pathFilter).getPath()), filter)); } else { walk.setFilter(AndTreeFilter.create(pathFilter, filter)); } source = new ContentSource.Pair(source(a), source(b)); List<DiffEntry> files = DiffEntry.scan(walk); if (pathFilter instanceof FollowFilter && isAdd(files)) { a.reset(); b.reset(); walk.reset(); walk.addTree(a); walk.addTree(b); walk.setFilter(filter); if (renameDetector == null) setDetectRenames(true); files = updateFollowFilter(detectRenames(DiffEntry.scan(walk))); } else if (renameDetector != null) files = detectRenames(files); return files; }
Source:
@Override public boolean clean(ByteBuffer buf) { try { Object cleaner = cleanerMtd.invoke(buf); if (cleaner == null) { return false; } cleanMtd.invoke(cleaner); return true; } catch (IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Failed to invoke direct buffer cleaner", e); } }

Target:
public boolean clean(ByteBuffer buf) { try { Object cleaner = cleanerMtd.invoke(buf); if (cleaner == null) { return false; } cleanMtd.invoke(cleaner); return true; } catch (IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Failed to invoke direct buffer cleaner", e); } }
Source:
public static Optional<ArrayByteSource> unzipPathNameInMemory(BeanByteSource source, String relativePathName) { try (ZipInputStream in = new ZipInputStream(source.openStream())) { ZipEntry entry = in.getNextEntry(); while (entry != null) { if (!entry.isDirectory() && entry.getName().equals(relativePathName)) { return Optional.of(ArrayByteSource.copyOf(ByteStreams.toByteArray(in)).withFileName(entry.getName())); } in.closeEntry(); entry = in.getNextEntry(); } } catch (IOException ex) { throw new UncheckedIOException(ex); } return Optional.empty(); }

Target:
public static Optional<ArrayByteSource> unzipPathNameInMemory(BeanByteSource source, String relativePathName) { ArgChecker.notNull(relativePathName, "relativePathName"); try (ZipInputStream in = new ZipInputStream(source.openStream())) { ZipEntry entry = in.getNextEntry(); while (entry != null) { if (!entry.isDirectory() && entry.getName().equals(relativePathName)) { return Optional.of(ArrayByteSource.copyOf(ByteStreams.toByteArray(in)).withFileName(entry.getName())); } in.closeEntry(); entry = in.getNextEntry(); } } catch (IOException ex) { throw new UncheckedIOException(ex); } return Optional.empty(); }
Source:
public KeyIncrementPair(Random random, int maxKey, int maxInc) { }

Target:
public KeyIncrementPair(Random random, int maxKey, int maxInc) { key = random.nextInt(maxKey); inc = random.nextInt(maxInc-1)+1; }
Source:
static Optional<ChargeStatus> newChargeStateForChargeNotification(String notificationStatus, ChargeStatus chargeStatus) { final EpdqNotification.StatusCode statusCode = EpdqNotification.StatusCode.byCode(notificationStatus); switch (statusCode) { case EPDQ_AUTHORISATION_REFUSED: return Optional.of(AUTHORISATION_REJECTED); case EPDQ_AUTHORISED: return Optional.of(AUTHORISATION_SUCCESS); case EPDQ_AUTHORISED_CANCELLED: switch (chargeStatus) { case USER_CANCEL_SUBMITTED: return Optional.of(USER_CANCELLATION_FLOW.getSuccessTerminalState()); case EXPIRE_CANCEL_SUBMITTED: return Optional.of(EXPIRE_FLOW.getSuccessTerminalState()); case SYSTEM_CANCEL_SUBMITTED: case CREATED: case ENTERING_CARD_DETAILS: return Optional.of(SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState()); default: return Optional.empty(); } case EPDQ_PAYMENT_REQUESTED: return Optional.of(CAPTURED); default: return Optional.empty(); } }

Target:
private static Optional<ChargeStatus> newChargeStateForChargeNotification(String notificationStatus, ChargeStatus chargeStatus) { final EpdqNotification.StatusCode statusCode = EpdqNotification.StatusCode.byCode(notificationStatus); switch (statusCode) { case EPDQ_AUTHORISATION_REFUSED: return Optional.of(AUTHORISATION_REJECTED); case EPDQ_AUTHORISED: return Optional.of(AUTHORISATION_SUCCESS); case EPDQ_AUTHORISED_CANCELLED: switch (chargeStatus) { case USER_CANCEL_SUBMITTED: return Optional.of(USER_CANCELLATION_FLOW.getSuccessTerminalState()); case EXPIRE_CANCEL_SUBMITTED: return Optional.of(EXPIRE_FLOW.getSuccessTerminalState()); case SYSTEM_CANCEL_SUBMITTED: case CREATED: case ENTERING_CARD_DETAILS: return Optional.of(SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState()); default: return Optional.empty(); } case EPDQ_PAYMENT_REQUESTED: return Optional.of(CAPTURED); default: return Optional.empty(); } }
Source:
protected CompletableFuture<Integer> getValue() { if (getter.isPresent()) { return getter.map(integerGetter -> integerGetter.get()).get(); } else { return null; } }

Target:
protected CompletableFuture<Integer> getValue() { return getter.map(integerGetter -> integerGetter.get()).orElse(null); }
Source:
public void shouldReturnTheCorrectStateForNonXPostalCode() { Optional<CanadaProvinceOrTerritory> canadaProvinceTerritory = CanadaPostalcodeToProvinceOrTerritoryMapper.getProvinceOrTerritory("A1A1A1"); assertThat(canadaProvinceTerritory.isPresent(), is (true)); assertThat(canadaProvinceTerritory.get().getAbbreviation(), is ("NL")); assertThat(canadaProvinceTerritory.get().getFullName(), is ("Newfoundland and Labrador")); }

Target:
public void shouldReturnTheCorrectStateForNonXPostalCode() { Optional<CanadaProvinceOrTerritory> canadaProvinceTerritory = CanadaPostalcodeToProvinceOrTerritoryMapper.getProvinceOrTerritory("A1A1A1"); assertThat(canadaProvinceTerritory.isPresent(), is (true)); assertThat(canadaProvinceTerritory.get(), is (CanadaProvinceOrTerritory.NEWFOUNDLAND_AND_LABRADOR)); }
Source:
public static ColumnValueSelector makeColumnValueSelectorWithFloatDefault( final ColumnSelectorFactory metricFactory, final ExprMacroTable macroTable, final String fieldName, final String fieldExpression, final float nullValue ) { if (fieldName != null && fieldExpression == null) { return metricFactory.makeColumnValueSelector(fieldName); } if (fieldName == null && fieldExpression != null) { final Expr expr = Parser.parse(fieldExpression, macroTable); final ColumnValueSelector<ExprEval> baseSelector = ExpressionSelectors.makeExprEvalSelector(metricFactory, expr); class ExpressionFloatColumnSelector implements FloatColumnSelector { @Override public float getFloat() { final ExprEval exprEval = baseSelector.getObject(); return exprEval.isNumericNull() ? nullValue : (float) exprEval.asDouble(); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } @Override public boolean isNull() { final ExprEval exprEval = baseSelector.getObject(); return exprEval == null || exprEval.isNumericNull(); } } return new ExpressionFloatColumnSelector(); } throw new IllegalArgumentException("Must have a valid, non-null fieldName or expression"); }

Target:
public static BaseFloatColumnValueSelector makeColumnValueSelectorWithFloatDefault( final ColumnSelectorFactory metricFactory, final ExprMacroTable macroTable, final String fieldName, final String fieldExpression, final float nullValue ) { if (fieldName != null && fieldExpression == null) { return metricFactory.makeColumnValueSelector(fieldName); } if (fieldName == null && fieldExpression != null) { final Expr expr = Parser.parse(fieldExpression, macroTable); final ColumnValueSelector<ExprEval> baseSelector = ExpressionSelectors.makeExprEvalSelector(metricFactory, expr); class ExpressionFloatColumnSelector implements FloatColumnSelector { @Override public float getFloat() { final ExprEval exprEval = baseSelector.getObject(); return exprEval.isNumericNull() ? nullValue : (float) exprEval.asDouble(); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } @Override public boolean isNull() { final ExprEval exprEval = baseSelector.getObject(); return exprEval == null || exprEval.isNumericNull(); } } return new ExpressionFloatColumnSelector(); } throw new IllegalArgumentException("Must have a valid, non-null fieldName or expression"); }
Source:
protected void logSearchRequest(SearchRequest request, NxQueryBuilder query, SearchType searchType) { if (log.isDebugEnabled()) { String scroll = ""; if (request.scroll() != null) { scroll = "&scroll=" + request.scroll().toString(); } log.debug(String.format( "Search query: curl -XGET 'http://localhost:9200/%s/%s/_search?pretty&search_type=%s%s' -d '%s'", getSearchIndexesAsString(query), DOC_TYPE, searchType.toString().toLowerCase(), scroll, request.source().toString())); } }

Target:
protected void logSearchRequest(SearchRequest request, NxQueryBuilder query, SearchType searchType) { if (log.isDebugEnabled()) { String scroll = request.scroll() != null ? "&scroll=" + request.scroll() : ""; log.debug(String.format( "Search query: curl -XGET 'http://localhost:9200/%s/%s/_search?pretty&search_type=%s%s' -d '%s'", getSearchIndexesAsString(query), DOC_TYPE, searchType.toString().toLowerCase(), scroll, request.source().toString())); } }
Source:
SlackService getSlackService(final String baseUrl, final String teamDomain, final String authTokenCredentialId, final boolean botUser, final String room) { return new StandardSlackService(baseUrl, teamDomain, null, authTokenCredentialId, botUser, room); }

Target:
SlackService getSlackService(final String baseUrl, final String teamDomain, final String authTokenCredentialId, final boolean botUser, final String room) { return new StandardSlackService(baseUrl, teamDomain, authTokenCredentialId, botUser, room); }
Source:
public void reinitializeCharts() { if (getGlobalPC() != null) { getGlobalPC().dispose(); } fGlobalPC = new PieChart(this, SWT.NONE); getGlobalPC().getTitle().setText(fGlobalPCname); getGlobalPC().getAxisSet().getXAxis(0).getTitle().setText(""); if (getTimeRangePC() != null) { getTimeRangePC().dispose(); fTimeRangePC = null; } layout(); setCurrentState(new PieChartViewerStateNoContentSelected(this)); }

Target:
public void reinitializeCharts() { if (getGlobalPC() != null && !getGlobalPC().isDisposed()) { getGlobalPC().dispose(); } fGlobalPC = new PieChart(this, SWT.NONE); getGlobalPC().getTitle().setText(fGlobalPCname); getGlobalPC().getAxisSet().getXAxis(0).getTitle().setText(""); if (getTimeRangePC() != null && !getTimeRangePC().isDisposed()) { getTimeRangePC().dispose(); fTimeRangePC = null; } layout(); setCurrentState(new PieChartViewerStateNoContentSelected(this)); }
Source:
public TaskExecutor(int runnerThreads, int minDrivers, int guaranteedNumberOfDriversPerTask, int maximumNumberOfDriversPerTask, Ticker ticker) { this( new Duration(1, SECONDS), runnerThreads, minDrivers, guaranteedNumberOfDriversPerTask, maximumNumberOfDriversPerTask, new EmbedVersion(new ServerConfig()), new MultilevelSplitQueue(2), ticker); }

Target:
public TaskExecutor(int runnerThreads, int minDrivers, int guaranteedNumberOfDriversPerTask, int maximumNumberOfDriversPerTask, Ticker ticker) { this( new TaskManagerConfig().getSplitRunDuration(), runnerThreads, minDrivers, guaranteedNumberOfDriversPerTask, maximumNumberOfDriversPerTask, new EmbedVersion(new ServerConfig()), new MultilevelSplitQueue(2), ticker); }
Source:
<T> Mono<DigitalTwinsResponse<T>> createDigitalTwinWithResponse(String digitalTwinId, T digitalTwin, Class<T> clazz, Context context) { return protocolLayer .getDigitalTwins() .addWithResponseAsync(digitalTwinId, digitalTwin, context) .flatMap(response -> { T genericResponse = null; try { genericResponse = DeserializationHelpers.castObject(mapper, response.getValue(), clazz); } catch (JsonProcessingException e) { logger.error("JsonProcessingException occurred while creating digital twin: ", e); return Mono.error(e); } DigitalTwinsResponseHeaders twinHeaders = mapper.convertValue(response.getDeserializedHeaders(), DigitalTwinsResponseHeaders.class); return Mono.just(new DigitalTwinsResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), genericResponse, twinHeaders)); }); }

Target:
<T> Mono<DigitalTwinsResponse<T>> createDigitalTwinWithResponse(String digitalTwinId, T digitalTwin, Class<T> clazz, Context context) { return protocolLayer .getDigitalTwins() .addWithResponseAsync(digitalTwinId, digitalTwin, context) .flatMap(response -> { T genericResponse = null; try { genericResponse = DeserializationHelpers.castObject(mapper, response.getValue(), clazz); } catch (JsonProcessingException e) { logger.error("JsonProcessingException occurred while deserializing the response: ", e); return Mono.error(e); } DigitalTwinsResponseHeaders twinHeaders = mapper.convertValue(response.getDeserializedHeaders(), DigitalTwinsResponseHeaders.class); return Mono.just(new DigitalTwinsResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), genericResponse, twinHeaders)); }); }
Source:
public <T extends Plugin> List<T> loadEnabled(@NonNull CoreConfiguration config, @NonNull Class<T> clazz) { List<T> list = load(clazz); for (Iterator<T> iterator = list.iterator(); iterator.hasNext(); ) { T plugin = iterator.next(); if (!plugin.enabled(config)) { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Removing non-enabled plugin : " + plugin); iterator.remove(); } } return list; }

Target:
public <T extends Plugin> List<T> loadEnabled(@NonNull CoreConfiguration config, @NonNull Class<T> clazz) { List<T> list = load(clazz); for (Iterator<T> iterator = list.iterator(); iterator.hasNext(); ) { T plugin = iterator.next(); if (!plugin.enabled(config)) { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Removing disabled plugin : " + plugin); iterator.remove(); } } return list; }
Source:
public void testHistoryTrackerConfigurer() throws Exception { final CountDownLatch latch = new CountDownLatch(1); testSink.input().subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { Assert.isTrue(message.getHeaders().containsKey("SPRING_CLOUD_STREAM_HISTORY"), "Message header should have tracking history info"); BindingProperties inputBindingProps = (BindingProperties) ((Map)((List) message.getHeaders() .get("SPRING_CLOUD_STREAM_HISTORY")).get(0)).get("input"); Assert.isTrue(inputBindingProps.getDestination().equals("configure")); Assert.isTrue(inputBindingProps.getTrackHistory()); BindingProperties outputBindingProps = (BindingProperties) ((Map)((List) message.getHeaders() .get("SPRING_CLOUD_STREAM_HISTORY")).get(0)).get("output");; Assert.isTrue(outputBindingProps.getDestination().equals("configure")); Assert.isTrue(!outputBindingProps.getTrackHistory()); latch.countDown(); } }); testSource.output().send(MessageBuilder.withPayload("{\"test\":\"value\"}").build()); latch.await(10, TimeUnit.SECONDS); }

Target:
public void testHistoryTrackerConfigurer() throws Exception { final CountDownLatch latch1 = new CountDownLatch(1); MessageHandler messageHandler1 = new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { assertTrue("Message header should have tracking history info", message.getHeaders().containsKey("SPRING_CLOUD_STREAM_HISTORY")); Map<String, String> headerValue = ((Map) ((List) message.getHeaders() .get("SPRING_CLOUD_STREAM_HISTORY")).get(0)); String inputBindingProps = (String) headerValue.get("input"); assertTrue(inputBindingProps.contains("destination=configure")); assertTrue(inputBindingProps.contains("trackHistory=true")); assertTrue(headerValue.get("instanceIndex").equals("0")); assertTrue(headerValue.get("instanceCount").equals("1")); assertTrue(headerValue.get("producer.nextModuleCount").equals("1")); assertTrue(headerValue.get("consumer.concurrency").equals("1")); String outputBindingProps = (String) ((Map) ((List) message.getHeaders() .get("SPRING_CLOUD_STREAM_HISTORY")).get(0)).get("output"); ; assertTrue(outputBindingProps.contains("destination=configure")); assertTrue(outputBindingProps.contains("trackHistory=true")); latch1.countDown(); } }; testSink.input().subscribe(messageHandler1); testSource.output().send(MessageBuilder.withPayload("{\"test\":\"value\"}").build()); latch1.await(10, TimeUnit.SECONDS); testSink.input().unsubscribe(messageHandler1); }
Source:
public void setSnapshotTransferDoneAndStartApply(LogReplicationEntry message) { setSnapshotTransferDone(message); long seqNum = logReplicationMetadataManager.query(null, LogReplicationMetadataManager.LogReplicationMetadataType.LAST_SNAPSHOT_SEQ_NUM); if (seqNum != Address.NON_ADDRESS) { phase = Phase.ApplyPhase; long snapshot = rt.getAddressSpaceView().getLogTail(); clearTables(); for (UUID uuid : streamViewMap.keySet()) { appliedSeq = applyShadowStream(uuid, appliedSeq, snapshot); } } logReplicationMetadataManager.setSnapshotApplied(message); }

Target:
public void setSnapshotTransferDoneAndStartApply(LogReplicationEntry message) { setSnapshotTransferDone(message); long seqNum = logReplicationMetadataManager.query(null, LogReplicationMetadataManager.LogReplicationMetadataType.LAST_SNAPSHOT_SEQ_NUM); if (seqNum != Address.NON_ADDRESS) { phase = Phase.ApplyPhase; long snapshot = rt.getAddressSpaceView().getLogTail(); clearTables(); for (UUID uuid : streamViewMap.keySet()) { appliedSeq = applyShadowStream(uuid, appliedSeq, snapshot); } } logReplicationMetadataManager.setSnapshotApplied(message); phase = Phase.TransferPhase; }
Source:
public String replace( String self, String oldString, String newString, Object maxSplitO) throws EvalException { int maxSplit = Integer.MAX_VALUE; if (maxSplitO != Runtime.NONE) { maxSplit = Math.max(0, (Integer) maxSplitO); } if (oldString.equals("")) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < self.length(); i++) { if (maxSplit > 0) { sb.append(newString); maxSplit--; } sb.append(self.charAt(i)); } if (maxSplit > 0) { sb.append(newString); } return sb.toString(); } return StringUtils.replace(self, oldString, newString, maxSplit); }

Target:
public String replace( String self, String oldString, String newString, Object maxSplitO) throws EvalException { int maxSplit = Integer.MAX_VALUE; if (maxSplitO != Runtime.NONE) { maxSplit = Math.max(0, (Integer) maxSplitO); } StringBuilder sb = new StringBuilder(); int start = 0; for (int i = 0; i < maxSplit; i++) { if (oldString.isEmpty()) { sb.append(newString); if (start < self.length()) { sb.append(self.charAt(start++)); } else { break; } } else { int end = self.indexOf(oldString, start); if (end < 0) break; sb.append(self, start, end).append(newString); start = end + oldString.length(); } } sb.append(self, start, self.length()); return sb.toString(); }
Source:
public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.start(); startAcceptor(); if (advancedNetworkingEnabled) { if (metricsRegistryScheduled.compareAndSet(false, true)) { metricsRegistry.scheduleAtFixedRate(new RefreshNetworkStatsTask(), 1, SECONDS, ProbeLevel.INFO); } inboundNetworkStats.registerMetrics(metricsRegistry, "tcp.bytesReceived"); outboundNetworkStats.registerMetrics(metricsRegistry, "tcp.bytesSend"); } }

Target:
public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.start(); startAcceptor(); if (unifiedEndpointManager == null) { if (metricsRegistryScheduled.compareAndSet(false, true)) { metricsRegistry.scheduleAtFixedRate(new RefreshNetworkStatsTask(), 1, SECONDS, ProbeLevel.INFO); } aggregateEndpointManager.getInboundNetworkStats().registerMetrics(metricsRegistry, "tcp.bytesReceived"); aggregateEndpointManager.getOutboundNetworkStats().registerMetrics(metricsRegistry, "tcp.bytesSend"); } }
Source:
public int getMaximumValue() { switch (relation) { case GREATER_THAN: case GREATER_THAN_OR_EQUAL: return Integer.MAX_VALUE; case LESS_THAN_OR_EQUAL: case EQUAL: return queryInt; case LESS_THAN: if (queryInt == Integer.MIN_VALUE) { return queryInt; } else { return queryInt - 1; } default: throw new IllegalStateException("Unknown relation " + relation); } }

Target:
public int getMaximumValue() { return range.max; }
Source:
private <T> Task<Response<T>> createTaskWithTimeout(final String name, final Request<T> request, final RequestContext requestContext, RequestConfig config) { ConfigValue<Long> timeout = config.getTimeoutMs(); int configuredTimeout = timeout.getValue().intValue(); boolean hasPerRequestTimeout = hasRequestContextTimeout(requestContext); if (timeout.getValue() != null && timeout.getValue() > 0 && !hasPerRequestTimeout && _d2RequestTimeoutEnabled) { requestContext.putLocalAttr(R2Constants.REQUEST_TIMEOUT, configuredTimeout); requestContext.putLocalAttr(R2Constants.REQUEST_TIMEOUT_IGNORE_IF_HIGHER_THAN_DEFAULT, true); } Task<Response<T>> requestTask; if (RequestGroup.isBatchable(request, config)) { requestTask = createBatchableTask(name, request, requestContext, config); } else { requestTask = Task.async(name, () -> sendRequest(request, requestContext)); } if (timeout.getValue() == null || timeout.getValue() <= 0 || hasPerRequestTimeout) { return requestTask; } else { if (!_d2RequestTimeoutEnabled) { return withTimeout(requestTask, timeout); } else { String srcDesc = timeout.getSource().map(src -> " src: " + src).orElse(""); String timeoutTaskName = "withTimeout " + configuredTimeout + TimeUnitHelper.toString(TimeUnit.MILLISECONDS) + srcDesc; return withD2Timeout(requestTask, timeoutTaskName); } } }

Target:
private <T> Task<Response<T>> createTaskWithTimeout(final String name, final Request<T> request, final RequestContext requestContext, RequestConfig config) { ConfigValue<Long> timeout = config.getTimeoutMs(); Task<Response<T>> requestTask; if (RequestGroup.isBatchable(request, config)) { requestTask = createBatchableTask(name, request, requestContext, config); } else { requestTask = Task.async(name, () -> sendRequest(request, requestContext)); } if (!needApplyTaskTimeout(requestContext, timeout)) { return requestTask; } else { return withTimeout(requestTask, timeout); } }
Source:
protected void setDefaultProfileAttributes( ILaunchConfigurationWorkingCopy wc) throws CoreException { wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false); wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); }

Target:
protected void setDefaultProfileAttributes( ILaunchConfigurationWorkingCopy wc) { wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false); wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); }
Source:
public SnippetType snippets() { return annotation.snippets(); }

Target:
public SnippetType snippets() { switch (annotation.snippets()) { case UNDERSCORE: return SnippetType.UNDERSCORE; case CAMELCASE: return SnippetType.CAMELCASE; default: throw new IllegalArgumentException("" + annotation.snippets()); } }
Source:
private String getSourceMetricName(final String metricName, final RollupPeriod period) { Optional<RollupPeriod> sourcePeriod = period.nextSmallest(); while (sourcePeriod.isPresent() && !sourcePeriod.map(p -> _maxBackFillByPeriod.getOrDefault(p, 0) > 0).orElse(true)) { sourcePeriod = sourcePeriod.flatMap(RollupPeriod::nextSmallest); } return sourcePeriod.map(p -> getDestinationMetricName(metricName, p)).orElse(metricName); }

Target:
private String getSourceMetricName(final String metricName, final RollupPeriod period) { Optional<RollupPeriod> sourcePeriod = period.nextSmallest(); while (sourcePeriod.isPresent() && _maxBackFillByPeriod.getOrDefault(sourcePeriod.get(), 0) == 0) { sourcePeriod = sourcePeriod.flatMap(RollupPeriod::nextSmallest); } return sourcePeriod.map(p -> getDestinationMetricName(metricName, p)).orElse(metricName); }
Source:
public void process(Document document) { Element body = document.body(); CssParser cssParser = new CssParser(); for (Element element : Selector.select("[style]", body)) { String style = element.attr("style"); String newStyle = ""; List<CssRule> rules = null; CssRule newRule = null; if (style != null && style.length() > 0) { rules = cssParser.parseBlockContent(style); Iterator<CssRule> ruleIt = rules.iterator(); while (ruleIt.hasNext()) { CssRule rule = ruleIt.next(); if ("color".equals(rule.name)) { String color = rule.value; Matcher invalidHexColorMatcher = Pattern.compile("^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$") .matcher(color); if (invalidHexColorMatcher.find()) { String newColor = "#" + color; ruleIt.remove(); newRule = new CssRule("color", newColor.trim(), 0, 0, 0, 0); } } } } if (rules != null && newRule != null) { newStyle = addRuleToStyle(newStyle, newRule); for (CssRule rule : rules) { newStyle = addRuleToStyle(newStyle, rule); } element.attr("style", newStyle); } } }

Target:
public void process(Document document) { Element body = document.body(); CssParser cssParser = new CssParser(); for (Element element : Selector.select("[style]", body)) { String style = element.attr("style"); String newStyle = ""; List<CssRule> rules = null; CssRule newRule = null; if (style != null && style.length() > 0) { rules = cssParser.parseBlockContent(style); Iterator<CssRule> ruleIt = rules.iterator(); while (ruleIt.hasNext()) { CssRule rule = ruleIt.next(); if ("color".equals(rule.name)) { String color = rule.value; Matcher invalidHexColorMatcher = Pattern.compile( "^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})(\\s+(!)\\s*important)?\\s*$") .matcher(color); if (invalidHexColorMatcher.find()) { String newColor = "#" + invalidHexColorMatcher.group(1); boolean importantExists = invalidHexColorMatcher.group(2) != null; if (importantExists) { newColor += " !important"; } ruleIt.remove(); newRule = new CssRule("color", newColor.trim(), 0, 0, 0, 0); } } } } if (rules != null && newRule != null) { newStyle = addRuleToStyle(newStyle, newRule); for (CssRule rule : rules) { newStyle = addRuleToStyle(newStyle, rule); } element.attr("style", newStyle); } } }
Source:
protected void sql(String qry, @Nullable Predicate<List<List<?>>> validator) { List<List<?>> res = execSql(qry); if (validator != null) validator.test(res); }

Target:
protected void sql(String qry, @Nullable Predicate<List<List<?>>> validator) { List<List<?>> res = execSql(qry); if (validator != null) Assert.assertTrue(validator.test(res)); }
Source:
public String catalogName() { return catalogName.names.get(0); }

Target:
public String catalogName() { return catalogName.getSimple(); }
Source:
public IValueProperty convert(VDomainModelReference domainModelReference) { if (domainModelReference == null) { throw new IllegalArgumentException("The given VDomainModelReference must not be null."); } if (!(domainModelReference instanceof VFeaturePathDomainModelReference)) { throw new IllegalArgumentException( "domainModelReference must be instance of VFeaturePathDomainModelReference."); } final VFeaturePathDomainModelReference featurePathReference = (VFeaturePathDomainModelReference) domainModelReference; final List<EReference> referencePath = featurePathReference.getDomainModelEReferencePath(); if (referencePath.isEmpty()) { return EMFProperties.value(featurePathReference.getDomainModelEFeature()); } IEMFValueProperty emfValueProperty = EMFProperties.value(referencePath.get(0)); for (int i = 1; i < referencePath.size(); i++) { emfValueProperty = emfValueProperty.value(referencePath.get(i)); } return emfValueProperty.value(featurePathReference.getDomainModelEFeature()); }

Target:
public IValueProperty convert(VDomainModelReference domainModelReference) { if (domainModelReference == null) { throw new IllegalArgumentException("The given VDomainModelReference must not be null."); } if (!VFeaturePathDomainModelReference.class.isInstance(domainModelReference)) { throw new IllegalArgumentException( "DomainModelReference must be an instance of VFeaturePathDomainModelReference."); } final VFeaturePathDomainModelReference featurePathReference = (VFeaturePathDomainModelReference) domainModelReference; final List<EReference> referencePath = featurePathReference.getDomainModelEReferencePath(); if (referencePath.isEmpty()) { return EMFProperties.value(featurePathReference.getDomainModelEFeature()); } IEMFValueProperty emfValueProperty = EMFProperties.value(referencePath.get(0)); for (int i = 1; i < referencePath.size(); i++) { emfValueProperty = emfValueProperty.value(referencePath.get(i)); } return emfValueProperty.value(featurePathReference.getDomainModelEFeature()); }
Source:
private boolean useLatestSnapshotIfWithinDelay() { DatabasePoll latestDatabasePoll = this.latestDatabasePoll; if (latestDatabasePoll instanceof PeriodicDatabasePoll) { Futures.getUnchecked(((PeriodicDatabasePoll) latestDatabasePoll).firstPollCompletionFuture); return true; } if (latestDatabasePoll instanceof OnDemandDatabasePoll) { long periodicPollDelayNanos = TimeUnit.MILLISECONDS.toNanos(periodicPollDelay.getMillis()); OnDemandDatabasePoll latestOnDemandPoll = (OnDemandDatabasePoll) latestDatabasePoll; boolean latestDatabasePollIsFresh = latestOnDemandPoll.nanosElapsedFromInitiation() < periodicPollDelayNanos; if (latestDatabasePollIsFresh) { Futures.getUnchecked(latestOnDemandPoll.pollCompletionFuture); return true; } } else { assert latestDatabasePoll == null; } return false; }

Target:
boolean useLatestSnapshotIfWithinDelay() { DatabasePoll latestDatabasePoll = this.latestDatabasePoll; if (latestDatabasePoll instanceof PeriodicDatabasePoll) { Futures.getUnchecked(((PeriodicDatabasePoll) latestDatabasePoll).firstPollCompletionFuture); return true; } if (latestDatabasePoll instanceof OnDemandDatabasePoll) { long periodicPollDelayNanos = TimeUnit.MILLISECONDS.toNanos(periodicPollDelay.getMillis()); OnDemandDatabasePoll latestOnDemandPoll = (OnDemandDatabasePoll) latestDatabasePoll; boolean latestDatabasePollIsFresh = latestOnDemandPoll.nanosElapsedFromInitiation() < periodicPollDelayNanos; if (latestDatabasePollIsFresh) { Futures.getUnchecked(latestOnDemandPoll.pollCompletionFuture); return true; } } else { assert latestDatabasePoll == null; } return false; }
Source:
public void testRemoveCacheCommandInNonOOB() throws Exception { CacheRpcCommand command = new RemoveCacheCommand(cacheName, null, null, null); log.debugf("Testing " + command.getClass().getCanonicalName()); Message nonOobRequest = serialize(command, false); if (nonOobRequest == null) { log.debugf("Don't test " + command.getClass() + ". it is not Serializable"); return; } executorService.reset(); commandAwareRpcDispatcher.handle(nonOobRequest, null); Assert.assertEquals(executorService.hasExecutedCommand, command.isProcessedAsynchronously(), "Command " + command.getClass() + " dispatched wrongly."); }

Target:
public void testRemoveCacheCommandInNonOOB() throws Exception { CacheRpcCommand command = new RemoveCacheCommand(cacheName, null, null, null); log.debugf("Testing " + command.getClass().getCanonicalName()); Message nonOobRequest = serialize(command, false); if (nonOobRequest == null) { log.debugf("Don't test " + command.getClass() + ". it is not Serializable"); return; } executorService.reset(); commandAwareRpcDispatcher.handle(nonOobRequest, null); Assert.assertFalse(executorService.hasExecutedCommand, "Command " + command.getClass() + " dispatched wrongly."); }
Source:
public Optional<MongoCodeListEntry> tryFind(Context data) { if (data.containsKey(MongoCodeListEntry.ID.getName())) { return mango.select(MongoCodeListEntry.class) .eq(MongoCodeListEntry.ID, data.getValue(MongoUserAccount.ID.getName()).asString()) .one(); } if (data.containsKey(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE).getName()) && data.containsKey(MongoCodeListEntry.CODE_LIST.getName())) { return mango.select(MongoCodeListEntry.class) .eq(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE), data.getValue(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE) .getName())) .eq(MongoCodeListEntry.CODE_LIST, data.getValue(MongoCodeListEntry.CODE_LIST.getName())) .one(); } return Optional.empty(); }

Target:
public Optional<MongoCodeListEntry> tryFind(Context data) { if (data.containsKey(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE).getName()) && data.containsKey(MongoCodeListEntry.CODE_LIST.getName())) { return mango.select(MongoCodeListEntry.class) .eq(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE), data.getValue(MongoCodeListEntry.CODE_LIST_ENTRY_DATA.inner(CodeListEntryData.CODE) .getName())) .eq(MongoCodeListEntry.CODE_LIST, data.getValue(MongoCodeListEntry.CODE_LIST.getName())) .one(); } return Optional.empty(); }
Source:
public boolean isAccelerometerNotifying() { TiSensorTagGattResources resource; if (this.isCC2650()) { resource = this.gattResources.get(MOVEMENT); if (resource != null) { return resource.getGattValueCharacteristic().isNotifying(); } else { return false; } } else { resource = this.gattResources.get(ACCELEROMETER); if (resource != null) { return resource.getGattValueCharacteristic().isNotifying(); } else { return false; } } }

Target:
public boolean isAccelerometerNotifying() { if (this.isCC2650()) { return isNotifying(MOVEMENT); } else { return isNotifying(ACCELEROMETER); } }
Source:
public void beforeClass(final @Optional Boolean usingEncryption, final @Optional String testType) throws IOException { if (testType.equals("buckets")) { throw new SkipException("Directory tests will be skipped in Manta Buckets"); } config = new IntegrationTestConfigContext(); final String testName = this.getClass().getSimpleName(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestConfigContext.generateBasePathWithoutSeparator(config, testName); }

Target:
public void beforeClass(final @Optional Boolean usingEncryption, final @Optional String testType) throws IOException { if ("buckets".equals(testType)) { throw new SkipException("Directory tests will be skipped in Manta Buckets"); } config = new IntegrationTestConfigContext(); final String testName = this.getClass().getSimpleName(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestConfigContext.generateBasePathWithoutSeparator(config, testName); }