auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CompletionStage<Void> evict(int segment, K key) { ConcurrentMap<K, InternalCacheEntry<K, V>> entries = getMapForSegment(segment); if (entries == null) { return CompletableFutures.completedNull(); } ByRef<CompletionStage<Void>> byRef = new ByRef<>(CompletableFutures.completedNull()); entries.computeIfPresent(key, (o, entry) -> { byRef.set(handleEviction(entry, null, passivator.running(), null, this, null)); computeEntryRemoved(o, entry); return null; }); return byRef.get(); }

Target:
public CompletionStage<Void> evict(int segment, K key) { ConcurrentMap<K, InternalCacheEntry<K, V>> entries = getMapForSegment(segment); if (entries == null) { return CompletableFutures.completedNull(); } ByRef<CompletionStage<Void>> evictionStageRef = new ByRef<>(CompletableFutures.completedNull()); entries.computeIfPresent(key, (o, entry) -> { evictionStageRef.set(handleEviction(entry, null, passivator.running(), null, this, null)); computeEntryRemoved(o, entry); return null; }); return evictionStageRef.get(); }
Source:
public static void updateNetworkStatus(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); boolean isAllowedConnectionType = false; if (ni == null) { Log.v(TAG, "Detected flight mode enabled."); isAllowedConnectionType = true; } else { Log.v(TAG, "Detected flight mode disabled."); boolean isWifi = ni.getType() == ConnectivityManager.TYPE_WIFI && ni.isConnected(); boolean isNetworkMetered = (Build.VERSION.SDK_INT >= 16) ? cm.isActiveNetworkMetered() : false; isAllowedConnectionType = isWifi && !isNetworkMetered; } LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); Intent intent = new Intent(DeviceStateHolder.ACTION_DEVICE_STATE_CHANGED); intent.putExtra(DeviceStateHolder.EXTRA_IS_ALLOWED_NETWORK_CONNECTION, isAllowedConnectionType); lbm.sendBroadcast(intent); }

Target:
public static void updateNetworkStatus(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); boolean isAllowedConnectionType = false; if (ni == null) { Log.v(TAG, "In flight mode"); isAllowedConnectionType = true; } else { Log.v(TAG, "Not in flight mode"); boolean isWifi = ni.getType() == ConnectivityManager.TYPE_WIFI && ni.isConnected(); boolean isNetworkMetered = (Build.VERSION.SDK_INT >= 16) ? cm.isActiveNetworkMetered() : false; isAllowedConnectionType = isWifi && !isNetworkMetered; } LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); Intent intent = new Intent(DeviceStateHolder.ACTION_DEVICE_STATE_CHANGED); intent.putExtra(DeviceStateHolder.EXTRA_IS_ALLOWED_NETWORK_CONNECTION, isAllowedConnectionType); lbm.sendBroadcast(intent); }
Source:
public void isListEmpty() { ArrayNode json = new ArrayNode(factory); assertTrue(expressionEvaluatorMock.isListEmpty(json)); ObjectNode nestedNode = new ObjectNode(factory); json.add(nestedNode); assertTrue(expressionEvaluatorMock.isListEmpty(json)); nestedNode.set("notEmptyField", new TextNode("text")); assertFalse(expressionEvaluatorMock.isListEmpty(json)); }

Target:
public void isListEmpty() { ArrayNode json = new ArrayNode(factory); assertTrue(expressionEvaluatorMock.isListEmpty(json)); ObjectNode nestedNode = new ObjectNode(factory); json.add(nestedNode); assertTrue(expressionEvaluatorMock.isListEmpty(json)); nestedNode.set("emptyField", new TextNode("")); assertTrue(expressionEvaluatorMock.isListEmpty(json)); nestedNode.set("notEmptyField", new TextNode("text")); assertFalse(expressionEvaluatorMock.isListEmpty(json)); }
Source:
public Iterator<T> iterator() { List<T> copy = Lists.newArrayList(underlying); Collections.shuffle(copy); return copy.iterator(); }

Target:
public Iterator<T> iterator() { return orderingIterator.next().iterator(); }
Source:
public void handleGet(ActionParameters params) throws ActionException { try { JSONObject result = new JSONObject(); if (params.getUser().isAdmin()) { result = service.getAdminAnnouncements(); } else { result = service.getAnnouncements(); } System.out.println(result); ResponseHelper.writeResponse(params, 200, result); } catch (Exception e) { LOG.error("Error", e); } }

Target:
public void handleGet(ActionParameters params) throws ActionException { try { JSONObject result = new JSONObject(); if (params.getUser().isAdmin()) { result = service.getAdminAnnouncements(); } else { result = service.getAnnouncements(); } ResponseHelper.writeResponse(params, 200, result); } catch (Exception e) { throw new ActionException("Cannot get announcements", e); } }
Source:
public CachedTableChecker(List<String> cachedTables) { this.cacheAllTables = cachedTables.contains("*"); if (cacheAllTables) { checkArgument(cachedTables.size() == 1, "Only '*' is expected when caching all tables"); this.cachedTableNames = ImmutableSet.of(); } else { this.cachedTableNames = cachedTables.stream() .map(CachingDirectoryLister::parseTableName) .collect(toImmutableSet()); } }

Target:
public CachedTableChecker(List<String> cachedTables) { cacheAllTables = cachedTables.contains("*"); if (cacheAllTables) { checkArgument(cachedTables.size() == 1, "Only '*' is expected when caching all tables"); this.cachedTableNames = ImmutableSet.of(); } else { this.cachedTableNames = cachedTables.stream() .map(CachingDirectoryLister::parseTableName) .collect(toImmutableSet()); } }
Source:
public static Date tryToConvert(String dateAsString) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); return dateFormat.parse(dateAsString); } catch (ParseException e) { return null; } }

Target:
public static Date tryToConvert(String dateAsString) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); return dateFormat.parse(dateAsString); } catch (ParseException e) { return TimeComparator.toDate(dateAsString); } }
Source:
public void generateImageWithRandomText() { String imageExtension = "png"; imagePath = imageFolder + "random_image." + imageExtension; String fontName = "TimesRoman"; int fontStyle = Font.BOLD; int fontSize = 20; Color fontColor = Color.BLUE; int textLength = 16; String imageText = getRandomText(textLength); String actionName = "generate random image"; String actionDescription = "generated image with random text: " + imageText; Graphics2D g2 = imageBuffer.createGraphics(); g2.setPaint(fontColor); Font font = new Font(fontName, fontStyle, fontSize); g2.setFont(font); FontMetrics fontMetrics = g2.getFontMetrics(); int stringWidth = fontMetrics.stringWidth(imageText); int stringHeight = fontMetrics.getAscent(); g2.drawString(imageText, (imageWidth - stringWidth) / 2, imageHeight / 2); try { if (ImageIO.write(imageBuffer, imageExtension, new File(imagePath))) { PageObjectLogging.logOnLowLevel(actionName, actionDescription, true); } } catch (IOException e) { e.printStackTrace(); } }

Target:
public void generateImageWithRandomText() { int fontStyle = Font.BOLD; int fontSize = 20; int textLength = 16; String fontName = "TimesRoman"; String imageExtension = "png"; String imageText = getRandomText(textLength); Color fontColor = Color.BLUE; this.imagePath = imageFolder + "random_image." + imageExtension; String actionName = "generate random image"; String actionDescription = "generated image with random text: " + imageText; Graphics2D g2 = imageBuffer.createGraphics(); g2.setPaint(fontColor); Font font = new Font(fontName, fontStyle, fontSize); g2.setFont(font); FontMetrics fontMetrics = g2.getFontMetrics(); int stringWidth = fontMetrics.stringWidth(imageText); g2.drawString(imageText, (imageWidth - stringWidth) / 2, imageHeight / 2); try { if (ImageIO.write(imageBuffer, imageExtension, new File(imagePath))) { PageObjectLogging.logOnLowLevel(actionName, actionDescription, true); } } catch (IOException e) { throw new RuntimeException(ExceptionUtils.getStackTrace(e)); } }
Source:
public void testDestroyUnknownCacheAlias() throws Exception { clusteredCacheManagerBuilder.build(true).close(); PersistentCacheManager cacheManager = newCacheManagerBuilder().with(cluster(CLUSTER_URI).expecting()).build(true); cacheManager.destroyCache("clustered-cache"); }

Target:
public void testDestroyUnknownCacheAlias() throws Exception { clusteredCacheManagerBuilder.build(true).close(); PersistentCacheManager cacheManager = newCacheManagerBuilder().with(cluster(CLUSTER_URI).expecting()).build(true); cacheManager.destroyCache("clustered-cache"); try { cacheManager.createCache("clustered-cache", newCacheConfigurationBuilder(Long.class, String.class, newResourcePoolsBuilder() .with(clustered()))); fail("Expected exception as clustered store no longer exists"); } catch (IllegalStateException e) { assertThat(e.getMessage(), containsString("clustered-cache")); } }
Source:
public boolean isEmpty() { BlockBuilder blockBuilder = blockBuilders.get(getGroupId()); return blockBuilder == null || blockBuilder.getPositionCount() == 0; }

Target:
public boolean isEmpty() { BlockBuilder blockBuilder = blockBuilders.get(getGroupId()); verify(blockBuilder.getPositionCount() != 0); return false; }
Source:
private boolean isGlusterEnabled() { VDSGroup vdsGroup = getVdsGroupDAO().get(getVdsGroupId()); return (vdsGroup.supportsGlusterService()); }

Target:
private boolean isGlusterEnabled() { return (getVdsGroup().supportsGlusterService()); }
Source:
protected StreamsDatum newDatum(ObjectNode item) { return new StreamsDatum(item, item.get("id").asText(), new DateTime(item.get("timestamp").asText())); }

Target:
protected StreamsDatum newDatum(ObjectNode item) { try { String id = null; if( item.get("id") != null ) id = item.get("id").asText(); DateTime timestamp = null; if( item.get("timestamp") != null ) timestamp = new DateTime(item.get("timestamp").asText()); if( id != null && timestamp != null ) return new StreamsDatum(item, id, timestamp); else if( id != null ) return new StreamsDatum(item, id); else if( timestamp != null ) return new StreamsDatum(item, null, timestamp); else return new StreamsDatum(item); } catch( Exception e ) { return new StreamsDatum(item); } }
Source:
private Map<String, Object> peopleApiConnect(final String userLogin, final String urlEndPoint) throws NotFoundException, BadRequestException, InternalServerErrorException { String fullRequest = urlEndPoint + userLogin; if (urlEndPoint.equals(PEOPLE_ENDPOINT_PROFILE)) { fullRequest += "?format=json"; } try { InputStream resourceStream = UserServiceTGImpl.class.getClassLoader() .getResourceAsStream("people_basic_auth.txt"); String auth = convertStreamToString(resourceStream); URL url = new URL(fullRequest); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", auth); ObjectMapper mapper = new ObjectMapper(); if (conn.getResponseCode() == 200) { Map<String, Object> providerResponse = mapper.readValue(conn.getInputStream(), Map.class); return providerResponse; } else { throw new NotFoundException(i18n.t("User not found")); } } catch (JsonParseException e) { throw new BadRequestException(OPERATION_FAILED); } catch (MalformedURLException e) { throw new BadRequestException(e.getMessage()); } catch (IOException e) { System.err.println("An internal server error ocurred!"); System.err.println(e.getMessage()); throw new InternalServerErrorException(i18n.t("An internal server error ocurred.")); } }

Target:
private Map<String, Object> peopleApiConnect(final String userLogin, final String urlEndPoint) throws NotFoundException, BadRequestException, InternalServerErrorException { String fullRequest = urlEndPoint + userLogin; if (urlEndPoint.equals(PEOPLE_ENDPOINT_PROFILE)) { fullRequest += "?format=json"; } try { InputStream resourceStream = UserServiceTGImpl.class.getClassLoader() .getResourceAsStream("people_basic_auth.txt"); String auth = convertStreamToString(resourceStream); URL url = new URL(fullRequest); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", auth); ObjectMapper mapper = new ObjectMapper(); if (conn.getResponseCode() == 200) { Map<String, Object> providerResponse = mapper.readValue(conn.getInputStream(), Map.class); return providerResponse; } else { throw new NotFoundException(i18n.t("User not found")); } } catch (JsonParseException e) { throw new BadRequestException(OPERATION_FAILED); } catch (MalformedURLException e) { throw new BadRequestException(e.getMessage()); } catch (IOException e) { log.info("An internal server error ocurred!"); log.info(e.getMessage()); throw new InternalServerErrorException(i18n.t("An internal server error ocurred.")); } }
Source:
public DataType<?> createType() { if (baseTypeName.equalsIgnoreCase(ArrayType.NAME)) { if (parameters.size() == 0) { return new ArrayType<>(UndefinedType.INSTANCE); } DataType<?> innerType = parameters.get(0).createType(); return new ArrayType<>(innerType); } if (baseTypeName.equalsIgnoreCase(ObjectType.NAME)) { var builder = ObjectType.builder(); for (int i = 0; i < parameters.size() - 1;) { var valTypeSignature = parameters.get(i + 1); final String innerTypeName; if (valTypeSignature instanceof NamedTypeSignature) { innerTypeName = ((NamedTypeSignature) valTypeSignature).parameterName(); } else { innerTypeName = String.valueOf(i); } builder.setInnerType(innerTypeName, valTypeSignature.createType()); i += 2; } return builder.build(); } return DataTypes.ofName(baseTypeName); }

Target:
public DataType<?> createType() { if (baseTypeName.equalsIgnoreCase(ArrayType.NAME)) { if (parameters.size() == 0) { return new ArrayType<>(UndefinedType.INSTANCE); } DataType<?> innerType = parameters.get(0).createType(); return new ArrayType<>(innerType); } if (baseTypeName.equalsIgnoreCase(ObjectType.NAME)) { var builder = ObjectType.builder(); for (int i = 0; i < parameters.size() - 1;) { var valTypeSignature = parameters.get(i + 1); assert valTypeSignature instanceof ObjectParameterTypeSignature : "the inner type signature must be named (must have ObjectParameterTypeSignature type)"; var innerTypeName = ((ObjectParameterTypeSignature) valTypeSignature).parameterName(); builder.setInnerType(innerTypeName, valTypeSignature.createType()); i += 2; } return builder.build(); } return DataTypes.ofName(baseTypeName); }
Source:
public void cancelLongPress() { super.cancelLongPress(); if (isSensorAvailable) { binding.bearingButton.cancelLongPress(); } binding.answerText.cancelLongPress(); }

Target:
public void cancelLongPress() { super.cancelLongPress(); binding.bearingButton.cancelLongPress(); binding.answerText.cancelLongPress(); }
Source:
public static boolean wouldBeSingleBreakend(final byte[] bases) { if ( bases.length <= 1 ) return false; else { return bases[0] == '.' || bases[bases.length - 1] == '.'; } }

Target:
public static boolean wouldBeSingleBreakend(final byte[] bases) { if ( bases.length <= 1 ) return false; else { return bases[0] == SINGLE_BREAKEND_INDICATOR || bases[bases.length - 1] == SINGLE_BREAKEND_INDICATOR; } }
Source:
int getTop(final HTMLElement element) { final String topString = element.style.getPropertyValue("top") .replace("px", ""); if (StringUtils.isEmpty(topString)) { return 0; } return Integer.valueOf(topString); }

Target:
int getTop(final HTMLElement element) { final String topString = element.style.getPropertyValue(TOP) .replace(PX, ""); if (StringUtils.isEmpty(topString)) { return 0; } return Integer.valueOf(topString); }
Source:
public void spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront_shouldFailBy_expectingOnError() throws Throwable { requireTestFailure(new ThrowingRunnable() { @Override public void run() throws Throwable { customPublisherVerification(new Publisher<Integer>() { @Override public void subscribe(final Subscriber<? super Integer> s) { final Random rnd = new Random(); s.onSubscribe(new Subscription() { @Override public void request(long n) { for (int i = 0; i < n; i++) { s.onNext(rnd.nextInt()); } } @Override public void cancel() { } }); } }).spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront(); } }, "Expected elements to be signaled in the same sequence to 1st and 2nd subscribers: Lists differ at element " ); }

Target:
public void spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront_shouldFailBy_expectingOnError() throws Throwable { requireTestFailure(new ThrowingRunnable() { @Override public void run() throws Throwable { customPublisherVerification(new Publisher<Integer>() { @Override public void subscribe(final Subscriber<? super Integer> s) { s.onSubscribe(new Subscription() { final Random rnd = new Random(); @Override public void request(long n) { for (int i = 0; i < n; i++) { s.onNext(rnd.nextInt()); } } @Override public void cancel() { } }); } }).spec113_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront(); } }, "Expected elements to be signaled in the same sequence to 1st and 2nd subscribers: Lists differ at element "); }
Source:
public PackingPlan(String id, Set<ContainerPlan> containers, Resource resource) { this.id = id; this.containers = containers; this.resource = resource; containersMap = new HashMap<>(); for (ContainerPlan containerPlan : containers) { containersMap.put(containerPlan.getId(), containerPlan); } }

Target:
public PackingPlan(String id, Set<ContainerPlan> containers, Resource resource) { this.id = id; this.containers = ImmutableSet.copyOf(containers); this.resource = resource; containersMap = new HashMap<>(); for (ContainerPlan containerPlan : containers) { containersMap.put(containerPlan.getId(), containerPlan); } }
Source:
public void projectOpened() { HaxeModuleSettings moduleSettings = HaxeModuleSettings.getInstance(mMyModule); String openFLPath = moduleSettings.getOpenFLPath(); setOpenFLPath(openFLPath); }

Target:
public void projectOpened() { moduleSettings = HaxeModuleSettings.getInstance(mMyModule); String openFLPath = moduleSettings.getOpenFLPath(); setOpenFLPath(openFLPath); }
Source:
public void navigate() { FinderNavigation navi; if (ConfigUtils.isDomain()) { navi = new FinderNavigation(browser, DomainConfigEntryPoint.class) .addAddress(FinderNames.CONFIGURATION, FinderNames.PROFILES) .addAddress(FinderNames.PROFILE, "full"); } else { navi = new FinderNavigation(browser, StandaloneConfigEntryPoint.class) .addAddress(FinderNames.CONFIGURATION, FinderNames.SUBSYSTEMS); } navi.addAddress(FinderNames.SUBSYSTEM, "Batch").selectRow().invoke(FinderNames.VIEW); Application.waitUntilVisible(); }

Target:
public void navigate() { FinderNavigation navi; if (ConfigUtils.isDomain()) { navi = new FinderNavigation(browser, DomainConfigEntryPoint.class) .addAddress(FinderNames.CONFIGURATION, FinderNames.PROFILES) .addAddress(FinderNames.PROFILE, ConfigUtils.getDefaultProfile()); } else { navi = new FinderNavigation(browser, StandaloneConfigEntryPoint.class) .addAddress(FinderNames.CONFIGURATION, FinderNames.SUBSYSTEMS); } navi.addAddress(FinderNames.SUBSYSTEM, "Batch").selectRow().invoke(FinderNames.VIEW); Application.waitUntilVisible(); }
Source:
public void queryBackend() { boolean nfs = false; if(currentTab == ProfileTabSelected.NFS) { nfs = true; } final VolumeProfileStatisticsModel profileStatsModel = this; profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); AsyncDataProvider.getGlusterVolumeProfilingStatistics(new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { profileStatsModel.stopProgress(); VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeProfileInfo profileInfoEntity =vdcValue.getReturnValue(); setProfileInfo(profileInfoEntity); if((profileInfoEntity == null) || (!vdcValue.getSucceeded())) { volumeListModel.showProfileErrorWindow(); } else { setConfirmWindow(null); if(getWindow() == null) { setTitle(ConstantsManager.getInstance().getMessages().volumeProfilingStatsTitle(volumeName)); if(currentTab == ProfileTabSelected.NFS) { showNfsProfileStats(profileInfoEntity); } else { showProfileStats(profileInfoEntity); } volumeListModel.setProfileWindow(profileStatsModel); } } } }), clusterId, volumeId, nfs); }

Target:
public void queryBackend() { boolean nfs = false; if(currentTab == ProfileTabSelected.NFS) { nfs = true; } final VolumeProfileStatisticsModel profileStatsModel = this; startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage()); AsyncDataProvider.getGlusterVolumeProfilingStatistics(new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { stopProgress(); VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeProfileInfo profileInfoEntity =vdcValue.getReturnValue(); setProfileInfo(profileInfoEntity); if((profileInfoEntity == null) || (!vdcValue.getSucceeded())) { volumeListModel.showProfileErrorWindow(); } else { setConfirmWindow(null); if(getWindow() == null) { setTitle(ConstantsManager.getInstance().getMessages().volumeProfilingStatsTitle(volumeName)); if(currentTab == ProfileTabSelected.NFS) { showNfsProfileStats(profileInfoEntity); } else { showProfileStats(profileInfoEntity); } volumeListModel.setProfileWindow(profileStatsModel); } } } }), clusterId, volumeId, nfs); }
Source:
public void requestInterstitialAd(Context context, MediationInterstitialListener listener, Bundle serverParameters, MediationAdRequest mediationAdRequest, Bundle mediationExtras) { onLog("requestInterstitialAd"); mInterstitialListener = listener; if (!(context instanceof Activity)) { Log.d(TAG, "IronSource SDK requires an Activity context to initialize"); onISAdFailedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } try { if (mediationExtras != null) { if (mediationExtras.containsKey(KEY_TEST_MODE)) { this.mIsTestEnabled = mediationExtras.getBoolean(KEY_TEST_MODE, false); } } String appKey = serverParameters.getString(KEY_APP_KEY); if (TextUtils.isEmpty(appKey)) { onLog("onInitializationFailed, make sure that 'appKey' server parameter is added"); onISAdFailedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } this.mInstanceID = serverParameters.getString(KEY_INTANCE_ID, "0"); onLog("Server params for IS | appKey: " + appKey + " | isTestEnabled: " + this.mIsTestEnabled + " | InstanceID: " + this.mInstanceID ); IronSource.setISDemandOnlyInterstitialListener(this); initIronSourceSDK(context, appKey, IronSource.AD_UNIT.INTERSTITIAL); loadISIronSourceSDK(); } catch (Exception e) { onLog("onInitializationFailed, error: " + e.getMessage()); onISAdFailedToLoad(AdRequest.ERROR_CODE_INTERNAL_ERROR); } }

Target:
public void requestInterstitialAd(Context context, MediationInterstitialListener listener, Bundle serverParameters, MediationAdRequest mediationAdRequest, Bundle mediationExtras) { onLog("requestInterstitialAd"); mInterstitialListener = listener; if (!(context instanceof Activity)) { Log.d(TAG, "IronSource SDK requires an Activity context to initialize"); onISAdFailedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } try { this.mIsLogEnabled = mediationAdRequest.isTesting(); String appKey = serverParameters.getString(KEY_APP_KEY); if (TextUtils.isEmpty(appKey)) { onLog("onInitializationFailed, make sure that 'appKey' server parameter is added"); onISAdFailedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } this.mInstanceID = serverParameters.getString(KEY_INTANCE_ID, "0"); onLog("Server params for IS | appKey: " + appKey + " | isTestEnabled: " + this.mIsLogEnabled + " | InstanceID: " + this.mInstanceID ); IronSource.setISDemandOnlyInterstitialListener(this); initIronSourceSDK(context, appKey, IronSource.AD_UNIT.INTERSTITIAL); loadISIronSourceSDK(); } catch (Exception e) { onLog("onInitializationFailed, error: " + e.getMessage()); onISAdFailedToLoad(AdRequest.ERROR_CODE_INTERNAL_ERROR); } }
Source:
public int compareTo(JavaVersion other) { if (this.equals(other)) { return 0; } return this.discard < other.discard ? -1 : this.discard > other.discard ? 1 : this.major < other.major ? -1 : this.major > other.major ? 1 : this.minor < other.minor ? -1 : this.minor > other.minor ? 1 : this.update < other.update ? -1 : this.update > other.update ? 1 : this.build < other.build ? -1 : 1; }

Target:
public int compareTo(JavaVersion other) { return this.discard != other.discard ? this.discard - other.discard : this.major != other.major ? this.major - other.major : this.minor != other.minor ? this.minor - other.minor : this.update != other.update ? this.update - other.update : this.build != other.build ? this.build - other.build : 0; }
Source:
void sendError(HttpResponseStatus status, Throwable ex) { String msg; if (ex instanceof InvocationTargetException) { msg = String.format("Exception Encountered while processing request : %s", ((InvocationTargetException) ex).getTargetException().getMessage()); } else { msg = String.format("Exception Encountered while processing request: %s", ex.getMessage()); } responder.sendString(status, msg, ImmutableMultimap.of(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE)); }

Target:
void sendError(HttpResponseStatus status, Throwable ex) { String msg; if (ex instanceof InvocationTargetException) { msg = String.format("Exception Encountered while processing request : %s", Objects.firstNonNull(ex.getCause(), ex).getMessage()); } else { msg = String.format("Exception Encountered while processing request: %s", ex.getMessage()); } responder.sendString(status, msg, ImmutableMultimap.of(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE)); }
Source:
private void settings(final int buttonNo) { ObservableList<Node> buttons; buttons = rootNode(stage).getScene().getRoot() .getChildrenUnmodifiable(); if (buttonNo <= SETTINGS_SOUNDEFFECTS) { clickOn(buttons.get(buttonNo), MouseButton.PRIMARY); } else { clickOn(buttons.get(buttonNo), MouseButton.PRIMARY); press(MouseButton.PRIMARY); moveTo(MOVE_X_SLIDER, MOVE_Y_SLIDER); release(MouseButton.PRIMARY); } sleep(SHORT); }

Target:
private void settings(final int buttonNo) { ObservableList<Node> buttons; buttons = rootNode(stage).getScene().getRoot() .getChildrenUnmodifiable(); if (buttonNo <= SETTINGS_SOUNDEFFECTS) { clickOn(buttons.get(buttonNo), MouseButton.PRIMARY); } else { clickOn(buttons.get(buttonNo), MouseButton.PRIMARY); press(MouseButton.PRIMARY); moveBy(MOVE_X_SLIDER, MOVE_Y_SLIDER); release(MouseButton.PRIMARY); } sleep(SHORT); }
Source:
private WebElement getActiveDialog() { WebElement dialog = null; List<WebElement> elements = driver.findElements(By.cssSelector(".discussion-dialog.is-visible")); if (elements.isEmpty()) { dialog = driver.findElement(By.cssSelector(".discussion-dialog.is-visible.modal-dialog-approve")); } else if (1 < elements.size()) { throw new IllegalStateException("Only one modal dialog should be visible!"); } else { dialog = elements.get(0); } return dialog; }

Target:
private WebElement getActiveDialog() { List<WebElement> elements = driver.findElements(By.cssSelector(".discussion-dialog.is-visible")); if (elements.isEmpty()) { return driver.findElement(By.cssSelector(".discussion-dialog.is-visible.modal-dialog-approve")); } else if (1 < elements.size()) { throw new IllegalStateException("Only one modal dialog should be visible!"); } else { return elements.get(0); } }
Source:
public LongWrappingDimensionSelector(LongColumnSelector selector, ExtractionFn extractionFn) { this.delegate = selector; this.exFn = extractionFn; }

Target:
public LongWrappingDimensionSelector(LongColumnSelector selector, ExtractionFn extractionFn) { this.selector = selector; this.extractionFn = extractionFn; }
Source:
public void load(EngineLocalConfig config) throws ConfigurationException { File customExtensionsDir = config.getCustomExtensionsDir(); File builtInExtensionsDir = config.getBuiltInExtensionsDir(); load(customExtensionsDir); load(builtInExtensionsDir); activate(); }

Target:
public void load(EngineLocalConfig config) throws ConfigurationException { for (File directory : config.getExtensionsDirectories()) { load(directory); } activate(); }
Source:
@Test public void test() { byte[] key = new byte[1024]; int[] position = new int[slots.size()]; int offset = ScanUtil.setKey(schema, slots, ScanUtil.getDefaultSlotSpans(slots.size()), position, bound, key, 0, 0, slots.size()); byte[] actualKey = new byte[offset]; System.arraycopy(key, 0, actualKey, 0, offset); assertArrayEquals(expectedKey, actualKey); }

Target:
public void test() { byte[] key = new byte[1024]; int[] position = new int[slots.size()]; int offset = ScanUtil.setKey(schema, slots, ScanUtil.getDefaultSlotSpans(slots.size()), position, bound, key, 0, 0, slots.size()); byte[] actualKey = new byte[offset]; System.arraycopy(key, 0, actualKey, 0, offset); assertArrayEquals(expectedKey, actualKey); }
Source:
public List<BaragonResponse> getResponsesForService(String serviceId, int limit) { final List<String> nodes = getChildren(String.format(RESPONSE_HISTORIES_FOR_SERVICE_FORMAT, serviceId)); final List<BaragonResponse> responses = Lists.newArrayListWithCapacity(Math.min(nodes.size(), limit)); Iterator<String> nodeIterator = nodes.iterator(); for (int i = 0; nodeIterator.hasNext() && i < limit; i++) { String requestId = nodeIterator.next(); try { responses.addAll(readFromZk(String.format(RESPONSE_HISTORY_FORMAT, serviceId, requestId), BaragonResponse.class).asSet()); } catch (Exception e) { LOG.error(String.format("Could not fetch info for group %s due to error %s", requestId, e)); } } return responses; }

Target:
public List<BaragonResponse> getResponsesForService(String serviceId, int limit) { final List<String> nodes = getChildren(String.format(RESPONSE_HISTORIES_FOR_SERVICE_FORMAT, serviceId)); final List<BaragonResponse> responses = Lists.newArrayListWithCapacity(Math.min(nodes.size(), limit)); for (String requestId : nodes.subList(0, Math.min(nodes.size(), limit))) { try { responses.addAll(readFromZk(String.format(RESPONSE_HISTORY_FORMAT, serviceId, requestId), BaragonResponse.class).asSet()); } catch (Exception e) { LOG.error(String.format("Could not fetch info for group %s due to error %s", requestId, e)); } } return responses; }
Source:
public void testGetAll() { Group group0 = ObjectsFactory.getRandomGroup(); saveAndEvict(group0); Group group1 = ObjectsFactory.getRandomGroup(); saveAndEvict(group1); List<Group> actual = groupDao.getAll(); Collections.sort(actual, new Comparator<Group>() { @Override public int compare(@Nonnull Group group, @Nonnull Group group1) { return Long.compareUnsigned(group.getId(), group1.getId()); } }); assertEquals(actual.size(), 2); assertReflectionEquals(actual.get(0), group0); assertReflectionEquals(actual.get(1), group1); }

Target:
public void testGetAll() { Group group0 = ObjectsFactory.getRandomGroup(); saveAndEvict(group0); Group group1 = ObjectsFactory.getRandomGroup(); saveAndEvict(group1); List<Group> actual = groupDao.getAll(); sortById(actual); assertEquals(actual.size(), 2); assertReflectionEquals(actual.get(0), group0); assertReflectionEquals(actual.get(1), group1); }
Source:
public boolean isTransportAutoWire() { return Config.getBooleanProperty("AUTOWIRE_CLUSTER_TRANSPORT", true) && LicenseUtil.getLevel()> 200; }

Target:
public boolean isTransportAutoWire() { return Config.getBooleanProperty("AUTOWIRE_CLUSTER_TRANSPORT", true) && LicenseUtil.getLevel()> LicenseLevel.STANDARD.level; }
Source:
private void startAgedFilesLoad(long runTimeMillis) { long threadID = Thread.currentThread().getId(); LOG.info("AGED LOADGEN: Started Aged IO Thread:{}.", threadID); String threadName = Thread.currentThread().getName(); long startTime = Time.monotonicNow(); while (isWriteThreadRunning.get() && (Time.monotonicNow() < startTime + runTimeMillis)) { String keyName = null; try { if (agedWriteProbability.isTrue()) { keyName = writeData(agedFileWrittenIndex.getAndIncrement(), agedLoadBucket, threadName); } else { Optional<Integer> index = randomKeyToRead(); if (index.isPresent()) { keyName = getKeyName(index.get(), threadName); readData(agedLoadBucket, keyName); } } } catch (Throwable t) { LOG.error("AGED LOADGEN: Exiting due to exception", keyName, t); break; } } isWriteThreadRunning.set(false); LOG.info("Terminating IO thread:{}.", threadID); }

Target:
private void startAgedFilesLoad(long runTimeMillis) { long threadID = Thread.currentThread().getId(); LOG.info("AGED LOADGEN: Started Aged IO Thread:{}.", threadID); String threadName = Thread.currentThread().getName(); long startTime = Time.monotonicNow(); while (isWriteThreadRunning.get() && (Time.monotonicNow() < startTime + runTimeMillis)) { String keyName = null; try { if (agedWriteProbability.isTrue()) { keyName = writeData(agedFileWrittenIndex.getAndIncrement(), agedLoadBucket, threadName); } else { Optional<Integer> index = randomKeyToRead(); if (index.isPresent()) { keyName = getKeyName(index.get(), threadName); readData(agedLoadBucket, keyName, index.get()); } } } catch (Throwable t) { LOG.error("AGED LOADGEN: Exiting due to exception", keyName, t); break; } } isWriteThreadRunning.set(false); LOG.info("Terminating IO thread:{}.", threadID); }
Source:
private boolean updateClusterCompatibilityVersionToOldCluster(boolean disableLock) { Version oldClusterVersion = getVm().getClusterCompatibilityVersionOrigin(); oldClusterVersion = oldClusterVersion == null ? Version.v3_6 : oldClusterVersion; if (isRestoreMemory() && getVm().getCustomCompatibilityVersion() == null && oldClusterVersion.less(getVm().getClusterCompatibilityVersion())) { VM vmFromDb = vmDao.get(getVmId()); return updateVm(vmFromDb, oldClusterVersion, disableLock); } return true; }

Target:
private boolean updateClusterCompatibilityVersionToOldCluster(boolean disableLock) { Version oldClusterVersion = getVm().getClusterCompatibilityVersionOrigin(); oldClusterVersion = oldClusterVersion == null ? Version.v3_6 : oldClusterVersion; if (isRestoreMemory() && getVm().getCustomCompatibilityVersion() == null && oldClusterVersion.less(getVm().getClusterCompatibilityVersion())) { VmStatic vmFromDb = vmStaticDao.get(getVmId()); return updateVm(vmFromDb, oldClusterVersion, disableLock); } return true; }
Source:
private List<Map<String, Object>> exitCodeAssertions() { List<Map<String, Object>> assertStatus = getConfig(ASSERT_STATUS); if (assertStatus.isEmpty()) { Map<String, Object> shouldSucceed = ImmutableMap.<String,Object>of(EQUALS, SUCCESS); assertStatus.add(shouldSucceed); } return assertStatus; }

Target:
private List<Map<String, Object>> exitCodeAssertions() { List<Map<String, Object>> assertStatus = getAssertions(this, ASSERT_STATUS); List<Map<String, Object>> assertOut = getAssertions(this, ASSERT_OUT); List<Map<String, Object>> assertErr = getAssertions(this, ASSERT_ERR); if (assertStatus.isEmpty() && assertOut.isEmpty() && assertErr.isEmpty()) { Map<String, Object> shouldSucceed = DEFAULT_ASSERTION; assertStatus.add(shouldSucceed); } return assertStatus; }
Source:
public DataObjectDeletedEvent(String source, DataModel currentModel, DataObject currentDataObject) { super(null, source, currentModel, currentDataObject); }

Target:
public DataObjectDeletedEvent(String source, DataModel currentModel, DataObject currentDataObject) { super(source, currentModel, currentDataObject); }
Source:
private void connector(IProject prj) { try { IRemoteConnection irc = Util.getRemoteConnection(prj); if(irc == null) return; Activator.log("Connection for project: '" + prj.getName() + "' is '" + irc + "'"); Activator.log("Connection address is " + irc.getAddress()); final ITerminalView tvr = (ITerminalView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView("org.eclipse.tm.terminal.view.TerminalView"); ITerminalConnector[] itcarray = TerminalConnectorExtension .makeTerminalConnectors(); int remoteTools = 0; for (int i = 0; i < itcarray.length; i++) { if("Remote Tools".equals(itcarray[i].getName())) { remoteTools = i; break; } } if(itcarray.length==0) { Activator.log("Could not find a terminal connection for "+prj.getName()); return; } final ITerminalConnector inner = itcarray[remoteTools]; Activator.log("inner="+inner.getId()+","+inner.getName()+","+inner.getSettingsSummary()); ITerminalConnector connector = new ConnectorWrapper(inner,prj); tvr.newTerminal(connector); } catch (CoreException e1) { Activator.log(e1); } }

Target:
private void connector(IProject prj) { try { IRemoteConnection irc = Util.getRemoteConnection(prj); if(irc == null) return; Activator.log("Connection for project: '" + prj.getName() + "' is '" + irc + "'"); Activator.log("Connection address is " + irc.getAddress()); final ITerminalView tvr = (ITerminalView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView("org.eclipse.tm.terminal.view.TerminalView"); ITerminalConnector[] itcarray = TerminalConnectorExtension .makeTerminalConnectors(); int remoteTools = -1; for (int i = 0; i < itcarray.length; i++) { if("Remote Tools".equals(itcarray[i].getName()) || "Remote Services".equals(itcarray[i].getName()) || "org.eclipse.ptp.remote.internal.terminal.RemoteToolsConnector".equals(itcarray[i].getId())) { remoteTools = i; break; } } if(itcarray.length==0) { Activator.log("Could not find a terminal connection for "+prj.getName()); return; } if(remoteTools >= 0) { final ITerminalConnector inner = itcarray[remoteTools]; Activator.log("inner="+inner.getId()+","+inner.getName()+","+inner.getSettingsSummary()); ITerminalConnector connector = inner; ISettingsStore store = new HashSettingsStore(); connector.save(store); store.put(RemoteSettings.PROJECT_NAME, prj.getName()); connector.load(store); tvr.newTerminal(connector); } } catch (CoreException e1) { Activator.log(e1); } }
Source:
public PropertyValues getClassPropertyValues(String wikiName, String className, String propertyName, Integer limit, List<String> filterParameters, Boolean isExactMatch) throws XWikiRestException { DocumentReference classReference = this.resolver.resolve(className, new WikiReference(wikiName)); ClassPropertyReference classPropertyReference = new ClassPropertyReference(propertyName, classReference); if (!this.authorization.hasAccess(Right.VIEW, classPropertyReference)) { throw new WebApplicationException(Status.UNAUTHORIZED); } if (!exists(classPropertyReference)) { throw new WebApplicationException(Status.NOT_FOUND); } URI propertyURI = Utils.createURI(this.uriInfo.getBaseUri(), ClassPropertyResource.class, wikiName, className, propertyName); Link propertyLink = this.objectFactory.createLink(); propertyLink.setHref(propertyURI.toString()); propertyLink.setRel(Relations.PROPERTY); PropertyValues propertyValues; if (isExactMatch) { propertyValues = this.propertyValuesProvider.getValue(classPropertyReference, filterParameters.toArray()); } else { propertyValues = this.propertyValuesProvider .getValues(classPropertyReference, limit, filterParameters.toArray()); } propertyValues.getLinks().add(propertyLink); return propertyValues; }

Target:
public PropertyValues getClassPropertyValues(String wikiName, String className, String propertyName, Integer limit, List<String> filterParameters, Boolean isExactMatch) throws XWikiRestException { DocumentReference classReference = this.resolver.resolve(className, new WikiReference(wikiName)); ClassPropertyReference classPropertyReference = new ClassPropertyReference(propertyName, classReference); if (!this.authorization.hasAccess(Right.VIEW, classPropertyReference)) { throw new WebApplicationException(Status.UNAUTHORIZED); } if (!exists(classPropertyReference)) { throw new WebApplicationException(Status.NOT_FOUND); } URI propertyURI = Utils.createURI(this.uriInfo.getBaseUri(), ClassPropertyResource.class, wikiName, className, propertyName); Link propertyLink = this.objectFactory.createLink(); propertyLink.setHref(propertyURI.toString()); propertyLink.setRel(Relations.PROPERTY); PropertyValues propertyValues = new PropertyValues(); if (isExactMatch) { for (String filterParameter : filterParameters) { PropertyValue value = this.propertyValuesProvider.getValue(classPropertyReference, filterParameter); if (value != null) { propertyValues.getPropertyValues().add(value); } } } else { propertyValues = this.propertyValuesProvider .getValues(classPropertyReference, limit, filterParameters.toArray()); } propertyValues.getLinks().add(propertyLink); return propertyValues; }
Source:
public void visitVariableIdentifier(VariableIdentifierTree tree) { if (!isBuiltInVariable(tree)) { if (classMemberUsageState == null) { createOrUseVariableIdentifierSymbol(tree); } else { if (classMemberUsageState.isSelfMember && classScope != null && classMemberUsageState.isStatic) { Symbol symbol = classScope.getSymbol(tree.text(), Symbol.Kind.FIELD); if (symbol != null) { symbol.addUsage(tree); symbolTable.associateSymbol(tree, symbol); } } Symbol symbol = currentScope.getSymbol(tree.text(), Symbol.Kind.VARIABLE, Symbol.Kind.PARAMETER); if (symbol != null) { symbol.addUsage(tree); symbolTable.associateSymbol(tree, symbol); } classMemberUsageState = null; } } }

Target:
public void visitVariableIdentifier(VariableIdentifierTree tree) { if (!isBuiltInVariable(tree)) { if (classMemberUsageState == null) { createOrUseVariableIdentifierSymbol(tree); } else { if (classMemberUsageState.isSelfMember && classScope != null && classMemberUsageState.isStatic) { Symbol symbol = classScope.getSymbol(tree.text(), Symbol.Kind.FIELD); if (symbol != null) { associateSymbol(tree, symbol); } } Symbol symbol = currentScope.getSymbol(tree.text(), Symbol.Kind.VARIABLE, Symbol.Kind.PARAMETER); if (symbol != null) { associateSymbol(tree, symbol); } classMemberUsageState = null; } } }
Source:
protected void registerFactorComparator(FactorComparator<T> comparator){ if (null == comparator || Integer.MAX_VALUE - this.getTotalWeight() < comparator.getWeight() ) { logger.info( "skipping registerFactorComparator as the comaractor is null or has an invalid weight value."); return; } this.factorComparatorList.put(comparator.getFactorName(),comparator); logger.info(String.format("Factor comparator added for '%s'. Weight = '%s'", comparator.getFactorName(), comparator.getWeight())); }

Target:
protected void registerFactorComparator(FactorComparator<T> comparator){ if (null == comparator || Integer.MAX_VALUE - this.getTotalWeight() < comparator.getWeight() ) { throw new IllegalArgumentException("unable to register comparator."+ " The passed comparator is null or has an invalid weight value."); } this.factorComparatorList.put(comparator.getFactorName(),comparator); logger.info(String.format("Factor comparator added for '%s'. Weight = '%s'", comparator.getFactorName(), comparator.getWeight())); }
Source:
public void run() { while (running) { try { numBytes += serialInput.read(buf, start + numBytes, buf.length - numBytes); while (true) { int numRead = peel(buf, start, numBytes); if (numRead == 0) { break; } start += numRead; numBytes -= numRead; } for (int i = 0; i < numBytes; i++) { buf[i] = buf[start + i]; } start = 0; try { Thread.sleep(asleepTime); } catch (InterruptedException e) { new RobobuggyLogicNotification("sleep .... interrupted?", RobobuggyMessageLevel.EXCEPTION); } } catch (IOException | NullPointerException | IndexOutOfBoundsException e) { sp.close(); setNodeState(NodeState.DISCONNECTED); e.printStackTrace(); } } }

Target:
public void run() { while (running) { try { numBytes += serialInput.read(buf, start + numBytes, buf.length - numBytes); while (true) { int numRead = peel(buf, start, numBytes); if (numRead == 0) { break; } start += numRead; numBytes -= numRead; } for (int i = 0; i < numBytes; i++) { buf[i] = buf[start + i]; } start = 0; try { Thread.sleep(asleepTime); } catch (InterruptedException e) { new RobobuggyLogicNotification("sleep .... interrupted?", RobobuggyMessageLevel.EXCEPTION); } } catch (IOException e) { sp.close(); setNodeState(NodeState.DISCONNECTED); e.printStackTrace(); } } }
Source:
public static List<Rule> createRules(ResourceBundle messages, Language language, Word2VecModel word2vecModel) { List<ScoredConfusionSet> confusionSets; try(InputStream confusionSetsStream = new FileInputStream(word2vecModel.getPath() + File.separator + CONFUSION_SET_FILENAME)) { confusionSets = ScoredConfusionSetLoader.loadConfusionSet(confusionSetsStream); } catch (IOException e) { System.err.println("Error: " + CONFUSION_SET_FILENAME + " not found for " + language.getShortCode() + "."); return new ArrayList<>(0); } List<Rule> neuralNetworkRules = new ArrayList<>(); for(ScoredConfusionSet confusionSet : confusionSets) { neuralNetworkRules.add(new NeuralNetworkRule(messages, language, confusionSet, word2vecModel)); } return neuralNetworkRules; }

Target:
public static List<Rule> createRules(ResourceBundle messages, Language language, Word2VecModel word2vecModel) throws IOException { List<ScoredConfusionSet> confusionSets; try(InputStream confusionSetsStream = new FileInputStream(word2vecModel.getPath() + File.separator + CONFUSION_SET_FILENAME)) { confusionSets = ScoredConfusionSetLoader.loadConfusionSet(confusionSetsStream); } catch (FileNotFoundException e) { System.err.println("Warning: " + CONFUSION_SET_FILENAME + " not found for " + language.getShortCode() + "."); return new ArrayList<>(0); } List<Rule> neuralNetworkRules = new ArrayList<>(); for(ScoredConfusionSet confusionSet : confusionSets) { neuralNetworkRules.add(new NeuralNetworkRule(messages, language, confusionSet, word2vecModel)); } return neuralNetworkRules; }
Source:
synchronized CompletableFuture<List<Map<Address, InternalCacheEntry<K, V>>>> requestState() { assert future == null; if (trace) log.tracef("Attempting to receive replicas for segment %s from %s with topology %s", segmentId, replicaHosts, topology); List<CompletableFuture<Void>> completableFutures = new ArrayList<>(); for (Address replica : replicaHosts) { if (replica.equals(rpcManager.getAddress())) { dataContainer.forEach(entry -> { int keySegment = topology.getDistribution(entry.getKey()).segmentId(); if (keySegment == segmentId) { addKeyToReplicaMap(replica, entry); } }); } else { InboundTransferTask transferTask = createTransferTask(segmentId, replica, topology); transferTaskMap.put(replica, transferTask); completableFutures.add(transferTask.requestSegments()); } } future = CompletableFuture .allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])) .thenApply(aVoid -> { List<Map<Address, InternalCacheEntry<K, V>>> retVal = keyReplicaMap.entrySet().stream() .map(Map.Entry::getValue) .collect(Collectors.toList()); keyReplicaMap.clear(); transferTaskMap.clear(); requestMap.remove(segmentId); return Collections.unmodifiableList(retVal); }); future.exceptionally(throwable -> { if (trace) log.tracef(throwable, "Exception when processing InboundTransferTask for cache %s", cacheName); cancel(throwable); return null; }); return future; }

Target:
synchronized CompletableFuture<List<Map<Address, CacheEntry<K, V>>>> requestState() { assert future == null; if (trace) log.tracef("Attempting to receive replicas for segment %s from %s with topology %s", segmentId, replicaHosts, topology); List<CompletableFuture<Void>> completableFutures = new ArrayList<>(); for (Address replica : replicaHosts) { if (replica.equals(rpcManager.getAddress())) { dataContainer.forEach(entry -> { int keySegment = topology.getDistribution(entry.getKey()).segmentId(); if (keySegment == segmentId) { addKeyToReplicaMap(replica, entry); } }); } else { InboundTransferTask transferTask = createTransferTask(segmentId, replica, topology); transferTaskMap.put(replica, transferTask); completableFutures.add(transferTask.requestSegments()); } } future = CompletableFuture .allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])) .thenApply(aVoid -> { List<Map<Address, CacheEntry<K, V>>> retVal = keyReplicaMap.entrySet().stream() .map(Map.Entry::getValue) .collect(Collectors.toList()); keyReplicaMap.clear(); transferTaskMap.clear(); requestMap.remove(segmentId); return Collections.unmodifiableList(retVal); }); future.exceptionally(throwable -> { if (trace) log.tracef(throwable, "Exception when processing InboundTransferTask for cache %s", cacheName); cancel(throwable); return null; }); return future; }
Source:
public void close() { try { Closeables.close(pathChildrenCache, true); } catch (IOException exc) { logger.warn("IOException should not have been thrown.", exc); } }

Target:
public void close() { try { Closeables.close(pathChildrenCache, true); } catch (IOException exc) { logger.error("IOException should not have been thrown.", exc); } }