auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private ObjectId storeCommentsInNotes() throws OrmException, IOException { ChangeNotes notes = ctl.getNotes(); notes.load(); NoteMap noteMap = notes.getNoteMap(); if (noteMap == null) { noteMap = NoteMap.newEmptyMap(); } if (commentsForPs.isEmpty() && commentsForBase.isEmpty()) { return null; } Multimap<PatchSet.Id, PatchLineComment> allCommentsOnBases = notes.getBaseComments(); Multimap<PatchSet.Id, PatchLineComment> allCommentsOnPs = notes.getPatchSetComments(); if (!commentsForBase.isEmpty()) { List<PatchLineComment> baseCommentsForThisPs = new ArrayList<>(allCommentsOnBases.get(psId)); baseCommentsForThisPs.addAll(commentsForBase); commentsUtil.writeCommentsToNoteMap(noteMap, baseCommentsForThisPs, inserter); } if (!commentsForPs.isEmpty()) { List<PatchLineComment> commentsForThisPs = new ArrayList<>(allCommentsOnPs.get(psId)); commentsForThisPs.addAll(commentsForPs); commentsUtil.writeCommentsToNoteMap(noteMap, commentsForThisPs, inserter); } return noteMap.writeTree(inserter); }

Target:
private ObjectId storeCommentsInNotes() throws OrmException, IOException { ChangeNotes notes = ctl.getNotes().load(); NoteMap noteMap = notes.getNoteMap(); if (noteMap == null) { noteMap = NoteMap.newEmptyMap(); } if (commentsForPs.isEmpty() && commentsForBase.isEmpty()) { return null; } Multimap<PatchSet.Id, PatchLineComment> allCommentsOnBases = notes.getBaseComments(); Multimap<PatchSet.Id, PatchLineComment> allCommentsOnPs = notes.getPatchSetComments(); if (!commentsForBase.isEmpty()) { List<PatchLineComment> baseCommentsForThisPs = new ArrayList<>(allCommentsOnBases.get(psId)); baseCommentsForThisPs.addAll(commentsForBase); commentsUtil.writeCommentsToNoteMap(noteMap, baseCommentsForThisPs, inserter); } if (!commentsForPs.isEmpty()) { List<PatchLineComment> commentsForThisPs = new ArrayList<>(allCommentsOnPs.get(psId)); commentsForThisPs.addAll(commentsForPs); commentsUtil.writeCommentsToNoteMap(noteMap, commentsForThisPs, inserter); } return noteMap.writeTree(inserter); }
Source:
public NetRC(File netrc) { this.netrc = netrc; }

Target:
public NetRC(File netrc) { this.netrc = netrc; parse(); }
Source:
public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { e1.printStackTrace(); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); command.requiresAuthentication(true); CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } SetReviewCommand command2 = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "+2"); reviewInput.setLabels(obj); command2.setReviewInput(reviewInput); command2.requiresAuthentication(true); ReviewInfo result2 = null; try { result2 = command2.call(); } catch (EGerritException e) { fail(e.getMessage()); } PublishDraftRevisionCommand command3 = fGerrit.publishDraftRevision(change_id, commit_id); command3.requiresAuthentication(true); String result3 = null; try { result3 = command3.call(); } catch (EGerritException e) { fail(e.getMessage()); } System.out.println(result3); assertTrue(true); }

Target:
public void testCall() { String change_id = null; String commit_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !\n This is the second line \n"); gAccess.pushFile(); change_id = gAccess.getChangeId(); commit_id = gAccess.getCommitId(); } catch (Exception e1) { fail(e1.getMessage()); } CreateDraftCommand command = fGerrit.createDraftComments(change_id, commit_id); CommentInfo commentInfo = new CommentInfo(); commentInfo.setLine(2); commentInfo.setMessage("This is a test comment"); commentInfo.setPath("EGerritTestReviewFile.java"); command.setCommentInfo(commentInfo); CommentInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } SetReviewCommand command2 = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "+2"); reviewInput.setLabels(obj); command2.setReviewInput(reviewInput); ReviewInfo result2 = null; try { result2 = command2.call(); } catch (EGerritException e) { fail(e.getMessage()); } PublishDraftRevisionCommand command3 = fGerrit.publishDraftRevision(change_id, commit_id); String result3 = null; try { result3 = command3.call(); } catch (EGerritException e) { fail(e.getMessage()); } System.out.println(result3); assertTrue(true); }
Source:
public void editingLocalCss_008_MonobookUserWithAdminRightsOpensSpecialCss() { WikiBasePageObject wiki = new WikiBasePageObject(driver, Global.DOMAIN); wiki.openWikiPage(); CommonFunctions.logInMonobook(Properties.userNameMonobook, Properties.passwordMonobook, driver); WikiArticleUserMonoBookPageObject monobookArticle = new WikiArticleUserMonoBookPageObject(driver); monobookArticle.openArticle(this.specialCSS); monobookArticle.verifyOasisOnly(); }

Target:
public void editingLocalCss_008_MonobookUserWithAdminRightsOpensSpecialCss() { SpecialUserLoginMonobookPageObject loginMonobook = new SpecialUserLoginMonobookPageObject(driver); loginMonobook.open(); loginMonobook.fillLoginForm(Properties.userNameMonobook, Properties.passwordMonobook, ""); loginMonobook.submitForm(); loginMonobook.verifyLogin(); WikiArticleMonoBookPageObject monobookArticle = new WikiArticleMonoBookPageObject(driver); monobookArticle.openArticle(URLsContent.specialCSS); monobookArticle.verifyOasisOnly(); }
Source:
public void deleteByQProfileAndUser(DbSession dbSession, QProfileDto profile, UserDto user) { mapper(dbSession).delete(profile.getKee(), user.getLogin()); }

Target:
public void deleteByQProfileAndUser(DbSession dbSession, QProfileDto profile, UserDto user) { mapper(dbSession).delete(profile.getKee(), user.getId()); }
Source:
private PositionInfo findMovePositionInfo(MUIElement element) { if (element != null) { for (String tag : element.getTags()) { if (tag.startsWith(MOVE_TAG)) { return PositionInfo.parse(tag.substring(5)); } } } return null; }

Target:
private PositionInfo findMovePositionInfo(MUIElement element) { if (element != null) { for (String tag : element.getTags()) { if (tag.startsWith(MOVE_TAG)) { return PositionInfo.parse(tag.substring(MOVE_TAG.length())); } } } return null; }
Source:
private void validateRequest() { if (this.dataClass != null && this.dataClass == HtsgetClass.header && ( this.interval != null || !this.fields.isEmpty() || !this.tags.isEmpty() || !this.notags.isEmpty())) { throw new IllegalArgumentException("Invalid request: no query parameters except `format` may be specified when class=header"); } if (this.format != null) { final String path = this.endpoint.getPath(); if ((path.endsWith(FileExtensions.BAM) || path.endsWith(FileExtensions.SAM) && ( this.format != HtsgetFormat.BAM && this.format != HtsgetFormat.CRAM)) || FileExtensions.VCF_LIST.stream().anyMatch(path::endsWith) && ( this.format != HtsgetFormat.VCF && this.format != HtsgetFormat.BCF)) { throw new IllegalArgumentException("Specified format: " + this.format + " is incompatible with id's file extension"); } } final String intersections = this.tags.stream() .filter(getNoTags()::contains) .collect(Collectors.joining(", ")); if (!intersections.isEmpty()) { throw new IllegalArgumentException("Invalid request: tags and notags overlap in the following fields: " + intersections); } }

Target:
private void validateRequest() { if (this.dataClass != null && this.dataClass == HtsgetClass.header && ( this.interval != null || !this.fields.isEmpty() || !this.tags.isEmpty() || !this.notags.isEmpty())) { throw new IllegalArgumentException("Invalid request: no query parameters except `format` may be specified when class=header"); } if (this.format != null) { final String path = this.endpoint.getPath(); if ((path.endsWith(FileExtensions.BAM) || path.endsWith(FileExtensions.CRAM)) && ( this.format != HtsgetFormat.BAM && this.format != HtsgetFormat.CRAM)) { throw new IllegalArgumentException("Specified reads format: " + this.format + " is incompatible with id's file extension " + path); } if (FileExtensions.VCF_LIST.stream().anyMatch(path::endsWith) && ( this.format != HtsgetFormat.VCF && this.format != HtsgetFormat.BCF)) { throw new IllegalArgumentException("Specified variant format: " + this.format + " is incompatible with id's file extension " + path); } } final String intersections = this.tags.stream() .filter(getNoTags()::contains) .collect(Collectors.joining(", ")); if (!intersections.isEmpty()) { throw new IllegalArgumentException("Invalid request: tags and notags overlap in the following fields: " + intersections); } }
Source:
public AppEngineCredentials(Collection<String> scopes, AppIdentityService appIdentityService) { this.scopes = scopes; this.appIdentityService = appIdentityService != null ? appIdentityService : AppIdentityServiceFactory.getAppIdentityService(); scopesRequired = (scopes == null || scopes.isEmpty()); }

Target:
public AppEngineCredentials(Collection<String> scopes, AppIdentityService appIdentityService) { this.scopes = ImmutableList.copyOf(scopes); this.appIdentityService = appIdentityService != null ? appIdentityService : AppIdentityServiceFactory.getAppIdentityService(); scopesRequired = (scopes == null || scopes.isEmpty()); }
Source:
public static <T> T bytes2obj(Marshaller marshaller, byte[] bytes) { if (bytes == null) return null; try { Object ret = marshaller.objectFromByteBuffer(bytes); if (ret instanceof byte[]) { try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream((byte[]) ret))) { return (T) ois.readObject(); } catch (Exception ee) { if (log.isDebugEnabled()) log.debugf("Standard deserialization not in use for %s", Util.printArray(bytes)); } } return (T) ret; } catch (Exception e) { throw log.unableToUnmarshallBytes(Util.toHexString(bytes), e); } }

Target:
public static <T> T bytes2obj(Marshaller marshaller, byte[] bytes) { if (bytes == null) return null; try { Object ret = marshaller.objectFromByteBuffer(bytes); if (ret instanceof byte[] && isJavaSerialized((byte[]) ret)) { try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream((byte[]) ret))) { return (T) ois.readObject(); } catch (Exception ee) { if (log.isDebugEnabled()) log.debugf("Standard deserialization not in use for %s", Util.printArray(bytes)); } } return (T) ret; } catch (Exception e) { throw log.unableToUnmarshallBytes(Util.toHexString(bytes), e); } }
Source:
public void removeAll(Collection<IClass> toRemove) { toRemove.stream().map(IClass::getName) .peek(loadedClasses::remove) .forEach(sourceMap::remove); }

Target:
public void removeAll(Collection<IClass> toRemove) { if (toRemove == null) { throw new IllegalArgumentException("toRemove is null"); } toRemove.stream().map(IClass::getName) .peek(loadedClasses::remove) .forEach(sourceMap::remove); }
Source:
private String getSaveAsADraftButtonText() { if (!userCanPublishPosts()) { return getString(R.string.submit_for_review); } switch (PostStatus.fromPost(mPost)) { case DRAFT: return getString(R.string.menu_publish_now); case PUBLISHED: case UNKNOWN: default: if (!isNewPost()) { return getString(R.string.menu_publish_now); } else { return getString(R.string.menu_save_as_draft); } } }

Target:
private String getSaveAsADraftButtonText() { if (!userCanPublishPosts()) { return getString(R.string.submit_for_review); } switch (PostStatus.fromPost(mPost)) { case DRAFT: return getString(R.string.menu_publish_now); case PUBLISHED: case UNKNOWN: if (mPost.isLocalDraft()) { return getString(R.string.menu_publish_now); } else { return getString(R.string.update_verb); } case PRIVATE: case PENDING: case TRASHED: case SCHEDULED: default: if (!isNewPost()) { return getString(R.string.menu_publish_now); } else { return getString(R.string.menu_save_as_draft); } } }
Source:
public void setCreatedAt(final Timestamp value) { this._createdAt = value; }

Target:
public void setCreatedAt(final Timestamp value) { _createdAt = value; }
Source:
public void inventoryMode() throws Exception { testOrderAspect(builder -> { builder.inventoryMode(null); }, order -> assertThat(order.getInventoryMode()).isEqualTo(InventoryMode.NONE)); testOrderAspect(builder -> { builder.inventoryMode(InventoryMode.NONE); }, order -> assertThat(order.getInventoryMode()).isEqualTo(InventoryMode.NONE)); }

Target:
public void inventoryMode() throws Exception { testOrderAspect(builder -> { builder.inventoryMode(null); }, order -> assertThat(order.getInventoryMode()).isEqualTo(InventoryMode.NONE)); withProductOfStock(client(), 5, product -> { final int variantId = 1; final String sku = product.getMasterData().getStaged().getMasterVariant().getSku(); final String productId = product.getId(); final LocalizedString name = en("a name"); final long quantity = 1; final Price price = Price.of(EURO_10); final OrderState orderState = OrderState.COMPLETE; final MonetaryAmount amount = EURO_10; final ProductVariantImportDraft variant = ProductVariantImportDraftBuilder.of(productId, variantId, sku).build(); final LineItemImportDraft lineItemImportDraft = LineItemImportDraftBuilder.of(variant, quantity, price, name).build(); final OrderImportDraft orderImportDraft = OrderImportDraftBuilder.ofLineItems(amount, orderState, asList(lineItemImportDraft)) .inventoryMode(InventoryMode.TRACK_ONLY).build(); final OrderImportCommand cmd = OrderImportCommand.of(orderImportDraft); final Order order = client().executeBlocking(cmd); assertThat(order.getInventoryMode()).isEqualTo(InventoryMode.TRACK_ONLY); client().executeBlocking(OrderDeleteCommand.of(order)); }); }
Source:
public void testCurrencySelection() { ArrayList<String> currenciestoUpdate = new ArrayList<String>(); currenciestoUpdate.add("KES"); currenciestoUpdate.add("BND"); currenciestoUpdate.add("LBP"); currenciestoUpdate.add("GHC"); currenciestoUpdate.add("USD"); ArrayList currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec, currenciestoUpdate); Assert.assertNotNull(currenciesOutput); Assert.assertEquals("Verifying Do Outputed Currencies Match after Updation", currenciestoUpdate, currenciesOutput); ArrayList<CurrencyDomain> currenciesBeforeUpdate = new ArrayList<CurrencyDomain>(); for (String e : currenciestoUpdate) currenciesBeforeUpdate.add(CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, e)); Collections.sort(currenciesBeforeUpdate); ArrayList<CurrencyDomain> currenciesAfterUpdate = CurrenciesHelper.getSelectedCurrencies(requestSpec, responseSpec); Assert.assertNotNull(currenciesAfterUpdate); Assert.assertEquals("Verifying Do Selected Currencies Match after Updation", currenciesBeforeUpdate, currenciesAfterUpdate); }

Target:
public void testCurrencySelection() { ArrayList<String> currenciestoUpdate = new ArrayList<String>(); currenciestoUpdate.add("KES"); currenciestoUpdate.add("BND"); currenciestoUpdate.add("LBP"); currenciestoUpdate.add("GHC"); currenciestoUpdate.add("USD"); ArrayList<String> currenciesOutput = CurrenciesHelper.updateSelectedCurrencies(this.requestSpec, this.responseSpec, currenciestoUpdate); Assert.assertNotNull(currenciesOutput); Assert.assertEquals("Verifying Do Outputed Currencies Match after Updation", currenciestoUpdate, currenciesOutput); ArrayList<CurrencyDomain> currenciesBeforeUpdate = new ArrayList<CurrencyDomain>(); for (String e : currenciestoUpdate) { currenciesBeforeUpdate.add(CurrenciesHelper.getCurrencybyCode(requestSpec, responseSpec, e)); } Collections.sort(currenciesBeforeUpdate); ArrayList<CurrencyDomain> currenciesAfterUpdate = CurrenciesHelper.getSelectedCurrencies(requestSpec, responseSpec); Assert.assertNotNull(currenciesAfterUpdate); Assert.assertEquals("Verifying Do Selected Currencies Match after Updation", currenciesBeforeUpdate, currenciesAfterUpdate); }
Source:
final void afterDeserialization(Boolean readOnlyBeforeAttachedToSession, String sessionFactoryUuid, boolean allowLoadOutsideTransaction) { if ( isReadOnlySettingAvailable() ) { throw new IllegalStateException( "Cannot call afterDeserialization when isReadOnlySettingAvailable == true [" + entityName + "#" + id + "]" ); } this.readOnlyBeforeAttachedToSession = readOnlyBeforeAttachedToSession; this.allowLoadOutsideTransaction = allowLoadOutsideTransaction; if ( allowLoadOutsideTransaction ) { this.sessionFactoryUuid = sessionFactoryUuid; } }

Target:
final void afterDeserialization(Boolean readOnlyBeforeAttachedToSession, String sessionFactoryUuid, boolean allowLoadOutsideTransaction) { if ( isReadOnlySettingAvailable() ) { throw new IllegalStateException( "Cannot call afterDeserialization when isReadOnlySettingAvailable == true [" + entityName + "#" + id + "]" ); } this.readOnlyBeforeAttachedToSession = readOnlyBeforeAttachedToSession; this.sessionFactoryUuid = sessionFactoryUuid; this.allowLoadOutsideTransaction = allowLoadOutsideTransaction; }
Source:
boolean StopDetector(float distance_d, int stop_type, float speed) { float lastToSecDistance = lastCoords.distanceTo(secondToLastCoords); Log.d(TAG, "Detecting stop. distance_d=" + distance_d + ". stop_type=" + stop_type + " speed=" + speed); if (stop_type == 1) { if ((distance_d > 50) && (distance_d < 100) && (distance_d != -1) && !m100_a) { m100_a = true; Log.d(TAG, "Case 1: false"); return false; } if ((distance_d > 20) && (distance_d < 50) && (distance_d != -1) && !m50_a) { m50_a = true; Log.d(TAG, "Case 2: false"); return false; } if ((distance_d < 20) && (distance_d != -1) && !m20_a) { m20_a = true; if ((speed > 15) && (lastToSecDistance < 100)) { Log.d(TAG, "Case 3: true"); return true; } Log.d(TAG, "Case 3: false"); return false; } if ((distance_d < 20) && (distance_d != -1) && m20_a && !m20_d) { m20_d = true; if (speed < 10) { Log.d(TAG, "Case 4: false"); return false; } else if (speed > 15) { Log.d(TAG, "Case 4: true"); return true; } } if ((distance_d > 20) && (distance_d < 50) && (distance_d != -1) && !m50_d && (m20_d || m20_a)) { m50_d = true; Log.d(TAG, "Case 5: true"); return true; } } return false; }

Target:
boolean StopDetector(float distance_d, int stop_type, float speed) { float lastToSecDistance = lastCoords.distanceTo(secondToLastCoords); Log.d(TAG, "Detecting stop. distance_d=" + distance_d + ". stop_type=" + stop_type + " speed=" + speed); if (stop_type == 1) { if ((distance_d > 50) && (distance_d < 100) && (distance_d != -1) && !m100_a) { m100_a = true; Log.d(TAG, "Case 1: false"); return false; } if ((distance_d > 20) && (distance_d < 50) && (distance_d != -1) && !m50_a) { m50_a = true; Log.d(TAG, "Case 2: false"); return false; } if ((distance_d < 20) && (distance_d != -1) && !m20_a) { m20_a = true; if (speed > 15 && lastToSecDistance < 100) { Log.d(TAG, "Case 3: true"); return true; } Log.d(TAG, "Case 3: false"); return false; } if ((distance_d < 20) && (distance_d != -1) && m20_a && !m20_d) { m20_d = true; if (speed < 10) { Log.d(TAG, "Case 4: false"); return false; } else if (speed > 15) { Log.d(TAG, "Case 4: true"); return true; } } if ((distance_d > 20) && (distance_d < 50) && (distance_d != -1) && !m50_d && (m20_d || m20_a)) { m50_d = true; Log.d(TAG, "Case 5: true"); return true; } } return false; }
Source:
public void takeLeadership(CuratorFramework curatorFramework) throws Exception { try { if (currentLeader != null) { String[] address = currentLeader.getId().split(":"); String host = address[0]; int port = Integer.parseInt(address[1]); OracleService.Client client = getOracleClient(host, port); if (client != null) { try { while (client.isLeader()) { Thread.sleep(500); } } catch (Exception e) { log.debug("Exception thrown in takeLeadership()", e); } } } synchronized (this) { isLeader = true; while (!curatorFramework.getState().equals(CuratorFrameworkState.STARTED)) { Thread.sleep(100); } byte[] d = curatorFramework.getData().forPath(maxTsPath); currentTs = maxTs = LongUtil.fromByteArray(d); } gcTsTracker = new GcTimestampTracker(); gcTsTracker.start(); while (started) { Thread.sleep(100); } } finally { isLeader = false; if (started) { Halt.halt("Oracle has lost leadership unexpectedly and is now halting."); } } }

Target:
public void takeLeadership(CuratorFramework curatorFramework) throws Exception { try { if (currentLeader != null) { String[] address = currentLeader.getId().split(":"); String host = address[0]; int port = Integer.parseInt(address[1]); OracleService.Client client = getOracleClient(host, port); if (client != null) { try { while (client.isLeader()) { Thread.sleep(500); } } catch (Exception e) { log.debug("Exception thrown in takeLeadership()", e); } } } synchronized (this) { isLeader = true; byte[] d = curatorFramework.getData().forPath(maxTsPath); currentTs = maxTs = LongUtil.fromByteArray(d); } gcTsTracker = new GcTimestampTracker(); gcTsTracker.start(); while (started) { Thread.sleep(100); } } finally { isLeader = false; if (started) { Halt.halt("Oracle has lost leadership unexpectedly and is now halting."); } } }
Source:
public void changeLimitForPeriod(final int limitForPeriod) { E newConfig = state.get().getConfig() .withLimitForPeriod(limitForPeriod); state.updateAndGet(currentState -> currentState.withConfig(newConfig)); }

Target:
public void changeLimitForPeriod(final int limitForPeriod) { try { E newConfig = withLimitForPeriod(limitForPeriod, state.get().getConfig()); state.updateAndGet(currentState -> currentState.withConfig(newConfig)); } catch (ConfigBuilderHelper.NonRegisteredConfig e) { throw new IllegalStateException("Please override method",e); } }
Source:
private void updatePlacesByLocation() { removeHiddenLocations(); Collections.sort(allLocations, new Comparator<MITMapPlace>() { @Override public int compare(MITMapPlace lhs, MITMapPlace rhs) { Location placeLocation1 = new Location("place1"); placeLocation1.setLatitude(lhs.getLatitude()); placeLocation1.setLongitude(lhs.getLongitude()); Location placeLocation2 = new Location("place2"); placeLocation2.setLatitude(rhs.getLatitude()); placeLocation2.setLongitude(rhs.getLongitude()); float distance1 = 0; float distance2 = 0; if (location != null) { distance1 = placeLocation1.distanceTo(location); distance2 = placeLocation2.distanceTo(location); } if (distance1 > distance2) { return 1; } else if (distance1 < distance2) { return -1; } else { return 0; } } }); for (int i = 0; i < NEARBY_LOCATION_MAX_COUNT; i++) { places.add(allLocations.get(i)); } placeAdapter.notifyDataSetChanged(); }

Target:
private void updatePlacesByLocation() { removeHiddenLocations(); Collections.sort(allLocations, new Comparator<MITMapPlace>() { @Override public int compare(MITMapPlace lhs, MITMapPlace rhs) { Location placeLocation1 = new Location("place1"); placeLocation1.setLatitude(lhs.getLatitude()); placeLocation1.setLongitude(lhs.getLongitude()); Location placeLocation2 = new Location("place2"); placeLocation2.setLatitude(rhs.getLatitude()); placeLocation2.setLongitude(rhs.getLongitude()); float distance1 = 0; float distance2 = 0; if (location != null) { distance1 = placeLocation1.distanceTo(location); distance2 = placeLocation2.distanceTo(location); } return Float.compare(distance1, distance2); } }); for (int i = 0; i < NEARBY_LOCATION_MAX_COUNT; i++) { places.add(allLocations.get(i)); } placeAdapter.notifyDataSetChanged(); }
Source:
public void testConfigure_WithoutValues() throws PropertyAccessException { CONNECTTestClient<TestServicePortType> testClient = new CONNECTTestClient<>( new TestServicePortDescriptor()); ServiceEndpoint<TestServicePortType> serviceEndpoint = testClient.getServiceEndpoint(); final PropertyAccessor mockPropAccessor = mock(PropertyAccessor.class); AssertionType assertion = new AssertionType(); assertion.setKeepAlive("true"); CONNECTCustomHttpHeadersType assertionHeaders = new CONNECTCustomHttpHeadersType(); assertionHeaders.setHeaderName("headerName"); assertionHeaders.setHeaderValue("headerValue"); assertion.getCONNECTCustomHttpHeaders().add(assertionHeaders); HttpHeaderServiceEndpointDecorator headerDecorator = new HttpHeaderServiceEndpointDecorator(serviceEndpoint, assertion) { }; headerDecorator.configure(); validateConfiguration(headerDecorator); }

Target:
public void testConfigure_WithoutValues() throws PropertyAccessException { final CONNECTTestClient<TestServicePortType> testClient = new CONNECTTestClient<>( new TestServicePortDescriptor()); final ServiceEndpoint<TestServicePortType> serviceEndpoint = testClient.getServiceEndpoint(); final AssertionType assertion = new AssertionType(); final HttpHeaderServiceEndpointDecorator headerDecorator = new HttpHeaderServiceEndpointDecorator( serviceEndpoint, assertion); headerDecorator.configure(); final BindingProvider bp = (BindingProvider) headerDecorator.getPort(); final Map<String, List<String>> bpMap = (Map<String, List<String>>) bp.getRequestContext() .get(NhincConstants.CUSTOM_HTTP_HEADERS); assertNull(bpMap); }
Source:
protected BundleContext getBundleContext() { final BundleContext bundleContext = this.bundleContext; if (bundleContext != null) { return bundleContext; } else { throw new IllegalStateException( "The bundle context is missing (it seems your thing handler is used but not active)."); } }

Target:
protected BundleContext getBundleContext() { final BundleContext bundleContext = this.bundleContext; if (bundleContext != null) { return bundleContext; } else { throw new IllegalStateException( "The bundle context is missing (it seems your thing handler factory is used but not active)."); } }
Source:
private void setLocaleWith(Locale locale) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException { Class<?> activityManagerNativeClass = Class.forName("android.app.ActivityManagerNative"); Object amn; Configuration config; Method methodGetDefault = activityManagerNativeClass.getMethod("getDefault"); methodGetDefault.setAccessible(true); amn = methodGetDefault.invoke(activityManagerNativeClass); if (Build.VERSION.SDK_INT >= 26) { activityManagerNativeClass = Class.forName(amn.getClass().getName()); } Method methodGetConfiguration = activityManagerNativeClass.getMethod("getConfiguration"); methodGetConfiguration.setAccessible(true); config = (Configuration) methodGetConfiguration.invoke(amn); Class<?> configClass = config.getClass(); Field f = configClass.getField("userSetLocale"); f.setBoolean(config, true); config.locale = locale; Method methodUpdateConfiguration = activityManagerNativeClass.getMethod("updateConfiguration", Configuration.class); methodUpdateConfiguration.setAccessible(true); methodUpdateConfiguration.invoke(amn, config); }

Target:
private void setLocaleWith(Locale locale) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException { Class<?> activityManagerNativeClass = Class.forName("android.app.ActivityManagerNative"); Method methodGetDefault = activityManagerNativeClass.getMethod("getDefault"); methodGetDefault.setAccessible(true); Object amn = methodGetDefault.invoke(activityManagerNativeClass); if (Build.VERSION.SDK_INT >= 26) { activityManagerNativeClass = Class.forName(amn.getClass().getName()); } Method methodGetConfiguration = activityManagerNativeClass.getMethod("getConfiguration"); methodGetConfiguration.setAccessible(true); Configuration config = (Configuration) methodGetConfiguration.invoke(amn); Class<?> configClass = config.getClass(); Field f = configClass.getField("userSetLocale"); f.setBoolean(config, true); config.locale = locale; Method methodUpdateConfiguration = activityManagerNativeClass.getMethod("updateConfiguration", Configuration.class); methodUpdateConfiguration.setAccessible(true); methodUpdateConfiguration.invoke(amn, config); }
Source:
public Builder( Class<?> beanClass, ConstrainedExecutable constrainedExecutable, ConstraintHelper constraintHelper, ExecutableHelper executableHelper, MethodValidationConfiguration methodValidationConfiguration) { super( beanClass, constraintHelper ); this.executableHelper = executableHelper; kind = constrainedExecutable.getKind(); executable = constrainedExecutable.getExecutable(); add( constrainedExecutable ); this.methodValidationConfiguration = methodValidationConfiguration; this.rules = new HashSet<MethodConfigurationRule>(); for ( Class<? extends MethodConfigurationRule> ruleClass : this.methodValidationConfiguration.getConfiguredRuleSet() ) { try { this.rules.add( ruleClass.newInstance() ); } catch ( InstantiationException e ) { throw new IllegalArgumentException( "Failed to create " + ruleClass.getName() + " with error " + e.toString() ); } catch ( IllegalAccessException e ) { throw new IllegalArgumentException( "Failed to create " + ruleClass.getName() + " with error " + e.toString() ); } } }

Target:
public Builder( Class<?> beanClass, ConstrainedExecutable constrainedExecutable, ConstraintHelper constraintHelper, ExecutableHelper executableHelper, MethodValidationConfiguration methodValidationConfiguration) { super( beanClass, constraintHelper ); this.executableHelper = executableHelper; kind = constrainedExecutable.getKind(); executable = constrainedExecutable.getExecutable(); add( constrainedExecutable ); this.methodValidationConfiguration = methodValidationConfiguration; this.rules = new HashSet<MethodConfigurationRule>(); for ( Class<? extends MethodConfigurationRule> ruleClass : this.methodValidationConfiguration.getConfiguredRuleSet() ) { MethodConfigurationRule rule = run( NewInstance.action( ruleClass, "Method configuration rule" ) ); this.rules.add( rule ); } }
Source:
public int nextAreaZoneId() { int desiredID = getServerZone().getMaxZoneID() + 1; while (desiredID < 5 || getServerZone().getAreaZone(desiredID) != null) { getServerZone().nextZoneID(); desiredID = getServerZone().getMaxZoneID() + 1; } return desiredID; }

Target:
public int nextAreaZoneId() { int desiredID = getServerZone().getMaxZoneID() + 1; while (desiredID < RESERVED_ID_COUNT || getServerZone().getAreaZone(desiredID) != null) { getServerZone().nextZoneID(); desiredID = getServerZone().getMaxZoneID() + 1; } return desiredID; }
Source:
public Consumer setUuid(String uuid) { if (this.uuid == null) { this.uuid = uuid; } return this; }

Target:
public Consumer setUuid(String uuid) { this.uuid = uuid; return this; }
Source:
public IncomingPhoneNumber checkIncomingPhoneNumberRegexMatch ( String selector, String inBoundPhoneNumber){ final SqlSession session = sessions.openSession(); String phoneRegexPattern = null; try { List<IncomingPhoneNumber> listPhones = getAllIncomingPhoneNumbers(); for (IncomingPhoneNumber listPhone : listPhones){ if (listPhone.getPhoneNumber().startsWith("+")){ phoneRegexPattern = listPhone.getPhoneNumber().replace("+", "/+"); }else if (listPhone.getPhoneNumber().startsWith("*")){ phoneRegexPattern = listPhone.getPhoneNumber().replace("*", "/*"); }else{ phoneRegexPattern = listPhone.getPhoneNumber(); } Pattern p = Pattern.compile(phoneRegexPattern); Matcher m = p.matcher(inBoundPhoneNumber); if (m.find()) { final Map<String, Object> resultRestcommRegexHostedNumber = session.selectOne(namespace + selector, phoneRegexPattern); if (resultRestcommRegexHostedNumber != null) { return toIncomingPhoneNumber(resultRestcommRegexHostedNumber); }else{ logger.error("Error, Regex check returns a null value " ); } } } logger.warn("No matching phone number found, make sure your Restcomm Regex phone number is correctly defined"); }finally { session.close(); } return null; }

Target:
public IncomingPhoneNumber checkIncomingPhoneNumberRegexMatch ( String selector, String inBoundPhoneNumber){ final SqlSession session = sessions.openSession(); String phoneRegexPattern = null; try { List<IncomingPhoneNumber> listPhones = getIncomingPhoneNumbersRegex(); if (logger.isInfoEnabled()) { String msg = String.format("Found %d Regex IncomingPhone numbers",listPhones.size()); logger.info(msg); } for (IncomingPhoneNumber listPhone : listPhones){ if (listPhone.getPhoneNumber().startsWith("+")){ phoneRegexPattern = listPhone.getPhoneNumber().replace("+", "/+"); }else if (listPhone.getPhoneNumber().startsWith("*")){ phoneRegexPattern = listPhone.getPhoneNumber().replace("*", "/*"); }else{ phoneRegexPattern = listPhone.getPhoneNumber(); } Pattern p = Pattern.compile(phoneRegexPattern); Matcher m = p.matcher(inBoundPhoneNumber); if (m.find()) { final Map<String, Object> resultRestcommRegexHostedNumber = session.selectOne(namespace + selector, phoneRegexPattern); if (resultRestcommRegexHostedNumber != null) { if (logger.isInfoEnabled()) { String msg = String.format("Pattern \"%s\" matched the phone number \"%s\"",phoneRegexPattern, inBoundPhoneNumber); logger.info(msg); } return toIncomingPhoneNumber(resultRestcommRegexHostedNumber); } else{ if (logger.isInfoEnabled()) { String msg = String.format("Error, Regex \"%s\" cannot be matched for phone number \"%s\"", phoneRegexPattern, inBoundPhoneNumber); logger.info(msg); } } } else { if (logger.isInfoEnabled()) { String msg = String.format("Error, Regex \"%s\" cannot be matched for phone number \"%s\"", phoneRegexPattern, inBoundPhoneNumber); logger.info(msg); } } } logger.info("No matching phone number found, make sure your Restcomm Regex phone number is correctly defined"); } catch (Exception e) { if (logger.isDebugEnabled()) { String msg = String.format("Exception while trying to match for a REGEX incoming phone number"); logger.debug(msg); } } finally { session.close(); } return null; }
Source:
public ConsumerGroupListing(String groupId, boolean isSimpleConsumerGroup, Optional<ConsumerGroupState> state) { this.groupId = groupId; this.isSimpleConsumerGroup = isSimpleConsumerGroup; this.state = state; }

Target:
public ConsumerGroupListing(String groupId, boolean isSimpleConsumerGroup, Optional<ConsumerGroupState> state) { this.groupId = groupId; this.isSimpleConsumerGroup = isSimpleConsumerGroup; this.state = Objects.requireNonNull(state); }
Source:
protected StorageDomainValidator getStorageDomainValidator(DiskImage diskImage) { if (storageDomainValidator == null) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool( diskImage.getStorageIds().get(0), diskImage.getStoragePoolId()); storageDomainValidator = new StorageDomainValidator(storageDomain); } return storageDomainValidator; }

Target:
protected StorageDomainValidator getStorageDomainValidator(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool( diskImage.getStorageIds().get(0), diskImage.getStoragePoolId()); return new StorageDomainValidator(storageDomain); }
Source:
private PGPCryptInfo safeGetCryptInfo(Object cryptInfo) throws MissingPGPKeyException { if (cryptInfo == null || cryptInfo instanceof PGPEncryptAndSignInfo) { MuleEvent event = RequestContext.getEvent(); String principalId = (String) this.getCredentialsAccessor().getCredentials(event); PGPPublicKey publicKey = keyManager.getPublicKey(principalId); validateNotNull(publicKey, PGPMessages.noPublicKeyForPrincipal(principalId)); this.checkKeyExpirity(publicKey); if (cryptInfo instanceof PGPEncryptAndSignInfo) { String signerPrincipal = ((PGPEncryptAndSignInfo) cryptInfo).getSignerPrincipal(); try { readSecretKeyBundleIfNecessary(); Iterator<PGPSecretKeyRing> signerSecretKeysIterator = this.keyManager.getSecretKeys().getKeyRings(signerPrincipal); if (!signerSecretKeysIterator.hasNext()) { throw new MissingPGPKeyException(createStaticMessage("Signer private key not found for principal: " + signerPrincipal)) ; } PGPSecretKey signerSecretKey = signerSecretKeysIterator.next().getSecretKey(); PGPPrivateKey signerPrivateKey = signerSecretKey.extractPrivateKey(PBE_SECRET_KEY_DECRYPTOR_BUILDER.build(keyManager.getSecretPassphrase().toCharArray())); return new PGPCryptInfo(publicKey, signerPrivateKey, signerPrincipal); } catch (PGPException e) { throw new MissingPGPKeyException(e); } } else { return new PGPCryptInfo(publicKey, false); } } else { PGPCryptInfo info = (PGPCryptInfo) cryptInfo; this.checkKeyExpirity(info.getPublicKey()); return info; } }

Target:
private PGPCryptInfo safeGetCryptInfo(Object cryptInfo) throws MissingPGPKeyException { if (cryptInfo == null) { return new PGPCryptInfo(getPublicKeyForCurrentEventValidatingIt(), false); } else if (cryptInfo instanceof PGPEncryptAndSignInfo) { return doSafeGetEncryptAndSignInfo((PGPEncryptAndSignInfo) cryptInfo); } else { PGPCryptInfo info = (PGPCryptInfo) cryptInfo; this.checkKeyExpirity(info.getPublicKey()); return info; } }
Source:
public GlowEntity spawn(Location location, Class<? extends GlowEntity> clazz, SpawnReason reason) throws IllegalArgumentException { if (TNTPrimed.class.isAssignableFrom(clazz)) { return new GlowTntPrimed(location, null); } GlowEntity entity = null; try { MethodHandle constructor = entityCtors.computeIfAbsent(clazz, clazz_ -> { try { return MethodHandles.lookup().unreflectConstructor( clazz_.getConstructor(Location.class)); } catch (IllegalAccessException e) { throw new IllegalAccessError(e.getMessage()); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.getMessage()); } }); entity = (GlowEntity) constructor.invokeExact((Location) location); GlowEntity impl = entity; EntitySpawnEvent spawnEvent = null; if (entity instanceof LivingEntity) { spawnEvent = EventFactory .callEvent(new CreatureSpawnEvent((LivingEntity) entity, reason)); } else if (!(entity instanceof Item)) { spawnEvent = EventFactory.callEvent(new EntitySpawnEvent(entity)); } if (spawnEvent != null && spawnEvent.isCancelled()) { entity.remove(); } else { List<Message> spawnMessage = entity.createSpawnMessage(); getRawPlayers().stream().filter(player -> player.canSeeEntity(impl)) .forEach(player -> player.getSession().sendAll(spawnMessage .toArray(new Message[spawnMessage.size()]))); } } catch (NoSuchMethodError | IllegalAccessError e) { GlowServer.logger.log(Level.WARNING, "Invalid entity spawn: ", e); } catch (Throwable t) { GlowServer.logger.log(Level.SEVERE, "Unable to spawn entity: ", t); } if (entity != null) { return entity; } throw new UnsupportedOperationException("Not supported yet."); }

Target:
public GlowEntity spawn(Location location, Class<? extends GlowEntity> clazz, SpawnReason reason) throws IllegalArgumentException { GlowEntity entity = null; try { if (EntityRegistry.getEntity(clazz) != null) { entity = EntityStorage.create(clazz, location); } EntitySpawnEvent spawnEvent = null; if (entity instanceof LivingEntity) { spawnEvent = EventFactory .callEvent(new CreatureSpawnEvent((LivingEntity) entity, reason)); } else if (!(entity instanceof Item)) { spawnEvent = EventFactory.callEvent(new EntitySpawnEvent(entity)); } if (spawnEvent != null && spawnEvent.isCancelled()) { entity.remove(); } else { List<Message> spawnMessage = entity.createSpawnMessage(); final GlowEntity finalEntity = entity; getRawPlayers().stream().filter(player -> player.canSeeEntity(finalEntity)) .forEach(player -> player.getSession().sendAll(spawnMessage .toArray(new Message[spawnMessage.size()]))); } } catch (NoSuchMethodError | IllegalAccessError e) { GlowServer.logger.log(Level.WARNING, "Invalid entity spawn: ", e); } catch (Throwable t) { GlowServer.logger.log(Level.SEVERE, "Unable to spawn entity: ", t); } if (entity != null) { return entity; } throw new UnsupportedOperationException("Not supported yet."); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logs); mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); findViewById(R.id.add_entry_button).setOnClickListener( new View.OnClickListener() { @SuppressLint("ShowToast") @Override public void onClick(View view) { if(((UBudgetApp) getApplication()).getBudgetList().isEmpty()){ Toast.makeText(LogsActivity.this, R.string.dialog_add_budget_first, Toast.LENGTH_LONG).show(); }else{ Intent intent = new Intent(LogsActivity.this, AddEntryActivity.class); startActivity(intent); } } }); findViewById(R.id.add_budget_button).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(LogsActivity.this, AddBudgetActivity.class); startActivity(intent); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logs); mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); findViewById(R.id.add_entry_button).setOnClickListener( new View.OnClickListener() { @SuppressLint("ShowToast") @Override public void onClick(View view) { List<Budget> budgets = ((UBudgetApp) getApplication()).getBudgetList(); if(budgets.isEmpty()){ Toast.makeText(LogsActivity.this, R.string.dialog_add_budget_first, Toast.LENGTH_LONG).show(); }else{ Intent intent = new Intent(LogsActivity.this, AddEntryActivity.class); startActivity(intent); } } }); findViewById(R.id.add_budget_button).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(LogsActivity.this, AddBudgetActivity.class); startActivity(intent); } }); }
Source:
@Override public void onPositiveClicked(@NotNull String instanceTag) { switch (instanceTag) { case GOOGLE_ERROR_DIALOG_TAG: break; } }

Target:
public void onPositiveClicked(@NotNull String instanceTag) { switch (instanceTag) { case GOOGLE_ERROR_DIALOG_TAG: break; } }
Source:
public void propertyChange(PropertyChangeEvent evt) { try { getController().handleCaseEvent(evt); } catch (NoCurrentCaseException ex) { return; } catch (TskCoreException ex) { MessageNotifyUtil.Message.error("Error creating timeline controller."); logger.log(Level.SEVERE, "Error creating timeline controller", ex); } if (Case.Events.valueOf(evt.getPropertyName()).equals(CURRENT_CASE)) { synchronized (controllerLock) { controller = null; } } }

Target:
public void propertyChange(PropertyChangeEvent evt) { if (Case.Events.valueOf(evt.getPropertyName()).equals(CURRENT_CASE)) { if (evt.getNewValue() == null) { synchronized (controllerLock) { if (controller != null) { SwingUtilities.invokeLater(controller::shutDownTimeLine); } controller = null; } } } else { try { getController().handleCaseEvent(evt); } catch (NoCurrentCaseException ignored) { } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error handling application event", ex); } } }
Source:
public void processAst(IASTTranslationUnit ast) { ast.accept(new ASTVisitor() { { shouldVisitNames = true; shouldVisitImplicitNames = true; } @Override public int visit(IASTName name) { try { IBinding binding = name.resolveBinding(); if (binding instanceof ICExternalBinding) if ( !(binding instanceof CImplicitFunction) && (binding instanceof CExternalFunction)) { reportProblem(ERR_ID, name.getLastName(), new String(name.getSimpleID())); return PROCESS_CONTINUE; } } catch (Exception e) { CodanCheckersActivator.log(e); } return PROCESS_CONTINUE; } }); }

Target:
public void processAst(IASTTranslationUnit ast) { ast.accept(new ASTVisitor() { { shouldVisitNames = true; shouldVisitImplicitNames = true; } @Override public int visit(IASTName name) { try { IBinding binding = name.resolveBinding(); if (binding instanceof ICExternalBinding) if ( !(binding instanceof CImplicitFunction) && (binding instanceof CExternalFunction)) { reportProblem(ERR_ID, name.getLastName(), name.getRawSignature()); return PROCESS_CONTINUE; } } catch (Exception e) { CodanCheckersActivator.log(e); } return PROCESS_CONTINUE; } }); }
Source:
private static <T extends Node> T simplifiedParse(ParseStart<T> context, Provider provider) { ParseResult<T> result = new JavaParser(staticConfiguration).parse(context, provider); if (result.isSuccessful()) { return result.getResult().get(); } throw new ParseProblemException(result); }

Target:
private static <T extends Node> T simplifiedParse(ParseStart<T> context, Provider provider) { ParseResult<T> result = new JavaParser(staticConfiguration).parse(context, provider); if (result.isSuccessful()) { return result.getResult().get(); } throw new ParseProblemException(result.getProblems()); }
Source:
public final void setData(String sessionId, String key, Object value) { SessionInfo sessionInfo = getSessionInfo(sessionId); if (sessionInfo == null) { sessionInfo = new SessionInfo(); sessionInfo.contentOfSession.put(ENGINE_SESSION_ID, sessionId); if (!key.equals(SOFT_LIMIT_INTERVAL_PARAMETER_NAME)) { sessionInfo.contentOfSession.put(SOFT_LIMIT_INTERVAL_PARAMETER_NAME, Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); } SessionInfo oldSessionInfo = sessionInfoMap.putIfAbsent(sessionId, sessionInfo); if (oldSessionInfo != null) { sessionInfo = oldSessionInfo; } } sessionInfo.contentOfSession.put(key, value); }

Target:
public final void setData(String sessionId, String key, Object value) { SessionInfo sessionInfo = getSessionInfo(sessionId); if (sessionInfo == null) { sessionInfo = new SessionInfo(); sessionInfo.contentOfSession.put(ENGINE_SESSION_ID, sessionId); sessionInfo.contentOfSession.put(SOFT_LIMIT_INTERVAL_PARAMETER_NAME, Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); SessionInfo oldSessionInfo = sessionInfoMap.putIfAbsent(sessionId, sessionInfo); if (oldSessionInfo != null) { sessionInfo = oldSessionInfo; } } sessionInfo.contentOfSession.put(key, value); }
Source:
public CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit) { assertRemoteCacheManagerIsStarted(); ReplaceIfUnmodifiedOperation op = operationsFactory.newReplaceIfUnmodifiedOperation( compatKeyIfNeeded(key), keyToBytes(key), valueToBytes(newValue), lifespan, lifespanTimeUnit, maxIdle, maxIdleTimeUnit, version, dataFormat); return op.execute().thenApply(response -> { boolean b = response.getCode().isUpdated(); if (statistics && b) { clientStatistics.incrementRemoteStores(); } return b; }); }

Target:
public CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit) { assertRemoteCacheManagerIsStarted(); ReplaceIfUnmodifiedOperation op = operationsFactory.newReplaceIfUnmodifiedOperation( keyAsObjectIfNeeded(key), keyToBytes(key), valueToBytes(newValue), lifespan, lifespanTimeUnit, maxIdle, maxIdleTimeUnit, version, dataFormat); return op.execute().thenApply(response -> response.getCode().isUpdated()); }