auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String format(String value) { ShortDOIService shortDOIService = new ShortDOIService(); DOI doi = null; try { doi = new DOI(value); value = shortDOIService.getShortDOI(doi).getDOI(); } catch (IllegalArgumentException | ShortDOIServiceException e) { LOGGER.error(e.getMessage(), e); } return value; }

Target:
public String format(String value) { Objects.requireNonNull(value); ShortDOIService shortDOIService = new ShortDOIService(); Optional<DOI> doi = Optional.empty(); try { doi = DOI.parse(value); if (doi.isPresent()) { return shortDOIService.getShortDOI(doi.get()).getDOI(); } } catch (ShortDOIServiceException e) { LOGGER.error(e.getMessage(), e); } return value; }
Source:
public void setFileList(ArrayList<IFile> files, Map<Repository, IndexDiff> indexDiffs) { items.clear(); for (IFile file : files) { RepositoryMapping repositoryMapping = RepositoryMapping .getMapping(file.getProject()); Repository repo = repositoryMapping.getRepository(); String path = repositoryMapping.getRepoRelativePath(file); CommitItem item = new CommitItem(); item.status = getFileStatus(path, indexDiffs.get(repo)); item.file = file; items.add(item); Collections.sort(items, new Comparator<CommitItem>() { public int compare(CommitItem o1, CommitItem o2) { int diff = o1.status.ordinal() - o2.status.ordinal(); if (diff != 0) return diff; diff = o1.file.getProject().getName().compareTo( o2.file.getProject().getName()); if (diff != 0) return diff; return o1.file .getProjectRelativePath() .toString() .compareTo( o2.file.getProjectRelativePath().toString()); } }); } }

Target:
public void setFileList(ArrayList<IFile> files, Map<Repository, IndexDiff> indexDiffs) { items.clear(); for (IFile file : files) { RepositoryMapping repositoryMapping = RepositoryMapping .getMapping(file.getProject()); Repository repo = repositoryMapping.getRepository(); String path = repositoryMapping.getRepoRelativePath(file); CommitItem item = new CommitItem(); item.status = getFileStatus(path, indexDiffs.get(repo)); item.file = file; items.add(item); } Collections.sort(items, new Comparator<CommitItem>() { public int compare(CommitItem o1, CommitItem o2) { int diff = o1.status.ordinal() - o2.status.ordinal(); if (diff != 0) return diff; diff = o1.file.getProject().getName().compareTo( o2.file.getProject().getName()); if (diff != 0) return diff; return o1.file .getProjectRelativePath() .toString() .compareTo( o2.file.getProjectRelativePath().toString()); } }); }
Source:
private boolean translateBinary2(String op, RexNode left, RexNode right) { switch (right.getKind()) { case LITERAL: break; default: return false; } final RexLiteral rightLiteral = (RexLiteral) right; switch (left.getKind()) { case INPUT_REF: final RexInputRef left1 = (RexInputRef) left; String name = fieldNames.get(left1.getIndex()); translateOp2(op, name, rightLiteral); return true; case CAST: return translateBinary2(op, ((RexCall) left).operands.get(0), right); case OTHER_FUNCTION: case ITEM: String itemName = MongoRules.isItem((RexCall) left); if (itemName != null) { translateOp2(op, itemName, rightLiteral); return true; } default: return false; } }

Target:
private boolean translateBinary2(String op, RexNode left, RexNode right) { switch (right.getKind()) { case LITERAL: break; default: return false; } final RexLiteral rightLiteral = (RexLiteral) right; switch (left.getKind()) { case INPUT_REF: final RexInputRef left1 = (RexInputRef) left; String name = fieldNames.get(left1.getIndex()); translateOp2(op, name, rightLiteral); return true; case CAST: return translateBinary2(op, ((RexCall) left).operands.get(0), right); case ITEM: String itemName = MongoRules.isItem((RexCall) left); if (itemName != null) { translateOp2(op, itemName, rightLiteral); return true; } default: return false; } }
Source:
private void enableLocation() { AlertDialog.Builder dialog = new AlertDialog.Builder(this, R.style.MaterialAlertDialogStyle); dialog.setTitle(getResources().getString(R.string.gps_network_not_enabled)); dialog.setMessage(getResources().getString(R.string.enable_location)); dialog.setPositiveButton(getResources().getString(R.string.open_location_settings), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface paramDialogInterface, int paramInt) { Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(myIntent); } }); dialog.setNegativeButton(getString(R.string.Cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface paramDialogInterface, int paramInt) { paramDialogInterface.dismiss(); } }); dialog.show(); }

Target:
private void enableLocation() { AlertDialog alertDialog = new AlertDialog.Builder(this, R.style.MaterialAlertDialogStyle) .setTitle(getResources().getString(R.string.gps_network_not_enabled)) .setMessage(getResources().getString(R.string.enable_location)) .setPositiveButton(getResources().getString(R.string.open_location_settings), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface paramDialogInterface, int paramInt) { Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(myIntent); } }) .setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface paramDialogInterface, int paramInt) { paramDialogInterface.dismiss(); } }) .create(); alertDialog.show(); }
Source:
public static void add(NetworkResponse response, ImageRequest request) { if (request.getRequestTime() == -1) { return; } mImageTimings.add(Pair.create(response.data.length, request.getRequestTime())); log("NETMON", "Added image request : " + response.data.length + " bytes with time " + request.getRequestTime()); int byteSum = 0; int timeSum = 0; for (Pair<Integer, Long> entry : mImageTimings.getElements()) { log("NETMON", "Queue entry:: bytes:" + entry.first + " time(ms):" + entry.second); byteSum += entry.first; timeSum += entry.second; } if (mImageTimings.isFull()) { int bandwidthKBPS = (byteSum / timeSum); log("NETMON", "Derived bandwidth: " + bandwidthKBPS + "kB/s"); if (bandwidthKBPS < BANDWIDTH_HYSTERETIC_LOWER) { lowBandwidth = true; log("NETMON", "Low-Bandwidth flag On"); } else if (bandwidthKBPS > BANDWIDTH_HYSTERETIC_UPPER && (!mIsRoaming || !mForceLowBandwidthIfRoaming)) { lowBandwidth = false; log("NETMON", "Low-Bandwidth flag Off"); } } }

Target:
public static void add(NetworkResponse response, ImageRequest request) { if (request.getRequestTime() == -1) { return; } mImageTimings.add(Pair.create(response.data.length, request.getRequestTime())); log("NETMON", "Added image request : " + response.data.length + " bytes with time " + request.getRequestTime()); int byteSum = 0; int timeSum = 0; for (Pair<Integer, Long> entry : mImageTimings.getElements()) { log("NETMON", "Queue entry:: bytes:" + entry.first + " time(ms):" + entry.second); byteSum += entry.first; timeSum += entry.second; } if (mImageTimings.isFull()) { int bandwidthKBPS = (byteSum / timeSum); log("NETMON", "Derived bandwidth: " + bandwidthKBPS + "kB/s"); if (bandwidthKBPS < BANDWIDTH_HYSTERETIC_LOWER) { lowBandwidth = true; log("NETMON", "Low-Bandwidth flag On"); } else if (bandwidthKBPS > BANDWIDTH_HYSTERETIC_UPPER) { lowBandwidth = false; log("NETMON", "Low-Bandwidth flag Off"); } } }
Source:
public boolean checkExists(Long transactorId) { if (timeoutCache.getIfPresent(transactorId) != null) return false; return cache.getCurrentData(TransactorID.getNodePath(config, transactorId)) != null; }

Target:
public boolean checkExists(Long transactorId) { return cache.getCurrentData(TransactorID.getNodePath(config, transactorId)) != null; }
Source:
protected void hookOnNext(ServiceBusReceivedMessageContext message) { boolean delivered = false; if (currentWork == null) { currentWork = getNextWorkAndRequest(); logger.verbose("No current work, Picked up next receive request."); } if (currentWork != null) { currentWork.next(message); delivered = true; remaining.decrementAndGet(); if (currentWork.isTerminal()) { currentWork.complete(); if (timeoutOperation != null && !timeoutOperation.isDisposed()) { timeoutOperation.dispose(); } currentWork = getNextWorkAndRequest(); logger.verbose("Current work is terminal, Picked up next receive request."); } } if (currentWork == null) { if (wip.decrementAndGet() != 0) { logger.warning("There is another worker in drainLoop. But there should only be 1 worker."); } if (!delivered) { bufferMessages.add(message); } } }

Target:
protected void hookOnNext(ServiceBusReceivedMessageContext message) { bufferMessages.add(message); drain(); }
Source:
private void checkCallContext() { if(this.callContext == null) throw new InternalError("Can only call methods with single callcontext."); }

Target:
private void checkCallContext() { if(this.callContext == null) throw new InternalError("Can only call set and get methods for call state when using a single CallContext."); }
Source:
public ItemUseHandler getItemHandler() { return e -> { Player p = e.getPlayer(); if (p.getFoodLevel() >= 2) { if (p.getInventory().getItemInMainHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) { FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 2); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { SlimefunPlugin.getLocalization().sendMessage(p, "messages.wind-staff-fail", true); return; } p.setFoodLevel(event.getFoodLevel()); } p.setVelocity(p.getEyeLocation().getDirection().multiply(4)); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1); p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1); p.setFallDistance(0F); } else { SlimefunPlugin.getLocalization().sendMessage(p, "messages.hungry", true); } }; }

Target:
public ItemUseHandler getItemHandler() { return e -> { Player p = e.getPlayer(); if (p.getFoodLevel() >= 2) { if (p.getInventory().getItemInMainHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) { FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { p.setFoodLevel(event.getFoodLevel()); } } p.setVelocity(p.getEyeLocation().getDirection().multiply(4)); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1); p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1); p.setFallDistance(0F); } else { SlimefunPlugin.getLocalization().sendMessage(p, "messages.hungry", true); } }; }
Source:
public final String getUsername() { return username; }

Target:
public String getUsername() { return username; }
Source:
public void testConnection() { }

Target:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, null)); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }
Source:
public void onEvent(ActivitiEvent event) { if (event.getType().equals(ActivitiEventType.JOB_RETRIES_DECREMENTED)) { if (event instanceof ActivitiEntityEvent && DeadLetterJobEntity.class.isAssignableFrom(((ActivitiEntityEvent) event).getEntity().getClass()) && ((DeadLetterJobEntityImpl)((ActivitiEntityEvent) event).getEntity()).getJobType().equals("timer")) { converter.from((ActivitiEntityEvent) event) .ifPresent(convertedEvent -> { for (BPMNElementEventListener<BPMNTimerRetriesDecrementedEvent> listener : processRuntimeEventListeners) { listener.onEvent(convertedEvent); } }); } } }

Target:
public void onEvent(ActivitiEvent event) { converter.from(event) .ifPresent(convertedEvent -> { for (BPMNElementEventListener<BPMNTimerRetriesDecrementedEvent> listener : processRuntimeEventListeners) { listener.onEvent(convertedEvent); } }); }
Source:
protected String generateSlug(Id id) { return "app-" + idCodec.encode(id.toBigInteger()); }

Target:
private String generateSlug(Id id) { return "app-" + idCodec.encode(id.toBigInteger()); }
Source:
public void testMonitor() throws Exception { MonitorScheduler monitorScheduler = EasyMock.createNiceMock(MonitorScheduler.class); Capture<? extends Monitor> monitorCapture = Capture.newInstance(); monitorScheduler.addMonitor(EasyMock.capture(monitorCapture)); EasyMock.expectLastCall().once(); EasyMock.replay(monitorScheduler); MemcachedCache cache = MemcachedCache.create(memcachedCacheConfig, monitorScheduler); EasyMock.verify(monitorScheduler); Assert.assertTrue(monitorCapture.hasCaptured()); final Monitor monitor = monitorCapture.getValue(); monitor.start(); Assert.assertNotNull(monitor); Emitter emitter = EasyMock.createNiceMock(Emitter.class); final Collection<Event> events = new ArrayList<>(); final ServiceEmitter serviceEmitter = new ServiceEmitter("service", "host", emitter) { @Override public void emit(Event event) { events.add(event); } }; while (events.isEmpty()) { Thread.sleep(memcachedCacheConfig.getTimeout()); Assert.assertTrue(monitor.monitor(serviceEmitter)); } Assert.assertFalse(events.isEmpty()); ObjectMapper mapper = new DefaultObjectMapper(); for (Event event : events) { log.info("Found event `%s`", mapper.writeValueAsString(event.toMap())); } }

Target:
public void testMonitor() throws Exception { MonitorScheduler monitorScheduler = EasyMock.createNiceMock(MonitorScheduler.class); Capture<? extends Monitor> monitorCapture = Capture.newInstance(); monitorScheduler.addMonitor(EasyMock.capture(monitorCapture)); EasyMock.expectLastCall().once(); EasyMock.replay(monitorScheduler); MemcachedCache cache = MemcachedCache.create(memcachedCacheConfig, monitorScheduler); EasyMock.verify(monitorScheduler); Assert.assertTrue(monitorCapture.hasCaptured()); final Monitor monitor = monitorCapture.getValue(); monitor.start(); Assert.assertNotNull(monitor); Emitter emitter = EasyMock.createNiceMock(Emitter.class); final Collection<Event> events = new ArrayList<>(); final ServiceEmitter serviceEmitter = new ServiceEmitter("service", "host", emitter) { @Override public void emit(Event event) { events.add(event); } }; while (events.isEmpty()) { Thread.sleep(memcachedCacheConfig.getTimeout()); Assert.assertTrue(monitor.monitor(serviceEmitter)); } Assert.assertFalse(events.isEmpty()); ObjectMapper mapper = new DefaultObjectMapper(); for (Event event : events) { log.debug("Found event `%s`", mapper.writeValueAsString(event.toMap())); } }
Source:
protected String getSpanName() { String spanName = this.name != null ? this.name : SpanNameRetrievalUtil.getSpanName(this.delegate); if (isDefaultToString(spanName)) { return "async"; } return spanName; }

Target:
protected String getSpanName() { if (this.name != null) { return this.name; } return this.spanNamer.name(this.delegate, "async"); }
Source:
public void testSingleDynamicFormSelectForm() throws Exception { if (!endToEndTestEnabled()) { return; } try { createNewNote(); setTextOfParagraph(1, "%spark println(\"Howdy \"+z.select(\"names\", Seq((\"1\",\"Alice\"), " + "(\"2\",\"Bob\"),(\"3\",\"stranger\"))))"); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Output text should not display any of the options in select form", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Howdy ")); Select dropDownMenu = new Select(driver.findElement(By.xpath((getParagraphXPath(1) + " dropDownMenu.selectByVisibleText("Alice"); collector.checkThat("After selection in drop down menu, output should not display any of the options", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Howdy ")); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Only after paragraph run we should see the new output including the selected option", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Howdy 1")); deleteTestNotebook(driver); } catch (Exception e) { handleException("Exception in ParagraphActionsIT while testSingleDynamicFormTextInput ", e); } }

Target:
public void testSingleDynamicFormSelectForm() throws Exception { if (!endToEndTestEnabled()) { return; } try { createNewNote(); setTextOfParagraph(1, "%spark println(\"Howdy \"+z.select(\"names\", Seq((\"1\",\"Alice\"), " + "(\"2\",\"Bob\"),(\"3\",\"stranger\"))))"); runParagraph(1); waitForParagraph(1, "FINISHED"); collector.checkThat("Output text should not display any of the options in select form", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Howdy ")); Select dropDownMenu = new Select(driver.findElement(By.xpath("(" + (getParagraphXPath(1) + " dropDownMenu.selectByVisibleText("Alice"); collector.checkThat("After selection in drop down menu, output should display the newly selected option", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Howdy 1")); driver.findElement(By.xpath(getParagraphXPath(1) + " clickAndWait(By.xpath(getParagraphXPath(1) + " Select sameDropDownMenu = new Select(driver.findElement(By.xpath("(" + (getParagraphXPath(1) + " sameDropDownMenu.selectByVisibleText("Bob"); collector.checkThat("After 'Run on selection change' checkbox is unchecked, the paragraph should not run if selecting a different option", driver.findElement(By.xpath(getParagraphXPath(1) + " CoreMatchers.equalTo("Howdy 1")); deleteTestNotebook(driver); } catch (Exception e) { handleException("Exception in ParagraphActionsIT while testSingleDynamicFormSelectForm ", e); } }
Source:
private Action getCumulativeAction() { Action action = new Action("Cumulative Counters Action", IAction.AS_CHECK_BOX) { @Override public void run() { TmfXYChartViewer chart = getChartViewer(); if (chart instanceof CounterChartViewer) { ((CounterChartViewer) chart).toggleCumulative(); } } }; action.setToolTipText("Activate cumulative counters"); action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.tracecompass.tmf.ui", "icons/elcl16/sigma.gif")); return action; }

Target:
private Action getCumulativeAction() { Action action = new Action(Messages.CounterView_CumulativeAction_Text, IAction.AS_CHECK_BOX) { private boolean isCumulative = false; @Override public void run() { isCumulative ^= true; setToolTipText(isCumulative ? Messages.CounterView_CumulativeAction_DifferentialTooltipText : Messages.CounterView_CumulativeAction_CumulativeTooltipText); TmfXYChartViewer chart = getChartViewer(); if (chart instanceof CounterChartViewer) { ((CounterChartViewer) chart).toggleCumulative(); } } }; action.setToolTipText(Messages.CounterView_CumulativeAction_CumulativeTooltipText); action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.tracecompass.tmf.ui", "icons/elcl16/sigma.gif")); return action; }
Source:
private static List<String> checkNonNullUniqueNames(final List<String> input, final String roleName) { if (input == null) { return null; } Utils.validateArg(input.stream().noneMatch(Objects::isNull), () -> String.format("the input %s list must not contain nulls", roleName)); Utils.validateArg(input.stream().sorted().distinct().count() == input.size(), () -> String.format("the input %s list must not contain repeats", roleName)); return Collections.unmodifiableList(new ArrayList<>(input)); }

Target:
private static List<String> checkNonNullUniqueNames(final List<String> input, final String roleName) { if (input == null) { return null; } Utils.containsNoNull(input, String.format("the input %s list must not contain nulls", roleName)); Utils.validateArg(input.stream().sorted().distinct().count() == input.size(), () -> String.format("the input %s list must not contain repeats", roleName)); return Collections.unmodifiableList(new ArrayList<>(input)); }
Source:
public static UserTrades adaptTradeHistoryV2( List<org.knowm.xchange.bitfinex.v2.dto.trade.Trade> trades) { List<UserTrade> pastTrades = new ArrayList<>(trades.size()); for (org.knowm.xchange.bitfinex.v2.dto.trade.Trade trade : trades) { OrderType orderType = trade.getExecAmount().signum() <= 0 ? OrderType.BID : OrderType.ASK; BigDecimal amount = trade.getExecAmount().signum() == -1 ? trade.getExecAmount().negate() : trade.getExecAmount(); Date timestamp = DateUtils.fromMillisUtc(trade.getTimestamp()); final BigDecimal fee = trade.getFee() != null ? trade.getFee().negate() : null; pastTrades.add( new UserTrade( orderType, amount, adaptCurrencyPair(trade.getSymbol()), trade.getExecPrice(), timestamp, trade.getId(), trade.getOrderId(), fee, Currency.getInstance(trade.getFeeCurrency()))); } return new UserTrades(pastTrades, TradeSortType.SortByTimestamp); }

Target:
public static UserTrades adaptTradeHistoryV2( List<org.knowm.xchange.bitfinex.v2.dto.trade.Trade> trades) { List<UserTrade> pastTrades = new ArrayList<>(trades.size()); for (org.knowm.xchange.bitfinex.v2.dto.trade.Trade trade : trades) { OrderType orderType = trade.getExecAmount().signum() >= 0 ? OrderType.BID : OrderType.ASK; BigDecimal amount = trade.getExecAmount().signum() == -1 ? trade.getExecAmount().negate() : trade.getExecAmount(); final BigDecimal fee = trade.getFee() != null ? trade.getFee().negate() : null; pastTrades.add( new UserTrade.Builder() .type(orderType) .originalAmount(amount) .currencyPair(adaptCurrencyPair(trade.getSymbol())) .price(trade.getExecPrice()) .timestamp(trade.getTimestamp()) .id(trade.getId()) .orderId(trade.getOrderId()) .feeAmount(fee) .feeCurrency(Currency.getInstance(trade.getFeeCurrency())) .build()); } return new UserTrades(pastTrades, TradeSortType.SortByTimestamp); }
Source:
public <KeyType> String chooseNode(Set<String> nodeIds, byte[] key) { if (nodeIds.isEmpty()) { return null; } Long2ObjectRBTreeMap<String> weights = new Long2ObjectRBTreeMap<>(); weights.defaultReturnValue(null); for (String nodeId : nodeIds) { HashCode keyHash = HASH_FN.hashBytes(key); HashCode nodeHash = HASH_FN.hashString(nodeId, Charsets.UTF_8); List<HashCode> hashes = Lists.newArrayList(nodeHash, keyHash); HashCode combinedHash = Hashing.combineOrdered(hashes); weights.put(combinedHash.asLong(), nodeId); } return weights.get(weights.lastLongKey()); }

Target:
public <KeyType> String chooseNode(Set<String> nodeIds, byte[] key) { if (nodeIds.isEmpty()) { return null; } final HashCode keyHash = HASH_FN.hashBytes(key); long maxHash = Long.MIN_VALUE; String maxNode = null; for (String nodeId : nodeIds) { HashCode nodeHash = HASH_FN.hashString(nodeId, Charsets.UTF_8); List<HashCode> hashes = Lists.newArrayList(nodeHash, keyHash); long combinedHash = Hashing.combineOrdered(hashes).asLong(); if (maxNode == null) { maxHash = combinedHash; maxNode = nodeId; } else if (combinedHash > maxHash) { maxHash = combinedHash; maxNode = nodeId; } } return maxNode; }
Source:
public void testAddBucketAcl() throws Exception { OzoneBucket ozoneBucket = setupBucket(); String remoteUserName = "remoteUser"; OzoneAcl defaultUserAcl = new OzoneAcl(USER, remoteUserName, READ, DEFAULT); OzoneObj ozoneObj = OzoneObjInfo.Builder.newBuilder() .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(OzoneObj.StoreType.OZONE) .setVolumeName(ozoneBucket.getVolumeName()) .setBucketName(ozoneBucket.getName()).build(); boolean addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl); Assert.assertTrue(addAcl); ozoneBucket.addAcls(Collections.singletonList(defaultUserAcl)); List<OzoneAcl> acls = objectStore.getAcl(ozoneObj); Assert.assertTrue(containsAcl(defaultUserAcl, acls)); addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl); Assert.assertFalse(addAcl); defaultUserAcl = new OzoneAcl(USER, remoteUserName, WRITE, DEFAULT); addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl); Assert.assertTrue(addAcl); }

Target:
public void testAddBucketAcl() throws Exception { OzoneBucket ozoneBucket = setupBucket(); String remoteUserName = "remoteUser"; OzoneAcl defaultUserAcl = new OzoneAcl(USER, remoteUserName, READ, DEFAULT); OzoneObj ozoneObj = OzoneObjInfo.Builder.newBuilder() .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(OzoneObj.StoreType.OZONE) .setVolumeName(ozoneBucket.getVolumeName()) .setBucketName(ozoneBucket.getName()).build(); boolean addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl); Assert.assertTrue(addAcl); List<OzoneAcl> acls = objectStore.getAcl(ozoneObj); Assert.assertTrue(containsAcl(defaultUserAcl, acls)); addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl); Assert.assertFalse(addAcl); defaultUserAcl = new OzoneAcl(USER, remoteUserName, WRITE, DEFAULT); addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl); Assert.assertTrue(addAcl); }
Source:
protected Pair<OAuth20AccessToken, OAuth20RefreshToken> generateAccessTokenOAuthGrantTypes(final AccessTokenRequestDataHolder holder) { LOGGER.debug("Creating access token for [{}]", holder.getService()); val clientId = holder.getRegisteredService().getClientId(); val authn = DefaultAuthenticationBuilder .newInstance(holder.getAuthentication()) .addAttribute(OAuth20Constants.GRANT_TYPE, holder.getGrantType().toString()) .addAttribute(OAuth20Constants.SCOPE, holder.getScopes()) .addAttribute(OAuth20Constants.CLIENT_ID, clientId) .addAttribute(OAuth20Constants.CLAIMS, holder.getClaims()) .build(); LOGGER.debug("Creating access token for [{}]", holder); val ticketGrantingTicket = holder.getTicketGrantingTicket(); val accessToken = this.accessTokenFactory.create(holder.getService(), authn, ticketGrantingTicket, holder.getScopes(), clientId, holder.getClaims()); LOGGER.debug("Created access token [{}]", accessToken); addTicketToRegistry(accessToken, ticketGrantingTicket); LOGGER.debug("Added access token to registry", accessToken); updateOAuthCode(holder, accessToken.getId()); val refreshToken = FunctionUtils.doIf(holder.isGenerateRefreshToken(), () -> generateRefreshToken(holder, accessToken.getId()), () -> { LOGGER.debug("Service is not able/allowed to receive refresh tokens", holder.getService()); return null; }).get(); return Pair.of(accessToken, refreshToken); }

Target:
protected Pair<OAuth20AccessToken, OAuth20RefreshToken> generateAccessTokenOAuthGrantTypes(final AccessTokenRequestDataHolder holder) { LOGGER.debug("Creating access token for [{}]", holder.getService()); val clientId = holder.getRegisteredService().getClientId(); val authn = DefaultAuthenticationBuilder .newInstance(holder.getAuthentication()) .addAttribute(OAuth20Constants.GRANT_TYPE, holder.getGrantType().toString()) .addAttribute(OAuth20Constants.SCOPE, holder.getScopes()) .addAttribute(OAuth20Constants.CLIENT_ID, clientId) .addAttribute(OAuth20Constants.CLAIMS, holder.getClaims()) .build(); LOGGER.debug("Creating access token for [{}]", holder); val ticketGrantingTicket = holder.getTicketGrantingTicket(); val accessToken = this.accessTokenFactory.create(holder.getService(), authn, ticketGrantingTicket, holder.getScopes(), clientId, holder.getClaims()); LOGGER.debug("Created access token [{}]", accessToken); addTicketToRegistry(accessToken, ticketGrantingTicket); LOGGER.debug("Added access token to registry", accessToken); updateOAuthCode(holder, accessToken); val refreshToken = FunctionUtils.doIf(holder.isGenerateRefreshToken(), () -> generateRefreshToken(holder, accessToken), () -> { LOGGER.debug("Service is not able/allowed to receive refresh tokens", holder.getService()); return null; }).get(); return Pair.of(accessToken, refreshToken); }
Source:
public final void testConsumerNotTransitionsToProcessingWhenInitializationFails() { ExecutorService failingService = spy(executorService); ShardConsumer consumer = new ShardConsumer(recordsPublisher, failingService, shardInfo, logWarningForTaskAfterMillis, shardConsumerArgument, blockedOnParentsState, t -> t, 1, taskExecutionListener, 0); mockSuccessfulUnblockOnParents(); mockSuccessfulInitializeWithFailureTransition(); mockSuccessfulProcessing(null); doCallRealMethod() .doThrow(new RejectedExecutionException()) .when(failingService).execute(any()); int arbitraryExecutionCount = 5; do { try { consumer.executeLifecycle(); Thread.sleep(100); } catch (Exception e) { } } while (--arbitraryExecutionCount > 0); assertEquals(ShardConsumerState.INITIALIZING.consumerState().state(), consumer.currentState().state()); }

Target:
public final void testConsumerNotTransitionsToProcessingWhenInitializationFails() { ExecutorService failingService = spy(executorService); ShardConsumer consumer = new ShardConsumer(recordsPublisher, failingService, shardInfo, logWarningForTaskAfterMillis, shardConsumerArgument, blockedOnParentsState, t -> t, 1, taskExecutionListener, 0); mockSuccessfulUnblockOnParents(); mockSuccessfulInitializeWithFailureTransition(); mockSuccessfulProcessing(null); doAnswer(invocation -> directlyExecuteRunnable(invocation)) .doThrow(new RejectedExecutionException()) .when(failingService).execute(any()); int arbitraryExecutionCount = 5; do { try { consumer.executeLifecycle(); } catch (Exception e) { fail("Unexpected exception while executing consumer lifecycle"); } } while (--arbitraryExecutionCount > 0); assertEquals(ShardConsumerState.INITIALIZING.consumerState().state(), consumer.currentState().state()); verify(failingService, times(5)).execute(any()); }
Source:
public static String getGatewayAlias(String url) { if (StringUtils.isNotBlank(url)) { String urlKey = getUrlKey(url); String gatewayAlias = gatewayAliasMapping.get(urlKey); if(StringUtils.isNotBlank(gatewayAlias)){ LOG.debug("debug--found url:{}, gatewayAlias:{}", url, gatewayAlias); return gatewayAlias; } } return getInstance().getPrivateKeyAlias(); }

Target:
public static String getGatewayAlias(String url) { if (StringUtils.isNotBlank(url)) { String urlKey = getUrlKey(url); String gatewayAlias = gatewayAliasMapping.get(urlKey); if(StringUtils.isNotBlank(gatewayAlias)){ LOG.debug("found url:{}, gatewayAlias:{}", url, gatewayAlias); return gatewayAlias; } } return getInstance().getPrivateKeyAlias(); }
Source:
protected VisitType getVisitType(Encounter encounter) throws APIException { String value = Context.getAdministrationService().getGlobalPropertyValue( OpenmrsConstants.GP_ENCOUNTER_TYPE_TO_VISIT_TYPE_MAPPING, ""); if (!StringUtils.isBlank(value)) { String targetEncounterTypeId = encounter.getEncounterType().getId().toString(); String[] mappings = value.split(","); for (String mapping : mappings) { int index = mapping.indexOf(':'); if (index > 0) { String encounterTypeId = mapping.substring(0, index).trim(); if (targetEncounterTypeId.equals(encounterTypeId) || encounter.getEncounterType().getUuid().equals(encounterTypeId)) { String visitTypeId = mapping.substring(index + 1).trim(); VisitType visitType = null; try { visitType = Context.getVisitService().getVisitType(Integer.parseInt(visitTypeId)); } catch (NumberFormatException e) { } if (visitType == null) visitType = Context.getVisitService().getVisitTypeByUuid(visitTypeId); if (visitType != null) { return visitType; } } } } throw new APIException( "Global Property: visit.encounterTypeToVisitTypeMapping does not have a mapping for encounter type: " + encounter.getEncounterType().getName()); } return Context.getVisitService().getAllVisitTypes().get(0); }

Target:
protected VisitType getVisitType(Encounter encounter) throws APIException { String value = Context.getAdministrationService().getGlobalPropertyValue( OpenmrsConstants.GP_ENCOUNTER_TYPE_TO_VISIT_TYPE_MAPPING, ""); if (!StringUtils.isBlank(value)) { String targetEncounterTypeId = encounter.getEncounterType().getId().toString(); String[] mappings = value.split(","); for (String mapping : mappings) { int index = mapping.indexOf(':'); if (index > 0) { String encounterTypeIdOrUuid = mapping.substring(0, index).trim(); if (targetEncounterTypeId.equals(encounterTypeIdOrUuid) || encounter.getEncounterType().getUuid().equals(encounterTypeIdOrUuid)) { String visitTypeIdOrUuid = mapping.substring(index + 1).trim(); VisitType visitType = null; try { visitType = Context.getVisitService().getVisitType(Integer.parseInt(visitTypeIdOrUuid)); } catch (NumberFormatException e) { } if (visitType == null) visitType = Context.getVisitService().getVisitTypeByUuid(visitTypeIdOrUuid); if (visitType != null) { return visitType; } } } } throw new APIException( "Global Property: visit.encounterTypeToVisitTypeMapping does not have a mapping for encounter type: " + encounter.getEncounterType().getName()); } return Context.getVisitService().getAllVisitTypes().get(0); }
Source:
public void setUp() { setAcceptedLanguage(LanguageMode.ECMASCRIPT6); languageOut = LanguageMode.ECMASCRIPT6; disableTypeCheck(); enableLineNumberCheck(false); enableCompareAsTree(false); }

Target:
public void setUp() { setAcceptedLanguage(LanguageMode.ECMASCRIPT6); languageOut = LanguageMode.ECMASCRIPT6; disableTypeCheck(); enableCompareAsTree(false); }
Source:
public void resolve(EObject view, TransformationCache cache) { if (view instanceof ViewExtensionDescription) { List<Category> categories = ((ViewExtensionDescription) view).getCategories(); for (Category category : categories) { for (GroupDescription group : category.getGroups()) { GroupValidationSetDescription validationSet = group.getValidationSet(); if (validationSet != null) { for (PropertyValidationRule rule : validationSet.getPropertyValidationRules()) { List<WidgetDescription> processedTargets = new ArrayList<WidgetDescription>(); for (WidgetDescription originalTarget : rule.getTargets()) { Optional<Object> targetOptional = cache.getOutput(originalTarget); Object target = targetOptional.get(); if (target instanceof WidgetDescription) { processedTargets.add((WidgetDescription) target); } } rule.getTargets().clear(); rule.getTargets().addAll(processedTargets); } } } } } }

Target:
public void resolve(EObject view, TransformationCache cache) { if (view instanceof ViewExtensionDescription) { List<Category> categories = ((ViewExtensionDescription) view).getCategories(); categories.forEach(category -> category.getGroups().forEach(group -> { Optional<GroupValidationSetDescription> validationSetOptional = Optional.ofNullable(group.getValidationSet()); validationSetOptional.ifPresent(validationSet -> validationSet.getPropertyValidationRules().forEach(rule -> { List<WidgetDescription> processedTargets = new ArrayList<WidgetDescription>(); rule.getTargets().forEach(originalTarget -> { cache.getOutput(originalTarget).filter(WidgetDescription.class::isInstance).map(WidgetDescription.class::cast).map(target -> processedTargets.add(target)); }); rule.getTargets().clear(); rule.getTargets().addAll(processedTargets); })); })); } }
Source:
public void isClientErrorShouldReturnFalseIfCustomPage200Matches() { CustomPage.Type type = CustomPage.Type.NOTFOUND_404; HttpMessage message = new HttpMessage(); message.getResponseHeader().setStatusCode(200); given(parent.isCustomPage(message, type)).willReturn(false); given(parent.isCustomPage(message, CustomPage.Type.OK_200)).willReturn(true); given(parent.getAnalyser()).willReturn(analyser); given(parent.getAnalyser().isFileExist(message)).willReturn(true); plugin.init(message, parent); boolean result = plugin.isClientError(message); assertThat(result, is(equalTo(false))); verify(parent).isCustomPage(message, CustomPage.Type.OK_200); }

Target:
public void isClientErrorShouldReturnFalseIfCustomPage200Matches() { CustomPage.Type type = CustomPage.Type.NOTFOUND_404; HttpMessage message = new HttpMessage(); message.getResponseHeader().setStatusCode(200); given(parent.isCustomPage(message, type)).willReturn(false); given(parent.isCustomPage(message, CustomPage.Type.OK_200)).willReturn(true); given(parent.getAnalyser()).willReturn(analyser); plugin.init(message, parent); boolean result = plugin.isClientError(message); assertThat(result, is(equalTo(false))); verify(parent).isCustomPage(message, CustomPage.Type.OK_200); }
Source:
public void accept(ServiceLocator serviceLocator) { logger.info("Loading topics metadata"); List<TopicName> topicsLeft = getTopics(); int initialTopicsCount = topicsLeft.size(); int retries = retryCount + 1; while (retries > 0) { retries--; topicsLeft = topicsLeft.stream().filter(this::topicMetadataNotAvailable).collect(toList()); if (!topicsLeft.isEmpty() && retries > 0) { waitBeforeNextRetry(); } } logResultInfo(topicsLeft, initialTopicsCount); }

Target:
public void accept(ServiceLocator serviceLocator) { long start = System.currentTimeMillis(); logger.info("Loading topics metadata"); List<CachedTopic> topics = topicsCache.getTopics(); List<MetadataLoadingResult> allResults = loadMetadataForTopics(topics); logResultInfo(allResults, System.currentTimeMillis() - start); }
Source:
private void createModel() { dataModel = new DataModelImpl(); dataObject = dataModel.addDataObject("Person1"); makeTheClassPersistable(dataObject); dataObject.addProperty("account balance", BigDecimal.class.getName()); dataObject.addProperty("salary", BigInteger.class.getName()); dataObject.addProperty("Married", Boolean.class.getName()); dataObject.addProperty("Children", Byte.class.getName()); dataObject.addProperty("Sex", Character.class.getName()); dataObject.addProperty("birth date", Date.class.getName()); dataObject.addProperty("Nose Size", Double.class.getName()); dataObject.addProperty("Waist Size", Float.class.getName()); dataObject.addProperty("Age", Integer.class.getName()); dataObject.addProperty("local date", LocalDate.class.getName()); dataObject.addProperty("local datetime", LocalDateTime.class.getName()); dataObject.addProperty("Seen Stars", Long.class.getName()); dataObject.addProperty("offset datetime", OffsetDateTime.class.getName()); dataObject.addProperty("Visited Countries", Short.class.getName()); dataObject.addProperty("name", String.class.getName()); dataObject.addProperty("married", boolean.class.getName()); dataObject.addProperty("children", byte.class.getName()); dataObject.addProperty("sex", char.class.getName()); dataObject.addProperty("nose size", double.class.getName()); dataObject.addProperty("waist size", float.class.getName()); dataObject.addProperty("age", int.class.getName()); dataObject.addProperty("seen stars", long.class.getName()); dataObject.addProperty("visited countries", short.class.getName()); dataObject.addProperty("address", NESTED_CLASSNAME); dataObject.addProperty("address list", NESTED_CLASSNAME, true); }

Target:
private void createModel() { dataModel = new DataModelImpl(); dataObject = dataModel.addDataObject("Person1"); Map<String, Object> params = new HashMap<String, Object>(); params.put("persistable", true); JPADomainHandler jpaDomainHandler = new JPADomainHandler(); jpaDomainHandler.setDefaultValues(dataObject, params); PropertyTypeFactoryImpl propertyTypeFactory = new PropertyTypeFactoryImpl(); List<PropertyType> basePropertyTypes = propertyTypeFactory.getBasePropertyTypes(); for (PropertyType baseProperty : basePropertyTypes) { dataObject.addProperty(baseProperty.getName(), baseProperty.getClassName()); } dataObject.addProperty("address", NESTED_CLASSNAME); dataObject.addProperty("address list", NESTED_CLASSNAME, true); }
Source:
public BaublesGuiFactory() { super(Baubles.MODID, getTitle()); }

Target:
public BaublesGuiFactory() { super(Baubles.MODID, GuiConfig.getAbridgedConfigPath(Config.config.toString())); }
Source:
public void init(IViewPart view) { updateEnablement(); view.addPropertyListener(new IPropertyListener() { public void propertyChanged(Object source, int propId) { updateEnablement(); } }); ScriptConsole.addActiveConsoleObserver(new ActiveConsoleObserver() { @Override protected void activeConsoleRunning(boolean running) { action.setEnabled(running); } }); }

Target:
public void init(IViewPart view) { updateEnablement(); view.addPropertyListener(this); ScriptConsoleManager.getInstance().addActiveConsoleObserver(this); }
Source:
public void setup(OperatorContext context) { sleepMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); FileAccessFSImpl fAccessImpl = new TFileImpl.DTFileImpl(); fAccessImpl.setBasePath(context.getValue(DAG.APPLICATION_PATH) + "/bucket_data"); managedState.setFileAccess(fAccessImpl); managedState.setup(context); if (orderedOutput) { decisions = Maps.newLinkedHashMap(); } }

Target:
public void setup(OperatorContext context) { FileAccessFSImpl fAccessImpl = new TFileImpl.DTFileImpl(); fAccessImpl.setBasePath(context.getValue(DAG.APPLICATION_PATH) + "/bucket_data"); managedState.setFileAccess(fAccessImpl); managedState.setup(context); if (preserveTupleOrder) { decisions = Maps.newLinkedHashMap(); } }
Source:
public String readServerId() { if(SERVER_ID==null){ try{ File serverFile = serverIdFile(); if(!serverFile.exists()){ writeServerIdToDisk(UUIDUtil.uuid()); } BufferedReader br = new BufferedReader(new FileReader(serverFile)); SERVER_ID = br.readLine(); br.close(); Logger.debug(ServerAPIImpl.class, "ServerID: " + SERVER_ID); } catch(IOException ioe){ throw new DotStateException("Unable to read server id at " + serverIdFile() + " please make sure that the directory exists and is readable and writeable. If problems persist, try deleting the file. The system will recreate a new one on startup", ioe); } } return SERVER_ID; }

Target:
public String readServerId() { BufferedReader br = null; FileReader reader = null; if(SERVER_ID==null){ try{ File serverFile = serverIdFile(); if(!serverFile.exists()){ writeServerIdToDisk(UUIDUtil.uuid()); } reader = new FileReader(serverFile); br = new BufferedReader(reader); SERVER_ID = br.readLine(); Logger.debug(ServerAPIImpl.class, "ServerID: " + SERVER_ID); } catch(IOException ioe){ throw new DotStateException("Unable to read server id at " + serverIdFile() + " please make sure that the directory exists and is readable and writeable. If problems" + " persist, try deleting the file. The system will recreate a new one on startup", ioe); } finally{ try { if (reader != null){ reader.close(); } if (br != null){ br.close(); } } catch (IOException e) { Logger.error(this.getClass(), e.getMessage()); } } } return SERVER_ID; }
Source:
public void init() throws Exception { folder = TMP_FOLDER.newFolder(); file = new File(folder, "sample"); ftpServer = new FakeFtpServer(); ftpServer.setServerControlPort(0); FileSystem fileSystem = new UnixFakeFileSystem(); fileSystem.add(new FileEntry(file.getAbsolutePath(), TEST_STRING)); ftpServer.setFileSystem(fileSystem); ftpServer.addUserAccount(new UserAccount(USER, PWD, folder.getAbsolutePath())); ftpServer.start(); Assert.assertTrue(ftpServer.isStarted()); port = ftpServer.getServerControlPort(); }

Target:
public void init() throws Exception { folder = TMP_FOLDER.newFolder(); file = new File(folder, "sample"); ftpServer = new FakeFtpServer(); ftpServer.setServerControlPort(0); FileSystem fileSystem = new UnixFakeFileSystem(); fileSystem.add(new FileEntry(file.getAbsolutePath(), TEST_STRING)); ftpServer.setFileSystem(fileSystem); ftpServer.addUserAccount(new UserAccount(USER, PWD, folder.getAbsolutePath())); ftpServer.start(); Tasks.waitFor(true, new Callable<Boolean>() { @Override public Boolean call() throws Exception { return ftpServer.isStarted(); } }, 5, TimeUnit.SECONDS); port = ftpServer.getServerControlPort(); }
Source:
public static <K, V> Set<K> toKeySet(AdvancedCacheLoader<K, V> acl, Predicate<? super K> filter) { if (acl == null) return Collections.emptySet(); return Flowable.fromPublisher(acl.publishEntries(filter, false, false)) .map(MarshalledEntry::getKey) .collectInto(new HashSet<K>(), Set::add).blockingGet(); }

Target:
public static <K, V> Set<K> toKeySet(AdvancedCacheLoader<K, V> acl, Predicate<? super K> filter) { if (acl == null) return Collections.emptySet(); return Flowable.fromPublisher(acl.publishKeys(filter)) .collectInto(new HashSet<K>(), Set::add).blockingGet(); }
Source:
public void caretUpdate(CaretEvent e) { if (e.getMark() == e.getDot()) { this.clearHighlight(); } if (e.getSource() == asciiViewTextArea) { int startByte = e.getMark(); int endByte = e.getDot(); if (startByte > endByte) { int t = endByte; endByte = startByte; startByte = t; } int startRows = (startByte - (startByte % bytesPerLine)) / bytesPerLine; int endRows = (endByte - (endByte % bytesPerLine)) / bytesPerLine; startByte -= startRows; endByte -= endRows; if (asciiLastSelectionStart == startByte && asciiLastSelectionEnd == endByte) { return; } asciiLastSelectionStart = startByte; asciiLastSelectionEnd = endByte; this.setSelection(startByte, endByte); } else if (e.getSource() == hexViewTextArea) { int startByte = e.getMark(); int endByte = e.getDot(); if (startByte > endByte) { int t = endByte; endByte = startByte; startByte = t; } int startRows = (startByte - (startByte % bytesPerLine)) / (3 * bytesPerLine); int endRows = (endByte - (endByte % bytesPerLine)) / (3 * bytesPerLine); startByte -= startRows; startByte /= 3; endByte -= endRows; endByte /= 3; if (hexLastSelectionStart == startByte && hexLastSelectionEnd == endByte) { return; } hexLastSelectionStart = startByte; hexLastSelectionEnd = endByte; this.setSelection(startByte, endByte); } else { logger.log(Level.INFO, "Source of event was neither the ascii view or the hex view text area"); } }

Target:
public void caretUpdate(CaretEvent e) { if (e.getMark() == e.getDot()) { this.clearHighlight(); } if (e.getSource() == asciiViewTextArea) { int startByte = e.getMark(); int endByte = e.getDot(); if (startByte > endByte) { int t = endByte; endByte = startByte; startByte = t; } int startRows = (startByte - (startByte % bytesPerLine)) / bytesPerLine; int endRows = (endByte - (endByte % bytesPerLine)) / bytesPerLine; startByte -= startRows; endByte -= endRows; if (asciiLastSelectionStart == startByte && asciiLastSelectionEnd == endByte) { return; } asciiLastSelectionStart = startByte; asciiLastSelectionEnd = endByte; this.setSelection(startByte, endByte); } else if (e.getSource() == hexViewTextArea) { int startByte = e.getMark(); int endByte = e.getDot(); if (startByte > endByte) { int t = endByte; endByte = startByte; startByte = t; } int startRows = (startByte - (startByte % bytesPerLine)) / (CHAR_ARRAY_SIZE * bytesPerLine); int endRows = (endByte - (endByte % bytesPerLine)) / (CHAR_ARRAY_SIZE * bytesPerLine); startByte -= startRows; startByte /= CHAR_ARRAY_SIZE; endByte -= endRows; endByte /= CHAR_ARRAY_SIZE; if (hexLastSelectionStart == startByte && hexLastSelectionEnd == endByte) { return; } hexLastSelectionStart = startByte; hexLastSelectionEnd = endByte; this.setSelection(startByte, endByte); } else { logger.log(Level.INFO, "Source of event was neither the ascii view or the hex view text area"); } }
Source:
private synchronized void drainQueueForRequests() { final RecordsRetrieved recordsToDeliver = peekNextResult(); if (requestedResponses.get() > 0 && recordsToDeliver != null) { lastEventDeliveryTime = Instant.now(); subscriber.onNext(recordsToDeliver); if(!shouldDrainEventOnAck.get()) { log.debug("{} : Notifier thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnAck.set(true); } } else { if(shouldDrainEventOnAck.get()){ log.debug("{} : Publisher thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnAck.set(false); } } }

Target:
private synchronized void drainQueueForRequests() { final RecordsRetrieved recordsToDeliver = peekNextResult(); if (requestedResponses.get() > 0 && recordsToDeliver != null) { lastEventDeliveryTime = Instant.now(); subscriber.onNext(recordsToDeliver); if (!shouldDrainEventOnlyOnAck.get()) { log.debug("{} : Notifier thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnlyOnAck.set(true); } } else { if (shouldDrainEventOnlyOnAck.get()) { log.debug("{} : Publisher thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnlyOnAck.set(false); } } }