auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCherryPickMerge() throws Exception { Git git = new Git(db); commitFile("file", "1\n2\n3\n", "master"); commitFile("file", "1\n2\n3\n", "side"); checkoutBranch("refs/heads/side"); RevCommit commitD = commitFile("file", "1\n2\n3\n4\n5\n", "side2"); commitFile("file", "a\n2\n3\n", "side"); MergeResult mergeResult = git.merge().include(commitD).call(); ObjectId commitM = mergeResult.getNewHead(); checkoutBranch("refs/heads/master"); RevCommit commitT = commitFile("another", "t", "master"); try { git.cherryPick().include(commitM).call(); fail("merges should not be cherry-picked by default"); } catch (GitAPIException e) { } try { git.cherryPick().include(commitM).setMainlineParentNumber(3).call(); fail("specifying a non-existent parent should fail"); } catch (Exception e) { } CherryPickResult result = git.cherryPick().include(commitM) .setMainlineParentNumber(1).call(); assertEquals(CherryPickStatus.OK, result.getStatus()); checkFile(new File(db.getWorkTree(), "file"), "1\n2\n3\n4\n5\n"); git.reset().setMode(ResetType.HARD).setRef(commitT.getName()).call(); result = git.cherryPick().include(commitM).setMainlineParentNumber(2) .call(); assertEquals(CherryPickStatus.OK, result.getStatus()); checkFile(new File(db.getWorkTree(), "file"), "a\n2\n3\n"); }

Target:
public void testCherryPickMerge() throws Exception { Git git = new Git(db); commitFile("file", "1\n2\n3\n", "master"); commitFile("file", "1\n2\n3\n", "side"); checkoutBranch("refs/heads/side"); RevCommit commitD = commitFile("file", "1\n2\n3\n4\n5\n", "side2"); commitFile("file", "a\n2\n3\n", "side"); MergeResult mergeResult = git.merge().include(commitD).call(); ObjectId commitM = mergeResult.getNewHead(); checkoutBranch("refs/heads/master"); RevCommit commitT = commitFile("another", "t", "master"); try { git.cherryPick().include(commitM).call(); fail("merges should not be cherry-picked by default"); } catch (MultipleParentsNotAllowedException e) { } try { git.cherryPick().include(commitM).setMainlineParentNumber(3).call(); fail("specifying a non-existent parent should fail"); } catch (JGitInternalException e) { assertTrue(e.getMessage().endsWith( "does not have a parent number 3.")); } CherryPickResult result = git.cherryPick().include(commitM) .setMainlineParentNumber(1).call(); assertEquals(CherryPickStatus.OK, result.getStatus()); checkFile(new File(db.getWorkTree(), "file"), "1\n2\n3\n4\n5\n"); git.reset().setMode(ResetType.HARD).setRef(commitT.getName()).call(); CherryPickResult result2 = git.cherryPick().include(commitM) .setMainlineParentNumber(2).call(); assertEquals(CherryPickStatus.OK, result2.getStatus()); checkFile(new File(db.getWorkTree(), "file"), "a\n2\n3\n"); }
Source:
private static @Nullable List<String> getOutputFromCommand(List<String> command) { try { Path tempFile = Files.createTempFile("output", null); ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); builder.redirectOutput(Redirect.to(tempFile.toFile())); Process p = builder.start(); int ret = p.waitFor(); List<String> lines = checkNotNull(Files.readAllLines(tempFile, Charset.defaultCharset())); Files.delete(tempFile); return (ret == 0 ? lines : null); } catch (IOException | InterruptedException e) { return null; } }

Target:
private static @Nullable List<String> getOutputFromCommand(List<String> command) { try { ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); Process p = builder.start(); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); int ret = p.waitFor(); List<String> lines = br.lines().collect(Collectors.toList()); return (ret == 0 ? lines : null); } catch (IOException | InterruptedException e) { return null; } }
Source:
public Map<String, Map.Entry<String, URI>> getParticipants() { try (BatchContext context = this.batcher.resumeBatch(this.batch)) { Sessions<String, Map.Entry<String, URI>> sessions = this.sso.getSessions(); Map<String, Map.Entry<String, URI>> map = new HashMap<>(); for (String deployment : sessions.getDeployments()) { if (map.put(deployment, sessions.getSession(deployment)) != null) { throw new IllegalStateException("Duplicate key"); } } return Collections.unmodifiableMap(map); } }

Target:
public Map<String, Map.Entry<String, URI>> getParticipants() { try (BatchContext context = this.batcher.resumeBatch(this.batch)) { Sessions<String, Map.Entry<String, URI>> sessions = this.sso.getSessions(); Map<String, Map.Entry<String, URI>> map = new HashMap<>(); for (String deployment : sessions.getDeployments()) { map.put(deployment, sessions.getSession(deployment)); } return Collections.unmodifiableMap(map); } }
Source:
public static DataType<?> guessType(Object value) { if (value == null) { return UNDEFINED; } else if (value instanceof Map) { return UNTYPED_OBJECT; } else if (value instanceof List) { return valueFromList((List) value); } else if (value.getClass().isArray()) { return valueFromList(Arrays.asList((Object[]) value)); } else if (value instanceof StringType) { return STRING; } return POJO_TYPE_MAPPING.get(value.getClass()); }

Target:
public static DataType<?> guessType(Object value) { if (value == null) { return UNDEFINED; } else if (value instanceof Map) { return UNTYPED_OBJECT; } else if (value instanceof List) { return valueFromList((List) value); } else if (value.getClass().isArray()) { return valueFromList(Arrays.asList((Object[]) value)); } return POJO_TYPE_MAPPING.get(value.getClass()); }
Source:
protected void verifyEmailSent(String email, String subject) { if (!TestProperties.INCLUDE_EMAIL_VERIFICATION) { return; } if (!TestProperties.TEST_EMAIL.equals(email)) { fail("Email verification is allowed only on preset test email."); } EmailAccount emailAccount = new EmailAccount(email); try { emailAccount.getUserAuthenticated(); int retryLimit = 5; boolean actual = emailAccount.isEmailWithSubjectPresent(subject); while (!actual && retryLimit > 0) { retryLimit--; ThreadHelper.waitFor(1000); actual = emailAccount.isEmailWithSubjectPresent(subject); } assertTrue(actual); } catch (Exception e) { fail("Failed to verify email sent:" + e); } }

Target:
protected void verifyEmailSent(String email, String subject) { if (TestProperties.isDevServer() || !TestProperties.INCLUDE_EMAIL_VERIFICATION) { return; } if (!TestProperties.TEST_EMAIL.equals(email)) { fail("Email verification is allowed only on preset test email."); } EmailAccount emailAccount = new EmailAccount(email); try { emailAccount.getUserAuthenticated(); int retryLimit = 5; boolean actual = emailAccount.isRecentEmailWithSubjectPresent(subject, TestProperties.TEST_SENDER_EMAIL); while (!actual && retryLimit > 0) { retryLimit--; ThreadHelper.waitFor(1000); actual = emailAccount.isRecentEmailWithSubjectPresent(subject, TestProperties.TEST_SENDER_EMAIL); } assertTrue(actual); } catch (Exception e) { fail("Failed to verify email sent:" + e); } }
Source:
private void showMainWindow(String repoId) { boolean shouldCreateSampleBoard = logic.getStoredRepos().size() == 0; logic.openPrimaryRepository(repoId); logic.setDefaultRepo(repoId); repoSelector.setText(repoId); triggerEvent(new PrimaryRepoChangedEvent(repoId)); triggerEvent(new BoardSavedEvent()); if (TestController.isTestMode()) { if (TestController.isTestChromeDriver()) { browserComponent = new BrowserComponent(this, true); browserComponent.initialise(); } else { browserComponent = new BrowserComponentStub(this); } } else { browserComponent = new BrowserComponent(this, false); browserComponent.initialise(); } setExpandedWidth(false); panels.init(guiController, panelsScrollPane); ensureSelectedPanelHasFocus(); initialisePickers(); if (shouldCreateSampleBoard && (!TestController.isTestMode() || TestController.isTestStartupBoard())){ launchSampleBoard(); } }

Target:
private void showMainWindow(String repoId) { boolean isAFirstTimeUser = logic.getStoredRepos().isEmpty(); logic.openPrimaryRepository(repoId); logic.setDefaultRepo(repoId); repoSelector.setText(repoId); triggerEvent(new PrimaryRepoChangedEvent(repoId)); triggerEvent(new BoardSavedEvent()); if (TestController.isTestMode()) { if (TestController.isTestChromeDriver()) { browserComponent = new BrowserComponent(this, true); browserComponent.initialise(); } else { browserComponent = new BrowserComponentStub(this); } } else { browserComponent = new BrowserComponent(this, false); browserComponent.initialise(); } setExpandedWidth(false); panels.init(guiController, panelsScrollPane); ensureSelectedPanelHasFocus(); initialisePickers(); if (isAFirstTimeUser && TestController.shouldOpenSampleBoard()){ createAndLoadSampleBoard(); } }
Source:
public void testTranslateStreamTableJoinWithoutJoinOperator() { Map<String, String> config = SamzaSqlTestConfig.fetchStaticConfigsWithFactories(configs, 1); String sql = "Insert into testavro.enrichedPageViewTopic" + " select p.name as profileName, pv.pageKey" + " from testavro.PAGEVIEW as pv, testavro.PROFILE.`$table` as p" + " where p.id = pv.profileId"; config.put(SamzaSqlApplicationConfig.CFG_SQL_STMT, sql); Config samzaConfig = SamzaSqlApplicationRunner.computeSamzaConfigs(true, new MapConfig(config)); SamzaSqlApplicationConfig samzaSqlApplicationConfig = new SamzaSqlApplicationConfig(new MapConfig(config)); QueryTranslator translator = new QueryTranslator(samzaSqlApplicationConfig); SamzaSqlQueryParser.QueryInfo queryInfo = samzaSqlApplicationConfig.getQueryInfo().get(0); StreamAppDescriptorImpl mockSpec = spy(new StreamAppDescriptorImpl(appDesc -> { }, samzaConfig)); translator.translate(queryInfo, mockSpec); }

Target:
public void testTranslateStreamTableJoinWithoutJoinOperator() { Map<String, String> config = SamzaSqlTestConfig.fetchStaticConfigsWithFactories(configs, 1); String sql = "Insert into testavro.enrichedPageViewTopic" + " select p.name as profileName, pv.pageKey" + " from testavro.PAGEVIEW as pv, testavro.PROFILE.`$table` as p" + " where p.id = pv.profileId"; config.put(SamzaSqlApplicationConfig.CFG_SQL_STMT, sql); Config samzaConfig = SamzaSqlApplicationRunner.computeSamzaConfigs(true, new MapConfig(config)); SamzaSqlApplicationConfig samzaSqlApplicationConfig = new SamzaSqlApplicationConfig(new MapConfig(config)); QueryTranslator translator = new QueryTranslator(samzaSqlApplicationConfig); SamzaSqlQueryParser.QueryInfo queryInfo = samzaSqlApplicationConfig.getQueryInfo().get(0); StreamApplicationDescriptorImpl streamAppDesc = new StreamApplicationDescriptorImpl(appDesc -> { }, samzaConfig); translator.translate(queryInfo, streamAppDesc); }
Source:
private void sendMessageForFeedEntry(String url, SyndEntry entry, String regex) { Map<String, Object> parameters = new HashMap<>(); Map<String, Object> rawContent = new HashMap<>(); Map<String, Object> extractedContent = new HashMap<>(); parameters.put("url", url); parameters.put("published_date", entry.getPublishedDate()); parameters.put("updated_date", entry.getUpdatedDate()); if (entry.getContents() != null) { Integer index = 1; for (SyndContent content : entry.getContents()) { rawContent.put(index.toString(), content.getValue()); String extractedContentString = extractContent(content.getValue(), regex); if (!StringUtils.isBlank(extractedContentString)) { extractedContent.put(index.toString(), extractedContentString); } index++; } } else { LOGGER.warn("NULL content for entry {}", entry.getUri()); } parameters.put("raw_content", rawContent); parameters.put("extracted_content", extractedContent); MotechEvent event = new MotechEvent(Constants.FEED_CHANGE_MESSAGE, parameters); LOGGER.debug("sending message {}", event); eventRelay.sendEventMessage(event); }

Target:
private void sendMessageForFeedEntry(String url, SyndEntry entry, String regex) { Map<String, Object> parameters = new HashMap<>(); Map<String, Object> rawContent = new HashMap<>(); Map<String, Object> extractedContent = new HashMap<>(); parameters.put("url", url); parameters.put("published_date", entry.getPublishedDate()); parameters.put("updated_date", entry.getUpdatedDate()); if (entry.getContents() != null) { Integer index = 1; for (SyndContent content : entry.getContents()) { rawContent.put(index.toString(), content.getValue()); String extractedContentString = extractContent(content.getValue(), regex); if (StringUtils.isNotBlank(extractedContentString)) { extractedContent.put(index.toString(), extractedContentString); } index++; } } else { LOGGER.warn("NULL content for entry {}", entry.getUri()); } parameters.put("raw_content", rawContent); parameters.put("extracted_content", extractedContent); MotechEvent event = new MotechEvent(Constants.FEED_CHANGE_MESSAGE, parameters); LOGGER.debug("sending message {}", event); eventRelay.sendEventMessage(event); }
Source:
List<StoreKey> getSuccessfullyPutChunkIds() { return indexToChunkIds.values().stream().map(b -> b.getFirst()).collect( Collectors.toList()); }

Target:
List<StoreKey> getSuccessfullyPutChunkIds() { return indexToChunkIdsAndChunkSizes.values().stream().map(Pair::getFirst).collect(Collectors.toList()); }
Source:
public void cancelAllManagementCalls() { InterruptedException stopper = new InterruptedException(); while (!managementCallAnswers.isEmpty()) { managementCallAnswers.forEach((k, v) -> { CompletableFuture<ContextualReturn<?>> removed = managementCallAnswers.remove(k); if (removed != null) { removed.completeExceptionally(stopper); } }); } }

Target:
public void cancelAllManagementCalls() { InterruptedException stopper = new InterruptedException(); while (!managementCallAnswers.isEmpty()) { managementCallAnswers.keySet().forEach(k -> { CompletableFuture<ContextualReturn<?>> removed = managementCallAnswers.remove(k); if (removed != null) { removed.completeExceptionally(stopper); } }); } }
Source:
public long next() throws IOException { long result; if (used == numInRun) { readHeader(); } if (repeat) { result = repeatBase + (used) * delta; } else { result = input.readVarint(signed); } used++; return result; }

Target:
public long next() throws IOException { long result; if (used == numValuesInRun) { readHeader(); } if (repeat) { result = repeatBase + used * delta; } else { result = input.readVarint(signed); } used++; return result; }
Source:
public void addAdditionalRefs(final Repository repo) throws IOException { for (Ref ref : repo.getRefDatabase().getAdditionalRefs()) { Set<Ref> set = reverseRefMap.get(ref.getObjectId()); if (set == null) { set = Collections.singleton(ref); } else { set = new HashSet<Ref>(set); set.add(ref); } reverseRefMap.put(ref.getObjectId(), set); } }

Target:
public void addAdditionalRefs(final Repository repo) throws IOException { for (Ref ref : repo.getRefDatabase().getAdditionalRefs()) { Set<Ref> set = reverseRefMap.get(ref.getObjectId()); if (set == null) set = Collections.singleton(ref); else { set = new HashSet<Ref>(set); set.add(ref); } reverseRefMap.put(ref.getObjectId(), set); } }
Source:
public Object getValueAt(int row, int col) { Transaction transaction = getTransaction(row); Money amount = transaction.getAmount(); Money balance = Money.zero(); for(int i = 0; i <= row; i++) { balance = balance.plus(getTransaction(i).getAmount()); } if(col == COL_CATEGORY) { return transaction.getCategoryName(); } if(col == COL_DESC) { return transaction.getDescription(); } if(col == COL_DEBIT) { if(amount.isNegative()) { return amount.multipliedBy(-1).toAmountAndSymbolString(); } else { return ""; } } if(col == COL_CREDIT) { if(amount.isPositive()) { return amount.toAmountAndSymbolString(); } else { return ""; } } if(col == COL_BALANCE) { return balance.toAmountAndSymbolString(); } if(col == COL_DATE) { SimpleDateFormat shortDateFormat = new SimpleDateFormat("MM/dd/yyyy"); return shortDateFormat.format(transaction.getDate()); } return "?"; }

Target:
public Object getValueAt(int row, int col) { Transaction transaction = getTransaction(row); Money amount = transaction.getAmount(); Money balance = Money.zero(); for(int i = 0; i <= row; i++) { balance = balance.plus(getTransaction(i).getAmount()); } if(col == COL_CATEGORY) { return transaction.getCategoryName(); } if(col == COL_DESC) { return transaction.getDescription(); } if(col == COL_DEBIT) { if(amount.isNegative()) { return amount.absolute().toAmountAndSymbolString(); } else { return ""; } } if(col == COL_CREDIT) { if(amount.isPositive()) { return amount.toAmountAndSymbolString(); } else { return ""; } } if(col == COL_BALANCE) { return balance.toAmountAndSymbolString(); } if(col == COL_DATE) { SimpleDateFormat shortDateFormat = new SimpleDateFormat("MM/dd/yyyy"); return shortDateFormat.format(transaction.getDate()); } return "?"; }
Source:
public void shouldPerformBoostOperation() { List<IndexQuery> indexQueries = new ArrayList<>(); String documentId = randomNumeric(5); SampleEntity sampleEntity1 = new SampleEntity(); sampleEntity1.setId(documentId); sampleEntity1.setRate(700); sampleEntity1.setMessage("bar foo"); sampleEntity1.setVersion(System.currentTimeMillis()); IndexQuery indexQuery1 = new IndexQuery(); indexQuery1.setId(documentId); indexQuery1.setObject(sampleEntity1); indexQueries.add(indexQuery1); String documentId2 = randomNumeric(5); SampleEntity sampleEntity2 = new SampleEntity(); sampleEntity2.setId(documentId2); sampleEntity2.setRate(800); sampleEntity2.setMessage("foo"); sampleEntity2.setVersion(System.currentTimeMillis()); IndexQuery indexQuery2 = new IndexQuery(); indexQuery2.setId(documentId2); indexQuery2.setObject(sampleEntity2); indexQueries.add(indexQuery2); operations.bulkIndex(indexQueries, index); operations.refresh(SampleEntity.class); CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("foo").boost(1)); Page<SearchHit<SampleEntity>> page = operations.queryForPage(criteriaQuery, SampleEntity.class, index); assertThat(page.getTotalElements()).isGreaterThanOrEqualTo(1); }

Target:
public void shouldPerformBoostOperation() { List<IndexQuery> indexQueries = new ArrayList<>(); String documentId = randomNumeric(5); SampleEntity sampleEntity1 = new SampleEntity(); sampleEntity1.setId(documentId); sampleEntity1.setRate(700); sampleEntity1.setMessage("bar foo"); sampleEntity1.setVersion(System.currentTimeMillis()); IndexQuery indexQuery1 = new IndexQuery(); indexQuery1.setId(documentId); indexQuery1.setObject(sampleEntity1); indexQueries.add(indexQuery1); String documentId2 = randomNumeric(5); SampleEntity sampleEntity2 = new SampleEntity(); sampleEntity2.setId(documentId2); sampleEntity2.setRate(800); sampleEntity2.setMessage("foo"); sampleEntity2.setVersion(System.currentTimeMillis()); IndexQuery indexQuery2 = new IndexQuery(); indexQuery2.setId(documentId2); indexQuery2.setObject(sampleEntity2); indexQueries.add(indexQuery2); operations.bulkIndex(indexQueries, index); operations.refresh(SampleEntity.class); CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("foo").boost(1)); Page<SearchHit<SampleEntity>> page = operations.searchForPage(criteriaQuery, SampleEntity.class, index); assertThat(page.getTotalElements()).isGreaterThanOrEqualTo(1); }
Source:
public void clickTemplateModalButton() { scrollElementToCenterAndClick(addTemplateModalLoadButton); }

Target:
public void clickTemplateModalButton() { addTemplateModalLoadButton.click(); }
Source:
public void testResolvePutsOnly() { Operation<Long, String> expected = new PutOperation<>(1L, "Matthew", 0L); Chain chain = getChainFromOperations( new PutOperation<>(1L, "Albin", 0L), new PutOperation<>(1L, "Suresh", 0L), new PutOperation<>(1L, "Matthew", 0L)); ChainResolver<Long, String> resolver = createChainResolver(ExpiryPolicyBuilder.noExpiration()); ResolvedChain<Long, String> resolvedChain = resolver.resolve(chain, 1L, 0L); Result<Long, String> result = resolvedChain.getResolvedResult(1L); assertEquals(expected, result); assertThat(resolvedChain.isCompacted(), is(true)); assertThat(resolvedChain.getCompactionCount(), is(2)); }

Target:
public void testResolvePutsOnly() { Operation<Long, String> expected = new PutOperation<>(1L, "Matthew", 0L); Chain chain = getChainFromOperations( new PutOperation<>(1L, "Albin", 0L), new PutOperation<>(1L, "Suresh", 0L), expected); ChainResolver<Long, String> resolver = createChainResolver(ExpiryPolicyBuilder.noExpiration()); ResolvedChain<Long, String> resolvedChain = resolver.resolve(chain, 1L, 0L); Result<Long, String> result = resolvedChain.getResolvedResult(1L); assertEquals(expected, result); assertThat(resolvedChain.isCompacted(), is(true)); assertThat(resolvedChain.getCompactionCount(), is(2)); }
Source:
public void toString_customMethod() { realm.beginTransaction(); CustomMethods cm = realm.createObject(CustomMethods.class); cm.setName("Foo"); realm.commitTransaction(); String expected = "custom toString"; assertEquals(expected, cm.toString()); }

Target:
public void toString_customMethod() { realm.beginTransaction(); CustomMethods cm = realm.createObject(CustomMethods.class); cm.setName("Foo"); realm.commitTransaction(); String expected = CustomMethods.CUSTOM_TO_STRING; assertEquals(expected, cm.toString()); }
Source:
<T> Optional<ConnectionHandler<T>> getConnectionHandler(T connection) { lock.lock(); try { return ofNullable(connections.get(new Reference<>(connection))).map(c -> (ConnectionHandler<T>) (((Pair) c).getSecond())); } finally { lock.unlock(); } }

Target:
<T> Optional<ConnectionHandler<T>> getConnectionHandler(T connection) { return ofNullable(connections.getIfPresent(new Reference<>(connection))) .map(c -> (ConnectionHandler<T>) (((Pair) c).getSecond())); }
Source:
public static Configuration propagateAccountOptions( Configuration source, String accountName) throws IOException { if (StringUtils.isEmpty(accountName)) { throw new IOException("Account name cannot be empty"); } final String accountPrefix = AZURE_AD_ACCOUNT_PREFIX + accountName +'.'; LOG.debug("Propagating entries under {}", accountPrefix); final Configuration dest = new Configuration(source); for (Map.Entry<String, String> entry : source) { final String key = entry.getKey(); final String value = entry.getValue(); if (!key.startsWith(accountPrefix) || accountPrefix.equals(key)) { continue; } final String stripped = key.substring(accountPrefix.length()); String origin = "[" + StringUtils.join( source.getPropertySources(key), ", ") +"]"; final String generic = AZURE_AD_PREFIX + stripped; LOG.debug("Updating from {}", generic, origin); dest.set(generic, value, key + " via " + origin); } return dest; }

Target:
public static Configuration propagateAccountOptions(Configuration source, String accountName) { Preconditions.checkArgument(StringUtils.isNotEmpty(accountName), "accountName"); final String accountPrefix = AZURE_AD_ACCOUNT_PREFIX + accountName +'.'; LOG.debug("Propagating entries under {}", accountPrefix); final Configuration dest = new Configuration(source); for (Map.Entry<String, String> entry : source) { final String key = entry.getKey(); final String value = entry.getValue(); if (!key.startsWith(accountPrefix) || accountPrefix.equals(key)) { continue; } final String stripped = key.substring(accountPrefix.length()); String origin = "[" + StringUtils.join( source.getPropertySources(key), ", ") +"]"; final String generic = AZURE_AD_PREFIX + stripped; LOG.debug("Updating from {}", generic, origin); dest.set(generic, value, key + " via " + origin); } return dest; }
Source:
public void onMatch(RelOptRuleCall call) { final Join join = call.rel(0); final Union unionRel; RelNode otherInput; boolean unionOnLeft; if (call.rel(1) instanceof Union) { unionRel = call.rel(1); otherInput = call.rel(2); unionOnLeft = true; } else { otherInput = call.rel(1); unionRel = call.rel(2); unionOnLeft = false; } if (!unionRel.all) { return; } if (!join.getVariablesSet().isEmpty()) { return; } if (unionOnLeft) { if (join.getJoinType().generatesNullsOnLeft()) { return; } } else { if (join.getJoinType().generatesNullsOnRight() || join.getJoinType() == JoinRelType.ANTI) { return; } } List<RelNode> newUnionInputs = new ArrayList<>(); for (RelNode input : unionRel.getInputs()) { RelNode joinLeft; RelNode joinRight; if (unionOnLeft) { joinLeft = input; joinRight = otherInput; } else { joinLeft = otherInput; joinRight = input; } newUnionInputs.add( join.copy( join.getTraitSet(), join.getCondition(), joinLeft, joinRight, join.getJoinType(), join.isSemiJoinDone())); } final SetOp newUnionRel = unionRel.copy(unionRel.getTraitSet(), newUnionInputs, true); call.transformTo(newUnionRel); }

Target:
public void onMatch(RelOptRuleCall call) { final Join join = call.rel(0); final Union unionRel; RelNode otherInput; boolean unionOnLeft; if (call.rel(1) instanceof Union) { unionRel = call.rel(1); otherInput = call.rel(2); unionOnLeft = true; } else { otherInput = call.rel(1); unionRel = call.rel(2); unionOnLeft = false; } if (!unionRel.all) { return; } if (!join.getVariablesSet().isEmpty()) { return; } if (unionOnLeft) { if (join.getJoinType().generatesNullsOnLeft()) { return; } } else { if (join.getJoinType().generatesNullsOnRight() || !join.getJoinType().projectsRight()) { return; } } List<RelNode> newUnionInputs = new ArrayList<>(); for (RelNode input : unionRel.getInputs()) { RelNode joinLeft; RelNode joinRight; if (unionOnLeft) { joinLeft = input; joinRight = otherInput; } else { joinLeft = otherInput; joinRight = input; } newUnionInputs.add( join.copy( join.getTraitSet(), join.getCondition(), joinLeft, joinRight, join.getJoinType(), join.isSemiJoinDone())); } final SetOp newUnionRel = unionRel.copy(unionRel.getTraitSet(), newUnionInputs, true); call.transformTo(newUnionRel); }
Source:
public static String uncompress(ByteString data) { try { if (data == null || data.length() == 0) { return null; } InflaterInputStream inflaterStream = new InflaterInputStream( new ByteArrayInputStream(data.getBytes(), 4, data.length())); return IOUtils.toString(inflaterStream); } catch (IOException e) { return null; } }

Target:
public static String uncompress(ByteString data) { try { if (data == null) { return null; } else if (data.length() == 0) { return ""; } InflaterInputStream inflaterStream = new InflaterInputStream( new ByteArrayInputStream(data.getBytes(), 4, data.length())); return IOUtils.toString(inflaterStream); } catch (IOException e) { return null; } }
Source:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getHttpRequest().setHeader(SYNC_TOKEN, getSyncTokenHeader()); return next.process().flatMap(httpResponse -> { final String syncTokenValue = httpResponse.getHeaders().getValue(SYNC_TOKEN); if (syncTokenValue == null) { return Mono.just(httpResponse); } final String[] syncTokens = syncTokenValue.split(","); for (final String syncTokenStr : syncTokens) { final SyncToken syncToken = new SyncToken().fromSyncTokenString(syncTokenStr); if (syncToken == null) { return Mono.just(httpResponse); } final String tokenId = syncToken.getId(); final long tokenSequenceNumber = syncToken.getSequenceNumber(); if (syncTokenMap.containsKey(tokenId)) { final SyncToken existSyncToken = syncTokenMap.get(tokenId); if (existSyncToken.getSequenceNumber() < tokenSequenceNumber) { syncTokenMap.replace(tokenId, existSyncToken, syncToken); } } else { syncTokenMap.put(tokenId, syncToken); } } return Mono.just(httpResponse); }); }

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getHttpRequest().setHeader(SYNC_TOKEN, getSyncTokenHeader()); return next.process().flatMap(httpResponse -> { final String syncTokenValue = httpResponse.getHeaders().getValue(SYNC_TOKEN); if (syncTokenValue == null) { return Mono.just(httpResponse); } final String[] syncTokens = syncTokenValue.split(COMMA); for (final String syncTokenString : syncTokens) { if (CoreUtils.isNullOrEmpty(syncTokenString)) { continue; } final SyncToken syncToken; try { syncToken = new SyncToken(syncTokenString); } catch (Exception ex){ logger.warning(SKIP_INVALID_TOKEN, syncTokenString); continue; } final String tokenId = syncToken.getId(); syncTokenMap.compute(tokenId, (key, existingSyncToken) -> { if (existingSyncToken == null || syncToken.getSequenceNumber() > existingSyncToken.getSequenceNumber()) { return syncToken; } return existingSyncToken; }); } return Mono.just(httpResponse); }); }
Source:
protected ExprEval eval(ExprEval param, int scale) { if (param.type() == ExprType.LONG) { return ExprEval.of(BigDecimal.valueOf(param.asLong()).setScale(scale, RoundingMode.HALF_UP).longValue()); } else if (param.type() == ExprType.DOUBLE) { return ExprEval.of(BigDecimal.valueOf(param.asDouble()).setScale(scale, RoundingMode.HALF_UP).doubleValue()); } else { return ExprEval.of(null); } }

Target:
private ExprEval eval(ExprEval param, int scale) { if (param.type() == ExprType.LONG) { return ExprEval.of(BigDecimal.valueOf(param.asLong()).setScale(scale, RoundingMode.HALF_UP).longValue()); } else if (param.type() == ExprType.DOUBLE) { return ExprEval.of(BigDecimal.valueOf(param.asDouble()).setScale(scale, RoundingMode.HALF_UP).doubleValue()); } else { return ExprEval.of(null); } }
Source:
public long putFile(File sourceFile, ContentReference targetContentReference) throws ContentIOException { try { FileInputStream fis = new FileInputStream(sourceFile); try { return putInputStream(fis, targetContentReference); } finally { if (fis != null) { fis.close(); } } } catch (IOException e) { logger.error(e.getMessage(), e); throw new ContentIOException("Failed to write content: " + e.getMessage(), e); } }

Target:
public long putFile(File sourceFile, ContentReference targetContentReference) throws ContentIOException { if (!isContentReferenceSupported(targetContentReference)) { throw new ContentIOException("ContentReference not supported"); } try { FileInputStream fis = new FileInputStream(sourceFile); try { return putInputStream(fis, targetContentReference); } finally { if (fis != null) { fis.close(); } } } catch (IOException e) { logger.error(e.getMessage(), e); throw new ContentIOException("Failed to write content: " + e.getMessage(), e); } }
Source:
protected void _onResume() { Log.i(LOG_TAG, "onResume"); startCampaignsAndResourcesTimer(true); disableAutoShowAfterDelay(); queueDeviceInfoNow(false); long currentTime = getSessionTime(); if (currentTime > lastSessionTick) { sessionStart(); } else { if (config.isSendQueuedEventsOnResume()) { sendQueuedEvents(); } } generateNewSessionInterval(); if (getActivityContext() != null && getActivityContext().getIntent() != null && getActivityContext().getIntent().getData() != null) { Uri uri = getActivityContext().getIntent().getData(); String referrer = uri.getQueryParameter(REFERRER); if (!SwrveHelper.isNullOrEmpty(referrer)) { Map<String, String> attributes = new HashMap<String, String>(); attributes.put(SWRVE_REFERRER_ID, referrer); Log.i(LOG_TAG, "Received referrer, so sending userUpdate:" + attributes); userUpdate(attributes); } } }

Target:
protected void _onResume() { Log.i(LOG_TAG, "onResume"); startCampaignsAndResourcesTimer(true); disableAutoShowAfterDelay(); queueDeviceInfoNow(false); long currentTime = getSessionTime(); if (currentTime > lastSessionTick) { sessionStart(); } else { if (config.isSendQueuedEventsOnResume()) { sendQueuedEvents(); } } generateNewSessionInterval(); Activity activity = getActivityContext(); if (activity != null && activity.getIntent() != null && activity.getIntent().getData() != null) { Uri uri = activity.getIntent().getData(); String referrer = uri.getQueryParameter(REFERRER); if (!SwrveHelper.isNullOrEmpty(referrer)) { Map<String, String> attributes = new HashMap<String, String>(); attributes.put(SWRVE_REFERRER_ID, referrer); Log.i(LOG_TAG, "Received referrer, so sending userUpdate:" + attributes); userUpdate(attributes); } } }
Source:
public List<Map<ActionParameter, String>> getParameterValues(String filePath, String scriptDefinitionFilePath) throws ScriptDefinitionNotMatched, UnsupportedOperationException { List<Map<ActionParameter, String>> newMappedParameterToValues = null; try { this.currentlyLoadedJSONFileContent = convertJSONtoObject(filePath); String scriptDefStoredInJson = currentlyLoadedJSONFileContent.getScriptDefinitionContent(); String actualScriptDefcontent = new String( Files.readAllBytes(Paths.get(scriptDefinitionFilePath))); if (scriptDefStoredInJson.equals(actualScriptDefcontent)) { List<Map<String, String>> mappedParamToValue = currentlyLoadedJSONFileContent.getParameterValues(); newMappedParameterToValues = getMappedParamToValue(mappedParamToValue); } else { throw new ScriptDefinitionNotMatched("Current script definition does not match with the " + "script definition that was used to generate the selected data file"); } } catch(JsonSyntaxException | JsonIOException | IOException e) { LOG.error(e); } return newMappedParameterToValues; }

Target:
public List<Map<ActionParameter, String>> getParameterValues(String filePath, String scriptDefinitionFilePath) throws ScriptDefinitionNotMatched, UnsupportedOperationException { List<Map<ActionParameter, String>> newMappedParameterToValues = Collections.emptyList(); try { Optional<ParametersConverter> currentlyLoadedJSONFileContent = convertJSONtoObject(readFileContent(filePath)); if (currentlyLoadedJSONFileContent.isPresent()) { String scriptDefStoredInJson = currentlyLoadedJSONFileContent.get().getScriptDefinitionContent(); String currentlyLoadedScriptDef = readFileContent(scriptDefinitionFilePath); if (scriptDefStoredInJson.equals(currentlyLoadedScriptDef)) { List<Map<String, String>> mappedParamToValue = currentlyLoadedJSONFileContent.get().getParameterValues("default"); newMappedParameterToValues = getMappedParamToValue(mappedParamToValue); } else { throw new ScriptDefinitionNotMatched("Current script definition does not match with the " + "script definition that was used to generate the selected data file"); } } } catch(JsonSyntaxException | JsonIOException | IOException e) { LOG.error(e); } return newMappedParameterToValues; }
Source:
public static Group getNameAndDataTypeText(final NameAndDataTypeHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double rowHeight) { final Group headerGroup = GWT.create(Group.class); final Text name = context.getRenderer().getTheme().getHeaderText(); name.setText(headerMetaData.getTitle()); name.setListening(false); name.setX(blockWidth / 2); name.setY(rowHeight / 2 - SPACING); final Text typeRef = context.getRenderer().getTheme().getHeaderText(); typeRef.setFontStyle(FONT_STYLE_TYPE_REF); typeRef.setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0); typeRef.setText("(" + headerMetaData.getTypeRef().toString() + ")"); typeRef.setListening(false); typeRef.setX(blockWidth / 2); typeRef.setY(rowHeight / 2 + SPACING); headerGroup.add(name); headerGroup.add(typeRef); return headerGroup; }

Target:
public static Group getNameAndDataTypeText(final NameAndDataTypeHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double rowHeight) { final Group headerGroup = GWT.create(Group.class); final Text name = context.getRenderer().getTheme().getHeaderText(); name.setText(headerMetaData.getTitle()); name.setListening(false); name.setX(blockWidth / 2); name.setY(rowHeight / 2 - SPACING); final Text typeRef = context.getRenderer().getTheme().getHeaderText(); typeRef.setFontStyle(FONT_STYLE_TYPE_REF); typeRef.setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0); typeRef.setText("(" + headerMetaData.getTypeRef() + ")"); typeRef.setListening(false); typeRef.setX(blockWidth / 2); typeRef.setY(rowHeight / 2 + SPACING); headerGroup.add(name); headerGroup.add(typeRef); return headerGroup; }
Source:
private static Peer createLocalPeer( int port ) throws UnknownHostException { var networkParameters = new MainNetParams(); var context = new Context(networkParameters); var ourVersionMessage = new VersionMessage(networkParameters, 0); var localPeerAddress = new PeerAddress(InetAddress.getLocalHost(), port); AbstractBlockChain blockchain = null; var peer = new Peer(networkParameters, ourVersionMessage, localPeerAddress, blockchain); return peer; }

Target:
private Peer createLocalPeer(int port) throws UnknownHostException { var networkParameters = config.baseCurrencyNetwork.getParameters(); new Context(networkParameters); var ourVersionMessage = new VersionMessage(networkParameters, 0); var localPeerAddress = new PeerAddress(InetAddress.getLocalHost(), port); return new Peer(networkParameters, ourVersionMessage, localPeerAddress, null); }
Source:
public void setResponseType(final String responseType) { responseTypeException = null; try { this.responseType = ResponseType.parse(responseType); } catch (ParseException e) { responseTypeException = new TechnicalException("Unrecognised responseType: " + responseType, e); } }

Target:
public void setResponseType(final String responseType) { try { this.responseType = ResponseType.parse(responseType); } catch (ParseException e) { throw new TechnicalException("Unrecognised responseType: " + responseType, e); } }
Source:
public void executeSetFridgeTemperature(int rangeValue, Config params) { boolean executed = executeCommand("set fridge temperature", params); if (executed) { fridgeTemperature.setValue(rangeValue); setChanged(true); } }

Target:
public void executeSetFridgeTemperature(int rangeValue, Config params) { boolean executed = executeCommand("set fridge temperature", params); if (executed) { setFridgeTemperature(rangeValue); } }
Source:
protected void setupBookieClientAddEntry() { doAnswer((Answer) (InvocationOnMock invokation) -> { Object[] args = invokation.getArguments(); BookkeeperInternalCallbacks.WriteCallback callback = (BookkeeperInternalCallbacks.WriteCallback) args[5]; BookieSocketAddress bookieSocketAddress = (BookieSocketAddress) args[0]; long _ledgerId = (Long) args[1]; long _entryId = (Long) args[3]; Object ctx = args[6]; submit(() -> { boolean fenced = fencedLedgers.contains(_ledgerId); LOG.error("addEntry {}@{} fenced {}", _ledgerId, _entryId, fenced); if (fenced) { callback.writeComplete(BKException.Code.LedgerFencedException, _ledgerId, _entryId, bookieSocketAddress, ctx); } else { callback.writeComplete(BKException.Code.OK, _ledgerId, _entryId, bookieSocketAddress, ctx); } }); return null; }).when(bookieClient).addEntry(any(BookieSocketAddress.class), anyLong(), any(byte[].class), anyLong(), any(ByteBuf.class), any(BookkeeperInternalCallbacks.WriteCallback.class), any(), anyInt()); }

Target:
protected void setupBookieClientAddEntry() { doAnswer((Answer) (InvocationOnMock invokation) -> { Object[] args = invokation.getArguments(); BookkeeperInternalCallbacks.WriteCallback callback = (BookkeeperInternalCallbacks.WriteCallback) args[5]; BookieSocketAddress bookieSocketAddress = (BookieSocketAddress) args[0]; long ledgerId = (Long) args[1]; long entryId = (Long) args[3]; Object ctx = args[6]; submit(() -> { boolean fenced = fencedLedgers.contains(ledgerId); if (fenced) { callback.writeComplete(BKException.Code.LedgerFencedException, ledgerId, entryId, bookieSocketAddress, ctx); } else { callback.writeComplete(BKException.Code.OK, ledgerId, entryId, bookieSocketAddress, ctx); } }); return null; }).when(bookieClient).addEntry(any(BookieSocketAddress.class), anyLong(), any(byte[].class), anyLong(), any(ByteBuf.class), any(BookkeeperInternalCallbacks.WriteCallback.class), any(), anyInt()); }
Source:
public void checkPool() throws Exception { AbstractPool pool = getPool(); assertEquals(pool.getManagedConnectionPools().size(), 0); SimpleConnection[] simpleConnections = fillPoolToSize(5); String[] mcHashes = new String[5]; for (int i = 0; i < 5; i++) { SimpleConnection sc = simpleConnections[i]; SimpleConnectionImpl sci = (SimpleConnectionImpl) sc; mcHashes[i] = sci.getManagedConnection().toString(); } assertEquals(pool.getManagedConnectionPools().size(), 1); PoolStatistics ps = pool.getStatistics(); checkStatistics(ps, 5, 0, 5); ManagedConnectionPool mcp = pool.getManagedConnectionPools().values().iterator().next(); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 4, 1); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 3, 2); simpleConnections = fillPoolToSize(5); String[] mcHashesAfterIdleConnectionCleanup = new String[5]; for (int i = 0; i < 5; i++) { SimpleConnection sc = simpleConnections[i]; SimpleConnectionImpl sci = (SimpleConnectionImpl) sc; mcHashesAfterIdleConnectionCleanup[i] = sci.getManagedConnection().toString(); } assertEquals(mcHashes[2], mcHashesAfterIdleConnectionCleanup[0]); assertEquals(mcHashes[3], mcHashesAfterIdleConnectionCleanup[1]); assertEquals(mcHashes[4], mcHashesAfterIdleConnectionCleanup[2]); }

Target:
public void checkPool() throws Exception { AbstractPool pool = getPool(); assertEquals(pool.getManagedConnectionPools().size(), 0); String[] mcsIds = fillPoolToSize(5); assertEquals(pool.getManagedConnectionPools().size(), 1); PoolStatistics ps = pool.getStatistics(); checkStatistics(ps, 5, 0, 5); ManagedConnectionPool mcp = pool.getManagedConnectionPools().values().iterator().next(); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 4, 1); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 3, 2); String[] mcsIdsAfterIdleConnectionCleanup = fillPoolToSize(5); assertEquals(mcsIds[2], mcsIdsAfterIdleConnectionCleanup[0]); assertEquals(mcsIds[3], mcsIdsAfterIdleConnectionCleanup[1]); assertEquals(mcsIds[4], mcsIdsAfterIdleConnectionCleanup[2]); assertEquals("SimpleManagedConnection #5", mcsIdsAfterIdleConnectionCleanup[3]); assertEquals("SimpleManagedConnection #6", mcsIdsAfterIdleConnectionCleanup[4]); }
Source:
public void batchUpdateMergingLarge() { Change change2 = new Change("Q2", 1, Instant.EPOCH, 1); List<Statement> statements2 = new StatementBuilder("Q2") .withPredicateObject(RDFS.LABEL, new LiteralImpl(randomizer.randomAsciiOfLength(300 * 1024))) .build(); change2.setStatements(statements2); Change change3 = new Change("Q3", 1, Instant.EPOCH, 1); List<Statement> statements3 = new StatementBuilder("Q3") .withPredicateObject(RDFS.LABEL, new LiteralImpl("third item")) .build(); change3.setStatements(statements3); List<Change> changes = ImmutableList.of(change2, change3); int count = mergingRepo.syncFromChanges(changes, false); assertThat(count).isEqualTo(2); verify(mergingMockClient, times(2)).mergingUpdate( any(Collection.class), any(Collection.class), any(Collection.class) ); }

Target:
public void batchUpdateMergingLarge() { List<Change> changes = ImmutableList.of(change2, change3); int count = mergingRepo.syncFromChanges(changes, false); assertThat(count).isEqualTo(2); verify(mergingMockClient, times(2)).mergingUpdate( any(Collection.class), any(Collection.class), any(Collection.class) ); }
Source:
public boolean saveConversationWallpaper(Bitmap bitmap, String filename) { File file; if (isConversationWallpaperCached(filename)) { return true; } else { String filepath = getConversationWallpaperPath(filename); file = new File(filepath); file.getParentFile().mkdirs(); OutputStream os = null; try { file.createNewFile(); os = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, os); os.close(); return os != null; } catch (IOException e) { return false; } finally { close(os); } } }

Target:
public boolean saveConversationWallpaper(Bitmap bitmap, String filename) { File file; boolean isWallpaperCached = false; if (isConversationWallpaperCached(filename + ".jpg")) { isWallpaperCached = true; file = new File(getConversationWallpaperPath(filename + "_tempWallpaper.jpg")); } else { file = new File(getConversationWallpaperPath(filename + ".jpg")); } file.getParentFile().mkdirs(); OutputStream outputStream = null; try { file.createNewFile(); outputStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream); outputStream.flush(); outputStream.close(); if (outputStream != null) { if (isWallpaperCached) { File oldFile = new File(getConversationWallpaperPath(filename + ".jpg")); if (oldFile.delete()) { file.renameTo(oldFile); return true; } file.delete(); return false; } } else { file.delete(); } return outputStream != null; } catch (IOException e) { file.delete(); return false; } finally { close(outputStream); } }
Source:
public void byteArrayToInputStreamTransformationIsSuccessful() { PollingProber.check(240000, 1000, () -> EventRecorder.countCapturedEvents() == 1); }

Target:
public void byteArrayToInputStreamTransformationIsSuccessful() { check(POLL_TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> EventRecorder.countCapturedEvents() == EXPECTED_EVENT_COUNT); }
Source:
public Object get(DataFetchingEnvironment env) { User user = MutationHelpers.getUser(env); String combinedId = env.getArgument("dataSetId"); String authString = env.getArgument("authorization"); Tuple<String, String> userAndDataSet = DataSetMetaData.splitCombinedId(combinedId); Optional<DataSet> dataSet; ResourceSyncImport.ResourceSyncReport resourceSyncReport; try { dataSet = dataSetRepository.getDataSet(user, userAndDataSet.getLeft(), userAndDataSet.getRight()); if (!dataSet.isPresent()) { LOG.error("DataSet does not exist."); throw new RuntimeException("DataSet does not exist."); } ResourceSyncImport resourceSyncImport = new ResourceSyncImport( resourceSyncFileLoader, dataSet.get(), false); String capabilityListUri = dataSet.get().getMetadata().getImportSource(); resourceSyncReport = resourceSyncImport.filterAndImport(capabilityListUri, null, true, authString); } catch (IOException | CantRetrieveFileException | CantDetermineDataSetException e) { LOG.error("Failed to do a resource sync import. ", e); throw new RuntimeException(e); } return resourceSyncReport; }

Target:
public Object get(DataFetchingEnvironment env) { User user = MutationHelpers.getUser(env); String combinedId = env.getArgument("dataSetId"); String authString = env.getArgument("authorization"); Tuple<String, String> userAndDataSet = DataSetMetaData.splitCombinedId(combinedId); Optional<DataSet> dataSet; ResourceSyncImport.ResourceSyncReport resourceSyncReport; try { dataSet = dataSetRepository.getDataSet(user, userAndDataSet.getLeft(), userAndDataSet.getRight()); if (!dataSet.isPresent()) { LOG.error("DataSet does not exist."); throw new RuntimeException("DataSet does not exist."); } ResourceSyncImport resourceSyncImport = new ResourceSyncImport( resourceSyncFileLoader, dataSet.get(), false); String capabilityListUri = dataSet.get().getMetadata().getImportInfo().get(0).getImportSource(); resourceSyncReport = resourceSyncImport.filterAndImport(capabilityListUri, null, true, authString); } catch (IOException | CantRetrieveFileException | CantDetermineDataSetException e) { LOG.error("Failed to do a resource sync import. ", e); throw new RuntimeException(e); } return resourceSyncReport; }
Source:
public int compare(Identifiable object1, Identifiable object2) { Integer val1 = value.get(object1.getGuid()); Integer val2 = value.get(object2.getGuid()); if (val1 == null) { val1 = Integer.MAX_VALUE - 1; } if (val2 == null) { val2 = Integer.MAX_VALUE; } return val1 - val2; }

Target:
public int compare(Identifiable object1, Identifiable object2) { Integer val1 = getIndex(object1); Integer val2 = getIndex(object2); if (val1 == null) { val1 = Integer.MAX_VALUE - 1; } if (val2 == null) { val2 = Integer.MAX_VALUE; } return val1 - val2; }
Source:
private static Uri addMessageToUri(ContentResolver resolver, Uri uri, String address, String body, String subject, Long date) { final int statusPending = 32; final int subId = SubscriptionManager.getDefaultSmsSubscriptionId(); ContentValues values = new ContentValues(7); Log.v(TAG, "Telephony addMessageToUri sub id: " + subId); values.put("sub_id", subId); values.put("address", address); if (date != null) { values.put("date", date); } values.put("read", Integer.valueOf(0)); values.put("subject", subject); values.put("body", body); values.put("status", statusPending); return resolver.insert(uri, values); }

Target:
private static Uri addMessageToUri(ContentResolver resolver, Uri uri, String address, String body, String subject, Long date) { ContentValues values = new ContentValues(7); final int statusPending = 32; final int subId = SubscriptionManager.getDefaultSmsSubscriptionId(); Log.v(TAG, "Telephony addMessageToUri sub id: " + subId); values.put(Telephony.Sms.SUBSCRIPTION_ID, subId); values.put(Telephony.Sms.ADDRESS, address); if (date != null) { values.put(Telephony.Sms.DATE, date); } values.put(Telephony.Sms.READ, 0); values.put(Telephony.Sms.SUBJECT, subject); values.put(Telephony.Sms.BODY, body); values.put(Telephony.Sms.STATUS, statusPending); return resolver.insert(uri, values); }
Source:
public boolean hasMinimumSize() { return splitBrainProtectionState == SplitBrainProtectionState.MIN_CLUSTER_SIZE_SATISFIED; }

Target:
public boolean hasMinimumSize() { return splitBrainProtectionState == SplitBrainProtectionState.HAS_MIN_CLUSTER_SIZE; }