auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { final List<ZooKeeperOperation> operations = Lists.newArrayList(); for (final Deployment deployment : getTasks(client, host).values()) { final boolean isOwnedByDeploymentGroup = Objects.equals( deployment.getDeploymentGroupName(), deploymentGroup.getName()); final boolean isSameJob = deployment.getJobId().equals(deploymentGroup.getJobId()); final RolloutOptions rolloutOptions = deploymentGroup.getRolloutOptions(); if (isOwnedByDeploymentGroup || ( isSameJob && rolloutOptions.getMigrate())) { if (isSameJob && isOwnedByDeploymentGroup && deployment.getGoal().equals(Goal.START)) { continue; } try { final String token = <START> rolloutOptions.getToken() == null ? Job.EMPTY_TOKEN : rolloutOptions.getToken(); <END> operations.addAll(getUndeployOperations( client, host, deployment.getJobId(), token)); } catch (TokenVerificationException e) { return opFactory.error(e, host, RollingUpdateError.TOKEN_VERIFICATION_ERROR); } catch (HostNotFoundException e) { return opFactory.error(e, host, RollingUpdateError.HOST_NOT_FOUND); } catch (JobNotDeployedException e) { } } } return opFactory.nextTask(operations); }</code><technical_language>above, firstNonNull work a bit easier read</technical_language>

Target:
private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { final List<ZooKeeperOperation> operations = Lists.newArrayList(); for (final Deployment deployment : getTasks(client, host).values()) { final boolean isOwnedByDeploymentGroup = Objects.equals( deployment.getDeploymentGroupName(), deploymentGroup.getName()); final boolean isSameJob = deployment.getJobId().equals(deploymentGroup.getJobId()); final RolloutOptions rolloutOptions = deploymentGroup.getRolloutOptions(); if (isOwnedByDeploymentGroup || ( isSameJob && rolloutOptions.getMigrate())) { if (isSameJob && isOwnedByDeploymentGroup && deployment.getGoal().equals(Goal.START)) { continue; } try { final String token = firstNonNull(deploymentGroup.getRolloutOptions().getToken(), Job.EMPTY_TOKEN); operations.addAll(getUndeployOperations( client, host, deployment.getJobId(), token)); } catch (TokenVerificationException e) { return opFactory.error(e, host, RollingUpdateError.TOKEN_VERIFICATION_ERROR); } catch (HostNotFoundException e) { return opFactory.error(e, host, RollingUpdateError.HOST_NOT_FOUND); } catch (JobNotDeployedException e) { } } } return opFactory.nextTask(operations); }
Source:
<code>public AccessControlPolicyExtension( AccessControlSecurityConfiguration config, SubjectIdentity subjectIdentity) { isOwner = predicate(subjectIdentity.getIdentityAttribute(), Core.METACARD_OWNER); isSystem = (s) -> { Set<String> subject = s.getOrDefault(config.getSystemUserAttribute(), Collections.emptySet()); return subject.contains(config.getSystemUserAttributeValue()); }; hasAccessAdministrators = predicate(subjectIdentity.getIdentityAttribute(), Security.ACCESS_ADMINISTRATORS); hasAccessGroups = predicate(Constants.ROLES_CLAIM_URI, SecurityAttributes.ACCESS_GROUPS); hasAccessGroupsReadOnly = <START> predicate(subjectIdentity.getIdentityAttribute(), SecurityAttributes.ACCESS_GROUPS_READ); <END> hasAccessIndividuals = predicate(subjectIdentity.getIdentityAttribute(), SecurityAttributes.ACCESS_INDIVIDUALS); hasAccessIndividualsReadOnly = predicate( subjectIdentity.getIdentityAttribute(), SecurityAttributes.ACCESS_INDIVIDUALS_READ); }</code><technical_language>this Constants.ROLES_CLAIM_URI</technical_language>

Target:
public AccessControlPolicyExtension( AccessControlSecurityConfiguration config, SubjectIdentity subjectIdentity) { isOwner = predicate(subjectIdentity.getIdentityAttribute(), Core.METACARD_OWNER); isSystem = (s) -> { Set<String> subject = s.getOrDefault(config.getSystemUserAttribute(), Collections.emptySet()); return subject.contains(config.getSystemUserAttributeValue()); }; hasAccessAdministrators = predicate(subjectIdentity.getIdentityAttribute(), Security.ACCESS_ADMINISTRATORS); hasAccessGroups = predicate(Constants.ROLES_CLAIM_URI, SecurityAttributes.ACCESS_GROUPS); hasAccessGroupsReadOnly = predicate(Constants.ROLES_CLAIM_URI, SecurityAttributes.ACCESS_GROUPS_READ); hasAccessIndividuals = predicate(subjectIdentity.getIdentityAttribute(), SecurityAttributes.ACCESS_INDIVIDUALS); hasAccessIndividualsReadOnly = predicate( subjectIdentity.getIdentityAttribute(), SecurityAttributes.ACCESS_INDIVIDUALS_READ); }
Source:
<code>public void shouldCaptureSuccessfully() { setUpAndCheckThatEpdqIsUp(); CardAuthorisationGatewayRequest request = buildAuthorisationRequest(chargeEntity); GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request); assertThat(response.isSuccessful(), is(true)); String transactionId = response.getBaseResponse().get().getTransactionId(); assertThat(transactionId, is(not(nullValue()))); CaptureGatewayRequest captureRequest = buildCaptureRequest(chargeEntity, transactionId); CaptureResponse captureResponse = paymentProvider.capture(captureRequest); <START> assertThat(captureResponse.isSuccessful(), is(true)); <END> }</code><technical_language>Extra asserts</technical_language>

Target:
public void shouldCaptureSuccessfully() { setUpAndCheckThatEpdqIsUp(); CardAuthorisationGatewayRequest request = buildAuthorisationRequest(chargeEntity); GatewayResponse<BaseAuthoriseResponse> response = paymentProvider.authorise(request); assertThat(response.isSuccessful(), is(true)); String transactionId = response.getBaseResponse().get().getTransactionId(); assertThat(transactionId, is(not(nullValue()))); CaptureGatewayRequest captureRequest = buildCaptureRequest(chargeEntity, transactionId); CaptureResponse captureResponse = paymentProvider.capture(captureRequest); assertThat(captureResponse.isSuccessful(), is(true)); assertThat(captureResponse.state(), Is.is(CaptureResponse.ChargeState.PENDING)); }
Source:
<code>public String getPeerUserAgent() { <START> if (options == null) throw new RequestNotYetReadException(); <END> for (String o : options) { if (o.startsWith(AGENT)) return o.substring(AGENT.length()); } return userAgent; }</code><technical_language>Inconsistent ReceivePack. else equal, I prefer this behavior ReceivePack one</technical_language>

Target:
public String getPeerUserAgent() { return UserAgent.getAgent(options, userAgent); }
Source:
<code>public WebElement getFiltersSuggestionByName(String suggestionName) { return seleniumWebDriverHelper.waitVisibility( <START> By.xpath(format(" END> }</code><technical_language>"//div[@name='suggestionText' text()='%s']" a constant locators, IMHO</technical_language>

Target:
public WebElement getFiltersSuggestionByName(String suggestionName) { String filtersSuggestion = format(" return seleniumWebDriverHelper.waitVisibility(By.xpath(filtersSuggestion)); }
Source:
<code>public Object invoke(Object object, Method method, Object[] objects) throws Throwable { if ("toString".equals(method.getName())) { <START> return "Proxy element for: " + locator.toString(); <END> } WebElement element; try { element = locator.findElement(); } catch (NoSuchElementException e) { throw e; } if ("getWrappedElement".equals(method.getName())) { return element; } try { return method.invoke(element, objects); } catch (InvocationTargetException e) { throw e.getCause(); } }</code><technical_language>String.format a choice</technical_language>

Target:
public Object invoke(Object object, Method method, Object[] objects) throws Throwable { if ("toString".equals(method.getName())) { return format("Proxy element for: %s", locator.toString()); } WebElement element; try { element = locator.findElement(); } catch (NoSuchElementException e) { throw e; } if ("getWrappedElement".equals(method.getName())) { return element; } try { return method.invoke(element, objects); } catch (InvocationTargetException e) { throw e.getCause(); } }
Source:
<code>public void set(long index, Slice value) { Slice currentValue = array.get(index); if (currentValue != null) { <START> int baseReferenceCount = trackedSlices.decrementReference(currentValue.getBase()); <END> int sliceReferenceCount = trackedSlices.decrementReference(currentValue); if (baseReferenceCount == 0) { sizeOfSlices -= currentValue.getRetainedSize(); } else if (sliceReferenceCount == 0) { sizeOfSlices -= SLICE_INSTANCE_SIZE; } } if (value != null) { int baseReferenceCount = trackedSlices.incrementReference(value.getBase()); int sliceReferenceCount = trackedSlices.incrementReference(value); if (baseReferenceCount == 1) { sizeOfSlices += value.getRetainedSize(); } else if (sliceReferenceCount == 1) { sizeOfSlices += SLICE_INSTANCE_SIZE; } } array.set(index, value); }</code><technical_language>ditto for incrementReference, a name I incrementReferenceAndGet simply incrementAndGet</technical_language>

Target:
public void set(long index, Slice value) { updateRetainedSize(index, value); array.set(index, value); }
Source:
<code>private static int readCPUMask() { <START> try (Stream<String> lines = Files.lines(Paths.get("/proc/self/status"), StandardCharsets.US_ASCII)) { <END> return lines.filter(line -> line.startsWith(CPUS_ALLOWED)) .findFirst().map(line -> { int count = 0; int start = CPUS_ALLOWED.length(); for (int i = start; i < line.length(); i++) { char ch = line.charAt(i); if (ch >= '0' && ch <= '9') { count += BITS[ch - '0']; } else if (ch >= 'a' && ch <= 'f') { count += BITS[ch - 'a' + 10]; } else if (ch >= 'A' && ch <= 'F') { count += BITS[ch - 'A' + 10]; } } return count; }).orElse(-1); } catch (IOException e) { return -1; } }</code><technical_language>This path a constant</technical_language>

Target:
private static int readCPUMask() { try (Stream<String> lines = Files.lines(Paths.get(PROC_SELF_STATUS), StandardCharsets.US_ASCII)) { return lines.filter(line -> line.startsWith(CPUS_ALLOWED)) .findFirst().map(line -> { int count = 0; int start = CPUS_ALLOWED.length(); for (int i = start; i < line.length(); i++) { char ch = line.charAt(i); if (ch >= '0' && ch <= '9') { count += BITS[ch - '0']; } else if (ch >= 'a' && ch <= 'f') { count += BITS[ch - 'a' + 10]; } else if (ch >= 'A' && ch <= 'F') { count += BITS[ch - 'A' + 10]; } } return count; }).orElse(-1); } catch (IOException e) { return -1; } }
Source:
<code>private String extractNextLink(HttpResponse canvasResponse) { String linkValueString = null; String linkValueNext = null; String searchPhrase = "rel=\"next\""; M_log.debug("SEARCH PHRASE: " + searchPhrase); HashMap<String, String> links = new HashMap<String, String>(); Header[] headers = canvasResponse.getAllHeaders(); for (Header header : headers) { M_log.debug("Key : " + header.getName() + " ,Value : " + header.getValue()); if(header.getName().equals("Link")){ linkValueString = header.getValue(); String[] headerPairs = linkValueString.split(","); for(String headerPair : headerPairs){ M_log.debug("String: " + headerPair); <START> String[] splitPairs = headerPair.split(";"); <END> splitPairs[0] = splitPairs[0].replace("<",""); splitPairs[0] = splitPairs[0].replace(">",""); links.put(splitPairs[1].trim(), splitPairs[0]); } break; } } if(links.containsKey(searchPhrase)){ M_log.debug("LINKS CONTAINS NEXT: " + links.get(searchPhrase)); linkValueNext = links.get(searchPhrase); linkValueNext = linkValueNext.substring(linkValueNext.indexOf("/api"), linkValueNext.length()); M_log.debug("NEW VALUE: " + linkValueNext); linkValueNext = "/canvasCourseManager/manager" + linkValueNext; M_log.debug("NEW VALUE: " + linkValueNext); if(linkValueNext.contains("as_user_id")){ linkValueNext = linkValueNext.replaceAll("as_user_id=sis_login_id.*?&", "user=self&"); M_log.debug("NEW VALUE: " + linkValueNext); } } M_log.debug("LINKS; " + links); M_log.debug("NEXT LINK VALUE: " + linkValueNext); return linkValueNext; }</code><technical_language>If a _simple_ regular expression for this splitting replacements (and possibly trimming), instead</technical_language>

Target:
private String extractNextLink(HttpResponse canvasResponse) { String linkValueString = null; String linkValueNext = null; String searchPhrase = "rel=\"next\""; M_log.debug("SEARCH PHRASE: " + searchPhrase); HashMap<String, String> links = new HashMap<String, String>(); Header[] headers = canvasResponse.getHeaders("Link"); for (Header header : headers) { M_log.debug("Key : " + header.getName() + " ,Value : " + header.getValue()); if(header.getName().equals("Link")){ linkValueString = header.getValue(); String[] headerPairs = linkValueString.split(","); for(String headerPair : headerPairs){ M_log.debug("String: " + headerPair); String[] splitPairs = headerPair.split(";"); splitPairs[0] = splitPairs[0].replace("<",""); splitPairs[0] = splitPairs[0].replace(">",""); links.put(splitPairs[1].trim(), splitPairs[0]); } break; } } if(links.containsKey(searchPhrase)){ M_log.debug("LINKS CONTAINS NEXT: " + links.get(searchPhrase)); linkValueNext = "/canvasCourseManager/manager" + links.get(searchPhrase).substring(links.get(searchPhrase).indexOf("/api"), links.get(searchPhrase).length()); if(linkValueNext.contains("as_user_id")){ linkValueNext = linkValueNext.replaceAll("as_user_id=sis_login_id.*?&", "user=self&"); } } M_log.debug("LINKS; " + links); M_log.debug("NEXT LINK VALUE: " + linkValueNext); return linkValueNext; }
Source:
<code>public ServiceManagerEnvironment loadServiceManagerEnvironment(IServer server) { Map<String, String> adbEnv = loadDockerEnv(server); Properties props = loadOpenshiftConsoleDetails(server); Map<String, String> merged = merge(adbEnv, props); String dotMinishift = System.getProperty("user.home") + File.separator + ".minishift"; Properties dotCDK = CDKServerUtility.getDotCDK(dotMinishift); merged = merge(merged, dotCDK); if( merged == null ) { <START> System.out.println("WHY!?!?!"); <END> } try { return new ServiceManagerEnvironment(merged); } catch (URISyntaxException urise) { CDKCoreActivator.pluginLog() .logError("Environment variable DOCKER_HOST is not a valid uri: " + merged.get("DOCKER_HOST"), urise); return null; } }</code><technical_language>This a leftover playing this, @robstryker ? :)</technical_language>

Target:
public ServiceManagerEnvironment loadServiceManagerEnvironment(IServer server) { Map<String, String> adbEnv = loadDockerEnv(server); Properties props = loadOpenshiftConsoleDetails(server); Map<String, String> merged = merge(adbEnv, props); String dotMinishift = System.getProperty("user.home") + File.separator + ".minishift"; Properties dotCDK = CDKServerUtility.getDotCDK(dotMinishift); merged = merge(merged, dotCDK); try { return new ServiceManagerEnvironment(merged); } catch (URISyntaxException urise) { CDKCoreActivator.pluginLog() .logError("Environment variable DOCKER_HOST is not a valid uri: " + merged.get("DOCKER_HOST"), urise); return null; } }
Source:
<code>public String getItemType() { <START> return DisplayableItemNode.FILE_PARENT_NODE_KEY; <END> }</code><technical_language>This node a file parent, key</technical_language>

Target:
public String getItemType() { return getClass().getName(); }
Source:
<code>public String toString() { <START> return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) <END> .append("myId", myId) .append("myUrl", myUrl) .append(myResource != null ? ("myResource=" + myResource.toString()) : ("myResource=(null)")) .append("myResourcePid", myResourcePid) .append("myName", myName) .append(myCodes != null ? ("myCodes - size=" + myCodes.size()) : ("myCodes=(null)")) .toString(); }</code><technical_language>Prefer ToStringStyle.SHORT_PREFIX_STYLE more compact</technical_language>

Target:
public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("myId", myId) .append("myUrl", myUrl) .append(myResource != null ? ("myResource=" + myResource.toString()) : ("myResource=(null)")) .append("myResourcePid", myResourcePid) .append("myName", myName) .append(myCodes != null ? ("myCodes - size=" + myCodes.size()) : ("myCodes=(null)")) .toString(); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof RouteInfo)) return false; RouteInfo target = (RouteInfo) obj; <START> return Objects.equals(mDestination, target.getDestination()); <END> }</code><technical_language>I change behaviour of equals() this. This class is part of public API changing equals() longer consider fields in object is a breaking change. Instead, I handle this case route objects "the properties", I add another method isSameDestinationAs(). This is consistent done in other classes LinkAddress, is checked in equals(), is another method checks object is "the properties". (In case of LinkAddress is called isSameAddressAs.) Also, this check MTU</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof RouteInfo)) return false; RouteInfo target = (RouteInfo) obj; return Objects.equals(mDestination, target.getDestination()) && Objects.equals(mGateway, target.getGateway()) && Objects.equals(mInterface, target.getInterface()) && mType == target.getType() && mMtu == target.getMtu(); }
Source:
<code>public void move(FileResource<?> target) { try { getFileOperations().move(file, target.getUnderlyingResourceObject()); <START> this.file = target.getUnderlyingResourceObject(); <END> } catch (IOException e) { throw new ResourceException("Error while moving Resource " + this, e); } }</code><technical_language>This work if target is a DirectoryResource. Return File object getFileOperation().move() (Change signature)</technical_language>

Target:
public void move(FileResource<?> target) { try { this.file = getFileOperations().move(file, target.getUnderlyingResourceObject()); } catch (IOException e) { throw new ResourceException("Error while moving Resource " + this, e); } }
Source:
<code>private static Function1<CharSeq, CharSeq> removeTrailingZeroes() { return seq -> seq .reverse() <START> .dropWhile(c -> Character.valueOf('0').equals(c)) END> .reverse(); }</code><technical_language>unboxing work: .dropWhile(c -> c == '0')</technical_language>

Target:
private static Function1<CharSeq, CharSeq> removeTrailingZeroes() { return seq -> seq .reverse() .dropWhile(c -> c == '0') .reverse(); }
Source:
<code>private Account getAccount(Account[] accounts, String username) { if (accounts != null) { for (Account account : accounts) { <START> if (account.name.equals(username)) { <END> return account; } } } return null; }</code><technical_language>Is username case sensitive</technical_language>

Target:
private Account getAccount(Account[] accounts, String username) { if (accounts != null && username != null) { for (Account account : accounts) { if (account.name.equalsIgnoreCase(username)) { return account; } } } return null; }
Source:
<code>QueryResultSubject assertQueryResult(QueryResponse queryResponse) { <START> checkNotNull(queryResponse, "`QueryResponse` must never be `null`"); <END> Iterable<Message> entityStates = extractEntityStates(queryResponse); QueryResultSubject subject = assertAbout(queryResult()).that(entityStates); subject.initChildSubjects(queryResponse); return subject; }</code><technical_language>put periods end of error messages sentences</technical_language>

Target:
QueryResultSubject assertQueryResult(QueryResponse queryResponse) { checkNotNull(queryResponse, "`QueryResponse` must never be `null`."); Iterable<Message> entityStates = extractEntityStates(queryResponse); QueryResultSubject subject = assertAbout(queryResult()).that(entityStates); subject.initChildSubjects(queryResponse); return subject; }
Source:
<code>public void loadBlocks() { exec1 = new ExecutorPipeline(8, 1000, true, (Function<Block, Block>) b -> { if (b.getNumber() >= blockchain.getBlockStore().getBestBlock().getNumber()) { for (Transaction tx : b.getTransactionsList()) { tx.getSender(); } } return b; }, throwable -> logger.error("Unhandled exception: ", throwable) ); exec2 = exec1.add(1, 1000, block -> { try { blockWork(block); } catch (Exception e) { e.printStackTrace(); } }); String fileSrc = config.blocksLoader(); try { final String blocksFormat = config.getConfig().hasPath("blocks.format") ? config.getConfig().getString("blocks.format") : null; System.out.println("Loading blocks: " + fileSrc + ", format: " + blocksFormat); if ("rlp".equalsIgnoreCase(blocksFormat)) { Path path = Paths.get(fileSrc); byte[] data = Files.readAllBytes(path); <START> RLPList list = RLP.decode2ListNarrow(data); <END> for (RLPElement item : list) { Block block = new Block(item.getRLPData()); exec1.push(block); } } else { FileInputStream inputStream = new FileInputStream(fileSrc); scanner = new Scanner(inputStream, "UTF-8"); while (scanner.hasNextLine()) { byte[] blockRLPBytes = Hex.decode(scanner.nextLine()); Block block = new Block(blockRLPBytes); exec1.push(block); } } } catch (Exception e) { e.printStackTrace(); System.exit(1); } try { exec1.join(); } catch (InterruptedException e) { throw new RuntimeException(e); } dbFlushManager.flushSync(); System.out.println(" * Done * "); System.exit(0); }</code><technical_language>turns out this update changes logic: RLP.decode2(data, Integer.MAX) is replaced RLP.decode2(data, 2).get(0). Additional get(0) is added in statement</technical_language>

Target:
public void loadBlocks() { exec1 = new ExecutorPipeline(8, 1000, true, (Function<Block, Block>) b -> { if (b.getNumber() >= blockchain.getBlockStore().getBestBlock().getNumber()) { for (Transaction tx : b.getTransactionsList()) { tx.getSender(); } } return b; }, throwable -> logger.error("Unhandled exception: ", throwable) ); exec2 = exec1.add(1, 1000, block -> { try { blockWork(block); } catch (Exception e) { e.printStackTrace(); } }); String fileSrc = config.blocksLoader(); try { final String blocksFormat = config.getConfig().hasPath("blocks.format") ? config.getConfig().getString("blocks.format") : null; System.out.println("Loading blocks: " + fileSrc + ", format: " + blocksFormat); if ("rlp".equalsIgnoreCase(blocksFormat)) { Path path = Paths.get(fileSrc); byte[] data = Files.readAllBytes(path); RLPList list = RLP.decode2(data, 1); for (RLPElement item : list) { Block block = new Block(item.getRLPData()); exec1.push(block); } } else { FileInputStream inputStream = new FileInputStream(fileSrc); scanner = new Scanner(inputStream, "UTF-8"); while (scanner.hasNextLine()) { byte[] blockRLPBytes = Hex.decode(scanner.nextLine()); Block block = new Block(blockRLPBytes); exec1.push(block); } } } catch (Exception e) { e.printStackTrace(); System.exit(1); } try { exec1.join(); } catch (InterruptedException e) { throw new RuntimeException(e); } dbFlushManager.flushSync(); System.out.println(" * Done * "); System.exit(0); }
Source:
<code>LoginResponse runInJob(ICluster cluster, IAccount account) { LoginJob job = new LoginJob(cluster, account); job.schedule(); IProgressMonitor monitor = new NullProgressMonitor(); try { if (job.join(10000, monitor)) { return job.getResponse(); } else { throw new InterruptedException(); } } catch (OperationCanceledException e) { return null; } catch (InterruptedException e) { if (job.isRunninginUI()) { try { job.join(); return job.getResponse(); <START> } catch (InterruptedException e1) { <END> return null; } } else { job.setShouldRun(false); monitor.setCanceled(true); job.cancel(); return null; } } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') re-interrupt this method rethrow "InterruptedException". [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
LoginResponse runInJob(ICluster cluster, IAccount account) { LoginJob job = new LoginJob(cluster, account); job.schedule(); IProgressMonitor monitor = new NullProgressMonitor(); try { if (job.join(TIMEOUT_JOB_ON_UI_THREAD, monitor)) { return job.getResponse(); } else { throw new InterruptedException(); } } catch (OperationCanceledException e) { return null; } catch (InterruptedException e) { if (job.isRunninginUI()) { try { job.join(); return job.getResponse(); } catch (InterruptedException e1) { return null; } } else { job.setShouldRun(false); monitor.setCanceled(true); job.cancel(); return null; } } }
Source:
<code>protected void initEffectiveCompatibilityVersion() { Version effectiveCompatibilityVersion = VmPropertiesUtils.getInstance().getSupportedClusterLevels().contains(getParameters().getVmStaticData().getCustomCompatibilityVersion()) ? CompatibilityVersionUtils.getEffective(getParameters().getVmStaticData(), this::getCluster) : CompatibilityVersionUtils.getEffective(this::getCluster); <START> setEffectiveCompatibilityVersion(effectiveCompatibilityVersion); <END> }</code><technical_language>I right place for this. I options: 1. validate custom-compatibility version in CompatibilityVersionUtils#getEffective instead. 2. validate this point, set incorrect value, rely validation in te 'validate' method. I #2 - point in validating put another (which is incorrect - if I asked for a VM CCV 5.7, I expect get this compatibility error if invalid)</technical_language>

Target:
protected void initEffectiveCompatibilityVersion() { setEffectiveCompatibilityVersion( CompatibilityVersionUtils.getEffective(getParameters().getVmStaticData(), this::getCluster)); }
Source:
<code>private void onRemove() { ConfirmationModel model = (ConfirmationModel) <START> getWindow(); <END> if (model.getProgress() != null) { return; } model.startProgress(); List<ActionParametersBase> prms = getSelectedItems() .stream() .map(item -> { RemoveDiskParameters params = new RemoveDiskParameters(item.getId(), getEntity().getId()); params.setUnregisteredDisk(true); return params; }) .collect(Collectors.toList()); Frontend.getInstance().runMultipleAction(ActionType.RemoveDisk, prms, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); }</code><technical_language>worth adding line: if (getWindow() != null) { return; }</technical_language>

Target:
private void onRemove() { if (getWindow() != null) { return; } ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } model.startProgress(); List<ActionParametersBase> removeDiskParameters = getSelectedItems() .stream() .map(item -> { RemoveDiskParameters params = new RemoveDiskParameters(item.getId(), getEntity().getId()); params.setUnregisteredDisk(true); return params; }) .collect(Collectors.toList()); Frontend.getInstance().runMultipleAction( ActionType.RemoveDisk, removeDiskParameters, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); }
Source:
<code>private boolean isInfinispanConsolePath(String uri) { <START> return uri.equals(rootUri) || (uri.contains(rootUri) && !uri.contains(".")); <END> }</code><technical_language>@karesti "." check is for, uri.startsWith(rootUri)</technical_language>

Target:
private boolean isInfinispanConsolePath(String uri) { return uri.startsWith(rootUri) && !uri.contains("."); }
Source:
<code>public void testNumberOfUnplacedHeavyAtoms_IAtomContainer(){ <START> IAtomContainer ac = AtomPlacer3DTest.makeAlphaPinene(); <END> int count=new AtomPlacer3D().numberOfUnplacedHeavyAtoms(ac); Assert.assertEquals(10,count); }</code><technical_language>I tend leave static class definition this read IAtomContainer ac = makeAlphaPinene();. Thoughts</technical_language>

Target:
public void testNumberOfUnplacedHeavyAtoms_IAtomContainer(){ IAtomContainer ac = makeAlphaPinene(); int count=new AtomPlacer3D().numberOfUnplacedHeavyAtoms(ac); Assert.assertEquals(10,count); }
Source:
<code>public static String getSpanName(String attributeName) { return attributeName.substring(0, <START> attributeName.lastIndexOf("/")); END> }</code><technical_language>single quote '/' remove //$NON-NLS-1$</technical_language>

Target:
public static @NonNull String getSpanName(String attributeName) { return attributeName.substring(0, attributeName.lastIndexOf('/')); }
Source:
<code>public void start() { try (DbSession dbSession = dbClient.openSession(false)) { QualityGateDto builtin = qualityGateDao.selectByName(dbSession, BUILTIN_QUALITY_GATE_NAME); if (builtin == null) { LOGGER.info("Built-in quality gate has been created", BUILTIN_QUALITY_GATE_NAME); builtin = createQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); if (qualityGates.getDefault() == null) { <START> qualityGates.setDefault(dbSession, builtin.getId()); <END> } } updateQualityConditionsIfRequired(dbSession, builtin); qualityGateDao.ensureOneBuiltInQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); dbSession.commit(); } }</code><technical_language>I a strategy : select built-in profiles, check name "Sonar way", if : - If name is wrong => update name (and add a log) - if => update flags (and add a log)</technical_language>

Target:
public void start() { try (DbSession dbSession = dbClient.openSession(false)) { QualityGateDto builtin = qualityGateDao.selectByName(dbSession, BUILTIN_QUALITY_GATE_NAME); if (builtin == null) { LOGGER.info("Built-in quality gate has been created", BUILTIN_QUALITY_GATE_NAME); builtin = createQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); } if (!qualityGateFinder.getDefault(dbSession).isPresent()) { LOGGER.info("Built-in quality gate has been set as default", BUILTIN_QUALITY_GATE_NAME); qualityGateUpdater.setDefault(dbSession, builtin); } if (!builtin.isBuiltIn()) { builtin.setBuiltIn(true); dbClient.qualityGateDao().update(builtin, dbSession); LOGGER.info("Quality gate has been set as built-in", BUILTIN_QUALITY_GATE_NAME); } updateQualityConditionsIfRequired(dbSession, builtin); qualityGateDao.ensureOneBuiltInQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); dbSession.commit(); } }
Source:
<code>public List<DecorationDescriptor> createDecorationDescriptors(IDiagramElementEditPart editPart, Session session) { Image decorationImage = getDecorationImage(editPart); if (decorationImage != null) { DecorationDescriptor decoDesc = new DecorationDescriptor(); decoDesc.setName(NAME); decoDesc.setPosition(Position.SOUTH_WEST_LITERAL); decoDesc.setDistributionDirection(DecorationDistributionDirection.HORIZONTAL); decoDesc.setDisplayPriority(DisplayPriority.HIGH_PRIORITY.getValue()); <START> decoDesc.setDecorationAsImage(decorationImage); boolean disableLockDecoPrint = Boolean.getBoolean(DISABLE_PRINT_FOR_PERMISSION_AUTHORITY_DECORATION); if (disableLockDecoPrint) { decoDesc.setPrintable(isImagePrintable(decorationImage)); } <END> decoDesc.setTooltipAsString(getToolTip(editPart)); return Arrays.asList(decoDesc); } return new ArrayList<>(); }</code><technical_language>I suggest reverse methode: DecorationDescriptor decoDesc = new DecorationDescriptor(); decoDesc.setName(NAME); decoDesc.setPosition(Position.SOUTH_WEST_LITERAL); decoDesc.setDistributionDirection(DecorationDistributionDirection.HORIZONTAL); decoDesc.setDisplayPriority(DisplayPriority.HIGH_PRIORITY.getValue()); //here call a new protected method compute image, //decide if is printable set image of decoDesc callNewMethod replace getDecorationIMage if (decoDesc.getImage() != null){ // add tooltip decoDesc.setTooltipAsString(getToolTip(editPart)); return Arrays.asList(decoDesc); } else { return new ArrayList() }</technical_language>

Target:
public List<DecorationDescriptor> createDecorationDescriptors(IDiagramElementEditPart editPart, Session session) { DecorationDescriptor decoDesc = new DecorationDescriptor(); addDecorationImage(editPart, decoDesc); if (decoDesc.getDecorationAsImage() != null) { decoDesc.setName(NAME); decoDesc.setPosition(Position.SOUTH_WEST_LITERAL); decoDesc.setDistributionDirection(DecorationDistributionDirection.HORIZONTAL); decoDesc.setDisplayPriority(DisplayPriority.HIGH_PRIORITY.getValue()); decoDesc.setTooltipAsString(getToolTip(editPart)); return Arrays.asList(decoDesc); } return new ArrayList<>(); }
Source:
<code>public void createControl(Composite parent) { ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog() .getTabs(); <START> model = ((RunImageVolumesTab) tabs[1]).getModel(); <END> final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1) .grab(true, false).applyTo(container); GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6) .applyTo(container); createEnvironmentVariablesContainer(container); setControl(container); }</code><technical_language>model passed in constructor instead</technical_language>

Target:
public void createControl(Composite parent) { final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1) .grab(true, false).applyTo(container); GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6) .applyTo(container); if (model == null) { setErrorMessage(LaunchMessages.getString("NoConnectionError.msg")); } else { setErrorMessage(null); createEnvironmentVariablesContainer(container); } setControl(container); }
Source:
<code>public void flush() { final boolean notifyDataAvailable; synchronized (buffers) { if (buffers.isEmpty()) { return; } notifyDataAvailable = mayNotifyDataAvailable() && buffers.peekFirst().isDataAvailable(); <START> flushRequested = flushRequested || buffers.size() > 1 || notifyDataAvailable; <END> dataAvailableNotified = dataAvailableNotified || notifyDataAvailable; } if (notifyDataAvailable) { notifyDataAvailable(); } }</code><technical_language>change behavior of flushRequested here. flushRequested is for judging availability of partition called upper component, coupled condition of dataAvailableNotified. E.g. if flushRequested = false buffers.size() == 1 buffers.peek().isDataAvailable(), matter dataAvailableNotified is false true, new flushRequested alway true</technical_language>

Target:
public void flush() { final boolean notifyDataAvailable; synchronized (buffers) { if (buffers.isEmpty() || flushRequested) { return; } notifyDataAvailable = shouldNotifyDataAvailable() && buffers.peekFirst().isDataAvailable(); flushRequested = buffers.size() > 1 || notifyDataAvailable; dataAvailableNotified = dataAvailableNotified || notifyDataAvailable; } if (notifyDataAvailable) { readView.notifyDataAvailable(); } }
Source:
<code>public ConnectionId(final String host, final int port, final String connectionId) { Objects.requireNonNull(host); if (port <= 0) { <START> throw new IllegalArgumentException(String.format("Port must be greater than 0")); <END> } this.host = host; this.port = port; this.connectionId = connectionId; }</code><technical_language>need String.format is parameter. provide throw new IllegalArgumentException("Port greater 0"); improve message somethign like: throw new IllegalArgumentException(String.format("Port greater 0 (provided {0})", port));</technical_language>

Target:
public ConnectionId(final String host, final int port, final String connectionId) { Objects.requireNonNull(host); if (port <= 0) { throw new IllegalArgumentException("Port must be greater than 0"); } this.host = host; this.port = port; this.connectionId = connectionId; }
Source:
<code>public static void printC() { calendar.set(year, month, 1); for (int i = 0; i < 7; ++i) { if (LenghtNameDay < dayNames[i].length()) { LenghtNameDay = dayNames[i].length(); } } if (weeksNeeded) { System.out.print(" "); } System.out.println(" " + DateFormatSymbols.getInstance().getMonths()[month] + ' ' + year); if (weeksNeeded) { System.out.print(" "); } for (int dayIndex : dayIndexes) { System.out.print(dayNames[dayIndex]); for (int j = 0; j < LenghtNameDay - dayNames[dayIndex].length() + 1; ++j) { System.out.print(' '); } } if (LenghtNameDay < 2) { LenghtNameDay = 2; } System.out.println(); <START> int current_day = 1; <END> int current_week = calendar.get(Calendar.WEEK_OF_YEAR); while (month == calendar.get(Calendar.MONTH)) { if (weeksNeeded) { if (current_week < 10) { System.out.print(" " + current_week + " "); } else { System.out.print(current_week + " "); } current_week++; } for (int indx : dayIndexes) { if (indx != calendar.get(Calendar.DAY_OF_WEEK) || month != calendar.get(Calendar.MONTH)) { for (int i = 0; i < LenghtNameDay + 1; ++i) { System.out.print(' '); } } else { for (int i = 0; i < LenghtNameDay - 2; ++i) { System.out.print(' '); } if (current_day < 10) { System.out.print(' '); } System.out.print(current_day + " "); current_day++; calendar.set(Calendar.DAY_OF_MONTH, current_day); } } System.out.println(); } }</code><technical_language>Code Conventions</technical_language>

Target:
public static void printC() { calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.set(year, month, 1); for (int i = 0; i < 7; ++i) { if (lenghtNameDay < dayNames[i].length()) { lenghtNameDay = dayNames[i].length(); } } if (lenghtNameDay < 2) { lenghtNameDay = 2; } if (weeksNeeded) { System.out.print(" "); } System.out.println(" " + DateFormatSymbols.getInstance().getMonths()[month] + ' ' + year); if (weeksNeeded) { System.out.print(" "); } for (int dayIndex : dayIndexes) { System.out.print(dayNames[dayIndex]); for (int j = 0; j < lenghtNameDay - dayNames[dayIndex].length() + 1; ++j) { System.out.print(' '); } } System.out.println(); int currentDay = 1; int currentWeek = calendar.get(Calendar.WEEK_OF_YEAR); while (month == calendar.get(Calendar.MONTH)) { if (weeksNeeded) { if (currentWeek < 10) { System.out.print(" " + currentWeek + " "); } else { System.out.print(currentWeek + " "); } currentWeek++; } for (int indx : dayIndexes) { if (indx != calendar.get(Calendar.DAY_OF_WEEK) || month != calendar.get(Calendar.MONTH)) { for (int i = 0; i < lenghtNameDay + 1; ++i) { System.out.print(' '); } } else { for (int i = 0; i < lenghtNameDay - 2; ++i) { System.out.print(' '); } if (currentDay < 10) { System.out.print(' '); } System.out.print(currentDay + " "); currentDay++; calendar.set(Calendar.DAY_OF_MONTH, currentDay); } } System.out.println(); } }
Source:
<code>protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); <START> collectTote(false, 5000); <END> setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("Setting to mechanum: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Setting to traction: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); DriveCode.octocanumShifting.set(false); }</code><technical_language>this tunable, in ContainerTote</technical_language>

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); collectTote(shake.get(), 5000); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("Setting to mechanum: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Setting to traction: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); DriveCode.octocanumShifting.set(false); }
Source:
<code>protected Boolean doInBackground(MeasurementDetails... params) { MeasurementDetails measurementDetails = params[0]; GmaApiClient apiClient = GmaApiClient.getInstance(MeasurementDetailsActivity.this); try { List<MeasurementDetails> data = new ArrayList<>(); data.add(measurementDetails); Log.i(TAG, "Saving new measurements to the database"); MeasurementsService.saveMeasurementDetailsToDatabase(MeasurementDetailsActivity.this, measurementDetails); Log.i(TAG, "Sending new measurements to the server"); <START> return apiClient.updateMeasurementDetails(data, preferences.getString(PREF_CURRENT_ASSIGNMENT, null)); <END> } catch(ApiException ae) { Log.e(TAG, "Error saving measurement details", ae); } catch(JSONException je) { Log.e(TAG, "Error parsing measurement details into JSON", je); } return false; }</code><technical_language>this access currentAssignment object in MeasurementsDetailsActivity. lead a race condition is changed UI thread doInBackground runs a background Executor thread. pass in current assignment creating task: new SaveMeasurementsToServer(currentAssignment).execute(data)</technical_language>

Target:
protected Boolean doInBackground(MeasurementDetails... params) { MeasurementDetails measurementDetails = params[0]; GmaApiClient apiClient = GmaApiClient.getInstance(MeasurementDetailsActivity.this); try { List<MeasurementDetails> data = new ArrayList<>(); data.add(measurementDetails); Log.i(TAG, "Saving new measurements to the database"); MeasurementsService.saveMeasurementDetailsToDatabase(MeasurementDetailsActivity.this, measurementDetails); Log.i(TAG, "Sending new measurements to the server"); return apiClient.updateMeasurementDetails(data, currentAssignment.getId()); } catch(ApiException ae) { Log.e(TAG, "Error saving measurement details", ae); } catch(JSONException je) { Log.e(TAG, "Error parsing measurement details into JSON", je); } return false; }
Source:
<code>public @Nullable IStatus validate(final @Nullable IProject project, final @Nullable String path) { IStatus status = super.validate(project, path); if (status instanceof CtfTraceValidationStatus) { Map<String, String> environment = Objects.requireNonNull(((CtfTraceValidationStatus) status).getEnvironment()); String domain = environment.get("tracer_name"); if <START> (domain == null || <END> !PERF_DOMAIN.equals(domain)) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "This trace is not a perf trace"); } return new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID); } return status; }</code><technical_language>useless no</technical_language>

Target:
public @Nullable IStatus validate(final @Nullable IProject project, final @Nullable String path) { IStatus status = super.validate(project, path); if (status instanceof CtfTraceValidationStatus) { Map<String, String> environment = Objects.requireNonNull(((CtfTraceValidationStatus) status).getEnvironment()); String domain = environment.get("tracer_name"); if (!PERF_DOMAIN.equals(domain)) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "This trace is not a perf trace"); } return new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID); } return status; }
Source:
<code>public static String readResource(String resource) throws IOException { <START> return Resources.toString(requireNonNull(BenchmarkGeometrySerde.class.getClassLoader().getResource(resource), "resource not found: " + resource), UTF_8); <END> }</code><technical_language>Resources.toString(Resources.getResource(resource), UTF_8)? I is in throwing IOException, catch throw UncheckedIOException</technical_language>

Target:
public static String readResource(String resource) { try { return Resources.toString(getResource(resource), UTF_8); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public Builder toBuilder() { Builder builder = new Builder(type, name); builder.javadoc.add(javadoc); builder.annotations.addAll(annotations); builder.modifiers.addAll(modifiers); <START> builder.initializer = initializer; <END> return builder; }</code><technical_language>nit: check if this is empty, if is pass null? add initializer copied instance. (I'm constructor figure out assignment is!)</technical_language>

Target:
public Builder toBuilder() { Builder builder = new Builder(type, name); builder.javadoc.add(javadoc); builder.annotations.addAll(annotations); builder.modifiers.addAll(modifiers); builder.initializer = initializer.isEmpty() ? null : initializer; return builder; }
Source:
<code>public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName()); accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name); String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters)); Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters, stateMachine.getWarningCollector()); List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery()) .getVisibleFields().stream() .map(field -> new ViewColumn(field.getName().get(), field.getType())) .collect(toImmutableList()); <START> List<ColumnMetadata> columnMetaData = columns.stream() <END> .map(column -> new ColumnMetadata(column.getName(), column.getType())) .collect(toImmutableList()); String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser()))); ConnectorTableMetadata viewMetadata = new ConnectorTableMetadata(name.asSchemaTableName(), columnMetaData); metadata.createView(session, viewMetadata, data, statement.isReplace()); return immediateFuture(null); }</code><technical_language>nit: call this columnMetadata (lower case d) else "metadata" is considered word</technical_language>

Target:
public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName()); accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name); String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters)); Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters, stateMachine.getWarningCollector()); List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery()) .getVisibleFields().stream() .map(field -> new ViewColumn(field.getName().get(), field.getType())) .collect(toImmutableList()); List<ColumnMetadata> columnMetadata = columns.stream() .map(column -> new ColumnMetadata(column.getName(), column.getType())) .collect(toImmutableList()); ConnectorTableMetadata viewMetadata = new ConnectorTableMetadata(name.asSchemaTableName(), columnMetadata); String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser()))); metadata.createView(session, name.getCatalogName(), viewMetadata, data, statement.isReplace()); return immediateFuture(null); }
Source:
<code>private double weightedRate( PricingEnvironment env, IborIndex iborIndex, IborAveragedFixing fixing) { double rate = (fixing.getFixedRate().isPresent() ? <START> fixing.getFixedRate().getAsDouble() : env.iborIndexRate(iborIndex, fixing.getFixingDate())); <END> return rate * fixing.getWeight(); }</code><technical_language>OptionalDouble return type create code: double rate = fixing.getFixedRate().orElse(env.iborIndexRate(iborIndex, fixing.getFixingDate()));</technical_language>

Target:
private double weightedRate( PricingEnvironment env, IborIndex iborIndex, IborAveragedFixing fixing) { double rate = fixing.getFixedRate().orElse(env.iborIndexRate(iborIndex, fixing.getFixingDate())); return rate * fixing.getWeight(); }