auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onPartitionBecomeStandbyFromBootstrap(String partitionName) { ReplicaId localReplica = storeManager.getReplica(partitionName); Store store = storeManager.getStore(localReplica.getPartitionId()); if (store == null) { throw new StateTransitionException("Store " + partitionName + " is not started", StateTransitionException.TransitionErrorCode.StoreNotStarted); } store.setCurrentState(ReplicaState.BOOTSTRAP); if (store.isBootstrapInProgress()) { replicaSyncUpService.initiateBootstrap(localReplica); } else { store.setCurrentState(ReplicaState.STANDBY); } }

Target:
public void onPartitionBecomeStandbyFromBootstrap(String partitionName) { ReplicaId localReplica = storeManager.getReplica(partitionName); Store store = storeManager.getStore(localReplica.getPartitionId()); if (store == null) { throw new StateTransitionException("Store " + partitionName + " is not started", StateTransitionException.TransitionErrorCode.StoreNotStarted); } if (store.isBootstrapInProgress()) { store.setCurrentState(ReplicaState.BOOTSTRAP); replicaSyncUpManager.initiateBootstrap(localReplica); } else { store.setCurrentState(ReplicaState.STANDBY); } }
Source:
private Coin getValidBsqTransferAmount(double amount) { Coin amountAsCoin = parseToCoin(new BigDecimal(amount).toString(), bsqFormatter); if (amountAsCoin.equals(Coin.ZERO)) throw new IllegalStateException(format("%.2f bsq is an invalid send amount", amount)); return amountAsCoin; }

Target:
private Coin getValidBsqTransferAmount(double amount) { Coin amountAsCoin = parseToCoin(Double.toString(amount), bsqFormatter); if (amountAsCoin.equals(Coin.ZERO)) throw new IllegalStateException(format("%.2f bsq is an invalid send amount", amount)); return amountAsCoin; }
Source:
public void init(BatchTraceRecorderBuilder builder) { this.tracePublisher = builder.tracePublisher; this.tenantId = builder.tenantId; this.batchSize = builder.batchSize; this.traces = new ArrayList<>(batchSize + 1); Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(true); return t; } }).scheduleAtFixedRate(new Runnable() { @Override public void run() { if (!traces.isEmpty()) { try { lock.lock(); submitTraces(); } finally { lock.unlock(); } } } }, builder.batchTime, builder.batchTime, TimeUnit.MILLISECONDS); executor = Executors.newFixedThreadPool(builder.threadPoolSize, new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(true); return t; } }); }

Target:
protected void init(BatchTraceRecorderBuilder builder) { this.tracePublisher = builder.tracePublisher; this.tenantId = builder.tenantId; this.batchSize = builder.batchSize; this.traces = new ArrayList<>(batchSize + 1); Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(true); return t; } }).scheduleAtFixedRate(new Runnable() { @Override public void run() { if (!traces.isEmpty()) { try { lock.lock(); submitTraces(); } finally { lock.unlock(); } } } }, builder.batchTime, builder.batchTime, TimeUnit.MILLISECONDS); executor = Executors.newFixedThreadPool(builder.threadPoolSize, new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(true); return t; } }); }
Source:
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) { AdapterType result = null; synchronized(this) { result = (AdapterType) this.adaptersCache.get(type); if (result == null) { AdapterManager mgr = this.adapterManager; result = mgr == null ? null : mgr.getAdapter(this, type); if (result != null) { this.adaptersCache.put(type, result); } } return result; } }

Target:
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) { AdapterType result = null; synchronized(this) { result = (AdapterType) this.adaptersCache.get(type); if (result == null) { AdapterManager mgr = this.adapterManager; if (mgr == null) { LOG.warn("Unable to adapt request for path to because AdapterManager is null", this.resource.getPath(), type); } else { result = mgr.getAdapter(this, type); } if (result != null) { this.adaptersCache.put(type, result); } } return result; } }
Source:
public Object convertForGetter(Object object) { FileWrapper wrapper = (FileWrapper) object; File f = new File(tempDir + File.separator + wrapper.getFilename() + ".zip"); try { f.createNewFile(); FileOutputStream stream = new FileOutputStream(f); stream.write(wrapper.getContent()); stream.flush(); stream.close(); } catch (FileNotFoundException ex) { LOGGER.error("File " + f.getAbsolutePath() + " could not be created", ex); } catch (IOException ex) { LOGGER.error("IOException while writing the byte array of the wrapper to file " + f.getAbsolutePath(), ex); } return unzipFile(f, wrapper.getFilename()); }

Target:
public Object convertForGetter(Object object) { FileWrapper wrapper = (FileWrapper) object; File f = new File(tempDir + File.separator + wrapper.getFilename() + ".zip"); FileOutputStream stream = null; try { f.createNewFile(); stream = new FileOutputStream(f); stream.write(wrapper.getContent()); stream.flush(); stream.close(); } catch (FileNotFoundException ex) { LOGGER.error("File " + f.getAbsolutePath() + " could not be created", ex); } catch (IOException ex) { LOGGER.error("IOException while writing the byte array of the wrapper to file " + f.getAbsolutePath(), ex); } finally { try { stream.close(); } catch (IOException ex) { LOGGER.error("Error while closing FileOutputStream", ex); } } return unzipFile(f, wrapper.getFilename()); }
Source:
public void init(Map<String,String> conf) throws CryptoException { String keyLocation = conf.get("instance.crypto.opts.key.uri"); String keyMgr = "uri"; Objects.requireNonNull(keyLocation, "Config property instance.crypto.opts.key.uri is required."); this.sr = CryptoUtils.newSha1SecureRandom(); this.decryptingKeys = new HashMap<>(); switch (keyMgr) { case AESKeyUtils.URI: this.keyManager = keyMgr; this.keyLocation = keyLocation; this.encryptingKek = AESKeyUtils.loadKekFromUri(keyLocation); break; default: throw new CryptoException("Unrecognized key manager"); } }

Target:
public void init(Map<String,String> conf) throws CryptoException { String keyLocation = conf.get("instance.crypto.opts.key.uri"); String keyMgr = "uri"; Objects.requireNonNull(keyLocation, "Config property instance.crypto.opts.key.uri is required."); this.sr = CryptoUtils.newSha1SecureRandom(); this.decryptingKeys = new HashMap<>(); switch (keyMgr) { case AESKeyUtils.URI: this.keyManager = keyMgr; this.keyLocation = keyLocation; this.encryptingKek = AESKeyUtils.loadKekFromUri(keyLocation); break; default: throw new CryptoException("Unrecognized key manager"); } Objects.requireNonNull(this.encryptingKek, "Encrypting Key Encryption Key was null, init failed"); }
Source:
public void init(IPageBookViewPage page, IConsole console) { StopScriptAction stopScriptAction = new StopScriptAction(page .getSite().getWorkbenchWindow(), (ScriptConsole) console); IToolBarManager manager = page.getSite().getActionBars().getToolBarManager(); manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, stopScriptAction); }

Target:
public void init(IPageBookViewPage page, IConsole console) { if (!(console instanceof ScriptConsole)){ return; } StopScriptAction stopScriptAction = new StopScriptAction(page .getSite().getWorkbenchWindow(), (ScriptConsole) console); IToolBarManager manager = page.getSite().getActionBars().getToolBarManager(); manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, stopScriptAction); }
Source:
private ResultSet executeQuery(String url, String username, String password, String sql) { try (Connection connection = DriverManager.getConnection(url, username, password)) { try (Statement statement = connection.createStatement()) { try { ResultSet result = statement.executeQuery(sql); return result; } catch (SQLException e) { throw e; } catch (Exception e) { throw Throwables.propagate(e); } } } catch (SQLException e) { Exception exception = e; if (("Error executing query".equals(e.getMessage()) || "Error fetching results".equals(e.getMessage())) && (e.getCause() instanceof Exception)) { exception = (Exception) e.getCause(); } exception.printStackTrace(); return null; } }

Target:
private ResultSet executeQuery(String url, String username, String password, String sql) throws SQLException { try (Connection connection = DriverManager.getConnection(url, username, password); Statement statement = connection.createStatement()) { try { ResultSet result = statement.executeQuery(sql); return result; } catch (SQLException e) { throw e; } } catch (SQLException e) { throw e; } }
Source:
private Map<String, String> getProcessArgsMap(MetaDataMap metaDataMap) { final Map<String, String> map = new LinkedHashMap<String, String>(); final String processArgs = metaDataMap.get("PROCESS_ARGS", ""); final String[] lines = StringUtils.split(processArgs, ","); for (final String line : lines) { final String[] entry = StringUtils.split(line, "="); if (entry.length == 2) { map.put(entry[0], entry[1]); } } return map; }

Target:
private Map<String, String> getProcessArgsMap(MetaDataMap metaDataMap) { final Map<String, String> map = new LinkedHashMap<String, String>(); final String processArgs = metaDataMap.get(WorkflowHelper.PROCESS_ARGS, ""); return ParameterUtil.toMap(StringUtils.split(processArgs,","),"="); }
Source:
public void markInCatalog() { exportLog.info("ExportDataSource for table " + m_tableName + " partition " + m_partitionId + " marked as in catalog."); m_isInCatalog = true; }

Target:
public void markInCatalog() { m_isInCatalog = true; }
Source:
public void testTimedMetricMetadata() { final Response response = WebClient.create(base.toExternalForm()) .path("/metrics/application/weather_day_status") .accept(MediaType.APPLICATION_JSON) .options(); final String metaData = response.readEntity(String.class); JsonObject metadataJson = Json.createReader(new StringReader(metaData)).readObject(); final String expected = "{\n" + " \"weather_day_status\": {\n" + " \"description\": \"This metric shows the weather status of the day.\",\n" + " \"displayName\": \"Weather Day Status\",\n" + " \"name\": \"weather_day_status\",\n" + " \"reusable\": false,\n" + " \"tags\": \"\",\n" + " \"type\": \"timer\",\n" + " \"typeRaw\": \"TIMER\",\n" + " \"unit\": \"nanoseconds\"\n" + " }\n" + "}"; JsonObject expectedJson = Json.createReader(new StringReader(expected)).readObject(); assertEquals(expectedJson, metadataJson); }

Target:
public void testTimedMetricMetadata() { WebTarget webTarget = client.target(base.toExternalForm()); Response response = webTarget.path("/metrics/application/weather_day_status") .request() .accept(MediaType.APPLICATION_JSON) .build("OPTIONS") .invoke(); final String metaData = response.readEntity(String.class); JsonObject metadataJson = Json.createReader(new StringReader(metaData)).readObject(); final String expected = "{\n" + " \"weather_day_status\": {\n" + " \"description\": \"This metric shows the weather status of the day.\",\n" + " \"displayName\": \"Weather Day Status\",\n" + " \"name\": \"weather_day_status\",\n" + " \"reusable\": false,\n" + " \"tags\": \"\",\n" + " \"type\": \"timer\",\n" + " \"typeRaw\": \"TIMER\",\n" + " \"unit\": \"nanoseconds\"\n" + " }\n" + "}"; JsonObject expectedJson = Json.createReader(new StringReader(expected)).readObject(); assertEquals(expectedJson.keySet().size(), metadataJson.keySet().size()); String[] expectedKeys = { "description", "displayName", "name", "reusable", "tags", "type", "typeRaw", "unit", }; Stream.of(expectedKeys) .forEach(text -> assertTrue( "Expected: " + text + " to be present in " + expected, expectedJson.getJsonObject("weather_day_status").get(text) != null)); }
Source:
public void getFromPoint(RotatedTileBox tb,PointF point, List<? super TransportStop> res) { if (objects != null) { int ex = (int) point.x; int ey = (int) point.y; final int rp = getRadiusPoi(tb); int radius = rp * 3 / 2; int small = rp; try { for (int i = 0; i < objects.size(); i++) { TransportStop n = objects.get(i); if (n.getLocation() == null){ contunue; } int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) { radius = small; res.add(n); } } } catch (IndexOutOfBoundsException e) { } } }

Target:
public void getFromPoint(RotatedTileBox tb,PointF point, List<? super TransportStop> res) { if (objects != null) { int ex = (int) point.x; int ey = (int) point.y; final int rp = getRadiusPoi(tb); int radius = rp * 3 / 2; int small = rp; try { for (int i = 0; i < objects.size(); i++) { TransportStop n = objects.get(i); if (n.getLocation() == null){ continue; } int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) { radius = small; res.add(n); } } } catch (IndexOutOfBoundsException e) { } } }
Source:
public void removeConsumer(MqttMessageConsumer subscriber) { logger.debug("Removing message consumer for topic '{}' from broker '{}'", subscriber.getTopic(), name); try { if (started) { client.unsubscribe(subscriber.getTopic()); } } catch (Exception e) { logger.error(String.format("Error unsubscribing topic '{}' from broker '{}'", subscriber.getTopic(), name), e); } consumers.remove(subscriber); }

Target:
public void removeConsumer(MqttMessageConsumer subscriber) { logger.debug("Unsubscribing message consumer for topic '{}' from broker '{}'", subscriber.getTopic(), name); try { if (started) { client.unsubscribe(subscriber.getTopic()); } } catch (Exception e) { logger.error("Error unsubscribing topic from broker", e); } consumers.remove(subscriber); }
Source:
protected boolean validate() { DiskValidator diskValidator; if (getParameters().isImportEntity()) { return true; } diskValidator = new DiskValidator(getDiskImage()); List<Pair<VM, VmDevice>> vmsForDisk = vmDao.getVmsWithPlugInfo(getDiskImage().getId()); if (!validate(diskValidator.isDiskPluggedToVmsThatAreNotDown(false, vmsForDisk))) { StorageDomainStatic destDomain = storageDomainStaticDao.get(getParameters().getStorageDomainId()); if (destDomain.isBackup() == true) { return false; } } Guid imageGroupId = Guid.isNullOrEmpty(getParameters().getImageGroupID()) ? getImageGroupId() : getParameters().getImageGroupID(); Disk disk = diskDao.get(imageGroupId); if (disk != null) { diskValidator = new DiskValidator(disk); return validate(diskValidator.validateUnsupportedDiskStorageType( DiskStorageType.LUN, DiskStorageType.CINDER)); } return true; }

Target:
protected boolean validate() { DiskValidator diskValidator; if (getParameters().isImportEntity()) { return true; } diskValidator = new DiskValidator(getDiskImage()); List<Pair<VM, VmDevice>> vmsForDisk = vmDao.getVmsWithPlugInfo(getDiskImage().getId()); if (!validate(diskValidator.isDiskPluggedToVmsThatAreNotDown(false, vmsForDisk))) { StorageDomainStatic destDomain = storageDomainStaticDao.get(getParameters().getStorageDomainId()); if (destDomain.isBackup()) { new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_COPY_TO_BACKUP_DOMAIN); return false; } } Guid imageGroupId = Guid.isNullOrEmpty(getParameters().getImageGroupID()) ? getImageGroupId() : getParameters().getImageGroupID(); Disk disk = diskDao.get(imageGroupId); if (disk != null) { diskValidator = new DiskValidator(disk); return validate(diskValidator.validateUnsupportedDiskStorageType( DiskStorageType.LUN, DiskStorageType.CINDER)); } return true; }
Source:
PlanNodeStatsEstimate calculateJoinComplementStats( Optional<Expression> filter, List<JoinNode.EquiJoinClause> criteria, PlanNodeStatsEstimate leftStats, PlanNodeStatsEstimate rightStats, TypeProvider types) { if (rightStats.getOutputRowCount() == 0) { return leftStats; } if (criteria.isEmpty()) { if (filter.isPresent()) { return PlanNodeStatsEstimate.unknown(); } return normalizer.normalize(leftStats.mapOutputRowCount(rowCount -> 0.0), types); } int numberOfFilterClauses = filter.map(expression -> extractConjuncts(expression).size()).orElse(0); return criteria.stream() .map(drivingClause -> calculateJoinComplementStats(leftStats, rightStats, drivingClause, criteria.size() - 1 + numberOfFilterClauses)) .filter(estimate -> !estimate.isOutputRowCountUnknown()) .max(comparingDouble(PlanNodeStatsEstimate::getOutputRowCount)) .map(estimate -> normalizer.normalize(estimate, types)) .orElse(PlanNodeStatsEstimate.unknown()); }

Target:
PlanNodeStatsEstimate calculateJoinComplementStats( Optional<Expression> filter, List<JoinNode.EquiJoinClause> criteria, PlanNodeStatsEstimate leftStats, PlanNodeStatsEstimate rightStats, TypeProvider types) { if (leftStats.getOutputRowCount() == 0 || rightStats.getOutputRowCount() == 0) { return leftStats; } if (criteria.isEmpty()) { if (filter.isPresent()) { return PlanNodeStatsEstimate.unknown(); } return normalizer.normalize(leftStats.mapOutputRowCount(rowCount -> 0.0), types); } int numberOfFilterClauses = filter.map(expression -> extractConjuncts(expression).size()).orElse(0); return criteria.stream() .map(drivingClause -> calculateJoinComplementStats(leftStats, rightStats, drivingClause, criteria.size() - 1 + numberOfFilterClauses)) .filter(estimate -> !estimate.isOutputRowCountUnknown()) .max(comparingDouble(PlanNodeStatsEstimate::getOutputRowCount)) .map(estimate -> normalizer.normalize(estimate, types)) .orElse(PlanNodeStatsEstimate.unknown()); }
Source:
public void produceWrappedGraphData() { notifyLoadingObservers(true); List<DataNode> resultNodes = originalGraphData.getNodeListClone(); filter(resultNodes); List<Edge> resultEdges = originalGraphData.getEdgeListClone(); EdgeUtil.removeAllDeadEdges(resultEdges, resultNodes); WrappedGraphData wrappedGraphData = new WrappedGraphData(resultNodes, resultEdges); EdgeUtil.removeAllEmptyEdges(wrappedGraphData); collapsedNode = WrapUtil.collapseGraph(wrappedGraphData) .getPositionedNodes().get(0); positionNodeYOnGenomeSpace.calculate(collapsedNode, null); calculateCollapse.compute(collapsedNode); new CalculateNInterest(-1000000000).calculate(this.collapsedNode, null); setChanged(); notifyObservers(); notifyLoadingObservers(false); }

Target:
public void produceWrappedGraphData() { notifyLoadingObservers(true); List<DataNode> resultNodes = originalGraphData.getNodeListClone(); filter(resultNodes); List<Edge> resultEdges = originalGraphData.getEdgeListClone(); EdgeUtil.removeAllDeadEdges(resultEdges, resultNodes); WrappedGraphData wrappedGraphData = new WrappedGraphData(resultNodes, resultEdges); EdgeUtil.removeAllEmptyEdges(wrappedGraphData); collapsedNode = WrapUtil.collapseGraph(wrappedGraphData).getPositionedNodes().get(0); positionNodeYOnGenomeSpace.calculate(collapsedNode, null); calculateCollapse.compute(collapsedNode); setChanged(); notifyObservers(); notifyLoadingObservers(false); }
Source:
private int getAccountAgeInDays(final DateTime accountCreated) { final DateTime now = DateTime.now(DateTimeZone.UTC); return (int) ((now.getMillis() - accountCreated.getMillis())/DateTimeUtil.DAY_IN_MILLIS); }

Target:
private int getAccountAgeInDays(final DateTime accountCreated) { final DateTime now = DateTime.now(DateTimeZone.UTC); final Duration duration = new Duration(accountCreated, now); return duration.toStandardDays().getDays(); }
Source:
public String getSourceIDLPath() { return new File(swiftDocumentContext.getThriftIDLUri()).toString(); }

Target:
public String getSourceIDLPath() throws Exception { URI inputBase = swiftDocumentContext.getSwiftGeneratorConfig().getInputBase(); URI idlUri = swiftDocumentContext.getThriftIdlUri(); return inputBase.relativize(idlUri).getPath(); }
Source:
static String attemptManualHighlighting(SolrDocumentList solrDocumentList, String highlightField, Collection<String> keywords) { if (solrDocumentList.isEmpty()) { return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "document"); } String text = solrDocumentList.get(0).getOrDefault(highlightField, "").toString(); text = StringEscapeUtils.escapeHtml(text); TreeRangeSet<Integer> highlights = TreeRangeSet.create(); for (String keyword : keywords) { final String escapedKeyword = StringEscapeUtils.escapeHtml(keyword); int searchOffset = 0; int hitOffset = StringUtils.indexOfIgnoreCase(text, escapedKeyword, searchOffset); while (hitOffset != -1) { searchOffset = hitOffset + escapedKeyword.length(); highlights.add(Range.closedOpen(hitOffset, searchOffset)); hitOffset = StringUtils.indexOfIgnoreCase(text, escapedKeyword, searchOffset); } } StringBuilder highlightedText = new StringBuilder(text); int totalHighLightLengthInserted = 0; for (Range<Integer> highlightRange : highlights.asRanges()) { int hStart = highlightRange.lowerEndpoint(); int hEnd = highlightRange.upperEndpoint(); highlightedText.insert(hStart + totalHighLightLengthInserted, HIGHLIGHT_PRE); totalHighLightLengthInserted += HIGHLIGHT_PRE.length(); highlightedText.insert(hEnd + totalHighLightLengthInserted, HIGHLIGHT_POST); totalHighLightLengthInserted += HIGHLIGHT_POST.length(); } return highlightedText.toString(); }

Target:
static String attemptManualHighlighting(SolrDocumentList solrDocumentList, String highlightField, Collection<String> keywords) { if (solrDocumentList.isEmpty()) { return Bundle.IndexedText_errorMessage_errorGettingText(); } String text = solrDocumentList.get(0).getOrDefault(highlightField, "").toString(); text = StringEscapeUtils.escapeHtml(text); TreeRangeSet<Integer> highlights = TreeRangeSet.create(); for (String keyword : keywords) { final String escapedKeyword = StringEscapeUtils.escapeHtml(keyword); int searchOffset = 0; int hitOffset = StringUtils.indexOfIgnoreCase(text, escapedKeyword, searchOffset); while (hitOffset != -1) { searchOffset = hitOffset + escapedKeyword.length(); highlights.add(Range.closedOpen(hitOffset, searchOffset)); hitOffset = StringUtils.indexOfIgnoreCase(text, escapedKeyword, searchOffset); } } StringBuilder highlightedText = new StringBuilder(text); int totalHighLightLengthInserted = 0; for (Range<Integer> highlightRange : highlights.asRanges()) { int hStart = highlightRange.lowerEndpoint(); int hEnd = highlightRange.upperEndpoint(); highlightedText.insert(hStart + totalHighLightLengthInserted, HIGHLIGHT_PRE); totalHighLightLengthInserted += HIGHLIGHT_PRE.length(); highlightedText.insert(hEnd + totalHighLightLengthInserted, HIGHLIGHT_POST); totalHighLightLengthInserted += HIGHLIGHT_POST.length(); } return highlightedText.toString(); }
Source:
public void shouldFailCaptureWhenInvalidConnectorUrl() { DatabaseFixtures.TestCharge testCharge = createTestCharge(app.getDatabaseTestHelper()); setupGatewayStub().respondWithUnexpectedResponseCodeWhenCapture(); app.getInstanceFromGuiceContainer(CardCaptureProcess.class).loadCaptureQueue(); app.getInstanceFromGuiceContainer(CardCaptureProcess.class).runCapture(1); assertLastGatewayClientLoggingEventContains("Exception for gateway url=<LINK_0>"); Assert.assertThat(app.getDatabaseTestHelper().getChargeStatus(testCharge.getChargeId()), is(CAPTURE_APPROVED_RETRY.getValue())); }

Target:
public void shouldFailCaptureWhenInvalidConnectorUrl() { DatabaseFixtures.TestCharge testCharge = createTestCharge(app.getDatabaseTestHelper()); setupGatewayStub().respondWithUnexpectedResponseCodeWhenCapture(); app.getInstanceFromGuiceContainer(CardCaptureProcess.class).loadCaptureQueue(); app.getInstanceFromGuiceContainer(CardCaptureProcess.class).runCapture(1); assertLastGatewayClientLoggingEventContains("Exception for gateway url=<LINK_0>"); assertThat(app.getDatabaseTestHelper().getChargeStatus(testCharge.getChargeId()), is(CAPTURE_APPROVED_RETRY.getValue())); }
Source:
private void init() { application = this; injector = RoboGuice.getOrCreateBaseApplicationInjector((Application) this, RoboGuice.DEFAULT_STAGE, (Module) RoboGuice.newDefaultRoboModule(this), (Module) new EdxDefaultModule(this)); injector.injectMembers(this); if (config.getFabricConfig().isEnabled() && !BuildConfig.DEBUG) { Fabric.with(this, new CrashlyticsCore()); EventBus.getDefault().register(new CrashlyticsCrashReportObserver()); } if (config.getNewRelicConfig().isEnabled()) { NewRelic.withApplicationToken(config.getNewRelicConfig().getNewRelicKey()) .withCrashReportingEnabled(false) .start(this); } if (config.getSegmentConfig().isEnabled()) { analyticsProvider.addAnalyticsProvider(injector.getInstance(SegmentAnalytics.class)); } registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION)); boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext(), config); if (!isOnZeroRatedNetwork && config.getFacebookConfig().isEnabled()) { com.facebook.Settings.setApplicationId(config.getFacebookConfig().getFacebookAppId()); } if (needVersionUpgrade(this)) { injector.getInstance(IStorage.class).repairDownloadCompletionData(); } Iconify.with(new FontAwesomeModule()); CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/OpenSans-Regular.ttf") .setFontAttrId(R.attr.fontPath) .build() ); }

Target:
private void init() { application = this; injector = RoboGuice.getOrCreateBaseApplicationInjector((Application) this, RoboGuice.DEFAULT_STAGE, (Module) RoboGuice.newDefaultRoboModule(this), (Module) new EdxDefaultModule(this)); injector.injectMembers(this); if (config.getFabricConfig().isEnabled() && !BuildConfig.DEBUG) { Fabric.with(this, config.getFabricConfig().getKitsConfig().getEnabledKits()); if (config.getFabricConfig().getKitsConfig().isCrashlyticsEnabled()) { EventBus.getDefault().register(new CrashlyticsCrashReportObserver()); } } if (config.getNewRelicConfig().isEnabled()) { NewRelic.withApplicationToken(config.getNewRelicConfig().getNewRelicKey()) .withCrashReportingEnabled(false) .start(this); } if (config.getSegmentConfig().isEnabled()) { analyticsRegistry.addAnalyticsProvider(injector.getInstance(SegmentAnalytics.class)); } registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION)); boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext(), config); if (!isOnZeroRatedNetwork && config.getFacebookConfig().isEnabled()) { com.facebook.Settings.setApplicationId(config.getFacebookConfig().getFacebookAppId()); } if (needVersionUpgrade(this)) { injector.getInstance(IStorage.class).repairDownloadCompletionData(); } Iconify.with(new FontAwesomeModule()); CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/OpenSans-Regular.ttf") .setFontAttrId(R.attr.fontPath) .build() ); }
Source:
public boolean cancelFYIsAndAcknowledgements() { Connection conn = null; CallableStatement cs = null; DbmsOutput dbmsOutput = null; boolean result; try { conn = getJdbcTemplate().getDataSource().getConnection(); cs = conn.prepareCall("{call CYNERGY.AUTO_CANCEL_FYI_ACK}"); dbmsOutput = new DbmsOutput(conn); dbmsOutput.enable(1000000); result = cs.execute(); dbmsOutput.show(); } catch (SQLException e) { throw new RuntimeException("Issue encountered with cancelFYIsAndAcknowledgements", e); } finally { if (dbmsOutput != null) { try { dbmsOutput.close(); } catch (SQLException e) { LOG.error("cancelFYIsAndAcknowledgements: Could not close DbmsOutput"); } } if (cs != null) { try { cs.close(); } catch (SQLException e) { LOG.error("cancelFYIsAndAcknowledgements: Could not close CallableStatement"); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { LOG.error("cancelFYIsAndAcknowledgements: Could not close Connection"); } } } return result; }

Target:
public boolean cancelFYIsAndAcknowledgements() { Connection conn = null; CallableStatement cs = null; DbmsOutput dbmsOutput = null; boolean result; try { conn = getJdbcTemplate().getDataSource().getConnection(); cs = conn.prepareCall("{call CYNERGY.AUTO_CANCEL_FYI_ACK}"); dbmsOutput = new DbmsOutput(conn); dbmsOutput.enable(1000000); result = cs.execute(); dbmsOutput.show(); } catch (SQLException e) { throw new RuntimeException("Issue encountered with cancelFYIsAndAcknowledgements", e); } finally { if (dbmsOutput != null) { dbmsOutput.close(); } if (cs != null) { try { cs.close(); } catch (SQLException e) { LOG.error("cancelFYIsAndAcknowledgements: Could not close CallableStatement"); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { LOG.error("cancelFYIsAndAcknowledgements: Could not close Connection"); } } } return result; }
Source:
public void addAnnotation(Annotation a) { Map<String, Object> parameters = new HashMap<>(2); parameters.put("from", a.getStart()); parameters.put("to", a.getEnd()); execute(e -> { Node annotation = e.createNode(NodeLabels.ANNOTATION); annotation.setProperty(PropertyTypes.ID.name(), a.getGeneName()); annotation.setProperty(PropertyTypes.STARTREF.name(), a.getStart()); annotation.setProperty(PropertyTypes.ENDREF.name(), a.getEnd()); annotation.setProperty(PropertyTypes.SENSE.name(), a.isSense()); ResourceIterator<Node> nodes = service.execute(GET_RANGE, parameters).columnAs("n"); nodes.forEachRemaining(n -> n.createRelationshipTo(annotation, RelTypes.ANNOTATED)); }); System.out.println("Finished loading annotations."); }

Target:
public void addAnnotation(Annotation a) { Map<String, Object> parameters = new HashMap<>(2); parameters.put("from", a.getStart()); parameters.put("to", a.getEnd()); execute(e -> { Node annotation = e.createNode(NodeLabels.ANNOTATION); annotation.setProperty(PropertyTypes.ID.name(), a.getGeneName()); annotation.setProperty(PropertyTypes.STARTREF.name(), a.getStart()); annotation.setProperty(PropertyTypes.ENDREF.name(), a.getEnd()); annotation.setProperty(PropertyTypes.SENSE.name(), a.isSense()); ResourceIterator<Node> nodes = service.execute(GET_RANGE, parameters).columnAs("n"); nodes.forEachRemaining(n -> n.createRelationshipTo(annotation, RelTypes.ANNOTATED)); }); }
Source:
public void tearDown() { MetricsService metricsService = new MetricsService(nodeEngineMock, () -> metricsRegistry); metricsService.init(nodeEngineMock, new Properties()); metricsService.shutdown(true); JmxLeakHelper.checkJmxBeans(); if (executionService != null) { executionService.shutdown(); } }

Target:
public void tearDown() { if (metricsService != null) { metricsService.shutdown(true); metricsService = null; } JmxLeakHelper.checkJmxBeans(); if (executionService != null) { executionService.shutdown(); } }
Source:
private List<WebACAuthorization> getDefaultAuthorizations() { final Map<String, List<String>> aclTriples = new HashMap<>(); final List<WebACAuthorization> authorizations = new ArrayList<>(); getDefaultAcl().listStatements().forEachRemaining(statement -> { final Triple triple = statement.asTriple(); if (hasAclPredicate.test(triple)) { aclTriples.putIfAbsent(triple.getPredicate().getURI(), new ArrayList<>()); if (triple.getObject().isURI()) { aclTriples.get(triple.getPredicate().getURI()).add(triple.getObject().getURI()); } else if (triple.getObject().isLiteral()) { aclTriples.get(triple.getPredicate().getURI()).add( triple.getObject().getLiteralValue().toString()); } } }); authorizations.add(createAuthorizationFromMap(aclTriples)); return authorizations; }

Target:
private static List<WebACAuthorization> getDefaultAuthorizations() { final Map<String, List<String>> aclTriples = new HashMap<>(); final List<WebACAuthorization> authorizations = new ArrayList<>(); getDefaultAcl().listStatements().mapWith(Statement::asTriple).forEachRemaining(triple -> { if (hasAclPredicate.test(triple)) { final List<String> values = aclTriples.computeIfAbsent(triple.getPredicate().getURI(), key -> new ArrayList<>()); nodeToStringStream(triple.getObject()).forEach(values::add); } }); authorizations.add(createAuthorizationFromMap(aclTriples)); return authorizations; }
Source:
public void onMessage(final String event, final String message) { if (event.equals(SUBSCRIPTION_SUCCESS_EVENT)) { updateState(ChannelState.SUBSCRIBED); } else { final Set<SubscriptionEventListener> listeners; synchronized (lock) { final Set<SubscriptionEventListener> sharedListeners = eventNameToListenerMap.get(event); if (sharedListeners != null) { listeners = new HashSet<SubscriptionEventListener>(sharedListeners); } else { listeners = null; } } if (listeners != null) { for (final SubscriptionEventListener listener : listeners) { final String data = extractDataFrom(message); final PusherEvent metadata = new PusherEvent(getMetaData(message)); factory.queueOnEventThread(new Runnable() { @Override public void run() { listener.onEvent(name, event, data, metadata); } }); } } } }

Target:
public void onMessage(final String event, final String message) { if (event.equals(SUBSCRIPTION_SUCCESS_EVENT)) { updateState(ChannelState.SUBSCRIBED); } else { final Set<SubscriptionEventListener> listeners; synchronized (lock) { final Set<SubscriptionEventListener> sharedListeners = eventNameToListenerMap.get(event); if (sharedListeners != null) { listeners = new HashSet<SubscriptionEventListener>(sharedListeners); } else { listeners = null; } } if (listeners != null) { for (final SubscriptionEventListener listener : listeners) { final PusherEvent e = GSON.fromJson(message, PusherEvent.class); factory.queueOnEventThread(new Runnable() { @Override public void run() { listener.onEvent(e); } }); } } } }
Source:
public Object evaluate(DeferredObject[] arguments) throws HiveException { BigDecimal sigil; if (arguments.length == 2) { if (sigilOI == null) { throw new HiveException("received sigil with no obj inspector"); } Object primitive = sigilOI.getPrimitiveJavaObject(arguments[1].get()); sigil = new BigDecimal(primitive.toString()); } else { sigil = null; } BigDecimal sum = BigDecimal.ZERO; for (Object inner : listOI.getList(arguments[0].get())) { if (inner == null) { continue; } Object primitive = elemOI.getPrimitiveJavaObject(inner); BigDecimal current = new BigDecimal(primitive.toString()); if (sigil == null || current.compareTo(sigil) != 0) { sum = sum.add(current); } } switch(elemOI.getPrimitiveCategory()) { case BYTE: return sum.byteValue(); case SHORT: return sum.shortValue(); case INT: return sum.intValue(); case LONG: return sum.longValue(); case FLOAT: return sum.floatValue(); case DOUBLE: return sum.doubleValue(); case DECIMAL: return HiveDecimal.create(sum); default: throw new HiveException("Unknown primitive type for return value: " + elemOI.getTypeName()); } }

Target:
public Object evaluate(DeferredObject[] arguments) throws HiveException { BigDecimal sigil; if (sigilOI == null) { sigil = null; } else { Object primitive = sigilOI.getPrimitiveJavaObject(arguments[1].get()); sigil = new BigDecimal(primitive.toString()); } BigDecimal sum = BigDecimal.ZERO; for (Object inner : listOI.getList(arguments[0].get())) { if (inner == null) { continue; } Object primitive = elemOI.getPrimitiveJavaObject(inner); BigDecimal current = new BigDecimal(primitive.toString()); if (sigil == null || current.compareTo(sigil) != 0) { sum = sum.add(current); } } switch(elemOI.getPrimitiveCategory()) { case BYTE: return sum.byteValue(); case SHORT: return sum.shortValue(); case INT: return sum.intValue(); case LONG: return sum.longValue(); case FLOAT: return sum.floatValue(); case DOUBLE: return sum.doubleValue(); case DECIMAL: return HiveDecimal.create(sum); default: throw new HiveException("Unknown primitive type for return value: " + elemOI.getTypeName()); } }
Source:
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException { validateTrade(sign, 1, 2, player, ess); if(ess.getSettings().isBuySignUpdatedToWorth()) { try { updateFromWorth(sign, ess, ess.getSettings().getEcoBuyMultiplier()); } catch (SignException e) { } } validateTrade(sign, 3, ess); return true; }

Target:
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException { validateTrade(sign, 1, 2, player, ess); if(sign.getLine(3).isEmpty()) { updateFromWorthMultiplied(sign, player, ess); } else { validateTrade(sign, 3, ess); } return true; }
Source:
RegExAffix(String[] regExes, String[] texts) { iSuffixes = texts; iPatterns = new Pattern[regExes.length]; for (int i = 0; i < regExes.length; i++) { Pattern pattern = PATTERNS.get(regExes[i]); if (pattern == null) { pattern = Pattern.compile(regExes[i]); PATTERNS.putIfAbsent(regExes[i], pattern); } iPatterns[i] = pattern; } }

Target:
RegExAffix(String[] regExes, String[] texts) { iSuffixes = texts.clone(); iPatterns = new Pattern[regExes.length]; for (int i = 0; i < regExes.length; i++) { Pattern pattern = PATTERNS.get(regExes[i]); if (pattern == null) { pattern = Pattern.compile(regExes[i]); PATTERNS.putIfAbsent(regExes[i], pattern); } iPatterns[i] = pattern; } }
Source:
public Response transferApiMemberOwnership( @Valid @NotNull TransferOwnership transferOwnership) { List<RoleEntity> newRoles = new ArrayList<>(); Optional<RoleEntity> optNewRole = roleService.findByScopeAndName(RoleScope.API, transferOwnership.getPoRole()); if (optNewRole.isPresent()) { newRoles.add(optNewRole.get()); } else { } apiService.findById(api); membershipService.transferApiOwnership(api, new MembershipService.MembershipMember( transferOwnership.getId(), transferOwnership.getReference(), MembershipMemberType.USER), newRoles); return Response.noContent().build(); }

Target:
public Response transferApiMemberOwnership( @Valid @NotNull TransferOwnership transferOwnership) { List<RoleEntity> newRoles = new ArrayList<>(); Optional<RoleEntity> optNewRole = roleService.findByScopeAndName(RoleScope.API, transferOwnership.getPoRole()); if (optNewRole.isPresent()) { newRoles.add(optNewRole.get()); } else { } apiService.findById(api); membershipService.transferApiOwnership(api, new MembershipService.MembershipMember( transferOwnership.getId(), transferOwnership.getReference(), MembershipMemberType.USER), newRoles); return Response.ok().build(); }
Source:
protected boolean canDoAction() { disk = getDiskDao().get(getParameters().getDiskId()); return isVmExist() && isVmInUpPausedDownStatus() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk() && isVmNotInPreviewSnapshot() && isVmNotLocked(); }

Target:
protected boolean canDoAction() { disk = getDiskDao().get(getParameters().getDiskId()); return isVmExist() && isVmInUpPausedDownStatus() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk() && isVmNotInPreviewSnapshot(); }
Source:
public Mono<Void> fireAndForget(Payload payload) { logger.info("Received a Task[{}] from Client.ID[{}]", payload.getDataUtf8(), id); tasksToProcess.tryEmitNext(new Task(id, payload.getDataUtf8())); payload.release(); return Mono.empty(); }

Target:
public Mono<Void> fireAndForget(Payload payload) { logger.info("Received a Task[{}] from Client.ID[{}]", payload.getDataUtf8(), id); Sinks.Emission emission = tasksToProcess.tryEmitNext(new Task(id, payload.getDataUtf8())); payload.release(); return emission.hasFailed() ? Mono.error(new Sinks.EmissionException(emission)) : Mono.empty(); }
Source:
public void append(Key key, Value value) throws IOException { if (key.compareTo(prevKey) < 0) { throw new IllegalArgumentException("Keys appended out-of-order. New key " + key + ", previous key " + prevKey); } if (((long) key.getSize() + (long) value.getSize()) >= Integer.MAX_VALUE) { throw new IllegalArgumentException("Key/value pair is too large to be appended to RFile."); } currentLocalityGroup.updateColumnCount(key); if (currentLocalityGroup.getFirstKey() == null) { currentLocalityGroup.setFirstKey(key); } if (sample != null) { sample.append(key, value); } if (blockWriter == null) { blockWriter = fileWriter.prepareDataBlock(); } else if (blockWriter.getRawSize() > blockSize) { if (averageKeySize == 0) { averageKeySize = keyLenStats.getMean(); } Key closeKey = KeyShortener.shorten(prevKey, key); if ((closeKey.getSize() <= averageKeySize || blockWriter.getRawSize() > maxBlockSize) && !isGiantKey(closeKey)) { closeBlock(closeKey, false); blockWriter = fileWriter.prepareDataBlock(); averageKeySize = 0; } else if (((long) key.getSize() + (long) value.getSize() + blockWriter.getRawSize()) >= Integer.MAX_VALUE) { closeBlock(closeKey, false); blockWriter = fileWriter.prepareDataBlock(); averageKeySize = 0; } } RelativeKey rk = new RelativeKey(lastKeyInBlock, key); rk.write(blockWriter); value.write(blockWriter); entries++; keyLenStats.addValue(key.getSize()); prevKey = new Key(key); lastKeyInBlock = prevKey; }

Target:
public void append(Key key, Value value) throws IOException { if (key.compareTo(prevKey) < 0) { throw new IllegalArgumentException("Keys appended out-of-order. New key " + key + ", previous key " + prevKey); } currentLocalityGroup.updateColumnCount(key); if (currentLocalityGroup.getFirstKey() == null) { currentLocalityGroup.setFirstKey(key); } if (sample != null) { sample.append(key, value); } if (blockWriter == null) { blockWriter = fileWriter.prepareDataBlock(); } else if (blockWriter.getRawSize() > blockSize) { if (averageKeySize == 0) { averageKeySize = keyLenStats.getMean(); } Key closeKey = KeyShortener.shorten(prevKey, key); if ((closeKey.getSize() <= averageKeySize || blockWriter.getRawSize() > maxBlockSize) && !isGiantKey(closeKey)) { closeBlock(closeKey, false); blockWriter = fileWriter.prepareDataBlock(); averageKeySize = 0; } else if (((long) key.getSize() + (long) value.getSize() + blockWriter.getRawSize() + 128L) >= Integer.MAX_VALUE) { closeBlock(closeKey, false); blockWriter = fileWriter.prepareDataBlock(); averageKeySize = 0; } } RelativeKey rk = new RelativeKey(lastKeyInBlock, key); rk.write(blockWriter); value.write(blockWriter); entries++; keyLenStats.addValue(key.getSize()); prevKey = new Key(key); lastKeyInBlock = prevKey; }
Source:
public SslConfiguration(boolean enabled, boolean requireClientAuth, Map<String, SslEngineConfiguration> sniDomainsConfiguration) { this.enabled = enabled; this.requireClientAuth = requireClientAuth; this.sniDomainsConfiguration = sniDomainsConfiguration; }

Target:
SslConfiguration(boolean enabled, boolean requireClientAuth, Map<String, SslEngineConfiguration> sniDomainsConfiguration) { this.enabled = enabled; this.requireClientAuth = requireClientAuth; this.sniDomainsConfiguration = sniDomainsConfiguration; }
Source:
public static void recordValue(DoubleHistogram doubleHistogram, long value) { try { doubleHistogram.recordValue(value); } catch (Exception ex) { logger.warn("Error while recording value for client telemetry", ex.getMessage()); } }

Target:
public static void recordValue(DoubleHistogram doubleHistogram, long value) { try { doubleHistogram.recordValue(value); } catch (Exception ex) { logger.warn("Error while recording value for client telemetry. ", ex); } }
Source:
private Set<String> getOnlineSegmentsFromExternalView(String tableNameWithType) { ExternalView externalView = getTableExternalView(tableNameWithType); if (externalView != null) { Set<String> partitionSet = externalView.getPartitionSet(); Set<String> onlineSegments = new HashSet<>(HashUtil.getHashMapCapacity(partitionSet.size())); for (String partition : partitionSet) { Map<String, String> instanceStateMap = externalView.getStateMap(partition); if (instanceStateMap.containsValue(SegmentStateModel.ONLINE) || instanceStateMap .containsValue(SegmentStateModel.CONSUMING)) { onlineSegments.add(partition); } } return onlineSegments; } else { return null; } }

Target:
private Set<String> getOnlineSegmentsFromExternalView(String tableNameWithType) { ExternalView externalView = getTableExternalView(tableNameWithType); Preconditions .checkState(externalView != null, String.format("External view is null for table (%s)", tableNameWithType)); Map<String, Map<String, String>> segmentAssignment = externalView.getRecord().getMapFields(); Set<String> onlineSegments = new HashSet<>(HashUtil.getHashMapCapacity(segmentAssignment.size())); for (Map.Entry<String, Map<String, String>> entry : segmentAssignment.entrySet()) { Map<String, String> instanceStateMap = entry.getValue(); if (instanceStateMap.containsValue(SegmentStateModel.ONLINE) || instanceStateMap .containsValue(SegmentStateModel.CONSUMING)) { onlineSegments.add(entry.getKey()); } } return onlineSegments; }
Source:
HttpPipeline setupPipeline() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), properties.get(SDK_NAME), properties.get(SDK_VERSION), buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); }

Target:
HttpPipeline setupPipeline() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; final List<HttpPipelinePolicy> policies = new ArrayList<>(); String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); }
Source:
public List<? extends Module> getJacksonModules() { return ImmutableList.<Module>of( new SimpleModule("DruidNamespacedExtractionModule") { @Override public void setupModule(SetupContext context) { context.registerSubtypes(NamespacedExtractor.class); context.registerSubtypes(ExtractionNamespace.class); context.registerSubtypes(NamespaceLookupExtractorFactory.class); } } ); }

Target:
public List<? extends Module> getJacksonModules() { return ImmutableList.<Module>of( new SimpleModule("DruidNamespacedExtractionModule") .registerSubtypes( ExtractionNamespace.class, NamespaceLookupExtractorFactory.class ) ); }
Source:
public void sourceEntryShouldBeAdded() throws Exception { Variant variant = buildVariantWithSourceEntry("1", 1, 2, "A", "T", "fileId", "previousStudy"); Variant newVariant = buildVariantWithSourceEntry("1", 1, 2, "A", "T", "fileId", "dbsnpStudy"); VariantMongoWriter variantMongoWriter = new VariantMongoWriter(collectionName, mongoOperations, false, false); variantMongoWriter.write(Collections.singletonList(variant)); variantMongoWriter.write(Collections.singletonList(newVariant)); DBCollection dbCollection = mongoOperations.getCollection(collectionName); assertEquals(1, dbCollection.count()); final DBObject storedVariant = dbCollection.findOne(); assertEquals(2, ((BasicDBList) storedVariant.get(FILES_FIELD)).size()); }

Target:
public void sourceEntryShouldBeAdded() throws Exception { Variant variant = buildVariantWithSampleData("1", 1, 2, "A", "T", "fileId", "previousStudy"); Variant newVariant = buildVariantWithSampleData("1", 1, 2, "A", "T", "fileId", "dbsnpStudy"); VariantMongoWriter variantMongoWriter = new VariantMongoWriter(collectionName, mongoOperations, false, false); variantMongoWriter.write(Collections.singletonList(variant)); variantMongoWriter.write(Collections.singletonList(newVariant)); DBCollection dbCollection = mongoOperations.getCollection(collectionName); assertEquals(1, dbCollection.count()); final DBObject storedVariant = dbCollection.findOne(); assertEquals(2, ((BasicDBList) storedVariant.get(FILES_FIELD)).size()); }