auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Node transform(Node node) { final SYIncludeNode includeNode = (SYIncludeNode) node; String resourcePath = ResourcePathUtils.toAbsoluteLocation(node.getStartPosition().getPath(), includeNode.getIncludePath()); InputStream inputStream = null; try { if (resourceLoader instanceof ResourceLoaderExtended) { inputStream = ((ResourceLoaderExtended) resourceLoader).fetchResource(resourcePath, this); } else { inputStream = resourceLoader.fetchResource(resourcePath); } if (inputStream == null) { return new IncludeErrorNode("Include cannot be resolved: " + resourcePath); } Node result; String includeContent = StreamUtils.toString(inputStream); if (resourcePath.endsWith(".raml") || resourcePath.endsWith(".yaml") || resourcePath.endsWith(".yml")) { try { RamlHeader ramlHeader = RamlHeader.parse(includeContent); final RamlFragment fragment = ramlHeader.getFragment(); result = NodeParser.parse(resourceLoader, resourcePath, includeContent); if (result != null && isTypedFragment(result, fragment)) { final RamlTypedFragmentNode newNode = new RamlTypedFragmentNode(fragment); result.replaceWith(newNode); result = newNode; } } catch (RamlHeader.InvalidHeaderException e) { result = NodeParser.parse(resourceLoader, resourcePath, includeContent); } } else { result = new StringNodeImpl(includeContent); updatePositionWithResourceUri(result); } if (result == null) { result = new NullNodeImpl(); } return result; } finally { IOUtils.closeQuietly(inputStream); } }

Target:
public Node transform(Node node) { final SYIncludeNode includeNode = (SYIncludeNode) node; String resourcePath = ResourcePathUtils.toAbsoluteLocation(node.getStartPosition().getPath(), includeNode.getIncludePath()); InputStream inputStream = null; try { if (resourceLoader instanceof ResourceLoaderExtended) { inputStream = ((ResourceLoaderExtended) resourceLoader).fetchResource(resourcePath, this); } else { inputStream = resourceLoader.fetchResource(resourcePath); } if (inputStream == null) { return new IncludeErrorNode("Include cannot be resolved: " + resourcePath); } Node result; String includeContent = StreamUtils.toString(inputStream); if (resourcePath.endsWith(".raml") || resourcePath.endsWith(".yaml") || resourcePath.endsWith(".yml")) { try { RamlHeader ramlHeader = RamlHeader.parse(includeContent); final RamlFragment fragment = ramlHeader.getFragment(); result = NodeParser.parse(resourceLoader, resourcePath, includeContent); if (result != null && isTypedFragment(result, fragment)) { final RamlTypedFragmentNode newNode = new RamlTypedFragmentNode(fragment); result.replaceWith(newNode); result = newNode; } } catch (RamlHeader.InvalidHeaderException e) { result = NodeParser.parse(resourceLoader, resourcePath, includeContent); } } else { result = new StringNodeImpl(includeContent); setTempPositionWithResourceUri(result); } if (result == null) { result = new NullNodeImpl(); } return result; } finally { IOUtils.closeQuietly(inputStream); } }
Source:
void compact(CompactionDetails details) throws InterruptedException, IOException, StoreException { if (srcIndex == null) { throw new IllegalStateException("Compactor has not been started"); } checkSanity(details); compactionLog = new CompactionLog(dataDir.getAbsolutePath(), storeId, time, details); resumeCompaction(); }

Target:
void compact(CompactionDetails details) throws IOException, StoreException { if (srcIndex == null) { throw new IllegalStateException("Compactor has not been initialized"); } else if (compactionLog != null) { throw new IllegalStateException("There is already a compaction in progress"); } checkSanity(details); compactionLog = new CompactionLog(dataDir.getAbsolutePath(), storeId, time, details); resumeCompaction(); }
Source:
public AuthorizationFramework getAuthorizationFramework() { if (authFramework == null) { authFramework = new AuthorizationFramework(threadConfig.get().getPluginDirectory()); } return authFramework; }

Target:
synchronized public AuthorizationFramework getAuthorizationFramework() { if (authFramework == null) { authFramework = new AuthorizationFramework(threadConfig.get().getPluginDirectory()); } return authFramework; }
Source:
public Worldpay3dsFlexCredentialsEntity build() { Worldpay3dsFlexCredentialsEntity worldpay3DsFlexCredentialsEntity = new Worldpay3dsFlexCredentialsEntity(); worldpay3DsFlexCredentialsEntity.jwtMacKey = this.jwtMacKey; worldpay3DsFlexCredentialsEntity.gatewayAccountId = this.gatewayAccountId; worldpay3DsFlexCredentialsEntity.organisationalUnitId = this.organisationalUnitId; worldpay3DsFlexCredentialsEntity.issuer = this.issuer; return worldpay3DsFlexCredentialsEntity; }

Target:
public Worldpay3dsFlexCredentialsEntity build() { Worldpay3dsFlexCredentialsEntity worldpay3dsFlexCredentialsEntity = new Worldpay3dsFlexCredentialsEntity(); worldpay3dsFlexCredentialsEntity.jwtMacKey = this.jwtMacKey; worldpay3dsFlexCredentialsEntity.gatewayAccountId = this.gatewayAccountId; worldpay3dsFlexCredentialsEntity.organisationalUnitId = this.organisationalUnitId; worldpay3dsFlexCredentialsEntity.issuer = this.issuer; return worldpay3dsFlexCredentialsEntity; }
Source:
protected void copyIfChanged(InputStream input, Path output) throws IOException { byte[] fileContent = IOUtil.toByteArray(input); ByteArrayInputStream bufferedInput = new ByteArrayInputStream(fileContent); if (Files.exists(output)) { try (InputStream outputContent = Files.newInputStream(output)) { if (IOUtil.contentEquals(bufferedInput, outputContent)) { return; } } bufferedInput.reset(); } Files.copy(bufferedInput, output, StandardCopyOption.REPLACE_EXISTING); }

Target:
protected void copyIfChanged(InputStream input, Path output) throws IOException { InputStream source = input; if (Files.exists(output)) { byte[] fileContent = IOUtil.toByteArray(input); ByteArrayInputStream bufferedInput = new ByteArrayInputStream(fileContent); try (InputStream outputContent = Files.newInputStream(output)) { if (IOUtil.contentEquals(bufferedInput, outputContent)) { return; } } bufferedInput.reset(); source = bufferedInput; } Files.copy(source, output, StandardCopyOption.REPLACE_EXISTING); }
Source:
public String toString() { return "RemoveExpiredCommand{" + "key=" + key + " value=" + value + " lifespan=" + lifespan + '}'; }

Target:
public String toString() { return "RemoveExpiredCommand{" + "key=" + key + ", value=" + value + ", lifespan=" + lifespan + '}'; }
Source:
public void startup() { this.sourceRunning = true; this.retryStartup.set(true); do { if(retryStartup.get()) { retryStartup.set(false); startupOngoing.set(true); initThread = new Thread(this::initialize); Threads.setDaemonThreadRunning(initThread, Thread.currentThread().getName() + ".replicationSource," + this.queueId, (t,e) -> { uncaughtException(t, e); retryStartup.set(true); }); } } while (startupOngoing.get()); }

Target:
public void startup() { MutableBoolean retryStartup = new MutableBoolean(true); this.sourceRunning = true; do { if(retryStartup.booleanValue()) { retryStartup.setValue(false); startupOngoing.set(true); initThread = new Thread(this::initialize); Threads.setDaemonThreadRunning(initThread, Thread.currentThread().getName() + ".replicationSource," + this.queueId, (t,e) -> { sourceRunning = false; uncaughtException(t, e, null, null); retryStartup.setValue(!this.abortOnError); }); } } while (this.startupOngoing.get() && !this.abortOnError); }
Source:
public FakeTicker advance(long time, TimeUnit timeUnit) { nanos.addAndGet(timeUnit.toNanos(time)); return this; }

Target:
public void advance(long time, TimeUnit timeUnit) { nanos.addAndGet(timeUnit.toNanos(time)); }
Source:
public Response checkElasticSearch() { try { delegate.toolsIndexSearch(null, null, null); } catch (Exception ex) { return Response.status(ERROR_STATUS_CODE).build(); } return Response.ok().build(); }

Target:
public Response checkElasticSearch() { Response elasticSearchResponse; try { elasticSearchResponse = delegate.toolsIndexSearch(null, null, null); String result = IOUtils.toString((InputStream)(elasticSearchResponse.getEntity()), StandardCharsets.UTF_8); JSONObject jsonObj = new JSONObject(result); JSONObject hitsHolder = jsonObj.getJSONObject("hits"); JSONArray hitsArray = hitsHolder.getJSONArray("hits"); if (hitsArray.toList().isEmpty()) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); } } catch (Exception ex) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); } return Response.ok().build(); }
Source:
public static Optional<InsightCard> getInsights(final SleepStatsDAODynamoDB sleepStatsDAODynamoDB, final AccountReadDAO accountReadDAO, final Long accountId) { final DateTime queryEndDate = DateTime.now().withTimeAtStartOfDay(); final DateTime queryStartDate = queryEndDate.minusDays(NUM_DAYS); final String queryEndDateString = DateTimeUtil.dateToYmdString(queryEndDate); final String queryStartDateString = DateTimeUtil.dateToYmdString(queryStartDate); final List<AggregateSleepStats> sleepStats = sleepStatsDAODynamoDB.getBatchStats(accountId, queryStartDateString, queryEndDateString); LOGGER.debug("Account id length of sleep stats is and sleepStats is ", accountId, sleepStats.size(), sleepStats); final List<Integer> wakeTimeList = Lists.newArrayList(); for (final AggregateSleepStats stat : sleepStats) { final Integer dayOfWeek = stat.dateTime.getDayOfWeek(); if (dayOfWeek == 6) { continue; } else if (dayOfWeek == 7) { continue; } final Long wakeTimeStamp = stat.sleepStats.wakeTime; final DateTime wakeTimeDateTime = new DateTime(wakeTimeStamp, DateTimeZone.forOffsetMillis(stat.offsetMillis)); final int wakeTime = wakeTimeDateTime.getMinuteOfDay(); wakeTimeList.add(wakeTime); } final DateTime dob = accountReadDAO.getById(accountId).get().DOB; final Integer userAge = Years.yearsBetween(dob, DateTime.now()).toPeriod().getYears(); final Optional<InsightCard> card = processSleepAlarm(accountId, wakeTimeList, userAge); return card; }

Target:
public static Optional<InsightCard> getInsights(final SleepStatsDAODynamoDB sleepStatsDAODynamoDB, final AccountReadDAO accountReadDAO, final Long accountId) { final DateTime queryEndDate = DateTime.now().withTimeAtStartOfDay(); final DateTime queryStartDate = queryEndDate.minusDays(NUM_DAYS); final String queryEndDateString = DateTimeUtil.dateToYmdString(queryEndDate); final String queryStartDateString = DateTimeUtil.dateToYmdString(queryStartDate); final List<AggregateSleepStats> sleepStats = sleepStatsDAODynamoDB.getBatchStats(accountId, queryStartDateString, queryEndDateString); LOGGER.debug("insight=sleep_alarm-account_id={}-sleep_stat_len={}", accountId, sleepStats.size()); final List<Integer> wakeTimeList = Lists.newArrayList(); for (final AggregateSleepStats stat : sleepStats) { final Integer dayOfWeek = stat.dateTime.getDayOfWeek(); if (dayOfWeek == 6) { continue; } else if (dayOfWeek == 7) { continue; } final Long wakeTimeStamp = stat.sleepStats.wakeTime; final DateTime wakeTimeDateTime = new DateTime(wakeTimeStamp, DateTimeZone.forOffsetMillis(stat.offsetMillis)); final int wakeTime = wakeTimeDateTime.getMinuteOfDay(); wakeTimeList.add(wakeTime); } final DateTime dob = accountReadDAO.getById(accountId).get().DOB; final Integer userAge = Years.yearsBetween(dob, DateTime.now()).toPeriod().getYears(); final Optional<InsightCard> card = processSleepAlarm(accountId, wakeTimeList, userAge); return card; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { String alreadyFilteredAttributeName = getAlreadyFilteredAttributeName(); boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttributeName) != null; if (hasAlreadyFilteredAttribute) { filterChain.doFilter(request, response); } else { final StatusExposingServletResponse statusExposingServletResponse = new StatusExposingServletResponse( (HttpServletResponse) response); requestInterceptor.handle(newServerRequestAdapter(newHttpServerRequest((HttpServletRequest) request), spanNameProvider)); try { filterChain.doFilter(request, statusExposingServletResponse); }finally { HttpResponse httpResponse = statusExposingServletResponse::getStatus; responseInterceptor.handle(newServerResponseAdapter(httpResponse)); } } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { String alreadyFilteredAttributeName = getAlreadyFilteredAttributeName(); boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttributeName) != null; if (hasAlreadyFilteredAttribute) { filterChain.doFilter(request, response); } else { final StatusExposingServletResponse statusExposingServletResponse = new StatusExposingServletResponse( (HttpServletResponse) response); requestInterceptor.handle(interceptRequestAdapter(newRequestAdapter(newRequest((HttpServletRequest) request), spanNameProvider))); try { filterChain.doFilter(request, statusExposingServletResponse); }finally { HttpResponse httpResponse = newResposne(statusExposingServletResponse); responseInterceptor.handle(interceptResponseAdapter(newResponseAdapter(httpResponse))); } } }
Source:
public void testPerformQueryAnonymous() throws Exception { repository.setCredentials(AuthenticationType.REPOSITORY, null, false); IRepositoryQuery query = new RepositoryQuery(repository.getConnectorKind(), "query"); query.setAttribute(GerritQuery.TYPE, GerritQuery.ALL_OPEN_CHANGES); query.setAttribute(GerritQuery.QUERY_STRING, GerritQuery.ALL_OPEN_CHANGES); InMemoryTaskDataCollector resultCollector = new InMemoryTaskDataCollector(); IStatus status = connector.performQuery(repository, query, resultCollector, null, new NullProgressMonitor()); assertEquals(Status.OK_STATUS, status); assertTrue(resultCollector.getResults().size() > 0); for (TaskData result : resultCollector.getResults()) { assertTrue(result.isPartial()); assertNull(result.getRoot().getAttribute(GerritTaskSchema.getDefault().UPLOADED.getKey())); TaskAttribute key = result.getRoot().getAttribute(GerritTaskSchema.getDefault().KEY.getKey()); assertNotNull(key); String value = key.getValue(); assertNotNull(value); assertTrue(value.startsWith("I")); String objId = StringUtils.rightPad(value.substring(1), Constants.OBJECT_ID_STRING_LENGTH, 'a'); assertTrue(ObjectId.isId(objId)); TaskAttribute owner = result.getRoot().getAttribute(GerritTaskSchema.getDefault().OWNER.getKey()); assertNotNull(owner); assertNotNull(owner.getValue()); } }

Target:
public void testPerformQueryAnonymous() throws Exception { repository.setCredentials(AuthenticationType.REPOSITORY, null, false); IRepositoryQuery query = new RepositoryQuery(repository.getConnectorKind(), "query"); query.setAttribute(GerritQuery.TYPE, GerritQuery.ALL_OPEN_CHANGES); query.setAttribute(GerritQuery.QUERY_STRING, GerritQuery.ALL_OPEN_CHANGES); InMemoryTaskDataCollector resultCollector = new InMemoryTaskDataCollector(); IStatus status = connector.performQuery(repository, query, resultCollector, null, new NullProgressMonitor()); assertEquals(Status.OK_STATUS, status); assertTrue(resultCollector.getResults().size() > 0); for (TaskData result : resultCollector.getResults()) { assertTrue(result.isPartial()); assertNull(result.getRoot().getAttribute(GerritTaskSchema.getDefault().UPLOADED.getKey())); TaskAttribute key = result.getRoot().getAttribute(GerritTaskSchema.getDefault().KEY.getKey()); assertNotNull(key); String value = key.getValue(); assertNotNull(value); assertTrue(value.startsWith("I")); String objId = StringUtils.rightPad(value.substring(1), Constants.OBJECT_ID_STRING_LENGTH, 'a'); assertTrue(ObjectId.isId(objId)); TaskAttribute owner = result.getRoot().getAttribute(GerritTaskSchema.getDefault().OWNER.getKey()); assertNotNull(owner); assertTrue(StringUtils.isNotBlank(owner.getValue())); } }
Source:
protected Object doTransform(Message<?> message) { Assert.state(message.getPayload() instanceof byte[], "Payload must be a byte[]"); DatumReader<?> reader = new SpecificDatumReader<>(this.type); try { return reader.read(null, this.decoderFactory.binaryDecoder((byte[]) message.getPayload(), null)); } catch (IOException e) { throw new UncheckedIOException(e); } }

Target:
protected Object doTransform(Message<?> message) { Assert.state(message.getPayload() instanceof byte[], "Payload must be a byte[]"); Class<? extends SpecificRecord> type = null; Object value = this.typeIdExpression.getValue(this.evaluationContext, message); if (value instanceof Class) { type = (Class<? extends SpecificRecord>) value; } else if (value instanceof String) { try { type = (Class<? extends SpecificRecord>) ClassUtils.forName((String) value, this.beanClassLoader); } catch (ClassNotFoundException | LinkageError e) { throw new IllegalStateException(e); } } if (type == null) { type = this.defaultType; } DatumReader<?> reader = new SpecificDatumReader<>(type); try { return reader.read(null, this.decoderFactory.binaryDecoder((byte[]) message.getPayload(), null)); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
public Future<String> putBlob(BlobProperties blobProperties, byte[] usermetadata, ReadableStreamChannel channel, Callback<String> callback) { FutureResult<String> futureResult = new FutureResult<String>(); if (isRunning.get()) { getOperationController().putBlob(blobProperties, usermetadata, channel, futureResult, null); } else { completeOperation(futureResult, null, callback, new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed)); } return futureResult; }

Target:
public Future<String> putBlob(BlobProperties blobProperties, byte[] usermetadata, ReadableStreamChannel channel, Callback<String> callback) { FutureResult<String> futureResult = new FutureResult<String>(); if (isOpen.get()) { getOperationController().putBlob(blobProperties, usermetadata, channel, futureResult, callback); } else { completeOperation(futureResult, null, callback, new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed)); } return futureResult; }
Source:
MantaMultipartUploadPart uploadPart(final ServerSideMultipartUpload upload, final int partNumber, final HttpEntity entity, final HttpContext context) throws IOException { Validate.notNull(upload, "Upload state object must not be null"); validatePartNumber(partNumber); final int adjustedPartNumber = partNumber - 1; final String putPath = upload.getPartsDirectory() + SEPARATOR + adjustedPartNumber; final HttpPut put = httpHelper.getRequestFactory().put(putPath); put.setEntity(entity); try (CloseableHttpResponse response = httpHelper.getConnectionContext().getHttpClient().execute(put, context)) { validateStatusCode( HttpStatus.SC_NO_CONTENT, response.getStatusLine().getStatusCode(), "Unable to upload part", put, response, null, null); Header etagHeader = response.getFirstHeader(HttpHeaders.ETAG); if (etagHeader == null || StringUtils.isEmpty(etagHeader.getValue())) { final MantaMultipartException mme = new MantaMultipartException("ETag missing from part response"); HttpHelper.annotateContextedException(mme, put, response); throw mme; } return new MantaMultipartUploadPart(partNumber, upload.getPath(), etagHeader.getValue()); } }

Target:
MantaMultipartUploadPart uploadPart(final ServerSideMultipartUpload upload, final int partNumber, final HttpEntity entity, final HttpContext context) throws IOException { Validate.notNull(upload, "Upload state object must not be null"); validatePartNumber(partNumber); final int adjustedPartNumber = partNumber - 1; final String putPath = upload.getPartsDirectory() + SEPARATOR + adjustedPartNumber; final HttpPut put = httpHelper.getRequestFactory().put(putPath); put.setEntity(entity); final CloseableHttpClient httpClient = httpHelper.getConnectionContext().getHttpClient(); try (CloseableHttpResponse response = httpClient.execute(put, context)) { validateStatusCode( HttpStatus.SC_NO_CONTENT, response.getStatusLine().getStatusCode(), "Unable to upload part", put, response, null, null); Header etagHeader = response.getFirstHeader(HttpHeaders.ETAG); if (etagHeader == null || StringUtils.isEmpty(etagHeader.getValue())) { final MantaMultipartException mme = new MantaMultipartException("ETag missing from part response"); HttpHelper.annotateContextedException(mme, put, response); throw mme; } return new MantaMultipartUploadPart(partNumber, upload.getPath(), etagHeader.getValue()); } }
Source:
public static GroupingSetDescriptor globalAggregation() { return singleGroupingSet(unmodifiableList(new ArrayList<>())); }

Target:
public static GroupingSetDescriptor globalAggregation() { return singleGroupingSet(unmodifiableList(emptyList())); }
Source:
public ServiceOfferingVO findById(Long vmId, long serviceOfferingId) { ServiceOfferingVO offering = super.findById(serviceOfferingId); if (offering.isDynamic()) { offering.setDynamicFlag(true); if (vmId == null) { throw new CloudRuntimeException("missing argument vmId"); } Map<String, String> dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId); return getcomputeOffering(offering, dynamicOffering); } return offering; }

Target:
public ServiceOfferingVO findById(Long vmId, long serviceOfferingId) { ServiceOfferingVO offering = super.findById(serviceOfferingId); if (offering.isDynamic()) { if (vmId == null) { throw new CloudRuntimeException("missing argument vmId"); } offering.setDynamicFlag(true); Map<String, String> dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId); return getcomputeOffering(offering, dynamicOffering); } return offering; }
Source:
private void handleStyles(final LayerInfo layer) { if (layer.getResource() instanceof WMSLayerInfo) { } else { start("Style"); StyleInfo defaultStyle = layer.getDefaultStyle(); if (defaultStyle == null) { throw new NullPointerException("Layer " + layer.getName() + " has no default style"); } Style ftStyle; try { ftStyle = defaultStyle.getStyle(); } catch (IOException e) { throw new RuntimeException(e); } element("Name", defaultStyle.prefixedName()); if (ftStyle.getDescription() != null) { if (ftStyle.getDescription().getTitle() != null) { element("Title", ftStyle.getDescription().getTitle()); } else { element("Title", defaultStyle.prefixedName()); } element("Abstract", ftStyle.getDescription().getAbstract()); } handleLegendURL(layer, defaultStyle.getLegend(), null, defaultStyle); end("Style"); Set<StyleInfo> styles = layer.getStyles(); if(styles != null){ for (StyleInfo styleInfo : styles) { try { ftStyle = styleInfo.getStyle(); } catch (IOException e) { throw new RuntimeException(e); } start("Style"); element("Name", styleInfo.prefixedName()); if (ftStyle.getDescription() != null) { if (ftStyle.getDescription().getTitle() != null) { element("Title", ftStyle.getDescription().getTitle()); } else { element("Title", styleInfo.prefixedName()); } element("Abstract", ftStyle.getDescription().getAbstract()); } handleLegendURL(layer, styleInfo.getLegend(), styleInfo, styleInfo); end("Style"); } } } }

Target:
private void handleStyles(final LayerInfo layer) { if (layer.getResource() instanceof WMSLayerInfo) { } else { start("Style"); StyleInfo defaultStyle = layer.getDefaultStyle(); if (defaultStyle == null) { throw new NullPointerException("Layer " + layer.getName() + " has no default style"); } handleCommonStyleElements(defaultStyle); handleLegendURL(layer, defaultStyle.getLegend(), null, defaultStyle); end("Style"); Set<StyleInfo> styles = layer.getStyles(); if(styles != null){ for (StyleInfo styleInfo : styles) { start("Style"); handleCommonStyleElements(styleInfo); handleLegendURL(layer, styleInfo.getLegend(), styleInfo, styleInfo); end("Style"); } } } }
Source:
public void verifyAccessible(InstructorAttributes instructor, FeedbackSessionAttributes feedbacksession, String privilegeName) { verifyNotNull(instructor, "instructor"); verifyNotNull(instructor.courseId, "instructor's course ID"); verifyNotNull(feedbacksession, "feedback session"); verifyNotNull(feedbacksession.getCourseId(), "feedback session's course ID"); if (!instructor.courseId.equals(feedbacksession.getCourseId())) { throw new UnauthorizedAccessException("Feedback session [" + feedbacksession.getFeedbackSessionName() + "] is not accessible to instructor [" + instructor.email + "]"); } if (!feedbacksession.getCreatorEmail().equals(instructor.email)) { throw new UnauthorizedAccessException("Feedback session [" + feedbacksession.getFeedbackSessionName() + "] is not accessible to instructor [" + instructor.email + "] for this purpose"); } if (!instructor.isAllowedForPrivilege(privilegeName)) { throw new UnauthorizedAccessException("Feedback session [" + feedbacksession.getFeedbackSessionName() + "] is not accessible to instructor [" + instructor.email + "] for privilege [" + privilegeName + "]"); } }

Target:
public void verifyAccessible(InstructorAttributes instructor, FeedbackSessionAttributes feedbacksession, String privilegeName) { verifyNotNull(instructor, "instructor"); verifyNotNull(instructor.courseId, "instructor's course ID"); verifyNotNull(feedbacksession, "feedback session"); verifyNotNull(feedbacksession.getCourseId(), "feedback session's course ID"); if (!instructor.courseId.equals(feedbacksession.getCourseId())) { throw new UnauthorizedAccessException("Feedback session [" + feedbacksession.getFeedbackSessionName() + "] is not accessible to instructor [" + instructor.email + "]"); } if (!instructor.isAllowedForPrivilege(privilegeName)) { throw new UnauthorizedAccessException("Feedback session [" + feedbacksession.getFeedbackSessionName() + "] is not accessible to instructor [" + instructor.email + "] for privilege [" + privilegeName + "]"); } }
Source:
public static void cancelQueuedPostUpload(PostModel post) { synchronized (mPostsList) { Iterator<PostModel> iterator = mPostsList.iterator(); while (iterator.hasNext()) { PostModel postModel = iterator.next(); if (postModel.getId() == post.getId()) { iterator.remove(); } } } }

Target:
public static void cancelQueuedPostUpload(PostModel post) { synchronized (mQueuedPostsList) { Iterator<PostModel> iterator = mQueuedPostsList.iterator(); while (iterator.hasNext()) { PostModel postModel = iterator.next(); if (postModel.getId() == post.getId()) { iterator.remove(); } } } }
Source:
public Promise<List<ProjectConfigDto>> createBatchProjects( List<NewProjectConfigDto> configurations) { String url = getBaseUrl() + BATCH_PROJECTS; if (url.contains("?")) { url += "&clientId=" + appContext.getApplicationId().orElse(""); } else { url += "?clientId=" + appContext.getApplicationId().orElse(""); } final String loaderMessage = configurations.size() > 1 ? "Creating the batch of projects..." : "Creating project..."; return reqFactory .createPostRequest(url, configurations) .header(ACCEPT, APPLICATION_JSON) .loader(loaderFactory.newLoader(loaderMessage)) .send(unmarshaller.newListUnmarshaller(ProjectConfigDto.class)); }

Target:
public Promise<List<ProjectConfigDto>> createBatchProjects( List<NewProjectConfigDto> configurations) { String url = getBaseUrl() + BATCH_PROJECTS; url += url.contains("?") ? "&" : "?"; url += "clientId=" + appContext.getApplicationId().orElse(""); final String loaderMessage = configurations.size() > 1 ? "Creating the batch of projects..." : "Creating project..."; return reqFactory .createPostRequest(url, configurations) .header(ACCEPT, APPLICATION_JSON) .loader(loaderFactory.newLoader(loaderMessage)) .send(unmarshaller.newListUnmarshaller(ProjectConfigDto.class)); }
Source:
public void addInstancesToElb(String name, List<Instance> instances){ if(instances.isEmpty()){ log.info("No instances to add to load balance "+name); return; } Collection ids = new ArrayList(); for (Instance i: instances) { ids.add(new com.amazonaws.services.elasticloadbalancing.model.Instance(i.getInstanceId())); } RegisterInstancesWithLoadBalancerRequest register = new RegisterInstancesWithLoadBalancerRequest(); register.setLoadBalancerName(name); register.setInstances(ids); RegisterInstancesWithLoadBalancerResult registerWithLoadBalancerResult = elb.registerInstancesWithLoadBalancer(register); }

Target:
public void addInstancesToElb(String name, List<Instance> instances){ if(instances.isEmpty()){ log.info("No instances to add to load balance "+name); return; } Collection<com.amazonaws.services.elasticloadbalancing.model.Instance> ids = new ArrayList(); for (Instance i: instances) { ids.add(new com.amazonaws.services.elasticloadbalancing.model.Instance(i.getInstanceId())); } RegisterInstancesWithLoadBalancerRequest register = new RegisterInstancesWithLoadBalancerRequest(); register.setLoadBalancerName(name); register.setInstances(ids); RegisterInstancesWithLoadBalancerResult registerWithLoadBalancerResult = elb.registerInstancesWithLoadBalancer(register); }
Source:
public void testAllOperationsAreAllowed() throws FunctionalException { final List<ActionRequest> actionRequestList = this.createActionRequestMockList(); when(this.domainHelperService.findOrganisation(ORGANISATION_IDENTIFICATION)).thenReturn(this.organisation); when(this.domainHelperService.findActiveDevice(DEVICE_IDENTIFICATION)).thenReturn(this.device); this.bundleService.enqueueBundleRequest(ORGANISATION_IDENTIFICATION, DEVICE_IDENTIFICATION, actionRequestList, 1); final ArgumentCaptor<SmartMeteringRequestMessage> message = ArgumentCaptor .forClass(SmartMeteringRequestMessage.class); verify(this.smartMeteringRequestMessageSender).send(message.capture()); assertEquals(message.getValue().getOrganisationIdentification(), ORGANISATION_IDENTIFICATION); assertEquals(message.getValue().getDeviceIdentification(), DEVICE_IDENTIFICATION); final BundleMessageRequest requestMessage = (BundleMessageRequest) message.getValue().getRequest(); final List<ActionRequest> actionList = requestMessage.getBundleList(); assertEquals(actionList.size(), actionRequestList.size()); for (final ActionRequest ar : actionList) { assertTrue(actionRequestList.contains(ar)); } }

Target:
public void testAllOperationsAreAllowed() throws FunctionalException { this.bundleService.enqueueBundleRequest(ORGANISATION_IDENTIFICATION, DEVICE_IDENTIFICATION, this.actionRequestMockList, 1); final ArgumentCaptor<SmartMeteringRequestMessage> message = ArgumentCaptor .forClass(SmartMeteringRequestMessage.class); verify(this.smartMeteringRequestMessageSender).send(message.capture()); assertEquals(message.getValue().getOrganisationIdentification(), ORGANISATION_IDENTIFICATION); assertEquals(message.getValue().getDeviceIdentification(), DEVICE_IDENTIFICATION); final BundleMessageRequest requestMessage = (BundleMessageRequest) message.getValue().getRequest(); final List<ActionRequest> actionList = requestMessage.getBundleList(); assertEquals(actionList.size(), this.actionRequestMockList.size()); for (int i = 0; i < actionList.size(); i++) { assertEquals(this.actionRequestMockList.get(i), actionList.get(i)); } }
Source:
void updateTaskStatus(TaskStatus newValue) { AtomicBoolean taskMismatch = new AtomicBoolean(); taskStatus.setIf(newValue, oldValue -> { boolean isOldValueEmpty = oldValue.getTaskInstanceIdLsb() == 0 && oldValue.getTaskInstanceIdMsb() == 0; if (!isOldValueEmpty && !(oldValue.getTaskInstanceIdLsb() == newValue.getTaskInstanceIdLsb() && oldValue.getTaskInstanceIdMsb() == newValue.getTaskInstanceIdMsb())) { taskMismatch.set(true); return false; } if (oldValue.getState().isDone()) { return false; } if (newValue.getVersion() < oldValue.getVersion()) { return false; } return true; }); if (taskMismatch.get()) { onFail.accept(new PrestoException(REMOTE_TASK_MISMATCH, format("%s (%s)", REMOTE_TASK_MISMATCH_ERROR, HostAddress.fromUri(getTaskStatus().getSelf())))); } }

Target:
void updateTaskStatus(TaskStatus newValue) { AtomicBoolean taskMismatch = new AtomicBoolean(); taskStatus.setIf(newValue, oldValue -> { boolean isEmpty = oldValue.getTaskInstanceIdLeastSignificantBits() == 0 && oldValue.getTaskInstanceIdMostSignificantBits() == 0; if (!isEmpty && !(oldValue.getTaskInstanceIdLeastSignificantBits() == newValue.getTaskInstanceIdLeastSignificantBits() && oldValue.getTaskInstanceIdMostSignificantBits() == newValue.getTaskInstanceIdMostSignificantBits())) { taskMismatch.set(true); return false; } if (oldValue.getState().isDone()) { return false; } if (newValue.getVersion() < oldValue.getVersion()) { return false; } return true; }); if (taskMismatch.get()) { onFail.accept(new PrestoException(REMOTE_TASK_MISMATCH, format("%s (%s)", REMOTE_TASK_MISMATCH_ERROR, HostAddress.fromUri(getTaskStatus().getSelf())))); } }
Source:
protected Future schedule(@Nonnull AbstractBuild<?, ?> build, @Nonnull final Job project, int quietPeriod, @Nonnull List<Action> list, @Nonnull TaskListener listener) throws InterruptedException, IOException { Cause cause = createUpstreamCause(build); List<Action> queueActions = new ArrayList<Action>(list); if (cause != null) { queueActions.add(new CauseAction(cause)); } if (project instanceof ParameterizedJobMixIn.ParameterizedJob) { final ParameterizedJobMixIn<?, ?> parameterizedJobMixIn = new ParameterizedJobMixIn() { @Override protected Job<?, ?> asJob() { return project; } }; if (!canTriggerProject(build, project, listener)) { return null; } return parameterizedJobMixIn.scheduleBuild2(quietPeriod, queueActions.toArray(new Action[0])); } return null; }

Target:
protected QueueTaskFuture schedule(@Nonnull AbstractBuild<?, ?> build, @Nonnull final Job project, int quietPeriod, @Nonnull List<Action> list, @Nonnull TaskListener listener) throws InterruptedException, IOException { Cause cause = createUpstreamCause(build); List<Action> queueActions = new ArrayList<Action>(list); if (cause != null) { queueActions.add(new CauseAction(cause)); } if (project instanceof ParameterizedJobMixIn.ParameterizedJob) { final ParameterizedJobMixIn<?, ?> parameterizedJobMixIn = new ParameterizedJobMixIn() { @Override protected Job<?, ?> asJob() { return project; } }; if (!canTriggerProject(build, project, listener)) { return null; } return parameterizedJobMixIn.scheduleBuild2(quietPeriod, queueActions.toArray(new Action[0])); } return null; }
Source:
Map<Integer, List<Pair<K, K>>> splitIntoSubKeyRanges(final List<Pair<K, K>> dataKeyRanges) { final Map<Integer, List<Pair<K, K>>> blockToSubKeyRangesMap = new HashMap<>(); for (final Pair<K, K> keyRange : dataKeyRanges) { final Map<Integer, Pair<K, K>> blockToSubKeyRangeMap = blockResolver.resolveBlocksForOrderedKeys(keyRange.getFirst(), keyRange.getSecond()); for (final Map.Entry<Integer, Pair<K, K>> blockToSubKeyRange : blockToSubKeyRangeMap.entrySet()) { final int blockId = blockToSubKeyRange.getKey(); final Pair<K, K> subKeyRange = blockToSubKeyRange.getValue(); blockToSubKeyRangesMap.computeIfAbsent(blockId, integer -> new LinkedList<>()); final List<Pair<K, K>> subKeyRangeList = blockToSubKeyRangesMap.get(blockId); subKeyRangeList.add(subKeyRange); } } return blockToSubKeyRangesMap; }

Target:
Map<Integer, List<Pair<K, K>>> splitIntoSubKeyRanges(final List<Pair<K, K>> dataKeyRanges) { final Map<Integer, List<Pair<K, K>>> blockToSubKeyRangesMap = new HashMap<>(); dataKeyRanges.forEach(keyRange -> { final Map<Integer, Pair<K, K>> blockToSubKeyRangeMap = blockResolver.resolveBlocksForOrderedKeys(keyRange.getFirst(), keyRange.getSecond()); blockToSubKeyRangeMap.forEach((blockId, subKeyRange) -> blockToSubKeyRangesMap.computeIfAbsent(blockId, integer -> new LinkedList<>()).add(subKeyRange)); }); return blockToSubKeyRangesMap; }
Source:
protected Map<String, Pair<String, String>> getSharedLocks() { if (sharedLockMap == null) { List<Disk> disksToLock = getVmPluggedDisks(); if (!disksToLock.isEmpty()) { sharedLockMap = new HashMap<String, Pair<String, String>>(disksToLock.size()); for (Disk disk : disksToLock) { sharedLockMap.put(disk.getId().toString(), LockMessagesMatchUtil.DISK); } } } return sharedLockMap; }

Target:
protected Map<String, Pair<String, String>> getSharedLocks() { List<Disk> disksToLock = getVmPluggedDisks(); if (!disksToLock.isEmpty()) { Map<String, Pair<String, String>> sharedLockMap = new HashMap<String, Pair<String, String>>(disksToLock.size()); for (Disk disk : disksToLock) { sharedLockMap.put(disk.getId().toString(), LockMessagesMatchUtil.DISK); } } return null; }
Source:
public void testListKeys() { List<SshKey> keys = api.getKeyPairApi().list(); assertTrue(keys.size() > 0, "SSH key list should not be empty"); }

Target:
public void testListKeys() { List<SshKey> keys = api.getKeyPairApi().list(); assertFalse(keys.isEmpty(), "SSH key list should not be empty"); }
Source:
public static <T extends Throwable> T closeAllSuppress(T rootCause, AutoCloseable... closeables) { requireNonNull(rootCause, "rootCause is null"); if (closeables == null) { return rootCause; } for (AutoCloseable closeable : closeables) { try { if (closeable != null) { closeable.close(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (Throwable e) { if (rootCause != e) { rootCause.addSuppressed(e); } } } return rootCause; }

Target:
public static <T extends Throwable> T closeAllSuppress(T rootCause, AutoCloseable... closeables) { requireNonNull(rootCause, "rootCause is null"); if (closeables == null) { return rootCause; } for (AutoCloseable closeable : closeables) { try { if (closeable != null) { closeable.close(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (rootCause != e) { rootCause.addSuppressed(e); } } catch (Throwable e) { if (rootCause != e) { rootCause.addSuppressed(e); } } } return rootCause; }
Source:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.value != null ? this.value.hashCode() : 0); return hash; }

Target:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.value != null ? this.value.hashCode() : 0); hash = 31 * hash + (this.key != null ? this.key.hashCode() : 0); return hash; }
Source:
private void configureDiskUsageService() { isDiskUsageServiceEnabled = config.getDiskUsageServiceEnabled(); NamespaceInterface namespace = NamespaceDirector.getNamespace(); List<VirtualFSInterface> toExclude = namespace.getVFSWithQuotaEnabled(); List<VirtualFSInterface> sas = namespace.getAllDefinedVFS() .stream() .filter(vfs -> !toExclude.contains(vfs)) .collect(Collectors.toList()); duService = new DiskUsageService(sas); }

Target:
private void configureDiskUsageService() { isDiskUsageServiceEnabled = config.getDiskUsageServiceEnabled(); NamespaceInterface namespace = NamespaceDirector.getNamespace(); List<VirtualFSInterface> quotaEnabledVfs = namespace.getVFSWithQuotaEnabled(); List<VirtualFSInterface> sas = namespace.getAllDefinedVFS() .stream() .filter(vfs -> !quotaEnabledVfs.contains(vfs)) .collect(Collectors.toList()); if (config.getDiskUsageServiceTasksParallel()) { duService = DiskUsageService.getScheduledThreadPoolService(sas); } else { duService = DiskUsageService.getSingleThreadScheduledService(sas); } }
Source:
protected void notAllowed( HttpServerExchange exchange ) { exchange.setStatusCode( StatusCodes.METHOD_NOT_ALLOWED ); exchange.getResponseHeaders().add( Headers.ALLOW, String.join( ", ", Methods.GET_STRING, Methods.HEAD_STRING, Methods.POST_STRING ) ); }

Target:
protected void notAllowed( HttpServerExchange exchange ) { final StringJoiner stringJoiner = new StringJoiner( ", "); for ( HttpString notAllowedMethod : notAllowedMethods ) { stringJoiner.add( notAllowedMethod.toString() ); } exchange.setStatusCode( StatusCodes.METHOD_NOT_ALLOWED ); exchange.getResponseHeaders().add( Headers.ALLOW, stringJoiner.toString() ); }
Source:
public void TestNoAdsForUsers_US(String page) throws Exception { SpecialUserLoginPageObject userLogin = new SpecialUserLoginPageObject(driver); userLogin.loginAndVerify(Properties.userName, Properties.password); AdsBaseObject wikiPage = new AdsBaseObject(driver, page); wikiPage.verifyNoAdsOnWikiPage(); }

Target:
public void TestNoAdsForUsers_US(String page) throws Exception { loginSteps(); AdsBaseObject wikiPage = new AdsBaseObject(driver, page); wikiPage.verifyNoAdsOnWikiPage(); }
Source:
private Producer<CloseableReference<CloseableImage>> getBasicDecodedImageSequence( ImageRequest imageRequest) { Preconditions.checkNotNull(imageRequest); ImageRequest.RequestLevel lowestPermittedRequestLevel = imageRequest.getLowestPermittedRequestLevel(); Preconditions.checkState( lowestPermittedRequestLevel.equals(ImageRequest.RequestLevel.FULL_FETCH) || lowestPermittedRequestLevel.equals( ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE), "Only support bitmap memory cache or full fetch at present, request level is %s ", lowestPermittedRequestLevel); if (lowestPermittedRequestLevel.equals(ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE)) { return getBitmapCacheGetOnlySequence(); } Uri uri = imageRequest.getSourceUri(); if (UriUtil.isNetworkUri(uri)) { return getNetworkFetchSequence(); } else if (UriUtil.isLocalFileUri(uri)) { if (MediaUtils.isVideo(MediaUtils.extractMime(uri.getPath()))) { return getLocalVideoFileFetchSequence(); } else { return getLocalImageFileFetchSequence(); } } else if (UriUtil.isLocalContentUri(uri)) { return getLocalContentUriFetchSequence(); } else if (UriUtil.isLocalAssetUri(uri)) { return getLocalAssetFetchSequence(); } else if (UriUtil.isLocalResourceUri(uri)) { return getLocalResourceFetchSequence(); } else { String uriString = uri.toString(); if (!TextUtils.isEmpty(uriString) && uriString.length() > 30) { uriString = uriStirng.substring(0, 30); } throw new RuntimeException( "Unsupported image type! Uri is: " + uriString); } }

Target:
private Producer<CloseableReference<CloseableImage>> getBasicDecodedImageSequence( ImageRequest imageRequest) { Preconditions.checkNotNull(imageRequest); ImageRequest.RequestLevel lowestPermittedRequestLevel = imageRequest.getLowestPermittedRequestLevel(); Preconditions.checkState( lowestPermittedRequestLevel.equals(ImageRequest.RequestLevel.FULL_FETCH) || lowestPermittedRequestLevel.equals( ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE), "Only support bitmap memory cache or full fetch at present, request level is %s ", lowestPermittedRequestLevel); if (lowestPermittedRequestLevel.equals(ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE)) { return getBitmapCacheGetOnlySequence(); } Uri uri = imageRequest.getSourceUri(); if (UriUtil.isNetworkUri(uri)) { return getNetworkFetchSequence(); } else if (UriUtil.isLocalFileUri(uri)) { if (MediaUtils.isVideo(MediaUtils.extractMime(uri.getPath()))) { return getLocalVideoFileFetchSequence(); } else { return getLocalImageFileFetchSequence(); } } else if (UriUtil.isLocalContentUri(uri)) { return getLocalContentUriFetchSequence(); } else if (UriUtil.isLocalAssetUri(uri)) { return getLocalAssetFetchSequence(); } else if (UriUtil.isLocalResourceUri(uri)) { return getLocalResourceFetchSequence(); } else { String uriString = uri.toString(); if (!TextUtils.isEmpty(uriString)) { uriString.substring(0, Math.min(30, uriString.length)); } throw new RuntimeException( "Unsupported image type! Uri is: " + uriString); } }
Source:
private PhpCfgBlock buildForStatement(ForStatementTree tree, PhpCfgBlock successor) { ForwardingBlock linkToCondition = createForwardingBlock(); addBreakable(successor, linkToCondition); PhpCfgBlock loopBodyBlock = buildSubFlow(tree.statements(), linkToCondition); removeBreakable(); PhpCfgBranchingBlock conditionBlock = createBranchingBlock(tree, loopBodyBlock, successor); tree.condition().forEach(conditionBlock::addElement); linkToCondition.setSuccessor(conditionBlock); return createSimpleBlock(conditionBlock); }

Target:
private PhpCfgBlock buildForStatement(ForStatementTree tree, PhpCfgBlock successor) { ForwardingBlock linkToCondition = createForwardingBlock(); PhpCfgBlock updateBlock = createSimpleBlock(linkToCondition); Lists.reverse(tree.update()).forEach(updateBlock::addElement); addBreakable(successor, updateBlock); PhpCfgBlock loopBodyBlock = buildSubFlow(tree.statements(), updateBlock); removeBreakable(); PhpCfgBranchingBlock conditionBlock = createBranchingBlock(tree, loopBodyBlock, successor); Lists.reverse(tree.condition()).forEach(conditionBlock::addElement); linkToCondition.setSuccessor(conditionBlock); PhpCfgBlock beforeFor = createSimpleBlock(conditionBlock); Lists.reverse(tree.init()).forEach(beforeFor::addElement); return beforeFor; }
Source:
private void generateNewUserInsights(final Long accountId, final Long deviceId, final int accountAge) { final Set<InsightCard.Category> recentCategories = this.getRecentInsightsCategories(accountId); InsightCard.Category categoryToGenerate; switch (accountAge) { case 1: categoryToGenerate = InsightCard.Category.LIGHT; break; case 2: categoryToGenerate = InsightCard.Category.TEMPERATURE; break; case 3: categoryToGenerate = InsightCard.Category.SOUND; break; case 4: categoryToGenerate = InsightCard.Category.SLEEP_QUALITY; break; default: return; } if (!recentCategories.contains(categoryToGenerate)) { generateInsightsByCategory(accountId, deviceId, categoryToGenerate); } LOGGER.debug("Generating NEW user insight for account id {}", accountId); generateInsightsByCategory(accountId, deviceId, categoryToGenerate); }

Target:
private void generateNewUserInsights(final Long accountId, final Long deviceId, final int accountAge) { final Set<InsightCard.Category> recentCategories = this.getRecentInsightsCategories(accountId); InsightCard.Category categoryToGenerate; switch (accountAge) { case 1: categoryToGenerate = InsightCard.Category.LIGHT; break; case 2: categoryToGenerate = InsightCard.Category.TEMPERATURE; break; case 3: categoryToGenerate = InsightCard.Category.SOUND; break; case 4: categoryToGenerate = InsightCard.Category.SLEEP_QUALITY; break; default: return; } if (!recentCategories.contains(categoryToGenerate)) { LOGGER.debug("Generating NEW user category insight for account id {}", categoryToGenerate, accountId); generateInsightsByCategory(accountId, deviceId, categoryToGenerate); } }
Source:
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { Command finalCommand = null; RecordingCommand recordingCommand = sortFiltersIfNeeded(notifications); Command cmd = new FilteredElementsUpdateCommand(domain, dDiagram); if (recordingCommand != null) { CompoundCommand compoundCommand = new CompoundCommand(); compoundCommand.append(cmd); compoundCommand.append(recordingCommand); finalCommand = compoundCommand; } else { finalCommand = cmd; } return Options.newSome(finalCommand); }

Target:
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { Command finalCommand = null; RecordingCommand sortFiltersCommand = sortFiltersIfNeeded(notifications); Command updateFilterApplicationCmd = new FilteredElementsUpdateCommand(domain, dDiagram); if (sortFiltersCommand != null) { CompoundCommand compoundCommand = new CompoundCommand(); compoundCommand.append(sortFiltersCommand); compoundCommand.append(updateFilterApplicationCmd); finalCommand = compoundCommand; } else { finalCommand = updateFilterApplicationCmd; } return Options.newSome(finalCommand); }