auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String writeBlob(BlobWriteContext blobWriteContext) throws IOException { BlobContext blobContext = blobWriteContext.blobContext; Blob blob = blobContext.blob; String copiedKey = copyBlob(blob); if (copiedKey != null) { return copiedKey; } Path file; String fileTraceSource; Path tmp = null; try { if (blobWriteContext.file != null) { file = blobWriteContext.file; fileTraceSource = "Nuxeo"; } else { File blobFile = blob.getFile(); if (blobFile != null) { if (blobWriteContext.writeObserver != null) { transfer(blobWriteContext, NULL_OUTPUT_STREAM); } file = blobFile.toPath(); fileTraceSource = "Nuxeo"; } else { tmp = Files.createTempFile("bin_", ".tmp"); logTrace(null, "->", "tmp", "write"); logTrace("hnote right: " + tmp.getFileName()); transfer(blobWriteContext, tmp); file = tmp; fileTraceSource = "tmp"; } } <START> String key = blobWriteContext.getKey(); if (key == null) { throw new NuxeoException("Missing key"); } else if (key.indexOf(VER_SEP) >= 0) { throw new NuxeoException( "Invalid key '" + key + "', it contains the version separator '" + VER_SEP + "'"); } String versionId = writeFile(key, file, blobContext, fileTraceSource); return versionId == null ? key : key + VER_SEP + versionId; } finally { <END> if (tmp != null) { try { logTrace("tmp", "-->", "tmp", "delete"); logTrace("hnote right: " + tmp.getFileName()); Files.delete(tmp); } catch (IOException e) { log.warn(e, e); } } } }</code><technical_language>want test throw exception beginning transferring anything</technical_language>

Target:
public String writeBlob(BlobWriteContext blobWriteContext) throws IOException { BlobContext blobContext = blobWriteContext.blobContext; Blob blob = blobContext.blob; String copiedKey = copyBlob(blob); if (copiedKey != null) { return copiedKey; } Path file; String fileTraceSource; Path tmp = null; try { Path blobWriteContextFile = blobWriteContext.getFile(); if (blobWriteContextFile != null) { file = blobWriteContextFile; fileTraceSource = "Nuxeo"; } else { File blobFile = blob.getFile(); if (blobFile != null) { if (blobWriteContext.writeObserver != null) { transfer(blobWriteContext, NULL_OUTPUT_STREAM); } file = blobFile.toPath(); fileTraceSource = "Nuxeo"; } else { tmp = Files.createTempFile("bin_", ".tmp"); logTrace(null, "->", "tmp", "write"); logTrace("hnote right: " + tmp.getFileName()); transfer(blobWriteContext, tmp); file = tmp; fileTraceSource = "tmp"; } } String key = blobWriteContext.getKey(); if (key == null) { throw new NuxeoException("Missing key"); } else if (key.indexOf(VER_SEP) >= 0) { throw new NuxeoException( "Invalid key '" + key + "', it contains the version separator '" + VER_SEP + "'"); } String versionId = writeFile(key, file, blobContext, fileTraceSource); return versionId == null ? key : key + VER_SEP + versionId; } finally { if (tmp != null) { try { logTrace("tmp", "-->", "tmp", "delete"); logTrace("hnote right: " + tmp.getFileName()); Files.delete(tmp); } catch (IOException e) { log.warn(e, e); } } } }
Source:
<code>private Pair<String, String> parseSourceHeader(String copyHeader) throws OS3Exception { String header = copyHeader; if (header.startsWith("/")) { header = copyHeader.substring(1); } int pos = header.indexOf("/"); if (pos == -1) { OS3Exception ex = S3ErrorTable.newError(S3ErrorTable .INVALID_ARGUMENT, header); ex.setErrorMessage("Copy Source must mention the source bucket and " + "key: sourcebucket/sourcekey"); throw ex; } <START> return Pair.of(copyHeader.substring(0, pos), copyHeader.substring(pos + 1)); <END> }</code><technical_language>I this header instead of copyHeader Pair.of(header.substring(0, pos), header.substring(pos + 1))? I a single variable for clarity</technical_language>

Target:
public static Pair<String, String> parseSourceHeader(String copyHeader) throws OS3Exception { String header = copyHeader; if (header.startsWith("/")) { header = copyHeader.substring(1); } int pos = header.indexOf("/"); if (pos == -1) { OS3Exception ex = S3ErrorTable.newError(S3ErrorTable .INVALID_ARGUMENT, header); ex.setErrorMessage("Copy Source must mention the source bucket and " + "key: sourcebucket/sourcekey"); throw ex; } return Pair.of(header.substring(0, pos), header.substring(pos + 1)); }
Source:
<code>protected void executeCommand() { if (maxServerFound() && StringUtils.isEmpty(getCluster().getCpuName())) { updateClusterCpuName(getMaxServerCpu().getCpuName(), getMaxServerCpu().getArchitecture()); } if <START> (!architecturesMatch() ) <END> { addCustomValue("VdsArchitecture", getMaxServerCpu().getArchitecture().name()); addCustomValue("ClusterArchitecture", getCluster().getArchitecture().name()); SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { List<String> missingFlags = getCpuFlagsManagerHandler().missingServerCpuFlags( getCluster().getCpuName(), getVds().getCpuFlags(), getCluster().getCompatibilityVersion()); if (!cpuFlagsMatch(missingFlags)) { if (missingFlags != null) { addCustomValue("CpuFlags", StringUtils.join(missingFlags, ", ")); if (missingFlags.contains("nx")) { auditLogDirector.log(this, AuditLogType.CPU_FLAGS_NX_IS_MISSING); } } SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { setCommandShouldBeLogged(false); } } setSucceeded(true); }</code><technical_language>If maxServerCpu is found, execution follow a branch this change. Is intentional</technical_language>

Target:
protected void executeCommand() { if (maxServerFound() && StringUtils.isEmpty(getCluster().getCpuName())) { updateClusterCpuName(getMaxServerCpu().getCpuName(), getMaxServerCpu().getArchitecture()); } if (maxServerFound() && !architecturesMatch() ) { addCustomValue("VdsArchitecture", getMaxServerCpu().getArchitecture().name()); addCustomValue("ClusterArchitecture", getCluster().getArchitecture().name()); SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { List<String> missingFlags = getCpuFlagsManagerHandler().missingServerCpuFlags( getCluster().getCpuName(), getVds().getCpuFlags(), getCluster().getCompatibilityVersion()); if (!cpuFlagsMatch(missingFlags)) { if (missingFlags != null) { addCustomValue("CpuFlags", StringUtils.join(missingFlags, ", ")); if (missingFlags.contains("nx")) { auditLogDirector.log(this, AuditLogType.CPU_FLAGS_NX_IS_MISSING); } } SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { setCommandShouldBeLogged(false); } } setSucceeded(true); }
Source:
<code>public ValidationResult checkCodeStyle(Path path, Locale messageLocale) { <START> return null; <END> }</code><technical_language>I a good idea return null this. Consider returning: java return new ValidationResult() { @Override public Strategy getStrategy() { return Strategy.DISABLED; } @Override public Map<File, List<ValidationError>> getValidationErrors() { return Maps.newHashMap(); } }; instead :camel:</technical_language>

Target:
public ValidationResult checkCodeStyle(Path path, Locale messageLocale) { return new ValidationResult() { @Override public Strategy getStrategy() { return Strategy.DISABLED; } @Override public Map<File, List<ValidationError>> getValidationErrors() { return Maps.newHashMap(); } }; }
Source:
<code>public PerspectiveDefinition buildPerspective() { PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName()); final PlaceRequest place = new DefaultPlaceRequest(RouterScreen.ID); PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place); perspective.getRoot().addPart(dashboardScreen); <START> perspective.setName("Router"); <END> return perspective; }</code><technical_language>Consider i18n "Router"</technical_language>

Target:
public PerspectiveDefinition buildPerspective() { PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName()); final PlaceRequest place = new DefaultPlaceRequest(RouterScreen.ID); PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place); perspective.getRoot().addPart(dashboardScreen); perspective.setName(i18n.routerPerspective()); return perspective; }
Source:
<code>private List<ConfigurableServiceDTO> getServicesByFilter(String filter) { List<ConfigurableServiceDTO> services = new ArrayList<>(); ServiceReference<?>[] serviceReferences = null; try { serviceReferences = RESTCoreActivator.getBundleContext().getServiceReferences((String) null, filter); } catch (InvalidSyntaxException ex) { <START> logger.error("Cannot get service references, because syntax is invalid: {}", ex.getMessage(), ex); <END> } if (serviceReferences != null) { for (ServiceReference<?> serviceReference : serviceReferences) { String id = getServiceId(serviceReference); String label = (String) serviceReference.getProperty(ConfigurableService.SERVICE_PROPERTY_LABEL); if (label == null) { label = configurationService.getProperty(id, ConfigConstants.SERVICE_CONTEXT); } String category = (String) serviceReference.getProperty(ConfigurableService.SERVICE_PROPERTY_CATEGORY); String configDescriptionURI = (String) serviceReference .getProperty(ConfigurableService.SERVICE_PROPERTY_DESCRIPTION_URI); services.add(new ConfigurableServiceDTO(id, label, category, configDescriptionURI, false)); } } return services; }</code><technical_language>drop comma</technical_language>

Target:
private List<ConfigurableServiceDTO> getServicesByFilter(String filter) { List<ConfigurableServiceDTO> services = new ArrayList<>(); ServiceReference<?>[] serviceReferences = null; try { serviceReferences = RESTCoreActivator.getBundleContext().getServiceReferences((String) null, filter); } catch (InvalidSyntaxException ex) { logger.error("Cannot get service references because the syntax of the filter '{}' is invalid.", filter); } if (serviceReferences != null) { for (ServiceReference<?> serviceReference : serviceReferences) { String id = getServiceId(serviceReference); String label = (String) serviceReference.getProperty(ConfigurableService.SERVICE_PROPERTY_LABEL); if (label == null) { label = configurationService.getProperty(id, ConfigConstants.SERVICE_CONTEXT); } String category = (String) serviceReference.getProperty(ConfigurableService.SERVICE_PROPERTY_CATEGORY); String configDescriptionURI = (String) serviceReference .getProperty(ConfigurableService.SERVICE_PROPERTY_DESCRIPTION_URI); if (configDescriptionURI == null) { String factoryPid = (String) serviceReference.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID); configDescriptionURI = getConfigDescriptionByFactoryPid(factoryPid); } boolean multiple = Boolean.parseBoolean( (String) serviceReference.getProperty(ConfigurableService.SERVICE_PROPERTY_FACTORY_SERVICE)); services.add(new ConfigurableServiceDTO(id, label, category, configDescriptionURI, multiple)); } } return services; }
Source:
<code>public AppPage verifyTitle(String expectedTitle) { assertEquals(expectedTitle, browser.driver.getTitle()); <START> return this; <END> }</code><technical_language>need return this;. sense for verification method a return value. P.S I others have, itching fix :p</technical_language>

Target:
public void verifyTitle(String expectedTitle) { assertEquals(expectedTitle, browser.driver.getTitle()); }
Source:
<code>public void testDecommissionAndStopRegionServers() throws Exception { List<ServerName> decommissionedRegionServers = ADMIN.listDecommissionedRegionServers(); assertTrue(decommissionedRegionServers.isEmpty()); ArrayList<ServerName> clusterRegionServers = new ArrayList<>(ADMIN.getClusterMetrics(EnumSet.of(ClusterMetrics.Option.LIVE_SERVERS)) .getLiveServerMetrics().keySet()); List<ServerName> serversToDecommission = new ArrayList<ServerName>(); serversToDecommission.add(clusterRegionServers.get(0)); ADMIN.decommissionRegionServers(serversToDecommission, true); assertEquals(1, ADMIN.listDecommissionedRegionServers().size()); ServerName serverName = serversToDecommission.get(0); ADMIN.stopRegionServer(serverName.getHostname()+":"+serverName.getPort()); assertNotEquals("RS not removed from decommissioned list", -1, <START> TEST_UTIL.waitFor(1000, ADMIN.listDecommissionedRegionServers().isEmpty())); <END> }</code><technical_language>build is failing: [ERROR] /home/jenkins/jenkins-slave/workspace/Base-PreCommit-GitHub-PR_PR-1841@2/yetus-jdk11-hadoop3-check/src/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin4.java:[63,16] suitable method for waitFor(int,boolean) Oh, lambda expression is missing: assertNotEquals("RS removed decommissioned list", -1, TEST_UTIL.waitFor(1000, () -> ADMIN.listDecommissionedRegionServers().isEmpty()));</technical_language>

Target:
public void testDecommissionAndStopRegionServers() throws Exception { List<ServerName> decommissionedRegionServers = ADMIN.listDecommissionedRegionServers(); assertTrue(decommissionedRegionServers.isEmpty()); ArrayList<ServerName> clusterRegionServers = new ArrayList<>(ADMIN.getRegionServers(true)); List<ServerName> serversToDecommission = new ArrayList<ServerName>(); serversToDecommission.add(clusterRegionServers.get(0)); ADMIN.decommissionRegionServers(serversToDecommission, true); assertEquals(1, ADMIN.listDecommissionedRegionServers().size()); ServerName serverName = serversToDecommission.get(0); ADMIN.stopRegionServer(serverName.getHostname()+":"+serverName.getPort()); assertNotEquals("RS not removed from decommissioned list", -1, TEST_UTIL.waitFor(10000, () -> ADMIN.listDecommissionedRegionServers().isEmpty())); ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); assertEquals(-1, ZKUtil.checkExists(zkw, ZNodePaths.joinZNode(zkw.getZNodePaths().drainingZNode, serverName.getServerName()))); }
Source:
<code>protected String doInBackground(Void... arg0) { try { if (!Utils.isNetworkAvailable(context)) { exception = new WebconnectionException(WebconnectionException.ERROR_NETWORK, "Network not available!"); <START> return null; <END> } return ServerCalls.getInstance().fetchTemplatesList(); } catch (WebconnectionException webconnectionException) { Log.e(TAG, Log.getStackTraceString(webconnectionException)); message = webconnectionException.getMessage(); } return null; }</code><technical_language>return null, throw exception, handle outside</technical_language>

Target:
protected String doInBackground(Void... arg0) { if (!Utils.isNetworkAvailable(context)) { networkAvailable = false; return null; } try { return ServerCalls.getInstance().fetchTemplatesList(); } catch (WebconnectionException webconnectionException) { Log.e(TAG, Log.getStackTraceString(webconnectionException)); message = webconnectionException.getMessage(); } return null; }
Source:
<code>public synchronized void start(final DAG<ExecutionVertex, MISTEdge> submittedDag) { setUpOutputEmitters(submittedDag); final Map<String, DAG<ExecutionVertex, MISTEdge>> mergeableDags = findMergeableDags(submittedDag); if (mergeableDags.size() == 0) { for (final ExecutionVertex source : submittedDag.getRootVertices()) { final PhysicalSource src = (PhysicalSource)source; executionDags.put(src.getConfiguration(), submittedDag); src.start(); } return; } final DAG<ExecutionVertex, MISTEdge> sharableDag = selectLargestDag(mergeableDags.values()); for (final DAG<ExecutionVertex, MISTEdge> sd : mergeableDags.values()) { if (sd != sharableDag) { GraphUtils.copy(sd, sharableDag); for (final ExecutionVertex source : sd.getRootVertices()) { executionDags.replace(((PhysicalSource)source).getConfiguration(), sharableDag); } } } final Map<ExecutionVertex, ExecutionVertex> subDagMap = subDagFindAlgorithm.findSubDag(sharableDag, submittedDag); final Set<ExecutionVertex> visited = new HashSet<>(submittedDag.numberOfVertices()); for (final ExecutionVertex source : submittedDag.getRootVertices()) { dfsMerge(subDagMap, visited, source, sharableDag, submittedDag); } for (final ExecutionVertex source : submittedDag.getRootVertices()) { final PhysicalSource src = (PhysicalSource)source; if (!subDagMap.containsKey(src)) { <START> src.start(); <END> } } }</code><technical_language>sources put executionDags</technical_language>

Target:
public synchronized void start(final DAG<ExecutionVertex, MISTEdge> submittedDag) { QueryStarterUtils.setUpOutputEmitters(operatorChainManager, submittedDag); final Map<String, DAG<ExecutionVertex, MISTEdge>> mergeableDags = findMergeableDags(submittedDag); if (mergeableDags.size() == 0) { for (final ExecutionVertex source : submittedDag.getRootVertices()) { final PhysicalSource src = (PhysicalSource)source; executionDags.put(src.getConfiguration(), submittedDag); src.start(); } return; } final DAG<ExecutionVertex, MISTEdge> sharableDag = selectLargestDag(mergeableDags.values()); for (final DAG<ExecutionVertex, MISTEdge> sd : mergeableDags.values()) { if (sd != sharableDag) { GraphUtils.copy(sd, sharableDag); for (final ExecutionVertex source : sd.getRootVertices()) { executionDags.replace(((PhysicalSource)source).getConfiguration(), sharableDag); } } } final Map<ExecutionVertex, ExecutionVertex> subDagMap = commonSubDagFinder.findSubDag(sharableDag, submittedDag); final Set<ExecutionVertex> visited = new HashSet<>(submittedDag.numberOfVertices()); for (final ExecutionVertex source : submittedDag.getRootVertices()) { dfsMerge(subDagMap, visited, source, sharableDag, submittedDag); } for (final ExecutionVertex source : submittedDag.getRootVertices()) { final PhysicalSource src = (PhysicalSource)source; if (!subDagMap.containsKey(src)) { executionDags.put(src.getConfiguration(), sharableDag); src.start(); } } }
Source:
<code>public ComponentTreeWsResponse componentTree(ComponentTreeWsRequest request) { GetRequest getRequest = new GetRequest(path(ACTION_COMPONENT_TREE)) .setParam(DEPRECATED_PARAM_BASE_COMPONENT_ID, request.getBaseComponentId()) .setParam(PARAM_COMPONENT, request.getComponent()) <START> .setParam(PARAM_STRATEGY, request.getStrategy()) <END> .setParam(PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers())) .setParam(PARAM_METRIC_KEYS, inlineMultipleParamValue(request.getMetricKeys())) .setParam(PARAM_ADDITIONAL_FIELDS, inlineMultipleParamValue(request.getAdditionalFields())) .setParam(PARAM_DEVELOPER_ID, request.getDeveloperId()) .setParam(PARAM_DEVELOPER_KEY, request.getDeveloperKey()) .setParam("q", request.getQuery()) .setParam("p", request.getPage()) .setParam("ps", request.getPageSize()) .setParam("s", inlineMultipleParamValue(request.getSort())) .setParam("asc", request.getAsc()) .setParam(PARAM_METRIC_SORT, request.getMetricSort()) .setParam(PARAM_METRIC_SORT_FILTER, request.getMetricSortFilter()); return call(getRequest, ComponentTreeWsResponse.parser()); }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove this of "getBaseComponentId"; is deprecated. [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public ComponentTreeWsResponse componentTree(ComponentTreeWsRequest request) { GetRequest getRequest = new GetRequest(path(ACTION_COMPONENT_TREE)) .setParam(DEPRECATED_PARAM_BASE_COMPONENT_ID, request.getBaseComponentId()) .setParam(DEPRECATED_PARAM_BASE_COMPONENT_KEY, request.getBaseComponentKey()) .setParam(PARAM_COMPONENT, request.getComponent()) .setParam(PARAM_BRANCH, request.getBranch()) .setParam(PARAM_STRATEGY, request.getStrategy()) .setParam(PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers())) .setParam(PARAM_METRIC_KEYS, inlineMultipleParamValue(request.getMetricKeys())) .setParam(PARAM_ADDITIONAL_FIELDS, inlineMultipleParamValue(request.getAdditionalFields())) .setParam(PARAM_DEVELOPER_ID, request.getDeveloperId()) .setParam(PARAM_DEVELOPER_KEY, request.getDeveloperKey()) .setParam("q", request.getQuery()) .setParam("p", request.getPage()) .setParam("ps", request.getPageSize()) .setParam("s", inlineMultipleParamValue(request.getSort())) .setParam("asc", request.getAsc()) .setParam(PARAM_METRIC_SORT, request.getMetricSort()) .setParam(PARAM_METRIC_SORT_FILTER, request.getMetricSortFilter()); return call(getRequest, ComponentTreeWsResponse.parser()); }
Source:
<code>private void stopTransferService() { TaskDefinition task = new TaskDefinition(); task = Context.getSchedulerService().getTaskByName(ART_TRANSFER_SCHEDULE_NAME); if (task != null) { try { Context.getSchedulerService().shutdownTask(task); } catch (SchedulerException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>@slubwama provide error message description of failed in addition stack trace</technical_language>

Target:
private void stopTransferService() { TaskDefinition task = new TaskDefinition(); task = Context.getSchedulerService().getTaskByName(ART_TRANSFER_SCHEDULE_NAME); if (task != null) { try { Context.getSchedulerService().shutdownTask(task); } catch (SchedulerException e) { log.error("Faied to shutdown task",e); } } }
Source:
<code>public void testINT3412AppendStatRmdir() { FtpRemoteFileTemplate template = new FtpRemoteFileTemplate(sessionFactory); DefaultFileNameGenerator fileNameGenerator = new DefaultFileNameGenerator(); fileNameGenerator.setExpression("'foobar.txt'"); template.setFileNameGenerator(fileNameGenerator); template.setRemoteDirectoryExpression(new LiteralExpression("foo/")); template.setUseTemporaryFileName(false); template.execute(new SessionCallback<FTPFile, Boolean>() { @Override public Boolean doInSession(Session<FTPFile> session) throws IOException { session.mkdir("foo/"); return session.mkdir("foo/bar/"); } }); template.append(new GenericMessage<String>("foo")); template.append(new GenericMessage<String>("bar")); template.executeWithClient(new ClientCallback<FTPClient, Void>() { @Override public Void doWithClient(FTPClient client) { try { FTPFile[] files = client.listFiles("foo/foobar.txt"); assertEquals(6, files[0].getSize()); return null; } catch (IOException e) { throw new RuntimeException(e); } } }); <START> template.execute(new SessionCallback<FTPFile, Void>() { <END> @Override public Void doInSession(Session<FTPFile> session) throws IOException { assertTrue(session.remove("foo/foobar.txt")); assertTrue(session.rmdir("foo/bar/")); FTPFile[] files = session.list("foo/"); assertEquals(0, files.length); assertTrue(session.rmdir("foo/")); return null; } }); }</code><technical_language>Minor, SessionCallbackWithoutResult matter</technical_language>

Target:
public void testINT3412AppendStatRmdir() { FtpRemoteFileTemplate template = new FtpRemoteFileTemplate(sessionFactory); DefaultFileNameGenerator fileNameGenerator = new DefaultFileNameGenerator(); fileNameGenerator.setExpression("'foobar.txt'"); template.setFileNameGenerator(fileNameGenerator); template.setRemoteDirectoryExpression(new LiteralExpression("foo/")); template.setUseTemporaryFileName(false); template.execute(new SessionCallback<FTPFile, Boolean>() { @Override public Boolean doInSession(Session<FTPFile> session) throws IOException { session.mkdir("foo/"); return session.mkdir("foo/bar/"); } }); template.append(new GenericMessage<String>("foo")); template.append(new GenericMessage<String>("bar")); assertTrue(template.exists("foo/foobar.txt")); template.executeWithClient(new ClientCallbackWithoutResult<FTPClient>() { @Override public void doWithClientWithoutResult(FTPClient client) { try { FTPFile[] files = client.listFiles("foo/foobar.txt"); assertEquals(6, files[0].getSize()); } catch (IOException e) { throw new RuntimeException(e); } } }); template.execute(new SessionCallbackWithoutResult<FTPFile>() { @Override public void doInSessionWithoutResult(Session<FTPFile> session) throws IOException { assertTrue(session.remove("foo/foobar.txt")); assertTrue(session.rmdir("foo/bar/")); FTPFile[] files = session.list("foo/"); assertEquals(0, files.length); assertTrue(session.rmdir("foo/")); } }); assertFalse(template.exists("foo")); }
Source:
<code>public String createTarget( File targetPropertiesFile, ApplicationTemplate creator ) throws IOException { String fileContent = Utils.readFileContent( targetPropertiesFile ); StringBuilder sb = new StringBuilder( fileContent ); if( creator != null ) { sb.append( "\n\n" ); sb.append( TargetsMngrImpl.TARGET_PROPERTY_CREATED_BY ); sb.append( ": " ); sb.append( creator.getName()); sb.append( " - " ); sb.append( creator.getQualifier()); } String targetId = createTarget( sb.toString()); File scriptsInDir = targetPropertiesFile.getParentFile(); File scriptsOutDir = findTargetDirectory( targetId ); List<File> scripts = Utils.listAllFiles( scriptsInDir ); for( File f : scripts) { String name = f.getName(); <START> if( !(name.contains(Constants.FILE_EXT_PROPERTIES) || name.contains(".tmp") || name.contains(CREATED_BY)) ) { <END> Utils.copyStream(f, new File(scriptsOutDir, name)); } } return targetId; }</code><technical_language>No, discussed this morning... :cry: :sob: for files properties files DO start name of target properties file. So, code be... java String prefix = Utils.removeFileExtension( targetPropertiesFile.getName()) + "."; List<File> scripts = Utils.listAllFiles( scriptsInDir ); for( File f : scripts) { if( name.startsWith( prefix ) && ! name.toLowerCase().endsWith( Constants.FILE_EXT_PROPERTIES )) Utils.copyStream(f, new File(scriptsOutDir, name)); }</technical_language>

Target:
public String createTarget( File targetPropertiesFile, ApplicationTemplate creator ) throws IOException { String fileContent = Utils.readFileContent( targetPropertiesFile ); StringBuilder sb = new StringBuilder( fileContent ); if( creator != null ) { sb.append( "\n\n" ); sb.append( TargetsMngrImpl.TARGET_PROPERTY_CREATED_BY ); sb.append( ": " ); sb.append( creator.getName()); sb.append( " - " ); sb.append( creator.getQualifier()); } String targetId = createTarget( sb.toString()); File scriptsInDir = targetPropertiesFile.getParentFile(); File scriptsOutDir = findTargetDirectory( targetId ); String prefix = Utils.removeFileExtension(targetPropertiesFile.getName()); List<File> scripts = Utils.listAllFiles( scriptsInDir ); for( File f : scripts) { String name = f.getName(); if( ! CREATED_BY.equals(name) && name.startsWith(prefix) && ! name.toLowerCase().endsWith(Constants.FILE_EXT_PROPERTIES)) Utils.copyStream(f, new File(scriptsOutDir, name)); } return targetId; }
Source:
<code>private void restoreThumbs() { if (ZipFilesTask.getInstance() != null && ZipFilesTask.getInstance().getStatus() == Status.RUNNING) { Toast.makeText(this, "Please wait until all images are backed-up.", Toast.LENGTH_SHORT).show(); return; } final DisplaySettingsActivity dsa = this; <START> UIHelper.createYesNoDialog( <END> this , getResources().getString(R.string.restore_zip_question) , getResources().getString(R.string.restore_zip_question2) , new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) { String zipName = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Backup_thumbs.zip"; String thumbRootPath = UIHelper.getImageRoot(dsa) + "/project/images/thumb"; if (getProcessAllImagesPreferences()) { zipName = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Backup_all_images.zip"; thumbRootPath = UIHelper.getImageRoot(dsa) + "/project/images"; } UnZipFilesTask task = UnZipFilesTask.getInstance(zipName, thumbRootPath, dsa, Constants.PREF_RESTORE_THUMB_IMAGES); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); else task.execute(); } } }).show(); }</code><technical_language>this: move YesNo dialog <LINK_0></technical_language>

Target:
private void restoreThumbs() { if (ZipFilesTask.getInstance() != null && ZipFilesTask.getInstance().getStatus() == Status.RUNNING) { Toast.makeText(this, "Please wait until all images are backed-up.", Toast.LENGTH_SHORT).show(); return; } String zipName = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Backup_thumbs.zip"; String thumbRootPath = UIHelper.getImageRoot(this) + "/project/images/thumb"; if (getProcessAllImagesPreferences()) { zipName = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Backup_all_images.zip"; thumbRootPath = UIHelper.getImageRoot(this) + "/project/images"; } UnZipFilesTask task = UnZipFilesTask.getInstance(zipName, thumbRootPath, this, Constants.PREF_RESTORE_THUMB_IMAGES); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); else task.execute(); }
Source:
<code>protected <S extends AbstractBackendResource<?, ?>> S inject(S resource) { resource.setBackend(backend); resource.setMappingLocator(mappingLocator); resource.setValidatorLocator(validatorLocator); resource.setSessionHelper(sessionHelper); resource.setMessageBundle(messageBundle); resource.setUriInfo(uriInfo); resource.setHttpHeaders(httpHeaders); <START> resource.setValidatorLocator(validatorLocator); <END> return resource; }</code><technical_language>do set twice</technical_language>

Target:
protected <S extends AbstractBackendResource<?, ?>> S inject(S resource) { resource.setBackend(backend); resource.setMappingLocator(mappingLocator); resource.setValidatorLocator(validatorLocator); resource.setSessionHelper(sessionHelper); resource.setMessageBundle(messageBundle); resource.setUriInfo(uriInfo); resource.setHttpHeaders(httpHeaders); return resource; }
Source:
<code>private static TableFinisher createTableFinisher(Session session, TableFinishNode node, Metadata metadata) { WriterTarget target = node.getTarget(); return (fragments, statistics) -> { if (target instanceof CreateHandle) { CreateHandle createHandle = (CreateHandle) target; if (metadata.isWritingStagingFilesEnabled(session)) { metadata.commitStagingFiles(session, createHandle.getSchemaTableName(), fragments); } return metadata.finishCreateTable(session, createHandle.getHandle(), fragments, statistics); } else if (target instanceof InsertHandle) { InsertHandle insertHandle = (InsertHandle) target; if (metadata.isWritingStagingFilesEnabled(session)) { metadata.commitStagingFiles(session, insertHandle.getSchemaTableName(), fragments); } return metadata.finishInsert(session, insertHandle.getHandle(), fragments, statistics); } else if (target instanceof DeleteHandle) { DeleteHandle deleteHandle = (DeleteHandle) target; if (metadata.isWritingStagingFilesEnabled(session)) { <START> metadata.commitStagingFiles(session, deleteHandle.getSchemaTableName(), fragments); <END> } metadata.finishDelete(session, deleteHandle.getHandle(), fragments); return Optional.empty(); } else { throw new AssertionError("Unhandled target type: " + target.getClass().getName()); } }; }</code><technical_language>if need commit staging data for delete</technical_language>

Target:
private static TableFinisher createTableFinisher(Session session, TableFinishNode node, Metadata metadata) { WriterTarget target = node.getTarget(); return (fragments, statistics) -> { if (target instanceof CreateHandle) { return metadata.finishCreateTable(session, ((CreateHandle) target).getHandle(), fragments, statistics); } else if (target instanceof InsertHandle) { return metadata.finishInsert(session, ((InsertHandle) target).getHandle(), fragments, statistics); } else if (target instanceof DeleteHandle) { metadata.finishDelete(session, ((DeleteHandle) target).getHandle(), fragments); return Optional.empty(); } else { throw new AssertionError("Unhandled target type: " + target.getClass().getName()); } }; }
Source:
<code>void twoTypesOfPlanesAndTogetherHaveAmountEqualToDiceSides() { whenGetRandom(bridge).thenAnswer(withValues(1)); final List<Unit> planes = planeUnitType.createTemp(3, hitPlayer); planes.addAll(otherPlaneUnitType.createTemp(3, hitPlayer)); final CasualtyDetails details = AaCasualtySelector.getAaCasualties( planes, aaUnitType.createTemp(1, aaPlayer), mock(CombatValue.class), givenAaCombatValue(), "text", givenDiceRollWithHitSequence(true), bridge, hitPlayer, UUID.randomUUID(), mock(Territory.class)); assertThat(details.getKilled(), hasSize(1)); assertThat( "The otherPlaneUnitType is killed because it's unitType is sorted before planeUnitType " + "(it sorts by unit type name) and there are 3 of them and the random selection was " + "for the second unit in the list.", details.getKilled().stream().map(Unit::getType).collect(Collectors.toList()), containsInAnyOrder(otherPlaneUnitType)); <START> assertThat( <END> "The planes have 1 hp so there can't be damaged planes", details.getDamaged(), is(empty())); }</code><technical_language>This asserted a times, is of tests this assertion fail others, is more case if fails fail</technical_language>

Target:
void twoTypesOfPlanesAndTogetherHaveAmountEqualToDiceSides() { whenGetRandom(bridge).thenAnswer(withValues(1)); final List<Unit> planes = planeUnitType.createTemp(3, hitPlayer); planes.addAll(otherPlaneUnitType.createTemp(3, hitPlayer)); final List<Unit> aaUnits = aaUnitType.createTemp(1, aaPlayer); final CasualtyDetails details = AaCasualtySelector.getAaCasualties( planes, aaUnits, mock(CombatValue.class), givenAaCombatValue(), "text", givenLowLuckDiceRoll(aaUnits, planes), bridge, hitPlayer, UUID.randomUUID(), mock(Territory.class)); assertThat(details.getKilled(), hasSize(1)); assertThat( "The otherPlaneUnitType is killed because it's unitType is sorted before planeUnitType " + "(it sorts by unit type name) and there are 3 of them and the random selection was " + "for the second unit in the list.", details.getKilled().stream().map(Unit::getType).collect(Collectors.toList()), containsInAnyOrder(otherPlaneUnitType)); assertThat( "The planes have 1 hp so there can't be damaged planes", details.getDamaged(), is(empty())); }
Source:
<code>public void testBinLogStartStop() throws Exception { AtomicInteger releaseCount = new AtomicInteger(); CountDownLatch ready = new CountDownLatch(2); binLog.put(new BinLog.ReleaseableWriteMarshallable() { public void release() { releaseCount.incrementAndGet(); } protected long version() { return 0; } protected String type() { return "test"; } public void writeMarshallablePayload(WireOut wire) { ready.countDown(); } }); binLog.put(new BinLog.ReleaseableWriteMarshallable() { protected long version() { return 0; } protected String type() { return "test"; } public void writeMarshallablePayload(WireOut wire) { ready.countDown(); } public void release() { releaseCount.incrementAndGet(); } }); ready.await(); Util.spinAssertEquals("Both records should be released", 2, releaseCount::get, 10, TimeUnit.SECONDS); Thread t = new Thread(() -> { try { binLog.stop(); } catch (InterruptedException e) { throw new AssertionError(e); } }); t.start(); t.join(60 * 1000); <START> assertEquals("BinLog stop should not block forever", t.getState(), Thread.State.TERMINATED); <END> Util.spinAssertEquals(2, releaseCount::get, 60); Util.spinAssertEquals(Thread.State.TERMINATED, binLog.binLogThread::getState, 60); }</code><technical_language>nit: I :) this message clear BinLog more a minute stop</technical_language>

Target:
public void testBinLogStartStop() throws Exception { AtomicInteger releaseCount = new AtomicInteger(); CountDownLatch ready = new CountDownLatch(2); Supplier<BinLog.ReleaseableWriteMarshallable> recordSupplier = () -> new BinLog.ReleaseableWriteMarshallable() { public void release() { releaseCount.incrementAndGet(); } protected long version() { return 0; } protected String type() { return "test"; } public void writeMarshallablePayload(WireOut wire) { ready.countDown(); } }; binLog.put(recordSupplier.get()); binLog.put(recordSupplier.get()); ready.await(1, TimeUnit.MINUTES); Util.spinAssertEquals("Both records should be released", 2, releaseCount::get, 10, TimeUnit.SECONDS); Thread t = new Thread(() -> { try { binLog.stop(); } catch (InterruptedException e) { throw new AssertionError(e); } }); t.start(); t.join(60 * 1000); assertEquals("BinLog should not take more than 1 minute to stop", t.getState(), Thread.State.TERMINATED); Util.spinAssertEquals(2, releaseCount::get, 60); Util.spinAssertEquals(Thread.State.TERMINATED, binLog.binLogThread::getState, 60); }
Source:
<code>public void testVerificationResourceFields() throws HTTPError { BankAccount bankAccount = createdAssociatedBankAccount(); BankAccountVerification verification = bankAccount.verify(); <START> assertEquals(verification.attempts.toString(), "0"); <END> assertEquals(verification.attempts_remaining.toString(), "3"); assertNotNull(verification.created_at); assertEquals(verification.deposit_status, "succeeded"); assertTrue(verification.href.contains("/verifications/BZ")); assertTrue(verification.id.contains("BZ")); assertEquals(verification.bank_account.href, bankAccount.href); assertNotNull(verification.updated_at); assertEquals(verification.verification_status, "pending"); }</code><technical_language>toString()</technical_language>

Target:
public void testVerificationResourceFields() throws HTTPError { BankAccount bankAccount = createdAssociatedBankAccount(); BankAccountVerification verification = bankAccount.verify(); assertEquals(verification.attempts.intValue(), 0); assertEquals(verification.attempts_remaining.intValue(), 3); assertNotNull(verification.created_at); assertEquals(verification.deposit_status, "succeeded"); assertTrue(verification.href.contains("/verifications/BZ")); assertTrue(verification.id.contains("BZ")); assertEquals(verification.bank_account.href, bankAccount.href); assertNotNull(verification.updated_at); assertEquals(verification.verification_status, "pending"); }
Source:
<code>public void pauseResume() throws Exception { logger.log(Level.INFO, "Pause/Resume"); try { switch(getControlState()) { case COMM_IDLE: default: <START> if (!this.controller.isStreaming()) { <END> throw new Exception("Cannot pause while '" + getControlState() + "'."); } case COMM_SENDING: this.controller.pauseStreaming(); return; case COMM_SENDING_PAUSED: this.controller.resumeStreaming(); return; } } catch (Exception e) { logger.log(Level.SEVERE, "Exception in pauseResume", e); throw new Exception(Localization.getString("mainWindow.error.pauseResume")); } }</code><technical_language>isSendingFile() for null check</technical_language>

Target:
public void pauseResume() throws Exception { logger.log(Level.INFO, "Pause/Resume"); try { switch(getControlState()) { case COMM_IDLE: default: if (!isSendingFile()) { throw new Exception("Cannot pause while '" + getControlState() + "'."); } case COMM_SENDING: this.controller.pauseStreaming(); return; case COMM_SENDING_PAUSED: this.controller.resumeStreaming(); return; } } catch (Exception e) { logger.log(Level.SEVERE, "Exception in pauseResume", e); throw new Exception(Localization.getString("mainWindow.error.pauseResume")); } }
Source:
<code>public void testVmOvfImportWithoutDbGeneration() throws Exception{ VM vm = createVM(); String xml = manager.ExportVm(vm, new ArrayList<DiskImage>()); assertNotNull(xml); final VM newVm = new VM(); assertTrue(xml.contains("Generation")); String replacedXml = xml.replaceAll("Generation", "test_replaced"); manager.ImportVm(replacedXml, newVm, new ArrayList<DiskImage>(), new ArrayList<VmNetworkInterface>()); assertEquals(vm, newVm); <START> assertEquals(new Long(1), newVm.getDbGeneration()); <END> }</code><technical_language>Long.valueOf(1)</technical_language>

Target:
public void testVmOvfImportWithoutDbGeneration() throws Exception { VM vm = createVM(); String xml = manager.ExportVm(vm, new ArrayList<DiskImage>()); assertNotNull(xml); final VM newVm = new VM(); assertTrue(xml.contains("Generation")); String replacedXml = xml.replaceAll("Generation", "test_replaced"); manager.ImportVm(replacedXml, newVm, new ArrayList<DiskImage>(), new ArrayList<VmNetworkInterface>()); assertEquals("imported vm is different than expected",vm, newVm); assertTrue("imported db generation is different than expected", newVm.getDbGeneration() == 1); }
Source:
<code>private Stream<Output> queryAsStream( List<String> terms, ReadOnlyFulltext indexReader, boolean fuzzy, boolean matchAll ) { PrimitiveLongIterator primitiveLongIterator; if ( fuzzy ) { primitiveLongIterator = indexReader.fuzzyQuery( matchAll, terms.toArray( new String[0] ) ); } else { primitiveLongIterator = indexReader.query( matchAll, terms.toArray( new String[0] ) ); } <START> Iterator<Output> iterator = PrimitiveLongCollections.map( Output::new, primitiveLongIterator ); <END> return StreamSupport.stream( Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED ), false ); }</code><technical_language>set defaultValues for fuzzy matchAll parameters. a thought</technical_language>

Target:
private Stream<EntityOutput> queryAsStream( List<String> terms, ReadOnlyFulltext indexReader, boolean fuzzy, boolean matchAll ) { PrimitiveLongIterator primitiveLongIterator; if ( fuzzy ) { primitiveLongIterator = indexReader.fuzzyQuery( terms, matchAll ); } else { primitiveLongIterator = indexReader.query( terms, matchAll ); } Iterator<EntityOutput> iterator = PrimitiveLongCollections.map( EntityOutput::new, primitiveLongIterator ); return StreamSupport.stream( Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED ), false ); }
Source:
<code>public OperationContext(T optionsBuilder) { this(optionsBuilder, null); mOptionsBuilder = optionsBuilder; <START> mCallTracker = () -> { <END> throw new IllegalStateException("Call tracking is not supported."); }; }</code><technical_language>this a static/constant noop tracker, avoid re-creating frequently</technical_language>

Target:
public OperationContext(T optionsBuilder) { this(optionsBuilder, null); mOptionsBuilder = optionsBuilder; mCallTracker = CallTracker.DISABLED_TRACKER; }
Source:
<code>public String toString() { <START> return "CacheQuotaRequirement{" + <END> "cacheQuotaScope=" + cacheQuotaScope + ", quota=" + quota + '}'; }</code><technical_language>toStringHelper</technical_language>

Target:
public String toString() { return toStringHelper(this) .add("cacheQuotaScope", cacheQuotaScope) .add("quota", quota) .toString(); }
Source:
<code>public void testViewActionsLink(){ ______TS("Link: recent actions link"); try { String expectedPersonInfo = logPage.getPersonInfoOfFirstEntry(); <START> logPage.clickViewActionsButtonOfSecondEntry(); <END> String actualPersonInfo = logPage.getFilterBoxString(); assertEqualsIfQueryStringNotEmpty(expectedPersonInfo, actualPersonInfo); } catch (NoSuchElementException emptylogs) { } }</code><technical_language>method name matches method does</technical_language>

Target:
public void testViewActionsLink(){ ______TS("Link: recent actions link"); try { String expectedPersonInfo = logPage.getPersonInfoOfFirstEntry(); logPage.clickViewActionsButtonOfFirstEntry(); String actualPersonInfo = logPage.getFilterBoxString(); assertEqualsIfQueryStringNotEmpty(expectedPersonInfo, actualPersonInfo); } catch (NoSuchElementException exceptionFromEmptyLogs) { } catch (IndexOutOfBoundsException exceptionFromInvisibleTmtLogs) { } }
Source:
<code>public void testValidateExecutableWithoutFix() { FormValidation actual = FormValidation.validateExecutable("git"); String failMessage = "There's no such executable git in PATH:"; <START> assertThat(actual.equals(FormValidation.error(failMessage)), is(false)); <END> }</code><technical_language>I receive a more clear assertion failure message if Hamcrest compare objects assert check equal. actual.equals() is used, hides information Hamcrest assertion failure message clearer. suggestion assertThat(actual, not(is(FormValidation.error(failMessage))));</technical_language>

Target:
public void testValidateExecutableWithoutFix() { FormValidation actual = FormValidation.validateExecutable("git"); String failMessage = "There's no such executable git in PATH:"; assertThat(actual, not(is(FormValidation.error(failMessage)))); }
Source:
<code>public MisoRunSample mapRow(ResultSet rs, int rowNum) throws SQLException { MisoRunSample s = new MisoRunSample(); s.setId(rs.getString("dilutionId")); s.setPartitionId(rs.getInt("partitionId")); s.setBarcode(AttributeKey.BARCODE.extractStringValueFrom(rs)); String barcode2 = AttributeKey.BARCODE_TWO.extractStringValueFrom(rs); <START> boolean reverseComplement2 = rs.getString("dataManglingPolicy").equals("RC_I5"); <END> s.setBarcodeTwo(reverseComplement2 ? reverseComplement(barcode2) : barcode2); Attribute att = AttributeKey.TARGETED_RESEQUENCING.extractAttributeFrom(rs); if (att != null) { Set<Attribute> atts = new HashSet<>(); atts.add(att); s.setAttributes(atts); } return s; }</code><technical_language>RC_I5 -> I5_RC</technical_language>

Target:
public MisoRunSample mapRow(ResultSet rs, int rowNum) throws SQLException { MisoRunSample s = new MisoRunSample(); s.setId(rs.getString("dilutionId")); s.setPartitionId(rs.getInt("partitionId")); s.setBarcode(AttributeKey.BARCODE.extractStringValueFrom(rs)); String barcode2 = AttributeKey.BARCODE_TWO.extractStringValueFrom(rs); boolean reverseComplement2 = rs.getString("dataManglingPolicy").equals("I5_RC"); s.setBarcodeTwo(reverseComplement2 ? reverseComplement(barcode2) : barcode2); Attribute att = AttributeKey.TARGETED_RESEQUENCING.extractAttributeFrom(rs); if (att != null) { Set<Attribute> atts = new HashSet<>(); atts.add(att); s.setAttributes(atts); } return s; }
Source:
<code><START> private static boolean setValue(Object object, String value, Field field) throws IllegalAccessException { <END> if (setIntegralValue(object, value, field)) { return true; } if (setFloatingPointValue(object, value, field)) { return true; } if (setNonNumericValue(object, value, field)) { return true; } return isProbeField(field); }</code><technical_language>commit is good, this method misleading - set if field belongs a probe</technical_language>

Target:
private static boolean setValue(Object object, String value, Field field) throws IllegalAccessException { if (setIntegralValue(object, value, field)) { return true; } if (setFloatingPointValue(object, value, field)) { return true; } return setNonNumericValue(object, value, field); }
Source:
<code>public void beginRecognizeCustomFormsFromUrlWithOptions() { String analyzeFilePath = "{file_source_url}"; String modelId = "{model_id}"; <START> <END> formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(analyzeFilePath, modelId, true, Duration.ofSeconds(5)).subscribe(trainingOperationResponse -> trainingOperationResponse.getFinalResult().subscribe(recognizedForms -> recognizedForms.forEach(extractedForm -> { extractedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Page number: %s%n", fieldValue.getPageNumber()); System.out.printf("Field text: %s%n", fieldText); System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); }); extractedForm.getPages().forEach(formPage -> { System.out.printf("Page Angle: %s%n", formPage.getTextAngle()); System.out.printf("Page Dimension unit: %s%n", formPage.getUnit()); System.out.println(); }); }) ) ); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl#string-string-boolean-Duration }</code><technical_language>boolean includeTextDetails = true; send in call below</technical_language>

Target:
public void beginRecognizeCustomFormsFromUrlWithOptions() { String analyzeFilePath = "{file_source_url}"; String modelId = "{model_id}"; boolean includeTextDetails = true; formRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl(analyzeFilePath, modelId, includeTextDetails, Duration.ofSeconds(5)).subscribe(recognizePollingOperation -> recognizePollingOperation.getFinalResult().subscribe(recognizedForms -> recognizedForms.forEach(recognizedForm -> { recognizedForm.getFields().forEach((fieldText, fieldValue) -> { System.out.printf("Page number: %s%n", fieldValue.getPageNumber()); System.out.printf("Field text: %s%n", fieldText); System.out.printf("Field value: %s%n", fieldValue.getFieldValue()); System.out.printf("Confidence score: %.2f%n", fieldValue.getConfidence()); }); }) ) ); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeCustomFormsFromUrl#string-string-boolean-Duration }