auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>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); } <START> store.setCurrentState(ReplicaState.BOOTSTRAP); <END> if (store.isBootstrapInProgress()) { replicaSyncUpService.initiateBootstrap(localReplica); } else { store.setCurrentState(ReplicaState.STANDBY); } }</code><technical_language>Move this line if clause</technical_language>

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:
<code><START> private Coin getValidBsqTransferAmount(double amount) { <END> 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; }</code><technical_language>Depending consider a valid amount in this context, want consider dust amount invalid small send. naming of this method dust amounts invalid. burn dust burnt satoshis added mining fee BSQ change lowered burnt amount. considered a transfer though</technical_language>

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:
<code>public void init(BatchTraceRecorderBuilder builder) { <START> this.tracePublisher = builder.tracePublisher; <END> 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; } }); }</code><technical_language>this protected</technical_language>

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:
<code><START> public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) { <END> 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; } }</code><technical_language>docs null is returned, a message logged. <LINK_0></technical_language>

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:
<code>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(); <START> stream.close(); <END> } 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()); }</code><technical_language>do close operations in final modifier</technical_language>

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:
<code>public void init(Map<String,String> conf) throws CryptoException { String keyLocation = conf.get("instance.crypto.opts.key.uri"); String keyMgr = "uri"; <START> Objects.requireNonNull(keyLocation, <END> "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"); } }</code><technical_language>If move option a properties value, "instance.crypto.opts.key.uri", move Objects.requireNonNull() this.encryptingKek switch statement. keyMgr's added in future, result is checked</technical_language>

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:
<code>public void init(IPageBookViewPage page, IConsole console) { <START> StopScriptAction stopScriptAction = new StopScriptAction(page <END> .getSite().getWorkbenchWindow(), (ScriptConsole) console); IToolBarManager manager = page.getSite().getActionBars().getToolBarManager(); manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, stopScriptAction); }</code><technical_language>action a member call setEnabled(true/false) in activated/deactivated</technical_language>

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:
<code>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; <START> if (("Error executing query".equals(e.getMessage()) || "Error fetching results".equals(e.getMessage())) && <END> (e.getCause() instanceof Exception)) { exception = (Exception) e.getCause(); } exception.printStackTrace(); return null; } }</code><technical_language>I need match error message here</technical_language>

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:
<code>private Map<String, String> getProcessArgsMap(MetaDataMap metaDataMap) { final Map<String, String> map = new LinkedHashMap<String, String>(); final String processArgs = metaDataMap.get("PROCESS_ARGS", ""); <START> final String[] lines = StringUtils.split(processArgs, ","); <END> for (final String line : lines) { final String[] entry = StringUtils.split(line, "="); if (entry.length == 2) { map.put(entry[0], entry[1]); } } return map; }</code><technical_language>return ParameterUtil.toMap(StringUtils.split(processArgs, ","), "="); .. thing</technical_language>

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:
<code>public void markInCatalog() { <START> exportLog.info("ExportDataSource for table " + m_tableName + " partition " + m_partitionId + " marked as in catalog."); <END> m_isInCatalog = true; }</code><technical_language>this INFO message is helpful users</technical_language>

Target:
public void markInCatalog() { m_isInCatalog = true; }
Source:
<code>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(); <START> assertEquals(expectedJson, metadataJson); <END> }</code><technical_language>this is stable assert keys (keys1.size() == keys2.size() && for key ==) another write assertEquals</technical_language>

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:
<code>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){ <START> contunue; <END> } 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) { } } }</code><technical_language>typo</technical_language>

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:
<code>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) { <START> logger.error(String.format("Error unsubscribing topic '{}' from broker '{}'", subscriber.getTopic(), name), e); <END> } consumers.remove(subscriber); }</code><technical_language>in logger.error String.format called implicitly</technical_language>

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:
<code>protected boolean validate() { <START> DiskValidator <END> 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; }</code><technical_language>please replace tab spaces</technical_language>

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:
<code>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)) <START> .filter(estimate -> !estimate.isOutputRowCountUnknown()) <END> .max(comparingDouble(PlanNodeStatsEstimate::getOutputRowCount)) .map(estimate -> normalizer.normalize(estimate, types)) .orElse(PlanNodeStatsEstimate.unknown()); }</code><technical_language>i this change belong Normalize intermidiate stats in JoinStatsRule cmt</technical_language>

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:
<code>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); <START> new CalculateNInterest(-1000000000).calculate(this.collapsedNode, null); <END> setChanged(); notifyObservers(); notifyLoadingObservers(false); }</code><technical_language>1000000000 from</technical_language>

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:
<code>private int getAccountAgeInDays(final DateTime accountCreated) { final DateTime now = DateTime.now(DateTimeZone.UTC); <START> return (int) ((now.getMillis() - accountCreated.getMillis())/DateTimeUtil.DAY_IN_MILLIS); <END> }</code><technical_language>friend Joda solved for you: java final Duration duration = new Duration(DateTime.now(), DateTime.now().minusDays(1)); return duration.toStandardDays().getDays();</technical_language>

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:
<code>public String getSourceIDLPath() { <START> return new File(swiftDocumentContext.getThriftIDLUri()).toString(); <END> }</code><technical_language>do need toString() of File? consider options: 1. Paths.get 2. File#getAbsolutePath File#getCanonicalPath</technical_language>

Target:
public String getSourceIDLPath() throws Exception { URI inputBase = swiftDocumentContext.getSwiftGeneratorConfig().getInputBase(); URI idlUri = swiftDocumentContext.getThriftIdlUri(); return inputBase.relativize(idlUri).getPath(); }
Source:
<code>static String attemptManualHighlighting(SolrDocumentList solrDocumentList, String highlightField, Collection<String> keywords) { if (solrDocumentList.isEmpty()) { <START> return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "document"); <END> } 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(); }</code><technical_language>turns out this error condition</technical_language>

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:
<code>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>"); <START> Assert.assertThat(app.getDatabaseTestHelper().getChargeStatus(testCharge.getChargeId()), is(CAPTURE_APPROVED_RETRY.getValue())); <END> }</code><technical_language>static import this please (there a more in other files)</technical_language>

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:
<code>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 { <START> dbmsOutput.close(); <END> } 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; }</code><technical_language>current implementation of DbmsOutput.close() method potential leave some of internal statements open if of throws exception close. If fixing is out of scope for this PR, create a new user story get this fixed. (DbmsOutput is a CU-specific class, need worry fixing KualiCo level.)</technical_language>

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:
<code>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)); }); <START> System.out.println("Finished loading annotations."); <END> }</code><technical_language>needed</technical_language>

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:
<code>public void tearDown() { <START> MetricsService metricsService = new MetricsService(nodeEngineMock, () -> metricsRegistry); <END> metricsService.init(nodeEngineMock, new Properties()); metricsService.shutdown(true); JmxLeakHelper.checkJmxBeans(); if (executionService != null) { executionService.shutdown(); } }</code><technical_language>I alternatively move out construction of service test cases a factory method sets a shutdown function object field call in tearDown. This prevent some other unwanted potential side-effects. this approach construct services, shutdown one. For example, service submits a scheduled task. I is fine for now, safer function proposed</technical_language>

Target:
public void tearDown() { if (metricsService != null) { metricsService.shutdown(true); metricsService = null; } JmxLeakHelper.checkJmxBeans(); if (executionService != null) { executionService.shutdown(); } }
Source:
<code>private List<WebACAuthorization> getDefaultAuthorizations() { final Map<String, List<String>> aclTriples = new HashMap<>(); final List<WebACAuthorization> authorizations = new ArrayList<>(); <START> getDefaultAcl().listStatements().forEachRemaining(statement -> { <END> 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; }</code><technical_language>listStatements().mapWith(Statement::asTriple).filterKeep(hasAclPredicate). forEachRemaining( reads me, or, if work, putting a utility class in place for pre-Jena 3 Filters Java 8 lambdas method refs, coming up. do work for Jena 3, volunteering. (At mapWithcan here.)</technical_language>

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:
<code>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); <START> final PusherEvent metadata = new PusherEvent(getMetaData(message)); <END> factory.queueOnEventThread(new Runnable() { @Override public void run() { listener.onEvent(name, event, data, metadata); } }); } } } }</code><technical_language>Currently parsing message JSON twice: in extractDataFrom in getMetaData. This improved modifying extractDataFrom output of getMetaData perhaps</technical_language>

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:
<code>public Object evaluate(DeferredObject[] arguments) throws HiveException { BigDecimal sigil; <START> if (arguments.length == 2) { <END> 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()); } }</code><technical_language>is need check argument length this time, initialize method establish a sigil proceed accordingly</technical_language>

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:
<code>protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException { validateTrade(sign, 1, 2, player, ess); <START> if(ess.getSettings().isBuySignUpdatedToWorth()) { try { updateFromWorth(sign, ess, ess.getSettings().getEcoBuyMultiplier()); } catch (SignException e) { } <END> } validateTrade(sign, 3, ess); return true; }</code><technical_language>No, fine</technical_language>

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:
<code>RegExAffix(String[] regExes, String[] texts) { <START> iSuffixes = texts; <END> 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; } }</code><technical_language>Array arguments stored need cloned ensure object remains immutable</technical_language>

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:
<code>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); <START> return Response.noContent().build(); <END> }</code><technical_language>right. a breaking change some users, API UI, affected this kind of changes. Please revert</technical_language>

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:
<code>protected boolean canDoAction() { disk = getDiskDao().get(getParameters().getDiskId()); return isVmExist() && isVmInUpPausedDownStatus() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk() && isVmNotInPreviewSnapshot() && <START> isVmNotLocked(); <END> }</code><technical_language>checked vm is up/paused/down in line 45..so reach vm locked</technical_language>

Target:
protected boolean canDoAction() { disk = getDiskDao().get(getParameters().getDiskId()); return isVmExist() && isVmInUpPausedDownStatus() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk() && isVmNotInPreviewSnapshot(); }
Source:
<code>public Mono<Void> fireAndForget(Payload payload) { logger.info("Received a Task[{}] from Client.ID[{}]", payload.getDataUtf8(), id); <START> tasksToProcess.tryEmitNext(new Task(id, payload.getDataUtf8())); <END> payload.release(); return Mono.empty(); }</code><technical_language>tryEmitNext method provides feedback reject emission. return checked, a minimum, for isFailed() status</technical_language>

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:
<code>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) { <START> throw new IllegalArgumentException("Key/value pair is too large to be appended to RFile."); <END> } 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; }</code><technical_language>do receiving end of this message debug good. include size of key+value in error message. Also, Key.toString() truncates is long leverage possibly include key</technical_language>

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:
<code><START> public SslConfiguration(boolean enabled, boolean requireClientAuth, Map<String, SslEngineConfiguration> sniDomainsConfiguration) { <END> this.enabled = enabled; this.requireClientAuth = requireClientAuth; this.sniDomainsConfiguration = sniDomainsConfiguration; }</code><technical_language>this need public? other in SslConfigurationBuilder</technical_language>

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

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:
<code>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 { <START> return null; <END> } }</code><technical_language>throw exception instead of returning null avoid NPE caller side: Preconditions.checkState(externalView != null, ...)</technical_language>

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:
<code>HttpPipeline setupPipeline() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; final List<HttpPipelinePolicy> policies = new ArrayList<>(); <START> policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), properties.get(SDK_NAME), <END> 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(); }</code><technical_language>need defaults</technical_language>

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(); }