auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected <S> S post(String url, Object object, Class<S> clazz) { String json = null; try { json = mapper.writeValueAsString(object); } catch (JsonProcessingException e) { String message = String.format("Could not process %s: %s", object.getClass().getSimpleName(), object.toString()); throw new BridgeSDKException(message, e); } HttpResponse response = post(url, json); return getResponseBodyAsType(response, clazz); }

Target:
protected <S> S post(String url, Object object, Class<S> clazz) { try { String json = mapper.writeValueAsString(object); HttpResponse response = post(url, json); return getResponseBodyAsType(response, clazz); } catch (JsonProcessingException e) { String message = String.format("Could not process %s: %s", object.getClass().getSimpleName(), object.toString()); throw new BridgeSDKException(message, e); } }
Source:
private Collection<PatchLineComment> addCommentsInFile( Collection<PatchLineComment> commentsOnFile, Collection<PatchLineComment> allComments, String file) { for (PatchLineComment c : allComments) { String currentFilename = c.getKey().getParentKey().getFileName(); if (currentFilename.equals(file)) { commentsOnFile.add(c); } } return commentsOnFile; }

Target:
private static Collection<PatchLineComment> addCommentsInFile( Collection<PatchLineComment> commentsOnFile, Collection<PatchLineComment> allComments, String file) { for (PatchLineComment c : allComments) { String currentFilename = c.getKey().getParentKey().getFileName(); if (currentFilename.equals(file)) { commentsOnFile.add(c); } } return commentsOnFile; }
Source:
private boolean isTooLarge(BigDecimal value) { BigDecimal scaled = value.multiply( scalingFactor ); return ( scaled.compareTo( BigDecimal.valueOf( Long.MAX_VALUE ) ) > 0 || scaled.compareTo( BigDecimal.valueOf( Long.MIN_VALUE ) ) < 0 ); }

Target:
private boolean isTooLarge(BigDecimal value) { BigDecimal scaled = value.multiply( scalingFactor ); return ( scaled.compareTo( NumberScaleConstants.MIN_LONG_AS_BIGDECIMAL ) < 0 || scaled.compareTo( NumberScaleConstants.MAX_LONG_AS_BIGDECIMAL ) > 0 ); }
Source:
public void install(String extensionId) { Extension ext = getExtension(extensionId, null); if (ext instanceof MarketplaceExtension && !ext.isInstalled()) { MarketplaceExtension mpExt = (MarketplaceExtension) ext; String type = getType(extensionId); switch (type) { case "ruletemplate": String url = mpExt.getDownloadUrl(); try { String template = getTemplate(url); marketplaceRuleTemplateProvider.addTemplateAsJSON(extensionId, template); } catch (ParsingException e) { postFailureEvent(extensionId, "Template is not valid."); logger.error("Rule template from marketplace is invalid: {}", e.getMessage()); } catch (IOException e) { postFailureEvent(extensionId, "Template cannot be downloaded."); logger.error("Rule template from marketplace cannot be downloaded: {}", e.getMessage()); } break; default: postFailureEvent(extensionId, "Id not known."); } postInstalledEvent(extensionId); } }

Target:
public void install(String extensionId) { Extension ext = getExtension(extensionId, null); if (ext instanceof MarketplaceExtension) { MarketplaceExtension mpExt = (MarketplaceExtension) ext; for (MarketplaceExtensionHandler handler : extensionHandlers) { if (handler.supports(mpExt)) { if (!handler.isInstalled(mpExt)) { try { handler.install(mpExt); postInstalledEvent(extensionId); } catch (MarketplaceHandlerException e) { postFailureEvent(extensionId, e.getMessage()); } } else { postFailureEvent(extensionId, "Extension is already installed."); } return; } } } postFailureEvent(extensionId, "Extension not known."); }
Source:
public void testSatisfiedNetworkRequestDoesNotTriggerOnUnavailable() { NetworkRequest nr = new NetworkRequest.Builder().addTransportType( NetworkCapabilities.TRANSPORT_WIFI).build(); final TestNetworkCallback networkCallback = new TestNetworkCallback(); final int timeoutMs = 150; mCm.requestNetwork(nr, networkCallback, timeoutMs); mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI); mWiFiNetworkAgent.connect(false); networkCallback.expectAvailableCallbacks(mWiFiNetworkAgent, false, false, timeoutMs + TEST_CALLBACK_TIMEOUT_MS); networkCallback.assertNoCallback(); }

Target:
public void testSatisfiedNetworkRequestDoesNotTriggerOnUnavailable() { NetworkRequest nr = new NetworkRequest.Builder().addTransportType( NetworkCapabilities.TRANSPORT_WIFI).build(); final TestNetworkCallback networkCallback = new TestNetworkCallback(); final int timeoutMs = 150; mCm.requestNetwork(nr, networkCallback, timeoutMs); mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI); mWiFiNetworkAgent.connect(false); networkCallback.expectAvailableCallbacks(mWiFiNetworkAgent, false, false, TEST_CALLBACK_TIMEOUT_MS); networkCallback.assertNoCallback(); }
Source:
public void close() throws Exception { if (tracerFactory != null) { tracerFactory.close(); } if (transportFactories.production() .isPresent()) { transportFactories.production() .get() .close(); } if (storages.production() .isPresent()) { storages.production() .get() .close(); } }

Target:
public void close() throws Exception { tracerFactory.ifPresentForEnvironment(Production.class, AutoCloseable::close); transportFactory.ifPresentForEnvironment(Production.class, AutoCloseable::close); storageFactory.ifPresentForEnvironment(Production.class, AutoCloseable::close); }
Source:
List<MetricFamilySamples> fromMeter(String name, Meter meter) { return Arrays.asList( new MetricFamilySamples(name + "_total", Type.COUNTER, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_total", new ArrayList<String>(), new ArrayList<String>(), meter.getCount()))), new MetricFamilySamples(name + "_1m_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_1m_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getOneMinuteRate()))), new MetricFamilySamples(name + "_5m_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_5m_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getFiveMinuteRate()))), new MetricFamilySamples(name + "_15m_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_15m_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getFifteenMinuteRate()))), new MetricFamilySamples(name + "_mean_rate", Type.GAUGE, GENERIC_HELP_MESSAGE, Arrays.asList(new MetricFamilySamples.Sample(name + "_mean_rate", new ArrayList<String>(), new ArrayList<String>(), meter.getMeanRate()))) ); }

Target:
List<MetricFamilySamples> fromMeter(String name, Meter meter) { return Arrays.asList( new MetricFamilySamples(name + "_total", Type.COUNTER, getHelpMessage(name, meter), Arrays.asList(new MetricFamilySamples.Sample(name + "_total", new ArrayList<String>(), new ArrayList<String>(), meter.getCount()))) ); }
Source:
public void testLogErrorDoesntLogWhenNoAnnotation() throws Exception { Log log = mock(Log.class); LoggedUtils.logError(log, "", new Object(), new Exception()); }

Target:
public void testLogErrorDoesntLogWhenNoAnnotation() throws Exception { Log log = mock(Log.class); LoggedUtils.logError(log, "", new Object(), new Exception()); verifyZeroInteractions(log); }
Source:
private Map<String, Integer> getSystemStatistics() { Map<String, Integer> res = new HashMap<String, Integer>(); int totalVMs = getTotalVMsStat(); int activeVMs = getActiveVMsStat(); int downVMs = (totalVMs - activeVMs) < 0 ? 0 : (totalVMs - activeVMs); int totalHosts = getTotalHostsStat(); int activeHosts = getActiveHostsStat(); int maintenanceHosts = getMaintenanceHostsStat(); int downHosts = (totalHosts - activeHosts - maintenanceHosts) < 0 ? 0 : (totalHosts - activeHosts - maintenanceHosts); int totalUsers = getTotalUsersStat(); int activeUsers = getActiveUsersStat(); int totalStorageDomains = getTotalStorageDomainsStat(); int activeStorageDomains = getActiveStorageDomainsStat(); res.put(QueryConstants.SYSTEM_STATS_TOTAL_VMS_FIELD, totalVMs); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_VMS_FIELD, activeVMs); res.put(QueryConstants.SYSTEM_STATS_DOWN_VMS_FIELD, downVMs); res.put(QueryConstants.SYSTEM_STATS_TOTAL_HOSTS_FIELD, totalHosts); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_HOSTS_FIELD, activeHosts); res.put(QueryConstants.SYSTEM_STATS_MAINTENANCE_HOSTS_FIELD, maintenanceHosts); res.put(QueryConstants.SYSTEM_STATS_DOWN_HOSTS_FIELD, downHosts); res.put(QueryConstants.SYSTEM_STATS_TOTAL_USERS_FIELD, totalUsers); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_USERS_FIELD, activeUsers); res.put(QueryConstants.SYSTEM_STATS_TOTAL_STORAGE_DOMAINS_FIELD, totalStorageDomains); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_STORAGE_DOMAINS_FIELD, activeStorageDomains); return res; }

Target:
private Map<String, Integer> getSystemStatistics() { Map<String, Integer> res = new HashMap<String, Integer>(); int totalVMs = getTotalVMsStat(); int activeVMs = getActiveVMsStat(); int downVMs = (totalVMs - activeVMs) < 0 ? 0 : (totalVMs - activeVMs); int totalHosts = getTotalHostsStat(); int activeHosts = getActiveHostsStat(); int maintenanceHosts = getMaintenanceHostsStat(); int downHosts = (totalHosts - activeHosts - maintenanceHosts) < 0 ? 0 : (totalHosts - activeHosts - maintenanceHosts); res.put(QueryConstants.SYSTEM_STATS_TOTAL_VMS_FIELD, totalVMs); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_VMS_FIELD, activeVMs); res.put(QueryConstants.SYSTEM_STATS_DOWN_VMS_FIELD, downVMs); res.put(QueryConstants.SYSTEM_STATS_TOTAL_HOSTS_FIELD, totalHosts); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_HOSTS_FIELD, activeHosts); res.put(QueryConstants.SYSTEM_STATS_MAINTENANCE_HOSTS_FIELD, maintenanceHosts); res.put(QueryConstants.SYSTEM_STATS_DOWN_HOSTS_FIELD, downHosts); res.put(QueryConstants.SYSTEM_STATS_TOTAL_USERS_FIELD, getTotalUsersStat()); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_USERS_FIELD, getActiveUsersStat()); res.put(QueryConstants.SYSTEM_STATS_TOTAL_STORAGE_DOMAINS_FIELD, getTotalStorageDomainsStat()); res.put(QueryConstants.SYSTEM_STATS_ACTIVE_STORAGE_DOMAINS_FIELD, getActiveStorageDomainsStat()); return res; }
Source:
public void onClose() { scheduledExecutorService.shutdownNow(); }

Target:
public void onClose() { scheduledExecutorService.shutdown(); }
Source:
private void setPassphrase(String imei) { byte[] passphrase_string = imei.getBytes(); byte[] passphrase_salt = PASSPHRASE_SALT.getBytes(); byte[] input = new byte[passphrase_string.length + passphrase_salt.length]; System.arraycopy(passphrase_string, 0, input, 0, passphrase_string.length); System.arraycopy(passphrase_salt, 0, input, passphrase_string.length, passphrase_salt.length); MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e1) { Log.e(TAG, "Error initializing SHA1 message digest"); } byte[] result_byte = md.digest(input); passphrase = new String(result_byte); }

Target:
private void setPassphrase(String imei) { String salt = sMainPrefs.getString(Advanced.ENCRYPT_DATABASE_SALT, DEFAULT_PASSPHRASE_SALT); MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e1) { Log.e(TAG, "Error initializing SHA-1 message digest"); } byte[] result_byte = md.digest((imei+salt).getBytes()); passphrase = new String(result_byte); }
Source:
public void testMetricsFromClippedOverhangs() throws IOException { final File input = new File(TEST_DATA_DIR, "namesorted.test.sam"); final File outfile = File.createTempFile("metrics", ".txt"); outfile.deleteOnExit(); final String[] args = new String[] { "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath() }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>> output = new MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>>(); output.read(new FileReader(outfile)); for (final CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics metrics : output.getMetrics()) { final boolean isRaw = metrics.TYPE == CollectWgsMetricsFromQuerySorted.METRICS_TYPE.RAW; Assert.assertEquals(metrics.TOTAL_BASES, 606); Assert.assertEquals(metrics.TOTAL_PASSING_BASES, isRaw ? 238 : 200); Assert.assertEquals(metrics.PCT_EXC_OVERLAP, isRaw ? 0.085809 : 0.013201); Assert.assertEquals(metrics.PCT_EXC_BASEQ, isRaw ? 0.188119 : 0.156766); Assert.assertEquals(metrics.PCT_EXC_MAPQ, isRaw ? 0.0 : 0.166667); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.333333); Assert.assertEquals(metrics.TOTAL_READ_PAIRS, 3); Assert.assertEquals(metrics.TOTAL_DUPE_PAIRS, 1); Assert.assertEquals(metrics.TOTAL_ORIENTED_PAIRS, 2); Assert.assertEquals(metrics.MEAN_INSERT_SIZE, 118.0); } }

Target:
public void testMetricsFromClippedOverhangs() throws IOException { final File input = new File(TEST_DATA_DIR, "namesorted.test.sam"); final File outfile = File.createTempFile("metrics", ".txt"); outfile.deleteOnExit(); final String[] args = new String[] { "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath() }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>> output = new MetricsFile<CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics, Comparable<?>>(); output.read(new FileReader(outfile)); for (final CollectWgsMetricsFromQuerySorted.QuerySortedSeqMetrics metrics : output.getMetrics()) { final boolean isRaw = metrics.TYPE == CollectWgsMetricsFromQuerySorted.FILTERING_STRINGENCY.RAW; Assert.assertEquals(metrics.TOTAL_BASES, 606); Assert.assertEquals(metrics.TOTAL_PASSING_BASES, isRaw ? 238 : 200); Assert.assertEquals(metrics.PCT_EXC_OVERLAP, isRaw ? 0.085809 : 0.013201); Assert.assertEquals(metrics.PCT_EXC_BASEQ, isRaw ? 0.188119 : 0.156766); Assert.assertEquals(metrics.PCT_EXC_MAPQ, isRaw ? 0.0 : 0.166667); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.333333); Assert.assertEquals(metrics.TOTAL_READ_PAIRS, 3); Assert.assertEquals(metrics.TOTAL_DUPE_PAIRS, 1); Assert.assertEquals(metrics.TOTAL_ORIENTED_PAIRS, 2); Assert.assertEquals(metrics.MEAN_INSERT_SIZE, 118.0); } }
Source:
public Mono<Void> fireAndForget(Payload payload) { try { if (leaseHandler != null) { MissingLeaseException leaseError = leaseHandler.useLease(); if (leaseError != null) { return Mono.error(leaseError); } } return requestHandler.fireAndForget(payload); } catch (Throwable t) { return Mono.error(t); } }

Target:
public Mono<Void> fireAndForget(Payload payload) { try { if (leaseHandler.useLease()) { return requestHandler.fireAndForget(payload); } else { payload.release(); return Mono.error(leaseHandler.leaseError()); } } catch (Throwable t) { return Mono.error(t); } }
Source:
public static void main(String[] argv) throws Exception{ Args args = new Args(); CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(argv); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } final IndexUtils util = new IndexUtils(args.index); if (args.stats) { util.printIndexStats(); } if (args.term != null) { util.printTermCounts(args.term); } if (args.docvectorDocid != null) { util.printDocumentVector(args.docvectorDocid); } if (args.docVectors != null) { if (args.docVectorWeight != null) { util.dumpDocumentVectors(args.docVectors, args.docVectorWeight); } else { util.dumpDocumentVectors(args.docVectors, null); } } if (args.dumpAllDocids != null) { util.getAllDocids(args.dumpAllDocids); } if (args.rawDoc != null) { System.out.println(util.getRawDocument(args.rawDoc)); } if (args.rawDocs != null) { util.dumpRawDocuments(args.rawDocs, false); } if (args.rawDocsWithDocid != null) { util.dumpRawDocuments(args.rawDocs, true); } if (args.transformedDoc != null) { System.out.println(util.getTransformedDocument(args.transformedDoc)); } if (args.sentDoc != null) { for (Sentence sent: util.getSentDocument(args.sentDoc)){ System.out.println(sent); } } if (args.lookupDocid != null) { System.out.println(util.convertDocidToLuceneDocid(args.lookupDocid)); } if (args.lookupLuceneDocid > 0) { System.out.println(util.convertLuceneDocidToDocid(args.lookupLuceneDocid)); } }

Target:
public static void main(String[] argv) throws Exception{ Args args = new Args(); CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(argv); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } final IndexUtils util = new IndexUtils(args.index); if (args.stats) { util.printIndexStats(); } if (args.term != null) { util.printTermCounts(args.term); } if (args.docvectorDocid != null) { util.printDocumentVector(args.docvectorDocid); } if (args.docVectors != null) { if (args.docVectorWeight == null) { args.docVectorWeight = DocVectorWeight.NONE; } util.dumpDocumentVectors(args.docVectors, args.docVectorWeight); } if (args.dumpAllDocids != null) { util.getAllDocids(args.dumpAllDocids); } if (args.rawDoc != null) { System.out.println(util.getRawDocument(args.rawDoc)); } if (args.rawDocs != null) { util.dumpRawDocuments(args.rawDocs, false); } if (args.rawDocsWithDocid != null) { util.dumpRawDocuments(args.rawDocs, true); } if (args.transformedDoc != null) { System.out.println(util.getTransformedDocument(args.transformedDoc)); } if (args.sentDoc != null) { for (Sentence sent: util.getSentDocument(args.sentDoc)){ System.out.println(sent); } } if (args.lookupDocid != null) { System.out.println(util.convertDocidToLuceneDocid(args.lookupDocid)); } if (args.lookupLuceneDocid > 0) { System.out.println(util.convertLuceneDocidToDocid(args.lookupLuceneDocid)); } }
Source:
public void testFilterNoColumns() { PageProcessor pageProcessor = new PageProcessor(Optional.of(new TestingPageFilter(positionsRange(0, 50))), ImmutableList.of()); Page inputPage = new Page(createLongSequenceBlock(0, 100)); AggregatedMemoryContext memoryContext = newSimpleAggregatedMemoryContext(); Iterator<Optional<Page>> output = pageProcessor.process(SESSION, new DriverYieldSignal(), memoryContext, inputPage); assertEquals(memoryContext.getBytes(), inputPage.getRetainedSizeInBytes()); List<Optional<Page>> outputPages = ImmutableList.copyOf(output); assertEquals(outputPages.size(), 1); Page outputPage = outputPages.get(0).orElse(null); assertEquals(outputPage.getChannelCount(), 0); assertEquals(outputPage.getPositionCount(), 50); }

Target:
public void testFilterNoColumns() { PageProcessor pageProcessor = new PageProcessor(Optional.of(new TestingPageFilter(positionsRange(0, 50))), ImmutableList.of()); Page inputPage = new Page(createLongSequenceBlock(0, 100)); LocalMemoryContext memoryContext = newSimpleAggregatedMemoryContext().newLocalMemoryContext(PageProcessor.class.getSimpleName()); Iterator<Optional<Page>> output = pageProcessor.process(SESSION, new DriverYieldSignal(), memoryContext, inputPage); assertEquals(memoryContext.getBytes(), 0); List<Optional<Page>> outputPages = ImmutableList.copyOf(output); assertEquals(outputPages.size(), 1); Page outputPage = outputPages.get(0).orElse(null); assertEquals(outputPage.getChannelCount(), 0); assertEquals(outputPage.getPositionCount(), 50); }
Source:
public ForkPoint find() throws IOException { try (RevWalk walk = new RevWalk(repo)) { Branch currentBranch = new Branch(walk.parseCommit(repo.exactRef("HEAD").getObjectId()), "HEAD"); Set<Branch> refs = allRefsExceptCurrent(walk, currentBranch.head); init(walk, currentBranch, refs); RevCommit next; while ((next = queue.next()) != null) { List<Branch> origins = commitOrigins.get(next); if (origins.size() > 1 && origins.contains(currentBranch)) { return matchFound(next, origins); } for (RevCommit p : next.getParents()) { if (p.equals(currentBranch.head)) { continue; } registerOrigins(p, origins); if (!p.has(RevFlag.SEEN)) { parse(walk, p); p.add(RevFlag.SEEN); queue.add(p); } } commitOrigins.remove(next); } } return null; }

Target:
public ForkPoint find() throws IOException { try (RevWalk walk = new RevWalk(repo)) { walk.setRetainBody(false); RevCommit currentBranch = walk.parseCommit(repo.exactRef("HEAD").getObjectId()); List<RevCommit> otherBranches = findOtherBranches(repo, walk, currentBranch); return internalFind(walk, currentBranch, otherBranches); } }
Source:
protected void initMaxCnxns() { String mxCxnProp = System.getProperty(ZOOKEEPER_MAX_CONNECTION); maxCnxns = ZOOKEEPER_MAX_CONNECTION_DEFAULT; if (null != mxCxnProp) { LOG.info("maxCnxns configured value is {}.", mxCxnProp); try { maxCnxns = Integer.parseInt(mxCxnProp.trim()); } catch (NumberFormatException e) { LOG.warn("maxCnxns configured value '{}' can not be parsed to integer, using default value {}.", mxCxnProp, ZOOKEEPER_MAX_CONNECTION_DEFAULT); } if (maxCnxns < 0) { maxCnxns = 0; LOG.warn("maxCnxns should be greater than or equal to 0, using default vlaue {}.", ZOOKEEPER_MAX_CONNECTION_DEFAULT); } } else { LOG.warn("maxCnxns is not configured, using default value {}.", ZOOKEEPER_MAX_CONNECTION_DEFAULT); } }

Target:
protected void initMaxCnxns() { maxCnxns = Integer.getInteger(ZOOKEEPER_MAX_CONNECTION, ZOOKEEPER_MAX_CONNECTION_DEFAULT); if (maxCnxns < 0) { maxCnxns = ZOOKEEPER_MAX_CONNECTION_DEFAULT; LOG.warn("maxCnxns should be greater than or equal to 0, using default vlaue {}.", ZOOKEEPER_MAX_CONNECTION_DEFAULT); } else if (maxCnxns == ZOOKEEPER_MAX_CONNECTION_DEFAULT) { LOG.warn("maxCnxns is not configured, using default value {}.", ZOOKEEPER_MAX_CONNECTION_DEFAULT); } else { LOG.info("maxCnxns configured value is {}.", maxCnxns); } }
Source:
public void testAdapter() throws Exception { deployContrib("org.nuxeo.ecm.platform.pictures.tiles", "OSGI-INF/pictures-tiles-adapter-contrib.xml"); applyInlineDeployments(); postSetUp(); }

Target:
public void testAdapter() throws Exception { pushInlineDeployments("org.nuxeo.ecm.platform.pictures.tiles:OSGI-INF/pictures-tiles-adapter-contrib.xml"); }
Source:
public void updateFile(DrawableFile f) { try { DrawableTransaction trans = beginTransaction(); CaseDbTransaction caseDbTransaction = tskCase.beginTransaction(); updateFile(f, trans, caseDbTransaction); commitTransaction(trans, true); caseDbTransaction.commit(); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error updating file", ex); } }

Target:
public void updateFile(DrawableFile f) { DrawableTransaction trans = null; CaseDbTransaction caseDbTransaction = null; try { trans = beginTransaction(); caseDbTransaction = tskCase.beginTransaction(); updateFile(f, trans, caseDbTransaction); commitTransaction(trans, true); caseDbTransaction.commit(); } catch (TskCoreException ex) { if (null != trans) { rollbackTransaction(trans); } if (null != caseDbTransaction) { try { caseDbTransaction.rollback(); } catch (TskCoreException ex2) { LOGGER.log(Level.SEVERE, "Error in trying to rollback transaction", ex2); } } LOGGER.log(Level.SEVERE, "Error updating file", ex); } }
Source:
private static List<String> getUriList(WikibaseUris uris, Collection<String> prefixes) { List<String> uriList = new LinkedList<>(uris.entityURIs()); uris.entityInitials().forEach(s -> uriList.add(uris.entityIdToURI(s))); uriList.add(uris.statement()); uriList.add(uris.reference()); uriList.add(uris.value()); for (String p: prefixes) { uriList.add(uris.property(p) + "P"); } return uriList; }

Target:
private static List<String> getUriList(WikibaseUris uris, Collection<String> prefixes) { ImmutableList.Builder<String> uriList = ImmutableList.<String>builder(); uriList.addAll(uris.entityURIs()); uris.entityInitials().forEach(s -> uriList.add(uris.entityIdToURI(s))); uriList.add(uris.statement()); uriList.add(uris.reference()); uriList.add(uris.value()); for (String p: prefixes) { uriList.add(uris.property(p) + "P"); } return uriList.build(); }
Source:
public PageLayoutApi getPageLayoutApiForRef(SpaceReference layoutSpaceRef) { if (layoutSpaceRef != null) { return getPageLayoutApiForDocRef(getPageLayoutCmd().standardPropDocRef(layoutSpaceRef)); } return null; }

Target:
public PageLayoutApi getPageLayoutApiForRef(SpaceReference layoutSpaceRef) { return getPageLayoutCmd().resolveValidLayoutSpace(layoutSpaceRef) .map(PageLayoutApi::new) .orElse(null); }
Source:
private void updateGameStatus() { if (chatUser == null) { return; } Optional<Player> playerOptional = chatUser.getPlayer(); if (!playerOptional.isPresent()) { playerStatusIndicator.setVisible(false); playerMapIndicator.setVisible(false); return; } Player player = playerOptional.get(); switch (player.getStatus()) { case IDLE: playerStatusIndicator.setVisible(false); break; case HOSTING: playerStatusIndicator.setImage(playerStatusHosting); playerStatusIndicator.setVisible(true); break; case LOBBYING: playerStatusIndicator.setImage(playerStatusLobby); playerStatusIndicator.setVisible(true); break; case PLAYING: playerStatusIndicator.setImage(playerStatusPlaying); playerStatusIndicator.setVisible(true); break; } }

Target:
private void updateGameStatus() { if (chatUser == null) { return; } Optional<Player> playerOptional = chatUser.getPlayer(); if (!playerOptional.isPresent()) { playerStatusIndicator.setVisible(false); return; } Player player = playerOptional.get(); if (player.getStatus() == PlayerStatus.IDLE) { playerStatusIndicator.setVisible(false); } else { playerStatusIndicator.setVisible(true); playerStatusIndicator.setImage(getPlayerStatusIcon(player.getStatus())); } }
Source:
public SonarLintEngineManager() { this(new SonarLintEngineFactory()); if (!ApplicationManager.getApplication().isUnitTestMode()) { startSonarLintWebServer(); } }

Target:
public SonarLintEngineManager() { this(new SonarLintEngineFactory()); startSonarLintWebServer(); }
Source:
void doRun() { ObjectTransitionSafepoint.INSTANCE.register(); ActorProcessingThread t = (ActorProcessingThread) Thread.currentThread(); WebDebugger dbg = null; if (VmSettings.TRUFFLE_DEBUGGER_ENABLED) { dbg = vm.getWebDebugger(); assert dbg != null; } t.currentlyExecutingActor = actor; if (VmSettings.UNIFORM_TRACING) { ActorExecutionTrace.recordActivityContext(actor, tracer); } else if (VmSettings.KOMPOS_TRACING) { KomposTrace.currentActivity(actor); } try { while (getCurrentMessagesOrCompleteExecution()) { processCurrentMessages(t, dbg); } } finally { ObjectTransitionSafepoint.INSTANCE.unregister(); } if (VmSettings.UNIFORM_TRACING || VmSettings.KOMPOS_TRACING) { t.swapTracingBufferIfRequestedUnsync(); } t.currentlyExecutingActor = null; }

Target:
void doRun() { if (VmSettings.DYNAMIC_METRICS) { numTurnBatches.incrementAndGet(); } ObjectTransitionSafepoint.INSTANCE.register(); ActorProcessingThread t = (ActorProcessingThread) Thread.currentThread(); try { doRunWithObjectSafepoints(t); } finally { ObjectTransitionSafepoint.INSTANCE.unregister(); if (VmSettings.UNIFORM_TRACING || VmSettings.KOMPOS_TRACING) { t.swapTracingBufferIfRequestedUnsync(); } t.currentlyExecutingActor = null; } }
Source:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return next.clone().process() .doOnNext(HttpResponse::close) .map(res -> res.headerValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEP_REFIX)) .flatMap(map -> { cache.scopes(map.get("resource")+"/.default"); return cache.getToken(); }) .flatMap(token -> { context.httpRequest().header(AUTHORIZATION, BEARER_TOKEP_REFIX + token.token()); return next.process(); }); }

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return next.clone().process() .doOnNext(HttpResponse::close) .map(res -> res.headerValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) .flatMap(map -> { cache.scopes(map.get("resource") + "/.default"); return cache.getToken(); }) .flatMap(token -> { context.httpRequest().header(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.token()); return next.process(); }); }
Source:
private static List<String> replaceElementsSuffix(List<String> bcp, String originalSuffix, String newSuffix) { for (int i=0; i<bcp.size(); i++) { String entry = bcp.get(i); if (entry.endsWith(originalSuffix)) { bcp.set(i, entry.substring(0, entry.length() - 4) + newSuffix); } } return bcp; }

Target:
private static List<String> replaceElementsSuffix(List<String> bcp, String originalSuffix, String newSuffix) { for (int i=0; i<bcp.size(); i++) { String entry = bcp.get(i); if (entry.endsWith(originalSuffix)) { bcp.set(i, entry.substring(0, entry.length() - originalSuffix.length()) + newSuffix); } } return bcp; }
Source:
public void immutableSources() { new InfoboxBuilderPage().open("InfoboxBuilderImmutableRows") .switchToIFrame() .setAndVerifyRowLabelWithIndex(0, "AutomatedTest") .save(); String invocationLabelText = new PortableInfobox().open("InfoboxBuilderImmutableExample") .getDataLabelTextWithIndex(0); Assertion.assertEquals("AutomatedTest", invocationLabelText); }

Target:
public void immutableSources() { new InfoboxBuilderPage().open("InfoboxBuilderImmutableRows") .setAndVerifyRowLabel(0, "AutomatedTest") .save(); String invocationLabelText = new PortableInfobox().open("InfoboxBuilderImmutableExample") .getDataLabelTextWithIndex(0); Assertion.assertEquals("AutomatedTest", invocationLabelText); }
Source:
public KeyValue getByLanguageAndContentType(final String key, final long languageId, final String contentTypeId) { try { @SuppressWarnings("unchecked") Map<Long, Map<String, KeyValue>> cachedValues = Map.class.cast(this.cache.get(key, BY_LANGUAGE_CONTENT_TYPE_GROUP)); if (null != cachedValues) { if (cachedValues.containsKey(languageId)) { return cachedValues.get(languageId).get(contentTypeId); } } } catch (DotCacheException e) { Logger.debug(this, String.format("Cache entry with key %s was not found.", key), e); } return null; }

Target:
public KeyValue getByLanguageAndContentType(final String key, final long languageId, final String contentTypeId) { KeyValue keyValue = null; try { @SuppressWarnings("unchecked") final Map<Long, Map<String, KeyValue>> cachedValues = Map.class.cast(this.cache.get(key, BY_LANGUAGE_CONTENT_TYPE_GROUP)); keyValue = (null != cachedValues && cachedValues.containsKey(languageId))? cachedValues.get(languageId).get(contentTypeId):null; } catch (DotCacheException e) { Logger.debug(this, String.format("Cache entry with key %s was not found.", key), e); } return keyValue; }
Source:
static void showLicense(@Nullable final Context context, @NonNull final License license) { if (context == null) { return; } Observable.fromCallable(() -> getFormattedLicense(context, license)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(formattedLicense -> { final String webViewData = Base64.encodeToString(formattedLicense .getBytes(StandardCharsets.UTF_8), Base64.NO_PADDING); final WebView webView = new WebView(context); webView.loadData(webViewData, "text/html; charset=UTF-8", "base64"); final AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(license.getName()); alert.setView(webView); assureCorrectAppLanguage(context); alert.setNegativeButton(context.getString(R.string.finish), (dialog, which) -> dialog.dismiss()); alert.show(); }); }

Target:
static Disposable showLicense(@Nullable final Context context, @NonNull final License license) { if (context == null) { return Disposables.empty(); } return Observable.fromCallable(() -> getFormattedLicense(context, license)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(formattedLicense -> { final String webViewData = Base64.encodeToString(formattedLicense .getBytes(StandardCharsets.UTF_8), Base64.NO_PADDING); final WebView webView = new WebView(context); webView.loadData(webViewData, "text/html; charset=UTF-8", "base64"); final AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(license.getName()); alert.setView(webView); assureCorrectAppLanguage(context); alert.setNegativeButton(context.getString(R.string.finish), (dialog, which) -> dialog.dismiss()); alert.show(); }); }
Source:
private static ImagePredicate localMediaIdPredicate(String id) { return new ImagePredicate(id, "data-wpid"); }

Target:
static ImagePredicate localMediaIdPredicate(String id) { return new ImagePredicate(id, "data-wpid"); }
Source:
List<UsageConsumableInArrearTierUnitDetail> getBilledDetailsForUnitType(final Iterable<InvoiceItem> billedItems, final String unitType) { final Map<Integer, UsageConsumableInArrearTierUnitDetail> resultMap = new TreeMap<Integer, UsageConsumableInArrearTierUnitDetail>(Ordering.<Integer>natural()); for (final InvoiceItem bi : billedItems) { final UsageConsumableInArrearDetail usageDetail = fromJson(bi.getItemDetails()); for (final UsageConsumableInArrearTierUnitDetail curDetail : usageDetail.getTierDetails()) { if (curDetail.getTierUnit().equals(unitType)) { if (!resultMap.containsKey(curDetail.getTier())) { resultMap.put(curDetail.getTier(), curDetail); } else { final UsageConsumableInArrearTierUnitDetail perTierDetail = resultMap.get(curDetail.getTier()); perTierDetail.updateQuantityAndAmount(perTierDetail.getQuantity() + curDetail.getQuantity()); } } } } return ImmutableList.copyOf(resultMap.values()); }

Target:
List<UsageConsumableInArrearTierUnitDetail> getBilledDetailsForUnitType(final Iterable<InvoiceItem> billedItems, final String unitType) { final Map<Integer, UsageConsumableInArrearTierUnitDetail> resultMap = new TreeMap<Integer, UsageConsumableInArrearTierUnitDetail>(Ordering.<Integer>natural()); for (final InvoiceItem bi : billedItems) { final UsageConsumableInArrearDetail usageDetail = fromJson(bi.getItemDetails()); for (final UsageConsumableInArrearTierUnitDetail curDetail : usageDetail.getTierDetails()) { if (curDetail.getTierUnit().equals(unitType)) { if (!resultMap.containsKey(curDetail.getTier())) { resultMap.put(curDetail.getTier(), curDetail); } else { final UsageConsumableInArrearTierUnitDetail perTierDetail = resultMap.get(curDetail.getTier()); perTierDetail.updateQuantityAndAmount(curDetail.getQuantity()); } } } } return ImmutableList.copyOf(resultMap.values()); }
Source:
private void startWebMetrics() throws Exception { WebMetrics.INSTANCE.addExecutorManagerMetrics(getExecutorManager()); MetricRegistry registry = MetricsManager.INSTANCE.getRegistry(); MetricsUtility.addGauge("JETTY-NumIdleThreads", registry, queuedThreadPool::getIdleThreads); MetricsUtility.addGauge("JETTY-NumTotalThreads", registry, queuedThreadPool::getThreads); MetricsUtility.addGauge("JETTY-NumQueuedThreads", registry, queuedThreadPool::getQueueSize); logger.info("starting reporting Web Server Metrics"); MetricsManager.INSTANCE.startReporting("AZ-WEB", props); }

Target:
private void startWebMetrics() throws Exception { MetricRegistry registry = MetricsManager.INSTANCE.getRegistry(); MetricsUtility.addGauge("JETTY-NumIdleThreads", registry, queuedThreadPool::getIdleThreads); MetricsUtility.addGauge("JETTY-NumTotalThreads", registry, queuedThreadPool::getThreads); MetricsUtility.addGauge("JETTY-NumQueueSize", registry, queuedThreadPool::getQueueSize); MetricsUtility.addGauge("WEB-NumQueuedFlows", registry, executorManager::getQueuedFlowSize); MetricsUtility.addGauge("WEB-NumRunningFlows", registry, () -> executorManager.getRunningFlows().size()); logger.info("starting reporting Web Server Metrics"); MetricsManager.INSTANCE.startReporting("AZ-WEB", props); }
Source:
public Resource getResource(String path) throws ZebedeeException, IOException { try { return findResource(path); } catch (BadRequestException e) { return findResource(path + "/index.html"); } }

Target:
public Resource getResource(String path) throws ZebedeeException, IOException { try { return findResource(path); } catch (BadRequestException e) { if(path.startsWith("/visualisations/")) { return findResource(path + "/index.html"); } throw e; } }
Source:
protected void authenticate(BasicMessage basicMessage, Session session) throws WebsocketAuthenticationException { log.tracef("About to authenticate message [%s] from WebSocket session [%s] of [%s]", basicMessage.getClass().getSimpleName(), session.getId(), endpoint); String username = null; String password = null; String token = null; String persona = null; if (basicMessage instanceof AuthMessage) { AuthMessage authMessage = (AuthMessage) basicMessage; Authentication auth = authMessage.getAuthentication(); if (auth != null) { username = auth.getUsername(); password = auth.getPassword(); token = auth.getToken(); persona = auth.getPersona(); authMessage.setAuthentication(null); } } try { boolean hasToken = (token != null && !token.isEmpty()); if (hasToken) { log.tracef("authenticating token [%s/%s], session=[%s]", token, persona, session.getId()); authenticator.authenticateWithToken(token, persona, session); } else { log.tracef("authenticating user [%s/%s/%s], session=[%s]", username, password, persona, session.getId()); authenticator.authenticateWithCredentials(username, password, persona, session); } } catch (WebsocketAuthenticationException wae) { throw wae; } catch (Exception e) { throw new WebsocketAuthenticationException("Unauthorized!", e); } return; }

Target:
protected void authenticate(BasicMessage basicMessage, Session session) throws WebsocketAuthenticationException { log.tracef("About to authenticate message [%s] from WebSocket session [%s] of [%s]", basicMessage.getClass().getName(), session.getId(), endpoint); String username = null; String password = null; String token = null; String persona = null; if (basicMessage instanceof AuthMessage) { AuthMessage authMessage = (AuthMessage) basicMessage; Authentication auth = authMessage.getAuthentication(); if (auth != null) { username = auth.getUsername(); password = auth.getPassword(); token = auth.getToken(); persona = auth.getPersona(); authMessage.setAuthentication(null); } } try { boolean hasToken = (token != null && !token.isEmpty()); if (hasToken) { log.tracef("authenticating token [%s/%s], session=[%s]", token, persona, session.getId()); authenticator.authenticateWithToken(token, persona, session); } else { log.tracef("authenticating user [%s/%s/%s], session=[%s]", username, password, persona, session.getId()); authenticator.authenticateWithCredentials(username, password, persona, session); } } catch (WebsocketAuthenticationException wae) { throw wae; } catch (Exception e) { throw new WebsocketAuthenticationException("Unauthorized!", e); } return; }
Source:
public void testLockAfterTaskComplete() throws InterruptedException { Task task = NoopTask.create(); exception.expect(IllegalStateException.class); lockbox.add(task); lockbox.remove(task); lockbox.lock(task, new Interval("2015-01-01/2015-01-02")); }

Target:
public void testLockAfterTaskComplete() throws InterruptedException { Task task = NoopTask.create(); exception.expect(ISE.class); exception.expectMessage("Unable to grant lock to inactive Task"); lockbox.add(task); lockbox.remove(task); lockbox.lock(task, new Interval("2015-01-01/2015-01-02")); }
Source:
List<Pair<Map<String, String>, List<ClusterNode>>> findFromAllShards() { final NodeRegistry registry = this.registry.get(); if (registry == null) { throw new IllegalStateException("Registry not ready"); } final List<Pair<Map<String, String>, List<ClusterNode>>> shards = registry.findFromAllShards(OptionalLimit.empty()); if (expectedShards.isPresent()) { final Set<Map<String, String>> foundShards = new HashSet<>(shards .stream() .map(mapListPair -> mapListPair.getKey()) .collect(Collectors.toList())); final List<Map<String, String>> shardsWithNoNodes = new ArrayList<>(); for (final Map<String, String> expected : expectedShards.get()) { if (!foundShards.contains(expected)) { shardsWithNoNodes.add(expected); } } if (shardsWithNoNodes.size() > 0) { for (final Map<String, String> shard : shardsWithNoNodes) { shards.add(Pair.of(shard, ImmutableList.of())); } } } return shards; }

Target:
List<Pair<Map<String, String>, List<ClusterNode>>> findFromAllShards() { final NodeRegistry registry = this.registry.get(); if (registry == null) { throw new IllegalStateException("Registry not ready"); } final List<Pair<Map<String, String>, List<ClusterNode>>> shards = registry.findFromAllShards(OptionalLimit.empty()); final Set<Map<String, String>> foundShards = new HashSet<>(shards.stream().map(Pair::getKey).collect(Collectors.toList())); final List<Map<String, String>> shardsWithNoNodes = expectedTopology .stream() .filter(e -> !foundShards.contains(e)) .collect(Collectors.toList()); if (shardsWithNoNodes.isEmpty()) { return shards; } final List<Pair<Map<String, String>, List<ClusterNode>>> withExpected = new ArrayList<>(); withExpected.addAll(shards); for (final Map<String, String> shard : shardsWithNoNodes) { withExpected.add(Pair.of(shard, ImmutableList.of())); } return withExpected; }
Source:
protected @Nullable ZoomThread createZoomThread(long startTime, long endTime, long resolution, boolean restart) { return new ZoomThreadByEntry(fVisibleEntries, startTime, endTime, resolution); }

Target:
protected @Nullable ZoomThread createZoomThread(long startTime, long endTime, long resolution, boolean restart) { final List<TimeGraphEntry> entryList = fEntryList; if (entryList == null) { return null; } return new ZoomThreadByEntry(entryList, startTime, endTime, resolution); }
Source:
public void compareResultsCount(int limit){ if(limit==0){ waitForElementNotPresent(listOfLinksSelector); PageObjectLogging.log( "verifyNoPagenameFounded", "Not existing pagename is not founded", true, driver ); } else{ waitForElementByElement(listOfLinks.get(0)); int amountOfLinks = listOfLinks.size(); Assertion.assertTrue(amountOfLinks <= limit); } }

Target:
public void compareResultsCount(int limit){ if(limit==0) { waitForElementNotPresent(listOfLinksSelector); PageObjectLogging.log( "verifyNoPagenameFounded", "Not existing pagename is not founded", true, driver ); } else { waitForElementByElement(listOfLinks.get(0)); Assertion.assertTrue(listOfLinks.size() <= limit); } }
Source:
public void shouldRunAndPrintItself() throws Exception { String message = String.format( "%s#shouldRunAndPrintItself() %d.", getClass().getSimpleName(), counter.incrementAndGet() ); TimeUnit.SECONDS.sleep( 1 ); synchronized ( System.out ) { System.out.println( message ); } }

Target:
public void shouldRunAndPrintItself() throws Exception { String message = String.format( "%s#shouldRunAndPrintItself() %d.", getClass().getSimpleName(), COUNTER.incrementAndGet() ); synchronized ( System.out ) { System.out.println( message ); TimeUnit.SECONDS.sleep( 2 ); } }
Source:
private void onImportFromServiceSelected(int serviceId) { FragmentManager fragmentManager; if (getParentFragment() == null) { fragmentManager = getFragmentManager(); } else { fragmentManager = getParentFragment().getFragmentManager(); } NavigationHelper.openSubscriptionsImportFragment(fragmentManager, serviceId); }

Target:
private void onImportFromServiceSelected(int serviceId) { FragmentManager fragmentManager = getFM(); NavigationHelper.openSubscriptionsImportFragment(fragmentManager, serviceId); }
Source:
public void run() { List<LuceneWork> filteredQueue = new ArrayList<LuceneWork>(queue); for ( LuceneWork work : queue ) { if ( work instanceof OptimizeLuceneWork ) { filteredQueue.remove( work ); } } if ( filteredQueue.size() == 0 ) { return; } LuceneWorkSerializer serializer = indexManager.getSerializer(); byte[] data = serializer.toSerializedModel( filteredQueue ); QueueSender sender; QueueSession session = null; QueueConnection connection = null; try { connection = processor.getJMSConnection(); if ( processor.isTransactional() ) { session = connection.createQueueSession( true, QueueSession.SESSION_TRANSACTED ); } else { session = connection.createQueueSession( false, QueueSession.AUTO_ACKNOWLEDGE ); } ObjectMessage message = session.createObjectMessage(); message.setObject( data ); message.setStringProperty( Environment.INDEX_NAME_JMS_PROPERTY, indexName ); sender = session.createSender( processor.getJmsQueue() ); sender.send( message ); session.close(); } catch (JMSException e) { throw log.unableToSendJMSWork( indexName, processor.getJmsQueueName(), e ); } finally { processor.releaseJMSConnection( connection ); } }

Target:
public void run() { List<LuceneWork> filteredQueue = new ArrayList<LuceneWork>(queue); for ( LuceneWork work : queue ) { if ( work instanceof OptimizeLuceneWork ) { filteredQueue.remove( work ); } } if ( filteredQueue.size() == 0 ) { return; } LuceneWorkSerializer serializer = indexManager.getSerializer(); byte[] data = serializer.toSerializedModel( filteredQueue ); QueueSender sender; QueueSession session = null; QueueConnection connection = null; try { connection = processor.getJMSConnection(); if ( processor.isTransactional() ) { session = connection.createQueueSession( true, QueueSession.SESSION_TRANSACTED ); } else { session = connection.createQueueSession( false, QueueSession.AUTO_ACKNOWLEDGE ); } ObjectMessage message = session.createObjectMessage(); message.setObject( data ); message.setStringProperty( Environment.INDEX_NAME_JMS_PROPERTY, indexName ); sender = session.createSender( processor.getJmsQueue() ); sender.send( message ); sender.close(); session.close(); } catch (JMSException e) { throw log.unableToSendJMSWork( indexName, processor.getJmsQueueName(), e ); } finally { processor.releaseJMSConnection( connection ); } }
Source:
public void example61(Vertx vertx) { HttpServerOptions options = new HttpServerOptions() .setUseProxyProtocol(true); HttpServer server = vertx.createHttpServer(options); }

Target:
public void example61(Vertx vertx) { HttpServerOptions options = new HttpServerOptions() .setUseProxyProtocol(true); HttpServer server = vertx.createHttpServer(options); server.requestHandler(request -> { System.out.println(request.remoteAddress()); System.out.println(request.localAddress()); }); }
Source:
public void shouldCompileCleanlyWhenAllRulesAreFollowedInSubTemplate() throws FileNotFoundException { final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile( "org/jboss/errai/processor/testcase/DateFieldNoWarningsSubtemplate.java"); assertSuccessfulCompilation(diagnostics); }

Target:
public void shouldCompileCleanlyWhenAllRulesAreFollowedInSubTemplate() throws FileNotFoundException { final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile( "org/jboss/errai/processor/testcase/DataFieldNoWarningsSubtemplate.java"); assertSuccessfulCompilation(diagnostics); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Event)) return false; Event event = (Event) o; return id == event.id; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Event)) return false; Event event = (Event) o; return id == event.id && registrationLimit == event.registrationLimit && Objects.equals(title, event.title) && Objects.equals(description, event.description) && Objects.equals(start, event.start) && Objects.equals(end, event.end) && Objects.equals(registrationStart, event.registrationStart) && Objects.equals(registrationEnd, event.registrationEnd); }