auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Future<String> putBlob(BlobProperties blobProperties, byte[] usermetadata, ReadableStreamChannel channel, Callback<String> callback) { FutureResult<String> futureResult = new FutureResult<String>(); if (isRunning.get()) { <START> getOperationController().putBlob(blobProperties, usermetadata, channel, futureResult, null); <END> } else { completeOperation(futureResult, null, callback, new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed)); } return futureResult; }</code><technical_language>callback is null</technical_language>

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:
<code>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); <START> try (CloseableHttpResponse response = httpHelper.getConnectionContext().getHttpClient().execute(put, context)) { <END> 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()); } }</code><technical_language>Potentially break context client out a separate variable</technical_language>

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:
<code>public static GroupingSetDescriptor globalAggregation() { <START> return singleGroupingSet(unmodifiableList(new ArrayList<>())); <END> }</code><technical_language>emptyList</technical_language>

Target:
public static GroupingSetDescriptor globalAggregation() { return singleGroupingSet(unmodifiableList(emptyList())); }
Source:
<code>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"); <START> } <END> Map<String, String> dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId); return getcomputeOffering(offering, dynamicOffering); } return offering; }</code><technical_language>Move top of method consider com.google.common.base.Preconditions#checkArgument check argument</technical_language>

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:
<code>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()); <START> } <END> 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"); } } } }</code><technical_language>If description is null, title missing. want another else clause of if (ftStyle.getDescription() != null)</technical_language>

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:
<code>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 + "]"); } <START> if (!feedbacksession.getCreatorEmail().equals(instructor.email)) { <END> 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 + "]"); } }</code><technical_language>fact creatorOnly is false means if block is used; removed entirely. Similarly for others</technical_language>

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:
<code>public static void cancelQueuedPostUpload(PostModel post) { synchronized (mPostsList) { <START> Iterator<PostModel> iterator = mPostsList.iterator(); <END> while (iterator.hasNext()) { PostModel postModel = iterator.next(); if (postModel.getId() == post.getId()) { iterator.remove(); } } } }</code><technical_language>rename mPostsList mQueuedPostsList this PR a clearer distinction currently uploaded opposed in a _queue_ upload</technical_language>

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:
<code>public Promise<List<ProjectConfigDto>> createBatchProjects( List<NewProjectConfigDto> configurations) { String url = getBaseUrl() + BATCH_PROJECTS; if (url.contains("?")) { url += "&clientId=" + appContext.getApplicationId().orElse(""); } else { <START> <END> 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)); }</code><technical_language>parts of if same</technical_language>

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:
<code>public void addInstancesToElb(String name, List<Instance> instances){ if(instances.isEmpty()){ log.info("No instances to add to load balance "+name); return; } <START> Collection ids = new ArrayList(); <END> 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); }</code><technical_language>add a type parameter of type of object putting in ids list</technical_language>

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:
<code>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) { <START> assertTrue(actionRequestList.contains(ar)); <END> } }</code><technical_language>order is allright, if available</technical_language>

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:
<code>void updateTaskStatus(TaskStatus newValue) { AtomicBoolean taskMismatch = new AtomicBoolean(); taskStatus.setIf(newValue, oldValue -> { <START> boolean isOldValueEmpty = oldValue.getTaskInstanceIdLsb() == 0 && oldValue.getTaskInstanceIdMsb() == 0; <END> 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())))); } }</code><technical_language>move this logic new TaskInstanceId</technical_language>

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:
<code>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])); <START> } <END> return null; }</code><technical_language>a reason choose 0 more dynamic size()</technical_language>

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:
<code>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()); <START> for (final Map.Entry<Integer, Pair<K, K>> blockToSubKeyRange : blockToSubKeyRangeMap.entrySet()) { <END> 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; }</code><technical_language>a personal taste, stream simpler follows: 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<>()); final List<Pair<K, K>> subKeyRangeList = blockToSubKeyRangesMap.get(blockId); subKeyRangeList.add(subKeyRange); } ); });</technical_language>

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:
<code><START> protected Map<String, Pair<String, String>> getSharedLocks() { <END> 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; }</code><technical_language>thought is if call super.getSharedLocks() needed, in case add shared locks run vm, starting this mechanism more more</technical_language>

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:
<code>public void testListKeys() { List<SshKey> keys = api.getKeyPairApi().list(); <START> assertTrue(keys.size() > 0, "SSH key list should not be empty"); <END> }</code><technical_language>!keys.isEmpty()</technical_language>

Target:
public void testListKeys() { List<SshKey> keys = api.getKeyPairApi().list(); assertFalse(keys.isEmpty(), "SSH key list should not be empty"); }
Source:
<code>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(); <START> throw new RuntimeException(e); <END> } catch (Throwable e) { if (rootCause != e) { rootCause.addSuppressed(e); } } } return rootCause; }</code><technical_language>here, need close everything, do special need return passed in cause. methods intended for in testing (hence in "testing" module), I ok</technical_language>

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:
<code>public int hashCode() { int hash = 7; hash = 31 * hash + (this.value != null ? this.value.hashCode() : 0); return hash; <START> } <END></code><technical_language>return Object? do need this class</technical_language>

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:
<code>private void configureDiskUsageService() { isDiskUsageServiceEnabled = config.getDiskUsageServiceEnabled(); NamespaceInterface namespace = NamespaceDirector.getNamespace(); <START> List<VirtualFSInterface> toExclude = namespace.getVFSWithQuotaEnabled(); <END> List<VirtualFSInterface> sas = namespace.getAllDefinedVFS() .stream() .filter(vfs -> !toExclude.contains(vfs)) .collect(Collectors.toList()); duService = new DiskUsageService(sas); }</code><technical_language>toExclude -> quotaEnabledVfs</technical_language>

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:
<code>protected void notAllowed( HttpServerExchange exchange ) { exchange.setStatusCode( StatusCodes.METHOD_NOT_ALLOWED ); <START> exchange.getResponseHeaders().add( Headers.ALLOW, String.join( ", ", Methods.GET_STRING, Methods.HEAD_STRING, Methods.POST_STRING ) ); <END> }</code><technical_language>allowed methods hard coded</technical_language>

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:
<code>public void TestNoAdsForUsers_US(String page) throws Exception { <START> SpecialUserLoginPageObject userLogin = new SpecialUserLoginPageObject(driver); <END> userLogin.loginAndVerify(Properties.userName, Properties.password); AdsBaseObject wikiPage = new AdsBaseObject(driver, page); wikiPage.verifyNoAdsOnWikiPage(); }</code><technical_language>deduplicate</technical_language>

Target:
public void TestNoAdsForUsers_US(String page) throws Exception { loginSteps(); AdsBaseObject wikiPage = new AdsBaseObject(driver, page); wikiPage.verifyNoAdsOnWikiPage(); }
Source:
<code>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 { <START> String uriString = uri.toString(); <END> if (!TextUtils.isEmpty(uriString) && uriString.length() > 30) { uriString = uriStirng.substring(0, 30); } throw new RuntimeException( "Unsupported image type! Uri is: " + uriString); } }</code><technical_language>Thanks for sending this! I do this more simply java uriString.substring(0, Math.min(30, uriString.length)); code a typo</technical_language>

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:
<code>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); <START> return createSimpleBlock(conditionBlock); <END> }</code><technical_language>adding init expressions this block</technical_language>

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:
<code>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); } <START> LOGGER.debug("Generating NEW user insight for account id {}", accountId); <END> generateInsightsByCategory(accountId, deviceId, categoryToGenerate); }</code><technical_language>Is this expected here</technical_language>

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:
<code>public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { Command finalCommand = null; RecordingCommand <START> recordingCommand = <END> 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); }</code><technical_language>please rename variables: sortFilterCmd updateFilterApplicationCmd</technical_language>

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); }
Source:
<code>private void flushTransactions() { while(true) { if (canFlush()) { syncToDB = true; setReadyBuffer(); final BatchOperation batchOperation = omMetadataManager.getStore() .initBatchOperation(); <START> readyBuffer.iterator().forEachRemaining((entry) -> { <END> try { entry.getResponse().addToRocksDBBatch(omMetadataManager, batchOperation); } catch (IOException ex) { String message = "During flush to DB encountered error " + ex.getMessage(); ExitUtil.terminate(1, message); } }); try { omMetadataManager.getStore().commitBatchOperation(batchOperation); } catch (IOException ex) { String message = "During flush to DB encountered error " + ex.getMessage(); ExitUtil.terminate(1, message); } int flushedTransactionsSize = readyBuffer.size(); flushedTransactionCount.addAndGet(flushedTransactionsSize); flushIterations.incrementAndGet(); LOG.info("Sync Iteration flushed transactions in this iteration{}", flushIterations.get(), flushedTransactionsSize); readyBuffer.clear(); syncToDB = false; } } }</code><technical_language>I prefer separate daemon thread OM double buffer, this class more flexible use</technical_language>

Target:
private void flushTransactions() { while(isRunning) { try { if (canFlush()) { setReadyBuffer(); final BatchOperation batchOperation = omMetadataManager.getStore() .initBatchOperation(); readyBuffer.iterator().forEachRemaining((entry) -> { try { entry.getResponse().addToDBBatch(omMetadataManager, batchOperation); } catch (IOException ex) { terminate(ex); } }); omMetadataManager.getStore().commitBatchOperation(batchOperation); int flushedTransactionsSize = readyBuffer.size(); flushedTransactionCount.addAndGet(flushedTransactionsSize); flushIterations.incrementAndGet(); LOG.debug("Sync Iteration flushed transactions in this " + "iteration{}", flushIterations.get(), flushedTransactionsSize); readyBuffer.clear(); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); if (isRunning) { final String message = "OMDoubleBuffer flush thread " + Thread.currentThread().getName() + " encountered Interrupted " + "exception while running"; ExitUtils.terminate(1, message, ex, LOG); } else { LOG.info("OMDoubleBuffer flush thread " + Thread.currentThread().getName() + " is interrupted and will " + "exit. {}", Thread.currentThread().getName()); } } catch (IOException ex) { terminate(ex); } catch (Throwable t) { final String s = "OMDoubleBuffer flush thread" + Thread.currentThread().getName() + "encountered Throwable error"; ExitUtils.terminate(2, s, t, LOG); } } }
Source:
<code>protected void validateCredentials(final UsernamePasswordCredentials credentials, final OAuthRegisteredService registeredService, final WebContext context) { <START> val clientSecret = context.getRequestParameter(OAuth20Constants.CLIENT_SECRET).map(String::valueOf).orElse(StringUtils.EMPTY); <END> if (!OAuth20Utils.checkClientSecret(registeredService, clientSecret, registeredServiceCipherExecutor)) { throw new CredentialsException("Bad secret for client identifier: " + credentials.getUsername()); } val codeVerifier = credentials.getPassword(); val code = context.getRequestParameter(OAuth20Constants.CODE) .map(String::valueOf).orElse(StringUtils.EMPTY); val token = this.ticketRegistry.getTicket(code, OAuthCode.class); if (token == null || token.isExpired()) { LOGGER.error("Provided code is either not found in the ticket registry or has expired", code); throw new CredentialsException("Invalid token: " + code); } val method = StringUtils.defaultString(token.getCodeChallengeMethod(), "plain"); val hash = calculateCodeVerifierHash(method, codeVerifier); if (!hash.equalsIgnoreCase(token.getCodeChallenge())) { LOGGER.error("Code verifier does not match the challenge [{}]", hash, token.getCodeChallenge()); throw new CredentialsException("Code verification does not match the challenge assigned to: " + token.getId()); } LOGGER.debug("Validated code verifier using verification method [{}]", method); }</code><technical_language>Break multiple lines starting .map .orElse</technical_language>

Target:
protected void validateCredentials(final UsernamePasswordCredentials credentials, final OAuthRegisteredService registeredService, final WebContext context) { val clientSecret = context.getRequestParameter(OAuth20Constants.CLIENT_SECRET) .map(String::valueOf) .orElse(StringUtils.EMPTY); if (!OAuth20Utils.checkClientSecret(registeredService, clientSecret, getRegisteredServiceCipherExecutor())) { throw new CredentialsException("Client Credentials provided is not valid for registered service: " + registeredService.getName()); } val codeVerifier = credentials.getPassword(); val code = context.getRequestParameter(OAuth20Constants.CODE) .map(String::valueOf).orElse(StringUtils.EMPTY); val token = getTicketRegistry().getTicket(code, OAuthCode.class); if (token == null || token.isExpired()) { LOGGER.error("Provided code is either not found in the ticket registry or has expired", code); throw new CredentialsException("Invalid token: " + code); } val method = StringUtils.defaultString(token.getCodeChallengeMethod(), "plain"); val hash = calculateCodeVerifierHash(method, codeVerifier); if (!hash.equalsIgnoreCase(token.getCodeChallenge())) { LOGGER.error("Code verifier does not match the challenge [{}]", hash, token.getCodeChallenge()); throw new CredentialsException("Code verification does not match the challenge assigned to: " + token.getId()); } LOGGER.debug("Validated code verifier using verification method [{}]", method); }
Source:
<code>private boolean isValidAfterCondition(IInvokedMethod method) { if (method.isTestMethod()) { return true; } <START> return method.getTestMethod().isAfterClassConfiguration(); <END> }</code><technical_language>java return method.isTestMethod() || method.getTestMethod().isAfterClassConfiguration();</technical_language>

Target:
private boolean isValidAfterCondition(IInvokedMethod method) { return method.isTestMethod() || method.getTestMethod().isAfterClassConfiguration(); }
Source:
<code>public static AssertionError argumentsAreDifferent(String wanted, List<String> actualCalls, List<Location> actualLocations) { if (actualCalls == null || actualLocations == null || actualCalls.size() != actualLocations.size()) { throw new IllegalArgumentException("actualCalls and actualLocations list must match"); } StringBuilder actualBuilder = new StringBuilder(); StringBuilder messageBuilder = new StringBuilder(); messageBuilder.append("\n"); messageBuilder.append("Argument(s) are different! Wanted:\n"); messageBuilder.append(wanted); messageBuilder.append("\n"); messageBuilder.append(new LocationImpl()); messageBuilder.append("\n"); <START> messageBuilder.append("Actual invocations have different arguments:\n"); <END> for (int i = 0; i < actualCalls.size(); i++) { actualBuilder.append(actualCalls.get(i)); messageBuilder.append(actualCalls.get(i)); messageBuilder.append("\n"); messageBuilder.append(actualLocations.get(i)); messageBuilder.append("\n"); } return ExceptionFactory.createArgumentsAreDifferentException(messageBuilder.toString(), wanted, actualBuilder.toString()); }</code><technical_language>fluent api of builder possible, in other words method chaining</technical_language>

Target:
public static AssertionError argumentsAreDifferent(String wanted, List<String> actualCalls, List<Location> actualLocations) { if (actualCalls == null || actualLocations == null || actualCalls.size() != actualLocations.size()) { throw new IllegalArgumentException("actualCalls and actualLocations list must match"); } StringBuilder actualBuilder = new StringBuilder(); StringBuilder messageBuilder = new StringBuilder(); messageBuilder.append("\n") .append("Argument(s) are different! Wanted:\n") .append(wanted) .append("\n") .append(new LocationImpl()) .append("\n") .append("Actual invocations have different arguments:\n"); for (int i = 0; i < actualCalls.size(); i++) { actualBuilder.append(actualCalls.get(i)) .append("\n"); messageBuilder.append(actualCalls.get(i)) .append("\n") .append(actualLocations.get(i)) .append("\n"); } return ExceptionFactory.createArgumentsAreDifferentException(messageBuilder.toString(), wanted, actualBuilder.toString()); }
Source:
<code>public static List<CPListElement> removeFilters(IPath path, IJavaProject project, List<CPListElement> existingEntries) { if (path == null) return Collections.emptyList(); IPath projPath= project.getPath(); if (projPath.isPrefixOf(path)) { path= path.removeFirstSegments(projPath.segmentCount()).addTrailingSeparator(); } List<CPListElement> result= new ArrayList<>(); for (CPListElement element : existingEntries) { boolean hasChange= false; IPath[] exlusions= (IPath[])element.getAttribute(CPListElement.EXCLUSION); if (exlusions != null) { List<IPath> exlusionList= new ArrayList<>(exlusions.length); for (IPath exlusion : exlusions) { if (!exlusion.equals(path)) { exlusionList.add(exlusion); } else { hasChange= true; } } element.setAttribute(CPListElement.EXCLUSION, exlusionList.toArray(new IPath[exlusionList.size()])); } IPath[] inclusion= (IPath[])element.getAttribute(CPListElement.INCLUSION); if (inclusion != null) { List<IPath> inclusionList= new ArrayList<>(inclusion.length); <START> for (IPath i : inclusion) { <END> if (!i.equals(path)) { inclusionList.add(i); } else { hasChange= true; } } element.setAttribute(CPListElement.INCLUSION, inclusionList.toArray(new IPath[inclusionList.size()])); } if (hasChange) { result.add(element); } } return result; }</code><technical_language>please 'i' for a path. inclusion (rename existing local var inclusion inclusions) includedPath</technical_language>

Target:
public static List<CPListElement> removeFilters(IPath path, IJavaProject project, List<CPListElement> existingEntries) { if (path == null) return Collections.emptyList(); IPath projPath= project.getPath(); if (projPath.isPrefixOf(path)) { path= path.removeFirstSegments(projPath.segmentCount()).addTrailingSeparator(); } List<CPListElement> result= new ArrayList<>(); for (CPListElement element : existingEntries) { boolean hasChange= false; IPath[] exlusions= (IPath[])element.getAttribute(CPListElement.EXCLUSION); if (exlusions != null) { List<IPath> exlusionList= new ArrayList<>(exlusions.length); for (IPath exlusion : exlusions) { if (!exlusion.equals(path)) { exlusionList.add(exlusion); } else { hasChange= true; } } element.setAttribute(CPListElement.EXCLUSION, exlusionList.toArray(new IPath[exlusionList.size()])); } IPath[] inclusions= (IPath[])element.getAttribute(CPListElement.INCLUSION); if (inclusions != null) { List<IPath> inclusionList= new ArrayList<>(inclusions.length); for (IPath inclusion : inclusions) { if (!inclusion.equals(path)) { inclusionList.add(inclusion); } else { hasChange= true; } } element.setAttribute(CPListElement.INCLUSION, inclusionList.toArray(new IPath[inclusionList.size()])); } if (hasChange) { result.add(element); } } return result; }
Source:
<code>protected String getEndpointId(Endpoint ep) { String answer = doGetEndpointId(ep); boolean sanitize = camelContext != null && camelContext.getManagementStrategy().getManagementAgent().getMask(); <START> if (sanitize != null && sanitize) { <END> answer = URISupport.sanitizeUri(answer); } return answer; }</code><technical_language>primitive boolean compared null</technical_language>

Target:
protected String getEndpointId(Endpoint ep) { String answer = doGetEndpointId(ep); boolean sanitize = camelContext != null && camelContext.getManagementStrategy().getManagementAgent().getMask(); if (sanitize) { answer = URISupport.sanitizeUri(answer); } return answer; }
Source:
<code>public RxSessionImpl(Session session) { this.session = session; <START> maximumInflightRequests = Math.min( <END> session.getCluster().getConfiguration().getPoolingOptions().getMaxRequestsPerConnection(HostDistance.LOCAL), session.getCluster().getConfiguration().getPoolingOptions().getMaxRequestsPerConnection(HostDistance.REMOTE) ); }</code><technical_language>max number of inflight requests is num_hosts * max_connections_per_host * max_requests_per_connection</technical_language>

Target:
public RxSessionImpl(Session session) { this.session = session; this.loadBalancingPolicy = session.getCluster().getConfiguration().getPolicies().getLoadBalancingPolicy(); PoolingOptions poolingOptions = session.getCluster().getConfiguration().getPoolingOptions(); maxInFlightLocal = poolingOptions.getCoreConnectionsPerHost(HostDistance.LOCAL) * poolingOptions.getMaxRequestsPerConnection(HostDistance.LOCAL); maxInFlightRemote = poolingOptions.getCoreConnectionsPerHost(HostDistance.REMOTE) * poolingOptions.getMaxRequestsPerConnection(HostDistance.REMOTE); }
Source:
<code>public List<Cue> getCues(long timeUs, Map<String, TtmlStyle> globalStyles, Map<String, TtmlRegion> regionMap, Map<String, String> imageMap) { TreeMap<String, SpannableStringBuilder> regionOutputs = new TreeMap<>(); <START> List<Pair<String, String>> regionImageList = new ArrayList<>(); <END> traverseForText(timeUs, false, regionId, regionOutputs); traverseForStyle(timeUs, globalStyles, regionOutputs); traverseForImage(timeUs, regionId, regionImageList); List<Cue> cues = new ArrayList<>(); for (Pair<String, String> regionImagePair : regionImageList) { String base64 = imageMap.get(regionImagePair.second); byte[] decodedString = Base64.decode(base64, Base64.DEFAULT); Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); TtmlRegion region = regionMap.get(regionImagePair.first); cues.add( new Cue(decodedByte, region.position, Cue.ANCHOR_TYPE_MIDDLE, region.line, region.lineAnchor, region.width, Cue.DIMEN_UNSET ) ); } for (Entry<String, SpannableStringBuilder> entry : regionOutputs.entrySet()) { TtmlRegion region = regionMap.get(entry.getKey()); cues.add( new Cue( cleanUpText(entry.getValue()), null, region.line, region.lineType, region.lineAnchor, region.position, Cue.TYPE_UNSET, region.width, region.textSizeType, region.textSize)); } return cues; }</code><technical_language>clearer call regionTextOutputs regionImageOutputs something, clearer is image equivalent of other</technical_language>

Target:
public List<Cue> getCues(long timeUs, Map<String, TtmlStyle> globalStyles, Map<String, TtmlRegion> regionMap, Map<String, String> imageMap) { TreeMap<String, SpannableStringBuilder> regionTextOutputs = new TreeMap<>(); List<Pair<String, String>> regionImageOutputs = new ArrayList<>(); traverseForText(timeUs, false, regionId, regionTextOutputs); traverseForStyle(timeUs, globalStyles, regionTextOutputs); traverseForImage(timeUs, regionId, regionImageOutputs); List<Cue> cues = new ArrayList<>(); for (Pair<String, String> regionImagePair : regionImageOutputs) { String base64 = imageMap.get(regionImagePair.second); if (base64 == null) { continue; } byte[] decodedString = Base64.decode(base64, Base64.DEFAULT); Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); TtmlRegion region = regionMap.get(regionImagePair.first); cues.add( new Cue(decodedByte, region.position, Cue.ANCHOR_TYPE_MIDDLE, region.line, region.lineAnchor, region.width, Cue.DIMEN_UNSET ) ); } for (Entry<String, SpannableStringBuilder> entry : regionTextOutputs.entrySet()) { TtmlRegion region = regionMap.get(entry.getKey()); cues.add( new Cue( cleanUpText(entry.getValue()), null, region.line, region.lineType, region.lineAnchor, region.position, Cue.TYPE_UNSET, region.width, region.textSizeType, region.textSize)); } return cues; }