auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (getArguments() != null) { location_id = args.getString(LOCATION_ID); Log.d("DirectionsFragment", "Got location " + location_id); use_location = args.getBoolean(USE_CURRENT_LOCATION); if (use_location) { Log.d("DirectionsFragment", "Showing directiosn from current location"); } else { Log.d("DirectionsFragment", "Showing directions from entered address"); } } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (getArguments() != null) { location_id = args.getString(LOCATION_ID); Log.d("DirectionsFragment", "Got location " + location_id); use_location = args.getBoolean(USE_CURRENT_LOCATION); if (use_location) { Log.d("DirectionsFragment", "Showing directions from current location"); } else { Log.d("DirectionsFragment", "Showing directions from entered address"); } } }
Source:
public void testDoesNotGetSubscriptionByCreateTopicIfAutosubscribeDisabled() throws NotFoundException { Topic createdTopic = ObjectsFactory.topics(user, 1).get(0); user.setAutosubscribe(false); replyTopicStubs(createdTopic); Topic createdTopicLast = topicService.createTopic(createdTopic, ANSWER_BODY); assertFalse(createdTopicLast.userSubscribed(user), UNSUBSCRIBED); }

Target:
public void testDoesNotGetSubscriptionByCreateTopicIfAutosubscribeDisabled() throws NotFoundException { Topic createdTopic = ObjectsFactory.topics(user, 1).get(0); user.setAutosubscribe(false); createTopicStubs(); Topic createdTopicLast = topicService.createTopic(createdTopic, ANSWER_BODY); verify(subscriptionService,never()).subscribe(createdTopicLast); }
Source:
private void sendDataToListView(final BattleReportStatistics statistics) { List<BaseItem> itemList = new ArrayList<BaseItem>(); if(statistics.getFavoriteReports().size() > 0) { itemList.add(new BattleReportHeader(R.string.header_favorite_battlereport)); itemList.addAll(buildBaseItemList(new ArrayList<GameReport>(statistics.getFavoriteReports()), statistics.getSoldierId())); } itemList.add(new BattleReportHeader(R.string.header_latest_battlereport)); itemList.addAll(buildBaseItemList(new ArrayList<GameReport>(statistics.getStatsGameReports()), statistics.getSoldierId())); BattleReportAdapter adapter = new BattleReportAdapter(getActivity().getApplicationContext(), itemList); setListAdapter(adapter); }

Target:
private void sendDataToListView(final BattleReportStatistics statistics) { List<BaseItem> itemList = new ArrayList<BaseItem>(); if(statistics.getFavoriteReports().size() > 0) { itemList.add(new BattleReportHeader(R.string.header_favorite_battlereport)); itemList.addAll(buildBaseItemList(new ArrayList<GameReport>(statistics.getFavoriteReports()), statistics.getSoldierId())); } itemList.add(new BattleReportHeader(R.string.header_latest_battlereport)); itemList.addAll(buildBaseItemList(new ArrayList<GameReport>(statistics.getStatsGameReports()), statistics.getSoldierId())); BattleReportAdapter adapter = new BattleReportAdapter(getActivity(), itemList); setListAdapter(adapter); }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!JavaVersion.class.isAssignableFrom(obj.getClass())) { return false; } final JavaVersion other = (JavaVersion) obj; return this.discard == other.discard && this.major == other.major && this.minor == other.minor && this.update == other.update && this.build == other.build; }

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof JavaVersion)) { return false; } final JavaVersion other = (JavaVersion) obj; return compareTo(other) == 0; }
Source:
public void filter(ContainerRequestContext requestContext) { if (healthCheck.shootTimeLock()) { requestContext.abortWith( Response.status(Response.Status.SERVICE_UNAVAILABLE).build()); } }

Target:
public void filter(ContainerRequestContext requestContext) { if (healthCheck.shouldRejectRequests()) { requestContext.abortWith( Response.status(Response.Status.SERVICE_UNAVAILABLE).build()); } }
Source:
static public boolean exists(File basePath) { return basePath.isDirectory() && basePath.list().length > 0; }

Target:
protected static boolean exists(File basePath) { return basePath.isDirectory() && basePath.list().length > 0; }
Source:
public WindowImpl(final long start, final long size) { latestTimestamp = Long.MIN_VALUE; latestWatermark = null; dataCollection = new LinkedList<>(); this.start = start; this.end = start + size; }

Target:
public WindowImpl(final long start, final long size) { latestTimestamp = 0L; latestWatermark = null; dataCollection = new LinkedList<>(); this.start = start; this.end = start + size; }
Source:
public String getQuestionResultStatisticsHtml(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(); Map<String, Integer> answerFrequency = new LinkedHashMap<>(); for (String option : mcqChoices) { answerFrequency.put(option, 0); } if (otherEnabled) { answerFrequency.put("Other", 0); } for (FeedbackResponseAttributes response : responses) { String answerString = response.getResponseDetails().getAnswerString(); boolean isOtherOptionAnswer = ((FeedbackMcqResponseDetails) response.getResponseDetails()).isOtherOptionAnswer(); if (isOtherOptionAnswer) { answerFrequency.putIfAbsent("Other", 0); answerFrequency.put("Other", answerFrequency.get("Other") + 1); } else { answerFrequency.putIfAbsent(answerString, 0); answerFrequency.put(answerString, answerFrequency.get(answerString) + 1); } } DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, Integer> entry : answerFrequency.entrySet()) { fragments.append(Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS_OPTIONFRAGMENT, Slots.MCQ_CHOICE_VALUE, SanitizationHelper.sanitizeForHtml(entry.getKey()), Slots.COUNT, entry.getValue().toString(), Slots.PERCENTAGE, df.format(100 * (double) entry.getValue() / responses.size()))); } return Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS, Slots.FRAGMENTS, fragments.toString()); }

Target:
public String getQuestionResultStatisticsHtml(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(); Map<String, Integer> answerFrequency = collateAnswerFrequency(responses); DecimalFormat df = new DecimalFormat("#.##"); answerFrequency.forEach((key, value) -> fragments.append(Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS_OPTIONFRAGMENT, Slots.MCQ_CHOICE_VALUE, SanitizationHelper.sanitizeForHtml(key), Slots.COUNT, value.toString(), Slots.PERCENTAGE, df.format(100 * (double) value / responses.size())))); return Templates.populateTemplate(FormTemplates.MCQ_RESULT_STATS, Slots.FRAGMENTS, fragments.toString()); }
Source:
private static boolean attemptToCreateKeyspace(CassandraKeyValueServiceConfig config) throws InvalidRequestException { for (InetSocketAddress host : config.servers()) { try { if (!keyspaceAlreadyExists(host, config)) { attemptToCreateKeyspaceOnHost(host, config); } return true; } catch (InvalidRequestException ire) { if (attemptedToCreateKeyspaceTwice(ire)) { return true; } else { throw ire; } } catch (Exception exception) { log.warn("Couldn't use host to of keyspace." + " It returned exception \"{}\" during the attempt." + " We will retry on other nodes, so this shouldn't be a problem unless all nodes failed." + " See the debug-level log for the stack trace.", SafeArg.of("host", CassandraLogHelper.host(host)), UnsafeArg.of("exceptionMessage", exception.toString())); log.debug("Specifically, creating the keyspace failed with the following stack trace", exception); } } return false; }

Target:
private static boolean attemptToCreateKeyspace(CassandraKeyValueServiceConfig config) throws InvalidRequestException { for (InetSocketAddress host : config.servers()) { try { if (!keyspaceAlreadyExists(host, config)) { attemptToCreateKeyspaceOnHost(host, config); } return true; } catch (InvalidRequestException ire) { if (attemptedToCreateKeyspaceTwice(ire)) { return true; } else { throw ire; } } catch (Exception exception) { log.warn("Couldn't use host to create keyspace." + " It returned exception \"{}\" during the attempt." + " We will retry on other nodes, so this shouldn't be a problem unless all nodes failed." + " See the debug-level log for the stack trace.", SafeArg.of("host", CassandraLogHelper.host(host)), UnsafeArg.of("exceptionMessage", exception.toString())); log.debug("Specifically, creating the keyspace failed with the following stack trace", exception); } } return false; }
Source:
public CharSequence getSym(int col) { return reader.getSymbolMapReader(columnIndex).valueOf(recordIndex); }

Target:
public CharSequence getSym(int col) { return symbolMapReader.valueOf(recordIndex); }
Source:
public void evaluate_shouldReturnAllPatientsCurrentlyActiveOnDrugs() throws Exception { cohortDefinition.setOnlyCurrentlyActive(true); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); System.out.println("Currently on Drugs " + cohort.getMemberIds() + " " + cohortDefinition + "==="); }

Target:
public void evaluate_shouldReturnAllPatientsCurrentlyActiveOnDrugs() throws Exception { cohortDefinition.setOnlyCurrentlyActive(true); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(3, cohort.size()); }
Source:
public void execute(Tuple input) { byte[] bytes = input.getBinaryByField("bytes"); try { IotasMessage iotasMessage = objectMapper.readValue(new String(bytes, StandardCharsets.UTF_8), IotasMessage.class); Parser parser = getParser(iotasMessage); Map<String, Object> parsed = parser.parse(iotasMessage.getData()); Values values = new Values(); for(String s: parsed.keySet()) { System.out.print("\"" + s + "\","); } System.out.println(); for (String str : outputFields) { values.add(parsed.get(str)); } collector.emit(input, values); collector.ack(input); } catch (Exception e) { collector.fail(input); collector.reportError(e); } }

Target:
public void execute(Tuple input) { byte[] bytes = input.getBinaryByField("bytes"); Parser parser = null; try { if (parserId == null) { IotasMessage iotasMessage = objectMapper.readValue(new String(bytes, StandardCharsets.UTF_8), IotasMessage.class); parser = getParser(iotasMessage); bytes = iotasMessage.getData(); } else { parser = getParser(parserId); } Map<String, Object> parsed = parser.parse(bytes); Values values = new Values(parsed); collector.emit(input, values); collector.ack(input); } catch (Exception e) { collector.fail(input); collector.reportError(e); } }
Source:
private ArrayList<SingleRecyclerViewLocation> setUpLists() { locationList = new ArrayList<>(); LatLng[] coordinates = new LatLng[] { new LatLng(-34.6054099, -58.363654800000006), new LatLng(-34.6041508, -58.38555650000001), new LatLng(-34.6114412, -58.37808899999999), new LatLng(-34.6097604, -58.382064000000014), new LatLng(-34.596636, -58.373077999999964), new LatLng(-34.590548, -58.38256609999996), new LatLng(-34.5982127, -58.38110440000003) }; for (int x = 0; x < 7; x++) { SingleRecyclerViewLocation singleLocation = new SingleRecyclerViewLocation(); singleLocation.setName(String.format(getString(R.string.rv_card_name), x)); singleLocation.setBedInfo(String.format(getString(R.string.rv_card_bed_info), x)); singleLocation.setLocationCoordinates(coordinates[x]); locationList.add(singleLocation); mapboxMap.addMarker(new MarkerOptions() .position(coordinates[x]) .title(String.format(getString(R.string.rv_card_name), x)) .snippet(String.format(getString(R.string.rv_card_bed_info), x))); mapboxMap.setOnMarkerClickListener(this); } return locationList; }

Target:
private ArrayList<SingleRecyclerViewLocation> setUpLists() { locationList = new ArrayList<>(); LatLng[] coordinates = new LatLng[] { new LatLng(-34.6054099, -58.363654800000006), new LatLng(-34.6041508, -58.38555650000001), new LatLng(-34.6114412, -58.37808899999999), new LatLng(-34.6097604, -58.382064000000014), new LatLng(-34.596636, -58.373077999999964), new LatLng(-34.590548, -58.38256609999996), new LatLng(-34.5982127, -58.38110440000003) }; for (int x = 0; x < coordinates.length; x++) { SingleRecyclerViewLocation singleLocation = new SingleRecyclerViewLocation(); singleLocation.setName(String.format(getString(R.string.rv_card_name), x)); singleLocation.setBedInfo(String.format(getString(R.string.rv_card_bed_info), x)); singleLocation.setLocationCoordinates(coordinates[x]); locationList.add(singleLocation); mapboxMap.addMarker(new MarkerOptions() .position(coordinates[x]) .title(String.format(getString(R.string.rv_card_name), x)) .snippet(String.format(getString(R.string.rv_card_bed_info), x))); mapboxMap.setOnMarkerClickListener(this); } return locationList; }
Source:
public Exchange createDbzExchange(final SourceRecord record) { final Exchange exchange = super.createExchange(); final Message message = exchange.getIn(); message.setHeader(DebeziumConstants.FIELD_IDENTIFIER, record.topic()); message.setHeader(DebeziumConstants.FIELD_KEY, record.key()); message.setHeader(DebeziumConstants.FIELD_SOURCE, record.sourceOffset()); setOperationFieldInHeader(message, record.valueSchema(), record.value()); message.setBody(record.value()); return exchange; }

Target:
public Exchange createDbzExchange(final SourceRecord record) { final Exchange exchange = super.createExchange(); final Message message = exchange.getIn(); final Schema valueSchema = record.valueSchema(); final Object value = record.value(); final Map<String, Object> sourceMetadata = extractSourceMetadataValueFromValueStruct(valueSchema, value); final Object operation = extractValueFromValueStruct(valueSchema, value, Envelope.FieldName.OPERATION); final Object before = extractValueFromValueStruct(valueSchema, value, Envelope.FieldName.BEFORE); final Object after = extractAfterValueFromValueStruct(valueSchema, value); final Object timestamp = extractValueFromValueStruct(valueSchema, value, Envelope.FieldName.TIMESTAMP); message.setHeader(DebeziumConstants.HEADER_IDENTIFIER, record.topic()); message.setHeader(DebeziumConstants.HEADER_KEY, record.key()); message.setHeader(DebeziumConstants.HEADER_SOURCE_METADATA, sourceMetadata); message.setHeader(DebeziumConstants.HEADER_OPERATION, operation); message.setHeader(DebeziumConstants.HEADER_BEFORE, before); message.setHeader(DebeziumConstants.HEADER_TIMESTAMP, timestamp); message.setBody(after); return exchange; }
Source:
private String formatPageName(String pageName) { if (pageName.startsWith("/")) { return pageName.substring(1, pageName.length()).toLowerCase(Locale.ENGLISH); } else { return pageName.toLowerCase(Locale.ENGLISH); } }

Target:
private String formatPageName(String pageName) { if (pageName.startsWith("/")) { return pageName.substring(1, pageName.length()).toLowerCase(); } else { return pageName.toLowerCase(); } }
Source:
public synchronized String process(final Integer key, final String message) { LOG.log(Level.INFO, "{0}-th iteration, message : {1}", new Object[]{key, message}); if (!counterMap.containsKey(key)) { counterMap.put(key, new AtomicInteger(0)); } final AtomicInteger counter = counterMap.get(key); switch (message) { case SynchronizationTestWorker.BEFORE_BARRIER_MSG: if (counter.get() < 0) { killEvaluatorWithMessage("A BEFORE_BARRIER_MSG in " + key + "-th iteration has arrived after a AFTER_BARRIER_MSG for the iteration"); } else { counter.incrementAndGet(); } break; case SynchronizationTestWorker.AFTER_BARRIER_MSG: if (counter.get() > 0) { counter.set(-counter.get()); } counter.incrementAndGet(); break; default: killEvaluatorWithMessage("Illegal message : " + message); } return message; }

Target:
public synchronized String process(final Integer key, final String message) { if (message.equals(SynchronizationTestWorker.FINAL_MSG)) { checkCounters(); return message; } LOG.log(Level.INFO, "{0}-th iteration, message : {1}", new Object[]{key, message}); if (!beforeMsgCounterMap.containsKey(key)) { beforeMsgCounterMap.put(key, 0); afterMsgCounterMap.put(key, 0); } switch (message) { case SynchronizationTestWorker.BEFORE_BARRIER_MSG: if (afterMsgCounterMap.get(key) > 0) { killEvaluatorWithMessage("A BEFORE_BARRIER_MSG in " + key + "-th iteration should not arrive after a AFTER_BARRIER_MSG for the iteration"); } else { beforeMsgCounterMap.put(key, beforeMsgCounterMap.get(key) + 1); } break; case SynchronizationTestWorker.AFTER_BARRIER_MSG: afterMsgCounterMap.put(key, afterMsgCounterMap.get(key) + 1); break; default: killEvaluatorWithMessage("Illegal message : " + message); } return message; }
Source:
public List<String> getPushOptions() { if (pushOptions == null) { return null; } return Collections.unmodifiableList(pushOptions); }

Target:
public List<String> getPushOptions() { if (allowPushOptions) { if (enabledCapabilities == null) { throw new RequestNotYetReadException(); } return pushOptions == null ? null : Collections.unmodifiableList(pushOptions); } else { throw new IllegalStateException(); } }
Source:
private final static void simpleJsonResponse(String jsonp, String message, HttpServletResponse rsp, int code) { ClientResponseImpl rimpl = new ClientResponseImpl( ClientResponse.UNEXPECTED_FAILURE, new VoltTable[0], message); String msg = rimpl.toJSONString(); if (jsonp != null) { msg = asJsonp(jsonp, msg); } rsp.setStatus(code); try { rsp.getWriter().print(msg); rsp.getWriter().flush(); } catch (IOException e) { } }

Target:
private final static void simpleJsonResponse(String jsonp, String message, HttpServletResponse rsp, int code) { ClientResponseImpl rimpl = new ClientResponseImpl( ClientResponse.UNEXPECTED_FAILURE, new VoltTable[0], message); String msg = rimpl.toJSONString(); if (jsonp != null) { msg = asJsonp(jsonp, msg); } rsp.setStatus(code); try { rsp.getWriter().print(msg); rsp.getWriter().flush(); } catch (IOException ignoreThisAsBrowserMustHaveClosed) { } }
Source:
private void updateSubscribers(final Branch.NameKey updatedBranch, final ObjectId mergedCommit, final String msg) { try { final List<Subscription> subscribers = schema.subscriptions().getSubscribers(updatedBranch).toList(); if (!subscribers.isEmpty()) { final StringBuilder msgbuf = new StringBuilder(); if (msg == null) { updatedSubscribers = new ArrayList<String>(); updatedSubscribers.add(updatedBranch.toString()); for (final Change chg : submitted) { final CodeReviewCommit c = commits.get(chg.getId()); if (c != null && (c.statusCode == CommitMergeStatus.CLEAN_MERGE || c.statusCode == CommitMergeStatus.CLEAN_PICK)) { msgbuf.append("\n"); msgbuf.append(c.getFullMessage()); } } } else { msgbuf.append(msg); } if (msgbuf.length() > 0) { for (final Subscription s : subscribers) { if (updatedSubscribers.contains(s.getSubscriber().toString())) { log.error("Possible circular subscription involving " + s.toString()); } else { Map<Branch.NameKey, ObjectId> modules = new HashMap<Branch.NameKey, ObjectId>(1); modules.put(updatedBranch, mergedCommit); updateGitlinks(s.getSubscriber(), modules, msgbuf.toString()); updatedSubscribers.add(s.getSubscriber().toString()); } } } } } catch (OrmException e) { log.error("Cannot read subscription records", e); } }

Target:
private void updateSubscribers(final Branch.NameKey updatedBranch, final ObjectId mergedCommit, final String msg) { try { final List<Subscription> subscribers = schema.subscriptions().getSubscribers(updatedBranch).toList(); if (!subscribers.isEmpty()) { final StringBuilder msgbuf = new StringBuilder(); if (msg == null) { updatedSubscribers = new HashSet<Branch.NameKey>(); updatedSubscribers.add(updatedBranch); for (final Change chg : submitted) { final CodeReviewCommit c = commits.get(chg.getId()); if (c != null && (c.statusCode == CommitMergeStatus.CLEAN_MERGE || c.statusCode == CommitMergeStatus.CLEAN_PICK)) { msgbuf.append("\n"); msgbuf.append(c.getFullMessage()); } } } else { msgbuf.append(msg); } if (msgbuf.length() > 0) { for (final Subscription s : subscribers) { if (updatedSubscribers.contains(s.getSubscriber())) { log.error("Possible circular subscription involving " + s.toString()); } else { Map<Branch.NameKey, ObjectId> modules = new HashMap<Branch.NameKey, ObjectId>(1); modules.put(updatedBranch, mergedCommit); updateGitlinks(s.getSubscriber(), modules, msgbuf.toString()); updatedSubscribers.add(s.getSubscriber()); } } } } } catch (OrmException e) { log.error("Cannot read subscription records", e); } }
Source:
void mapActionItemsToSelection(ISelection selection) { setMoveItemsEnabled(false); if (selection == null || selection.isEmpty()) return; if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; Object obj = structured.getFirstElement(); if (!(obj instanceof PlanElement)) return; PlanElement firstSelectedEntry = (PlanElement) obj; if (structured.size() > 1) { ElementAction type = firstSelectedEntry.getPlanElementAction(); PlanElement entry = null; for (Iterator iterator = structured.iterator(); iterator .hasNext();) { Object selectedObj = iterator.next(); if (!(selectedObj instanceof PlanElement)) continue; entry = (PlanElement) selectedObj; if (type != entry.getPlanElementAction()) { unselectAllActionItemsExecpt(null); break; } } enableMoveButtons(structured, firstSelectedEntry, entry); return; } enableMoveButtons(structured, firstSelectedEntry, firstSelectedEntry); unselectAllActionItemsExecpt(getItemFor(firstSelectedEntry .getPlanElementAction())); } }

Target:
void mapActionItemsToSelection(ISelection selection) { setMoveItemsEnabled(false); if (selection == null || selection.isEmpty()) return; if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; Object obj = structured.getFirstElement(); if (!(obj instanceof PlanElement)) return; PlanElement firstSelectedEntry = (PlanElement) obj; PlanElement lastSelectedEntry = firstSelectedEntry; if (structured.size() > 1) { ElementAction type = firstSelectedEntry.getPlanElementAction(); for (Iterator iterator = structured.iterator(); iterator .hasNext();) { Object selectedObj = iterator.next(); if (!(selectedObj instanceof PlanElement)) continue; PlanElement entry = lastSelectedEntry = (PlanElement) selectedObj; if (type != entry.getPlanElementAction()) { unselectAllActionItemsExecpt(null); } } } else { unselectAllActionItemsExecpt(getItemFor(firstSelectedEntry .getPlanElementAction())); } enableMoveButtons(firstSelectedEntry, lastSelectedEntry); } }
Source:
private String getReservedId() { final IPentahoSession session = PentahoSessionHolder.getSession(); final IJobIdGenerator iJobIdGenerator = PentahoSystem.get( IJobIdGenerator.class ); final String failover = UUID.randomUUID().toString(); final String precomputedId = getRequestParameters().getStringParameter( RESERVED_ID, failover ); UUID uuid = null; try { uuid = UUID.fromString( precomputedId ); } catch ( final IllegalArgumentException e ) { logger.warn( "Wrong uuid came from client side: ", e ); } if ( session != null && iJobIdGenerator != null && iJobIdGenerator.acquire( session, uuid ) ) { return precomputedId; } return failover; }

Target:
private UUID getReservedId() throws IllegalStateException { final IJobIdGenerator iJobIdGenerator = PentahoSystem.get( IJobIdGenerator.class ); final UUID failover = UUID.randomUUID(); final String precomputedId = getRequestParameters().getStringParameter( RESERVED_ID, failover.toString() ); final UUID uuid; try { uuid = UUID.fromString( precomputedId ); } catch ( final IllegalArgumentException e ) { logger.warn( "Wrong uuid came from client side: ", e ); return failover; } if ( iJobIdGenerator != null && iJobIdGenerator.acquire( userSession, uuid ) ) { return uuid; } return failover; }
Source:
private Schedule scheduleAround(Broadcast broadcast, Set<Publisher> publishers) { Duration shortBroadcastFlexibility = Duration.standardMinutes(2); Duration broadcastPeriod = new Duration( broadcast.getTransmissionTime(), broadcast.getTransmissionEndTime() ); DateTime start = broadcast.getTransmissionTime().minus(flexibility); DateTime end = broadcast.getTransmissionEndTime().plus(flexibility); if (broadcastPeriod.compareTo(new Duration(600000)) < 0) { start = broadcast.getTransmissionTime().minus(shortBroadcastFlexibility); end = broadcast.getTransmissionEndTime().plus(shortBroadcastFlexibility); } Maybe<Channel> channel = channelResolver.fromUri(broadcast.getBroadcastOn()); if (channel.hasValue()) { return resolver.unmergedSchedule( start, end, ImmutableSet.of(channel.requireValue()), publishers ); } return null; }

Target:
private Schedule scheduleAround(Broadcast broadcast, Set<Publisher> publishers) { Duration shortBroadcastFlexibility = Duration.standardMinutes(2); Duration broadcastPeriod = new Duration( broadcast.getTransmissionTime(), broadcast.getTransmissionEndTime() ); DateTime start = broadcast.getTransmissionTime().minus(flexibility); DateTime end = broadcast.getTransmissionEndTime().plus(flexibility); if (broadcastPeriod.compareTo(SHORT_CONTENT_REDUCED_TIME_FLEXIBILITY) < 0) { start = broadcast.getTransmissionTime().minus(shortBroadcastFlexibility); end = broadcast.getTransmissionEndTime().plus(shortBroadcastFlexibility); } Maybe<Channel> channel = channelResolver.fromUri(broadcast.getBroadcastOn()); if (channel.hasValue()) { return resolver.unmergedSchedule( start, end, ImmutableSet.of(channel.requireValue()), publishers ); } return null; }
Source:
public void acceptsCorrectContentTypeRequest() throws IOException { final Take consumes = new TkConsumes( new TkFixed(new RsJSON(new RsEmpty())), "application/json" ); final Response response = consumes.act( new RqFake( Arrays.asList( "GET /?TkConsumes", "Content-Type: application/json" ), "" ) ); MatcherAssert.assertThat( new RsPrint(response).print(), Matchers.equalTo( Joiner.on("\r\n").join( "HTTP/1.1 200 OK", "Content-Type: application/json", "", "" ) ) ); }

Target:
public void acceptsCorrectContentTypeRequest() throws IOException { final Take consumes = new TkConsumes( new TkFixed(new RsJSON(new RsEmpty())), "application/json" ); final Response response = consumes.act( new RqFake( Arrays.asList( "GET /?TkConsumes", "Content-Type: application/json" ), "" ) ); MatcherAssert.assertThat( new RsPrint(response).print(), Matchers.startsWith( Joiner.on("\r\n").join( "HTTP/1.1 200 OK", "Content-Type: application/json" ) ) ); }
Source:
private InputStream locateStream(String path) throws FileNotFoundException { if (path.startsWith("classpath:")) { if (path.startsWith("classpath:")) { path = path.replaceFirst("classpath:", ""); } InputStream resultStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(path); if (resultStream == null) { resultStream = getClass().getResourceAsStream(path); } if (resultStream == null) { throw new IllegalArgumentException("Classpath resource " + path + " not found for MicroProfile Rest Client SSL configuration"); } return resultStream; } else { if (path.startsWith("file:")) { path = path.replaceFirst("file:", ""); } File certificateFile = new File(path); if (!certificateFile.isFile()) { throw new IllegalArgumentException("Certificate file: " + path + " not found for MicroProfile Rest Client SSL configuration"); } return new FileInputStream(certificateFile); } }

Target:
private InputStream locateStream(String path) throws FileNotFoundException { if (path.startsWith("classpath:")) { path = path.replaceFirst("classpath:", ""); InputStream resultStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(path); if (resultStream == null) { resultStream = getClass().getResourceAsStream(path); } if (resultStream == null) { throw new IllegalArgumentException("Classpath resource " + path + " not found for MicroProfile Rest Client SSL configuration"); } return resultStream; } else { if (path.startsWith("file:")) { path = path.replaceFirst("file:", ""); } File certificateFile = new File(path); if (!certificateFile.isFile()) { throw new IllegalArgumentException("Certificate file: " + path + " not found for MicroProfile Rest Client SSL configuration"); } return new FileInputStream(certificateFile); } }
Source:
public final void initDS() { log.debug("Creating Datasource for " + this.getName()); boolean lazyload = false; String lzString = (String) this.get(DB_LAZY_INIT_MODE_KEY); if (lzString != null) { lazyload = Boolean.parseBoolean(lzString); } if (!lazyload) { Object handles = this.get(DATASOURCE_HANDLES_KEY); Object datasources = this.get(DATASOURCES_KEY); if(handles != null && datasources != null){ log.debug("register DB handles and Datasources"); registerMultipleDatsourceHandles(); registerDatasources(); } Datasource ds = getDatasource(); if (ds != null) { CRDatabaseFactory.releaseDatasource(ds); } } for (int i = 1; i <= getRequestProcessorSize(); i++) { CRConfigUtil requestProcessorConfig = getRequestProcessorConfig(i); requestProcessorConfig.initDS(); } }

Target:
public final void initDS() { log.debug("Creating Datasource for " + this.getName()); boolean lazyload = false; String lzString = (String) this.get(DB_LAZY_INIT_MODE_KEY); if (lzString != null) { lazyload = Boolean.parseBoolean(lzString); } if (!lazyload) { registerDatsourceHandles(); registerDatasources(); Datasource ds = getDatasource(); if (ds != null) { CRDatabaseFactory.releaseDatasource(ds); } } for (int i = 1; i <= getRequestProcessorSize(); i++) { CRConfigUtil requestProcessorConfig = getRequestProcessorConfig(i); requestProcessorConfig.initDS(); } }
Source:
public static ScenarioModifierManifest Deserialize(String fileName) { ScenarioModifierManifest resultingList = null; try { JAXBContext context = JAXBContext.newInstance(ScenarioModifierManifest.class); Unmarshaller um = context.createUnmarshaller(); File xmlFile = new File(fileName); if(!xmlFile.exists()) { MekHQ.getLogger().warning(ScenarioModifierManifest.class, "Deserialize", String.format("Specified file %s does not exist", fileName)); return null; } JAXBElement<ScenarioModifierManifest> templateElement = um.unmarshal(new StreamSource(xmlFile), ScenarioModifierManifest.class); resultingList = templateElement.getValue(); } catch(Exception e) { MekHQ.getLogger().error(ScenarioModifierManifest.class, "Deserialize", "Error Deserializing Scenario Modifier List", e); } return resultingList; }

Target:
public static ScenarioModifierManifest Deserialize(String fileName) { ScenarioModifierManifest resultingList = null; try { JAXBContext context = JAXBContext.newInstance(ScenarioModifierManifest.class); Unmarshaller um = context.createUnmarshaller(); File xmlFile = new File(fileName); if(!xmlFile.exists()) { MekHQ.getLogger().warning(ScenarioModifierManifest.class, "Deserialize", String.format("Specified file %s does not exist", fileName)); return null; } Source inputSource = MekHqXmlUtil.createSafeXmlSource(new FileInputStream(xmlFile)); JAXBElement<ScenarioModifierManifest> templateElement = um.unmarshal(inputSource, ScenarioModifierManifest.class); resultingList = templateElement.getValue(); } catch(Exception e) { MekHQ.getLogger().error(ScenarioModifierManifest.class, "Deserialize", "Error Deserializing Scenario Modifier List", e); } return resultingList; }
Source:
void updateProgress () { if (progressState == SWT.INDETERMINATE) return; if (progressState == SWT.DEFAULT) return; parent.mTaskbarList3.SetProgressValue(shell.hAccel, progress, PROGRESS_MAX); }

Target:
void updateProgress () { if (progressState == SWT.INDETERMINATE) return; if (progressState == SWT.DEFAULT) return; parent.mTaskbarList3.SetProgressValue(shell.handle, progress, PROGRESS_MAX); }
Source:
public static String loadJSONHTML(URL src) throws IOException { URLConnection con = ProxyConfiguration.open(src); int responseCode = HttpURLConnection.HTTP_OK; if (con instanceof HttpURLConnection) { ((HttpURLConnection) con).setInstanceFollowRedirects(true); responseCode = ((HttpURLConnection) con).getResponseCode(); } if (HttpURLConnection.HTTP_OK != responseCode && HttpURLConnection.HTTP_MOVED_TEMP != responseCode && HttpURLConnection.HTTP_MOVED_PERM != responseCode && HttpURLConnection.HTTP_SEE_OTHER != responseCode) { throw new IOException("Could not find JSON in " + src); } else if (HttpURLConnection.HTTP_OK != responseCode) { String redirection = ((HttpURLConnection) con).getHeaderField("Location"); con = ProxyConfiguration.open(new URL(redirection)); responseCode = ((HttpURLConnection) con).getResponseCode(); } if (HttpURLConnection.HTTP_OK != responseCode) { throw new IOException("Could not find JSON in " + src); } try (InputStream is = con.getInputStream()) { String jsonp = IOUtils.toString(is, "UTF-8"); String preamble = "window.parent.postMessage(JSON.stringify("; int start = jsonp.indexOf(preamble); int end = jsonp.lastIndexOf("),'*');"); if (start >= 0 && end > start) { return jsonp.substring(start + preamble.length(), end).trim(); } else { throw new IOException("Could not find JSON in " + src); } } }

Target:
public static String loadJSONHTML(URL src) throws IOException { URLConnection con; try { con = ProxyConfiguration.openURLAllowingCrossProtocolRedirects(src); } catch (IOException e) { throw new IOException("Could not find JSON in " + src, e); } try (InputStream is = con.getInputStream()) { String jsonp = IOUtils.toString(is, "UTF-8"); String preamble = "window.parent.postMessage(JSON.stringify("; int start = jsonp.indexOf(preamble); int end = jsonp.lastIndexOf("),'*');"); if (start >= 0 && end > start) { return jsonp.substring(start + preamble.length(), end).trim(); } else { throw new IOException("Could not find JSON in " + src); } } }
Source:
private void assertGetResult(VM result) { assertNotNull(result); assertTrue("Vm db generation wasn't loaded as expected", result.getDbGeneration() == 1); assertEquals(result, existingVm); }

Target:
private void assertGetResult(VM result) { assertNotNull(result); assertEquals("Vm db generation wasn't loaded as expected", 1, result.getDbGeneration()); assertEquals(result, existingVm); }
Source:
public void testDeleteSupplementaryFiles() { setup(); ITmfTrace trace = fTrace; assertNotNull(trace); String suppFilesPath = TmfTraceManager.getSupplementaryFileDir(trace); try { assertFalse(isDirectoryEmpty(suppFilesPath)); trace.dispose(); TmfTraceManager.deleteSupplementaryFiles(trace); assertTrue(isDirectoryEmpty(suppFilesPath)); } catch (IOException e) { fail(e.getMessage()); } }

Target:
public void testDeleteSupplementaryFiles() { fTrace = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.TRACE2); ITmfTrace trace = fTrace; assertNotNull(trace); String suppFilesPath = TmfTraceManager.getSupplementaryFileDir(trace); try { assertFalse(isDirectoryEmpty(suppFilesPath)); trace.dispose(); TmfTraceManager.deleteSupplementaryFiles(trace); assertTrue(isDirectoryEmpty(suppFilesPath)); } catch (IOException e) { fail(e.getMessage()); } }
Source:
private String getSecurityManagerBySecurityLevel(String securityLevel) { if (GRINDER_SECURITY_LEVEL_LIGHT.equalsIgnoreCase(securityLevel)) { return "NGrinderLightSecurityManager"; } else { return "NGrinderSecurityManager"; } }

Target:
private String getSecurityManagerBySecurityLevel(String securityLevel) { if (GRINDER_SECURITY_LEVEL_LIGHT.equalsIgnoreCase(securityLevel)) { return "org.ngrinder.sm.NGrinderLightSecurityManager"; } else { return "org.ngrinder.sm.NGrinderSecurityManager"; } }
Source:
private IResource[] toResourceArray(Collection<String> paths) { Set<IResource> resources = new HashSet<>(); final Repository repository2 = repository; for (String path : paths) { IFile file = null; if (repository2 != null && path != null) { file = ResourceUtil.getFileForLocation(repository2, path, false); } if (file != null) { resources.add(file.getProject()); } } if (resources.size() == 0 && repository2 != null) { resources .addAll(Arrays .asList(ProjectUtil.getProjects(repository2))); } return resources.toArray(new IResource[0]); }

Target:
private IResource[] toResourceArray(Collection<String> paths) { Set<IResource> resources = new HashSet<>(); for (String path : paths) { IFile file = null; if (path != null) { file = ResourceUtil.getFileForLocation(repository, path, false); } if (file != null) { resources.add(file.getProject()); } } if (resources.size() == 0) { resources .addAll(Arrays .asList(ProjectUtil.getProjects(repository))); } return resources.toArray(new IResource[0]); }
Source:
public byte[] getOrCreateId(int dimensionNum, byte[] input, int numIdBytes) throws IOException, InterruptedException { Validate.validateDimensionNum(dimensionNum); Validate.validateNumIdBytes(numIdBytes); final byte[] lookupKey = makeLookupKey(dimensionNum, input); final Optional<byte[]> existingId = getId(lookupKey, numIdBytes); if (existingId.isPresent()) { return existingId.get(); } byte[] counterKey = makeCounterKey(dimensionNum); final long id = WithHTable.increment(pool, counterTable, counterKey, cf, QUALIFIER, 1L); if (log.isDebugEnabled()) { log.debug("Allocated new id " + id); } final long maxId = LongMath.pow(2L, numIdBytes * 8); if (id > maxId) { throw new RuntimeException("Exhausted IDs for dimension " + dimensionNum); } else if (id < 0) { throw new RuntimeException("Somehow ID was less than zero. Weird!"); } final Put put = new Put(lookupKey); byte[] allocatedRecord = ArrayUtils.addAll(HBaseIdService.ALLOCATED_BYTES, Util.longToBytes(id)); put.add(cf, QUALIFIER, allocatedRecord); boolean swapSuccess = WithHTable.checkAndPut(pool, lookupTable, lookupKey, cf, QUALIFIER, EMPTY, put); if (swapSuccess) { return Util.leastSignificantBytes(id, numIdBytes); } else { final Optional<byte[]> currentValue = getId(lookupKey, numIdBytes); if (currentValue.isPresent()) { return currentValue.get(); } else { throw new RuntimeException("Failed to get id for row " + Bytes.toString(lookupKey) + " after CAS failed"); } } }

Target:
public byte[] getOrCreateId(int dimensionNum, byte[] input, int numIdBytes) throws IOException, InterruptedException { Validate.validateDimensionNum(dimensionNum); Validate.validateNumIdBytes(numIdBytes); final byte[] lookupKey = makeLookupKey(dimensionNum, input); final Optional<byte[]> existingId = getId(lookupKey, numIdBytes); if (existingId.isPresent()) { return existingId.get(); } final TimerContext timer = idCreationTime.time(); byte[] counterKey = makeCounterKey(dimensionNum); final long id = WithHTable.increment(pool, counterTable, counterKey, cf, QUALIFIER, 1L); if (log.isDebugEnabled()) { log.debug("Allocated new id " + id); } final long maxId = LongMath.pow(2L, numIdBytes * 8); if (id > maxId) { throw new RuntimeException("Exhausted IDs for dimension " + dimensionNum); } else if (id < 0) { throw new RuntimeException("Somehow ID was less than zero. Weird!"); } else if (maxId / id <= 2) { dimensionsApproachingExhaustion.add(dimensionNum); } final Put put = new Put(lookupKey); byte[] allocatedRecord = ArrayUtils.addAll(HBaseIdService.ALLOCATED_BYTES, Util.longToBytes(id)); put.add(cf, QUALIFIER, allocatedRecord); boolean swapSuccess = WithHTable.checkAndPut(pool, lookupTable, lookupKey, cf, QUALIFIER, EMPTY, put); if (swapSuccess) { timer.stop(); return Util.leastSignificantBytes(id, numIdBytes); } else { wastedIdNumbers.mark(); final Optional<byte[]> currentValue = getId(lookupKey, numIdBytes); timer.stop(); if (currentValue.isPresent()) { return currentValue.get(); } else { throw new RuntimeException("Failed to get id for row " + Bytes.toString(lookupKey) + " after CAS failed"); } } }
Source:
protected void onLoad() { enableForm(false); super.onLoad(); Util.PROJECT_SVC.listBranches(projectName, new GerritCallback<List<Branch>>() { public void onSuccess(final List<Branch> result) { Util.PROJECT_SVC.projectDetail(projectName, new GerritCallback<ProjectDetail>() { public void onSuccess(final ProjectDetail projectDetail) { com.google.gerrit.client.account.Util.ACCOUNT_SEC.myGroups(new GerritCallback<List<AccountGroup>>() { public void onSuccess(List<AccountGroup> myGroups) { boolean userHasOwnRight = Util.hasOwnRight(projectDetail, myGroups); enableForm(true); branches.display(result, userHasOwnRight); addPanel.setVisible(userHasOwnRight); delBranch.setVisible(userHasOwnRight); } }); } }); } }); }

Target:
protected void onLoad() { enableForm(false); super.onLoad(); Util.PROJECT_SVC.listBranches(projectName, new GerritCallback<ListBranchesResult>() { public void onSuccess(final ListBranchesResult result) { enableForm(true); display(result.getBranches()); addPanel.setVisible(result.getCanAdd()); } }); }
Source:
private Pair<Long, Long> populateTestRealmAndCompactOnLaunch(CompactOnLaunchCallback compactOnLaunch) { final String REALM_NAME = "test.realm"; RealmConfiguration realmConfig = configFactory.createConfiguration(REALM_NAME); Realm realm = Realm.getInstance(realmConfig); populateTestRealm(realm, 100); realm.beginTransaction(); realm.deleteAll(); realm.commitTransaction(); realm.close(); long before = new File(realmConfig.getPath()).length(); RealmConfiguration.Builder builder = configFactory.createConfigurationBuilder(); File folder = configFactory.getRoot(); builder.directory(folder); builder.name(REALM_NAME); builder.compactOnLaunch(compactOnLaunch); realmConfig = builder.build(); realm = Realm.getInstance(realmConfig); realm.close(); long after = new File(realmConfig.getPath()).length(); return new Pair(before, after); }

Target:
private Pair<Long, Long> populateTestRealmAndCompactOnLaunch(CompactOnLaunchCallback compactOnLaunch) { return populateTestRealmAndCompactOnLaunch(compactOnLaunch, 100); }
Source:
public String toString() { StringBuffer sb = new StringBuffer( super.toString() ); sb.append( "(GAVCE=" ); sb.append( getGroupId() ); sb.append( ":" ); sb.append( getArtifactId() ); sb.append( ":" ); sb.append( getVersion() ); sb.append( ":c=" ); sb.append( getClassifier() ); sb.append( ":e=" ); sb.append( getExtension() ); sb.append( ", for " ); sb.append( RepositoryStringUtils.getHumanizedNameString( getMavenRepository() ) ); sb.append( ") " ); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder( super.toString() ); sb.append( "(GAVCE=" ); sb.append( getGroupId() ); sb.append( ":" ); sb.append( getArtifactId() ); sb.append( ":" ); sb.append( getVersion() ); sb.append( ":c=" ); sb.append( getClassifier() ); sb.append( ":e=" ); sb.append( getExtension() ); sb.append( ", for " ); sb.append( RepositoryStringUtils.getHumanizedNameString( getMavenRepository() ) ); sb.append( ") " ); return sb.toString(); }
Source:
public boolean isPeerReplicaLeaderForPartition(String partitionName, ReplicaId replicaId) { rwLock.readLock().lock(); try { return peerLeaderReplicasByPartition.containsKey(partitionName) && peerLeaderReplicasByPartition.get( partitionName).contains(replicaId); } finally { rwLock.readLock().unlock(); } }

Target:
public boolean isPeerReplicaLeaderForPartition(String partitionName, ReplicaId replicaId) { rwLock.readLock().lock(); try { return peerLeaderReplicasByPartition.getOrDefault(partitionName, Collections.emptySet()).contains(replicaId); } finally { rwLock.readLock().unlock(); } }
Source:
protected SSLContext createSSLContext(Map<String, Object> configuration, String keystoreProvider, String keystorePath, String keystorePassword, String truststoreProvider, String truststorePath, String truststorePassword, String crlPath, String trustManagerFactoryPlugin, boolean trustAll) throws Exception { if (LOGGER.isDebugEnabled()) { final StringBuilder builder = new StringBuilder(); configuration.forEach((k, v) -> builder.append("\r\n").append(k).append("=").append(v)); LOGGER.debugf("Creating SSL context with configuration %s", builder.toString()); } boolean useDefaultSslContext = ConfigurationHelper.getBooleanProperty(TransportConstants.USE_DEFAULT_SSL_CONTEXT_PROP_NAME, TransportConstants.DEFAULT_USE_DEFAULT_SSL_CONTEXT, configuration); if (useDefaultSslContext) { return SSLContext.getDefault(); } return new SSLSupport() .setKeystoreProvider(keystoreProvider) .setKeystorePath(keystorePath) .setKeystorePassword(keystorePassword) .setTruststoreProvider(truststoreProvider) .setTruststorePath(truststorePath) .setTruststorePassword(truststorePassword) .setTrustAll(trustAll) .setCrlPath(crlPath) .setTrustManagerFactoryPlugin(trustManagerFactoryPlugin) .createContext(); }

Target:
protected SSLContext createSSLContext(Map<String, Object> configuration, String keystoreProvider, String keystorePath, String keystorePassword, String truststoreProvider, String truststorePath, String truststorePassword, String crlPath, String trustManagerFactoryPlugin, boolean trustAll) throws Exception { if (log.isDebugEnabled()) { final StringBuilder builder = new StringBuilder(); configuration.forEach((k, v) -> builder.append("\r\n").append(k).append("=").append(v)); log.debugf("Creating SSL context with configuration %s", builder.toString()); } boolean useDefaultSslContext = ConfigurationHelper.getBooleanProperty(TransportConstants.USE_DEFAULT_SSL_CONTEXT_PROP_NAME, TransportConstants.DEFAULT_USE_DEFAULT_SSL_CONTEXT, configuration); if (useDefaultSslContext) { return SSLContext.getDefault(); } return new SSLSupport() .setKeystoreProvider(keystoreProvider) .setKeystorePath(keystorePath) .setKeystorePassword(keystorePassword) .setTruststoreProvider(truststoreProvider) .setTruststorePath(truststorePath) .setTruststorePassword(truststorePassword) .setTrustAll(trustAll) .setCrlPath(crlPath) .setTrustManagerFactoryPlugin(trustManagerFactoryPlugin) .createContext(); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((repository == null) ? 0 : repository.hashCode()); return result; }

Target:
public int hashCode() { return repository.hashCode(); }
Source:
private void updateMapHelper(Map<String, Long> map, String key, Long value) { Long existingValue = map.get(key); if (existingValue == null) { existingValue = value; } else { existingValue += value; } map.put(key, existingValue); }

Target:
private void updateMapHelper(Map<String, Long> map, String key, Long value) { Long newValue = map.containsKey(key) ? map.get(key) + value : value; map.put(key, newValue); }
Source:
public String getResourceDir() { return "resource" + File.separator + getClass().getSimpleName(); }

Target:
public String getResourceDir() { return Util.getResourceDir() + File.separator + getClass().getSimpleName(); }
Source:
public int purgeQueue(final String queueName) { return this.rabbitTemplate.execute(channel -> { PurgeOk queuePurged = channel.queuePurge(queueName); if (this.logger.isDebugEnabled()) { logger.debug("Purged queue: " + queueName + ", " + queuePurged); } return queuePurged.getMessageCount(); }); }

Target:
public int purgeQueue(final String queueName) { return this.rabbitTemplate.execute(channel -> { PurgeOk queuePurged = channel.queuePurge(queueName); if (this.logger.isDebugEnabled()) { this.logger.debug("Purged queue: " + queueName + ", " + queuePurged); } return queuePurged.getMessageCount(); }); }
Source:
private void logTraceResults(long duration, Set<TableReference> tableRefs, ByteBuffer recvTrace, boolean failed) { if (failed || duration > tracingPrefs.getMinimumDurationToTraceMillis()) { log.warn("Traced a call to that {}took ms. It will appear in system_traces with UUID={}", tableRefs.stream().map(TableReference::getQualifiedName).collect(Collectors.joining(", ")), failed ? "failed and " : "", duration, CassandraKeyValueServices.convertCassandraByteBufferUuidToString(recvTrace)); } }

Target:
private void logTraceResults(long duration, Set<TableReference> tableRefs, ByteBuffer recvTrace, boolean failed) { if (failed || duration > tracingPrefs.getMinimumDurationToTraceMillis()) { log.info("Traced a call to that {}took ms. It will appear in system_traces with UUID={}", tableRefs.stream().map(TableReference::getQualifiedName).collect(Collectors.joining(", ")), failed ? "failed and " : "", duration, CassandraKeyValueServices.convertCassandraByteBufferUuidToString(recvTrace)); } }