auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void createStreams(String planId, List<StreamSpec> intStreams, StreamManager streamManager) { if (intStreams.isEmpty()) { LOG.info("Set of intermediate streams is empty. Nothing to create."); return; } LOG.info("A single processor must create the intermediate streams. Processor will attempt to acquire the lock.", uid); if(coordinationUtils == null) { JobCoordinatorConfig jcConfig = new JobCoordinatorConfig(appDesc.getConfig()); String coordinationId = new ApplicationConfig(appDesc.getConfig()).getGlobalAppId() + CoordinationConstants.APPLICATION_RUNNER_PATH_SUFFIX; coordinationUtils = jcConfig.getCoordinationUtilsFactory().getCoordinationUtils(coordinationId, uid, appDesc.getConfig()); } if (coordinationUtils == null) { LOG.warn("Processor failed to create utils. Each processor will attempt to create streams.", uid); streamManager.createStreams(intStreams); return; } Boolean isAppModeBatch = new ApplicationConfig(userConfig).getAppMode() == ApplicationConfig.ApplicationMode.BATCH; String lockId = planId; if(isAppModeBatch && runId != null) { lockId = runId; } DistributedLockWithState lockWithState = coordinationUtils.getLockWithState(lockId); try { if (lockWithState.lockIfNotSet(1000, TimeUnit.MILLISECONDS)) { LOG.info("lock acquired for streams creation by " + uid); streamManager.createStreams(intStreams); lockWithState.unlockAndSet(); } else { LOG.info("Processor did not obtain the lock for streams creation. They must've been created by another processor.", uid); } } catch (TimeoutException e) { String msg = String.format("Processor failed to get the lock for stream initialization", uid); throw new SamzaException(msg, e); } finally { if(!isAppModeBatch && coordinationUtils != null) { coordinationUtils.close(); coordinationUtils = null; } } }

Target:
private void createStreams(String planId, List<StreamSpec> intStreams, StreamManager streamManager) { if (intStreams.isEmpty()) { LOG.info("Set of intermediate streams is empty. Nothing to create."); return; } LOG.info("A single processor must create the intermediate streams. Processor will attempt to acquire the lock.", processorId); if (coordinationUtils == null) { LOG.warn("Processor failed to create utils. Each processor will attempt to create streams.", processorId); streamManager.createStreams(intStreams); return; } boolean isAppModeBatch = new ApplicationConfig(userConfig).getAppMode() == ApplicationConfig.ApplicationMode.BATCH; String lockId = planId; if (isAppModeBatch && runId != null) { lockId = runId; } try { checkAndCreateStreams(lockId, intStreams, streamManager); } catch (TimeoutException te) { throw new SamzaException(String.format("Processor failed to get the lock for stream initialization within timeout.", processorId), te); } finally { if (!isAppModeBatch && coordinationUtils != null) { coordinationUtils.close(); } } }
Source:
public void register() { artifactCoordinatesValidatorRegistry.addProvider(ALIAS, this); logger.info("Registered artifact coordinates validator '" + getClass().getCanonicalName() + "'" + " with alias '" + ALIAS + "'."); }

Target:
public void register() { artifactCoordinatesValidatorRegistry.addProvider(ALIAS, this); logger.info("Registered artifact coordinates validator '{}' with alias '{}'.", getClass().getCanonicalName(), ALIAS); }
Source:
@Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { while (!isCancelled() && !Thread.interrupted()) { blockingSectionBegin(); try { synchronized (this) { while (readyForFlushSize.get() < flushBatchSize && !isCancelled()) wait(); } flushBuffer(); } finally { blockingSectionEnd(); } } fileWriter = null; ringByteBuffer.close(); ringByteBuffer.poll(); ringByteBuffer.free(); U.closeQuiet(fileIo); stringIds.clear(); stopFut.onDone(); log.info("Performance statistics writer stopped."); }

Target:
@Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { try { long writtenToFile = 0; while (!isCancelled()) { blockingSectionBegin(); try { synchronized (this) { if (writtenToFile / flushSize == writtenToBuf.get() / flushSize) wait(); } } finally { blockingSectionEnd(); } writtenToFile += flush(); } flush(); } catch (InterruptedException e) { try { flush(); } catch (IOException ignored) { } } catch (ClosedByInterruptException ignored) { } catch (IOException e) { log.error("Unable to write to the performance statistics file.", e); } }
Source:
public void open() throws IOException { writer = CompressionFactory.getLongSerializer( ioPeon, String.format("%s_little", metricName), IndexIO.BYTE_ORDER, CompressionFactory.DEFAULT_LONG_ENCODING, CompressedObjectStrategy.DEFAULT_COMPRESSION_STRATEGY ); writer.open(); }

Target:
public void open() throws IOException { writer = CompressionFactory.getLongSerializer( ioPeon, String.format("%s_little", metricName), IndexIO.BYTE_ORDER, encoding, compression ); writer.open(); }
Source:
private void testUpdateInterface(Guid interface_id) { VdsNetworkInterface iface = dao.get(interface_id); iface.setName(iface.getName().toUpperCase()); iface.setQos(newQos); dao.updateInterfaceForVds(iface); VdsNetworkInterface ifaced = dao.get(interface_id); assertTrue(ifaced.getName().equals(iface.getName()) && ifaced.getQos().equals(iface.getQos())); }

Target:
private void testUpdateInterface(Guid interface_id) { VdsNetworkInterface iface = dao.get(interface_id); iface.setName(iface.getName().toUpperCase()); iface.setQos(newQos); dao.updateInterfaceForVds(iface); VdsNetworkInterface ifaced = dao.get(interface_id); assertEquals(iface.getName(), ifaced.getName()); assertEquals(iface.getQos(), ifaced.getQos()); }
Source:
public static void setConnectorInfo(JobConf job, String principal, AuthenticationToken token) throws AccumuloSecurityException { if (token instanceof KerberosToken) { log.info("Received KerberosToken, attempting to fetch DelegationToken"); try { Connector conn = Connector.builder().usingClientInfo(getClientInfo(job)) .usingToken(principal, token).build(); token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); } catch (Exception e) { log.warn("Failed to automatically obtain DelegationToken, " + "Mappers/Reducers will likely fail to communicate with Accumulo", e); } } if (token instanceof DelegationTokenImpl) { DelegationTokenImpl delegationToken = (DelegationTokenImpl) token; AuthenticationTokenIdentifier identifier = delegationToken.getIdentifier(); Token<AuthenticationTokenIdentifier> hadoopToken = new Token<>(identifier.getBytes(), delegationToken.getPassword(), identifier.getKind(), delegationToken.getServiceName()); job.getCredentials().addToken(hadoopToken.getService(), hadoopToken); } OutputConfigurator.setConnectorInfo(CLASS, job, principal, token); }

Target:
public static void setConnectorInfo(JobConf job, String principal, AuthenticationToken token) throws AccumuloSecurityException { if (token instanceof DelegationTokenImpl) { DelegationTokenImpl delegationToken = (DelegationTokenImpl) token; AuthenticationTokenIdentifier identifier = delegationToken.getIdentifier(); Token<AuthenticationTokenIdentifier> hadoopToken = new Token<>(identifier.getBytes(), delegationToken.getPassword(), identifier.getKind(), delegationToken.getServiceName()); job.getCredentials().addToken(hadoopToken.getService(), hadoopToken); } OutputConfigurator.setConnectorInfo(CLASS, job, principal, token); }
Source:
private void update() { if (busy.compareAndSet(false, true)) { try { PollingResponse response = reader.call(); if (response.hasData()) { current = response.getToAdd(); notifyConfigUpdated(this); } } catch (Exception e) { try { notifyError(e, this); } catch (Exception e2) { LOG.warn("Failed to notify error observer"); } } finally { busy.set(false); } } }

Target:
private void update() { if (busy.compareAndSet(false, true)) { try { PollingResponse response = reader.call(); if (response.hasData()) { current = response.getToAdd(); notifyConfigUpdated(this); } } catch (Exception e) { try { notifyError(e, this); } catch (Exception e2) { LOG.warn("Failed to notify error observer", e2); } } finally { busy.set(false); } } }
Source:
private synchronized <T> EventListenerGroupImpl<T> getOrCreateEventListenerGroup(EventType<T> eventType) { final int sizeOriginal = this.registeredEventListeners.length; if ( eventType.ordinal() < sizeOriginal ) { final EventListenerGroupImpl registeredEventListener = registeredEventListeners[ eventType.ordinal() ]; if ( registeredEventListener != null ) { return registeredEventListener; } } else { final int sizeNew = EventType.values().size(); final EventListenerGroupImpl[] registeredEventListenersNew = new EventListenerGroupImpl[sizeNew]; System.arraycopy( this.registeredEventListeners, 0, registeredEventListenersNew, 0, sizeOriginal ); this.registeredEventListeners = registeredEventListenersNew; } final EventListenerGroupImpl listenerGroup = new EventListenerGroupImpl( eventType, EventListenerRegistryImpl.this ); registeredEventListeners[eventType.ordinal()] = listenerGroup; return listenerGroup; }

Target:
private synchronized <T> EventListenerGroupImpl<T> getOrCreateEventListenerGroup(EventType<T> eventType) { final int sizeOriginal = this.registeredEventListeners.length; final EventListenerGroupImpl[] registeredEventListenersNew; if ( eventType.ordinal() < sizeOriginal ) { final EventListenerGroupImpl registeredEventListener = registeredEventListeners[ eventType.ordinal() ]; if ( registeredEventListener != null ) { return registeredEventListener; } registeredEventListenersNew = this.registeredEventListeners; } else { final int sizeNew = Math.max( eventType.ordinal() + 1, EventType.values().size() ); registeredEventListenersNew = new EventListenerGroupImpl[sizeNew]; System.arraycopy( this.registeredEventListeners, 0, registeredEventListenersNew, 0, sizeOriginal ); } final EventListenerGroupImpl listenerGroup = new EventListenerGroupImpl( eventType, EventListenerRegistryImpl.this ); registeredEventListenersNew[eventType.ordinal()] = listenerGroup; this.registeredEventListeners = registeredEventListenersNew; return listenerGroup; }
Source:
default CompletableFuture<String> getsAsync(String row, Column column) { return CompletableFuture.supplyAsync(() -> gets(row, column)); }

Target:
default CompletableFuture<String> getsAsync(String row, Column column) { return CompletableFuture.completedFuture(gets(row, column)); }
Source:
public void putMetrics(MetricsRecord metricsRecord) { for (AbstractMetric metrics : metricsRecord.metrics()) { if (metrics.type() == MetricType.COUNTER || metrics.type() == MetricType.GAUGE) { String key = prometheusName( metricsRecord.name(), metrics.name()); StringBuilder builder = new StringBuilder(); builder.append("# TYPE ") .append(key) .append(" ") .append(metrics.type().toString().toLowerCase()) .append("\n"); StringBuilder prometheusMetricKey = new StringBuilder(); prometheusMetricKey.append(key) .append("{"); String sep = ""; for (MetricsTag tag : metricsRecord.tags()) { String tagName = tag.name().toLowerCase(); if (!tagName.equals("numopenconnectionsperuser")) { prometheusMetricKey.append(sep) .append(tagName) .append("=\"") .append(tag.value()) .append("\""); sep = ","; } } prometheusMetricKey.append("}"); builder.append(prometheusMetricKey.toString()); builder.append(" "); builder.append(metrics.value()); builder.append("\n"); metricLines.put(prometheusMetricKey.toString(), builder.toString()); } } }

Target:
public void putMetrics(MetricsRecord metricsRecord) { for (AbstractMetric metrics : metricsRecord.metrics()) { if (metrics.type() == MetricType.COUNTER || metrics.type() == MetricType.GAUGE) { String key = prometheusName( metricsRecord.name(), metrics.name()); StringBuilder builder = new StringBuilder(); builder.append("# TYPE ") .append(key) .append(" ") .append(metrics.type().toString().toLowerCase()) .append("\n"); StringBuilder prometheusMetricKey = new StringBuilder(); prometheusMetricKey.append(key) .append("{"); String sep = ""; for (MetricsTag tag : metricsRecord.tags()) { String tagName = tag.name().toLowerCase(); if (!tagName.equals("numopenconnectionsperuser")) { prometheusMetricKey.append(sep) .append(tagName) .append("=\"") .append(tag.value()) .append("\""); sep = ","; } } prometheusMetricKey.append("}"); String prometheusMetricKeyAsString = prometheusMetricKey.toString(); builder.append(prometheusMetricKeyAsString); builder.append(" "); builder.append(metrics.value()); builder.append("\n"); metricLines.put(prometheusMetricKeyAsString, builder.toString()); } } }
Source:
private int waitForCompletion(int commandId, long timeout) throws IOException, InterruptedException { URL url = new URL("<LINK_0>" + commandId); long endTime = System.currentTimeMillis() + timeout; while (System.currentTimeMillis() < endTime) { Map response = makeRequest(url, null); if (response.get("status").equals("done")) { return 0; } System.out.println("waiting 3 seconds for results of query " + commandId + ". Current status " + response.get("status")); Thread.sleep(3000); } return 1; }

Target:
private void waitForCompletion(int commandId, long timeout) throws IOException, InterruptedException { URL url = new URL("<LINK_0>" + commandId); long endTime = System.currentTimeMillis() + timeout; while (System.currentTimeMillis() < endTime) { Map response = makeRequest(url, null); if (response.get("status").equals("done")) { return; } System.out.println("waiting 3 seconds for results of query " + commandId + ". Current status " + response.get("status")); Thread.sleep(3000); } throw new IOException("Qubole commandId" + commandId + " failed to return within timeout."); }
Source:
private MethodBehavior createIsEmptyOrBlankMethodBehavior(Symbol.MethodSymbol symbol, Constraint constraint) { MethodBehavior behavior; behavior = new MethodBehavior(symbol); HappyPathYield nullYield = new HappyPathYield(behavior); nullYield.parametersConstraints.add(pmapForConstraint(ObjectConstraint.NULL)); nullYield.setResult(-1, pmapForConstraint(constraint)); behavior.addYield(nullYield); MethodYield notNullYield = new HappyPathYield(behavior); notNullYield.parametersConstraints.add(pmapForConstraint(ObjectConstraint.NOT_NULL)); behavior.addYield(notNullYield); behavior.completed(); return behavior; }

Target:
private static MethodBehavior createIsEmptyOrBlankMethodBehavior(Symbol.MethodSymbol symbol, Constraint constraint) { MethodBehavior behavior = new MethodBehavior(symbol); HappyPathYield nullYield = new HappyPathYield(behavior); nullYield.parametersConstraints.add(pmapForConstraint(ObjectConstraint.NULL)); nullYield.setResult(-1, pmapForConstraint(constraint)); behavior.addYield(nullYield); MethodYield notNullYield = new HappyPathYield(behavior); notNullYield.parametersConstraints.add(pmapForConstraint(ObjectConstraint.NOT_NULL)); behavior.addYield(notNullYield); behavior.completed(); return behavior; }
Source:
public List<Block> execute(Object unusedParameters, String content, MacroTransformationContext context) throws MacroExecutionException { List<Block> result = Collections.emptyList(); Block parent = context.getCurrentMacroBlock().getParent().getParent(); if (parent != null && parent instanceof FigureBlock) { XDOM xdom = this.contentParser.parse(content, context, false, false); List<Block> figureCaptionChildren = xdom.getChildren(); this.parserUtils.removeTopLevelParagraph(figureCaptionChildren); result = Collections.singletonList(new FigureCaptionBlock(Collections.singletonList( new UnchangedContentBlock(figureCaptionChildren) ))); } return result; }

Target:
public List<Block> execute(Object unusedParameters, String content, MacroTransformationContext context) throws MacroExecutionException { List<Block> result = Collections.emptyList(); Block parent = context.getCurrentMacroBlock().getParent(); if (parent != null && parent instanceof FigureBlock) { XDOM xdom = this.contentParser.parse(content, context, false, false); List<Block> figureCaptionChildren = xdom.getChildren(); this.parserUtils.removeTopLevelParagraph(figureCaptionChildren); result = Collections.singletonList(new FigureCaptionBlock(figureCaptionChildren)); } return result; }
Source:
public final void setExcludedPackages(String... excludedPackages) { this.excludedPackages = Collections.unmodifiableSet(Arrays.stream(excludedPackages) .map(x -> x + DOT).collect(Collectors.toSet())); }

Target:
public final void setExcludedPackages(String... excludedPackages) { final List<String> invalidIdentifiers = Arrays.stream(excludedPackages) .filter(x -> !CommonUtils.isName(x)) .collect(Collectors.toList()); if (!invalidIdentifiers.isEmpty()) { throw new IllegalArgumentException( "the following values are not valid identifiers: " + invalidIdentifiers.stream().collect(Collectors.joining(", ", "[", "]"))); } this.excludedPackages = Collections.unmodifiableSet( Arrays.stream(excludedPackages).collect(Collectors.toSet())); }
Source:
public int executeTask(HiveHistory hiveHistory) { try { this.setStarted(); if (hiveHistory != null) { hiveHistory.logPlanProgress(queryPlan); } String queryId = conf.getVar(HIVEQUERYID); if (!org.apache.commons.lang.StringUtils.isEmpty(queryId)) { conf.set(MRJobConfig.JOB_TAGS, queryId); } int retval = execute(driverContext); this.setDone(); if (hiveHistory != null) { hiveHistory.logPlanProgress(queryPlan); } return retval; } catch (IOException e) { throw new RuntimeException("Unexpected error: " + e.getMessage(), e); } }

Target:
public int executeTask(HiveHistory hiveHistory) { try { this.setStarted(); if (hiveHistory != null) { hiveHistory.logPlanProgress(queryPlan); } if (conf != null) { LOG.debug("Task getting executed using mapred tag : " + conf.get(MRJobConfig.JOB_TAGS)); } int retval = execute(driverContext); this.setDone(); if (hiveHistory != null) { hiveHistory.logPlanProgress(queryPlan); } return retval; } catch (IOException e) { throw new RuntimeException("Unexpected error: " + e.getMessage(), e); } }
Source:
public String getQuestionResultStatisticsHtml( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if (view.equals("student") || responses.isEmpty()) { return ""; } String html = ""; StringBuilder fragments = new StringBuilder(100); Map<String, List<Integer>> optionRanks = generateOptionRanksMapping(responses); DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, List<Integer>> entry : optionRanks.entrySet()) { List<Integer> ranks = entry.getValue(); double average = computeAverage(ranks); String ranksReceived = getListOfRanksReceivedAsString(ranks); String option = entry.getKey(); fragments.append(FeedbackQuestionFormTemplates.populateTemplate(FeedbackQuestionFormTemplates.RANK_RESULT_STATS_OPTIONFRAGMENT, "${rankOptionValue}", Sanitizer.sanitizeForHtml(option), "${ranksReceived}", ranksReceived, "${averageRank}", df.format(average))); } html = FeedbackQuestionFormTemplates.populateTemplate(FeedbackQuestionFormTemplates.RANK_RESULT_OPTION_STATS, "${optionRecipientDisplayName}", "Option", "${fragments}", fragments.toString()); return html; }

Target:
public String getQuestionResultStatisticsHtml( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(100); Map<String, List<Integer>> optionRanks = generateOptionRanksMapping(responses); DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, List<Integer>> entry : optionRanks.entrySet()) { List<Integer> ranks = entry.getValue(); double average = computeAverage(ranks); String ranksReceived = getListOfRanksReceivedAsString(ranks); String option = entry.getKey(); fragments.append(FeedbackQuestionFormTemplates.populateTemplate(FeedbackQuestionFormTemplates.RANK_RESULT_STATS_OPTIONFRAGMENT, "${rankOptionValue}", Sanitizer.sanitizeForHtml(option), "${ranksReceived}", ranksReceived, "${averageRank}", df.format(average))); } return FeedbackQuestionFormTemplates.populateTemplate(FeedbackQuestionFormTemplates.RANK_RESULT_OPTION_STATS, "${optionRecipientDisplayName}", "Option", "${fragments}", fragments.toString()); }
Source:
public void resetTheApp() { resetApp(); appWasReset(); try { Thread.sleep(10000); } catch (Throwable t) }

Target:
public void resetTheApp() { resetApp(); appWasReset(); }
Source:
public ImportVmCommand(ImportVmParameters parameters) { super(parameters); setVmId(parameters.getContainerId()); parameters.setEntityId(getVmId()); setVm(parameters.getVm()); parameters.setEntityId(getVm().getId()); setVdsGroupId(parameters.getVdsGroupId()); imageList = new ArrayList<DiskImage>(getVm().getDiskMap().values()); ensureDomainMap(); }

Target:
public ImportVmCommand(ImportVmParameters parameters) { super(parameters); setVmId(parameters.getContainerId()); parameters.setEntityId(getVmId()); setVm(parameters.getVm()); parameters.setEntityId(getVm().getId()); setVdsGroupId(parameters.getVdsGroupId()); if (parameters.getVm() != null && getVm().getDiskMap() != null) { imageList = new ArrayList<DiskImage>(getVm().getDiskMap().values()); } ensureDomainMap(imageList, getParameters().getDestDomainId()); }
Source:
public boolean test(Object object) { boolean b = false; for (Class<?> immutableClass : this.unmodifiableClasses) { if (immutableClass.isInstance(object)) { b = true; break; } } if (b) { if (object instanceof Set) return true; Collection<?> collection = (object instanceof Map) ? ((Map<?, ?>) object).values() : (Collection<?>) object; for (Object e : collection) { if (! this.elementImmutability.test(e)) { return false; } } return true; } return false; }

Target:
public boolean test(Object object) { for (Class<?> immutableClass : unmodifiableClasses) { if (immutableClass.isInstance(object)) { if (object instanceof Set) return true; Collection<?> collection = (object instanceof Map) ? ((Map<?, ?>) object).values() : (Collection<?>) object; for (Object e : collection) { if (! this.elementImmutability.test(e)) { return false; } } return true; } } return false; }
Source:
public void testEmptyMapCP() throws Exception { SMRMap<String, String> map = r.getObjectsView().build() .setType(SMRMap.class) .setStreamName("Map1") .open(); MultiCheckpointWriter mcw = new MultiCheckpointWriter(); mcw.addMap(map); long address = mcw.appendCheckpoints(r, "A1").getSequence(); assertThat(address).isEqualTo(0); IStreamView sv = r.getStreamsView().get(CorfuRuntime.getStreamID("S1")); final int objSize = 100; long a1 = sv.append(new byte[objSize]); final long cpEndAddress = 3L; assertThat(a1).isEqualTo(cpEndAddress); }

Target:
public void testEmptyMapCP() throws Exception { SMRMap<String, String> map = r.getObjectsView().build() .setType(SMRMap.class) .setStreamName("Map1") .open(); MultiCheckpointWriter mcw = new MultiCheckpointWriter(); mcw.addMap(map); long address = mcw.appendCheckpoints(r, "A1").getSequence(); assertThat(address).isEqualTo(-1); IStreamView sv = r.getStreamsView().get(CorfuRuntime.getStreamID("S1")); final int objSize = 100; long a1 = sv.append(new byte[objSize]); final long cpEndAddress = 0L; assertThat(a1).isEqualTo(cpEndAddress); }
Source:
protected EmailTemplate processTemplate(String subjectKey, List<Object> subjectAttributes, String template, Map<String, Object> attributes) throws EmailException { try { Theme theme = getTheme(); Locale locale = session.getContext().resolveLocale(user); attributes.put("locale", locale); Properties rb = theme.getMessages(locale); attributes.put("msg", new MessageFormatterMethod(locale, rb)); attributes.put("properties", theme.getProperties()); String subject = new MessageFormat(rb.getProperty(subjectKey, subjectKey), locale).format(subjectAttributes.toArray()); String textTemplate = String.format("text/%s", template); String textBody; try { textBody = freeMarker.processTemplate(attributes, textTemplate, theme); } catch (final FreeMarkerException e) { textBody = null; logger.warn("Failed to template plain text email.", e); } String htmlTemplate = String.format("html/%s", template); String htmlBody; try { htmlBody = freeMarker.processTemplate(attributes, htmlTemplate, theme); } catch (final FreeMarkerException e) { htmlBody = null; logger.warn("Failed to template html email.", e); } if (textBody == null && htmlBody == null) { throw new EmailException("Both plain text and html are empty!"); } return new EmailTemplate(subject, textBody, htmlBody); } catch (Exception e) { throw new EmailException("Failed to template email", e); } }

Target:
protected EmailTemplate processTemplate(String subjectKey, List<Object> subjectAttributes, String template, Map<String, Object> attributes) throws EmailException { try { Theme theme = getTheme(); Locale locale = session.getContext().resolveLocale(user); attributes.put("locale", locale); Properties rb = theme.getMessages(locale); attributes.put("msg", new MessageFormatterMethod(locale, rb)); attributes.put("properties", theme.getProperties()); String subject = new MessageFormat(rb.getProperty(subjectKey, subjectKey), locale).format(subjectAttributes.toArray()); String textTemplate = String.format("text/%s", template); String textBody; try { textBody = freeMarker.processTemplate(attributes, textTemplate, theme); } catch (final FreeMarkerException e) { throw new EmailException("Failed to template plain text email.", e); } String htmlTemplate = String.format("html/%s", template); String htmlBody; try { htmlBody = freeMarker.processTemplate(attributes, htmlTemplate, theme); } catch (final FreeMarkerException e) { throw new EmailException("Failed to template html email.", e); } return new EmailTemplate(subject, textBody, htmlBody); } catch (Exception e) { throw new EmailException("Failed to template email", e); } }
Source:
public void prepare() throws IOException { e = SQLExecutor.builder(clusterService) .enableDefaultTables() .addTable("create table t (" + " id integer primary key," + " qty integer constraint check_qty_gt_zero check (qty > 0)," + " constraint check_id_ge_zero check (id >= 0)" + ")") .build(); plannerContext = e.getPlannerContext(clusterService.state()); }

Target:
public void prepare() throws IOException { e = SQLExecutor.builder(clusterService) .addTable("create table t (" + " id integer primary key," + " qty integer constraint check_qty_gt_zero check (qty > 0)," + " constraint check_id_ge_zero check (id >= 0)" + ")") .build(); plannerContext = e.getPlannerContext(clusterService.state()); }
Source:
public static void main( String[] args ) throws Exception { WebSocketImpl.DEBUG = true; ChatServer chatserver = new ChatServer( 8887 ); String STORETYPE = "JKS"; String KEYSTORE = "D:\\GitHub\\Java-WebSocket\\src\\main\\example\\keystore.jks"; String STOREPASSWORD = "storepassword"; String KEYPASSWORD = "keypassword"; KeyStore ks = KeyStore.getInstance( STORETYPE ); File kf = new File( KEYSTORE ); ks.load( new FileInputStream( kf ), STOREPASSWORD.toCharArray() ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( "SunX509" ); kmf.init( ks, KEYPASSWORD.toCharArray() ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( "SunX509" ); tmf.init( ks ); SSLContext sslContext = null; sslContext = SSLContext.getInstance( "TLS" ); sslContext.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); chatserver.setWebSocketFactory( new DefaultSSLWebSocketServerFactory( sslContext ) ); chatserver.start(); }

Target:
public static void main( String[] args ) throws Exception { WebSocketImpl.DEBUG = true; ChatServer chatserver = new ChatServer( 8887 ); String STORETYPE = "JKS"; String KEYSTORE = "keystore.jks"; String STOREPASSWORD = "storepassword"; String KEYPASSWORD = "keypassword"; KeyStore ks = KeyStore.getInstance( STORETYPE ); File kf = new File( KEYSTORE ); ks.load( new FileInputStream( kf ), STOREPASSWORD.toCharArray() ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( "SunX509" ); kmf.init( ks, KEYPASSWORD.toCharArray() ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( "SunX509" ); tmf.init( ks ); SSLContext sslContext = null; sslContext = SSLContext.getInstance( "TLS" ); sslContext.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); chatserver.setWebSocketFactory( new DefaultSSLWebSocketServerFactory( sslContext ) ); chatserver.start(); }
Source:
private void collectErrorMessages(ValidationException e, StringBuilder builder) { builder.append(e.getMessage()); if (!e.getCausingExceptions().isEmpty()) { e.getCausingExceptions().stream() .forEach(causingException -> { builder.append("\n"); collectErrorMessages(causingException, builder); }); } }

Target:
private void collectErrorMessages(ValidationException e, StringBuilder builder) { builder.append(e.getMessage()); e.getCausingExceptions().stream() .forEach(causingException -> { builder.append("\n"); collectErrorMessages(causingException, builder); }); }
Source:
static String computeKeyHash(String prefix, String namespace, byte[] key) { return prefix + ':' + DigestUtils.sha1Hex(namespace) + ':' + DigestUtils.sha1Hex(key); }

Target:
static String computeKeyHash(String prefix, String namespace, byte[] key) { return String.format("%s:%s:%s", prefix, DigestUtils.sha1Hex(namespace), DigestUtils.sha1Hex(key)); }
Source:
public static List<AssociationOrderBy> parse(String fragment, SessionFactoryImplementor factory, ColumnMapper columnMapper) { TranslationContext context = new TranslationContext() { public SessionFactoryImplementor getSessionFactory() { return factory; } public Dialect getDialect() { return factory.getServiceRegistry().getService( JdbcServices.class ).getDialect(); } public SQLFunctionRegistry getSqlFunctionRegistry() { return factory.getSqlFunctionRegistry(); } public ColumnMapper getColumnMapper() { return columnMapper; } }; GeneratedOrderByLexer lexer = new GeneratedOrderByLexer( new StringReader( fragment ) ); OrderByFragmentParser parser = new OrderByFragmentParser( lexer, context ); try { parser.orderByFragment(); } catch ( HibernateException e ) { throw e; } catch ( Throwable t ) { throw new HibernateException( "Unable to parse order-by fragment", t ); } OGMOrderByRendered rendered = new OGMOrderByRendered(); try { rendered.orderByFragment( parser.getAST() ); return rendered.getOrderByItems(); } catch (RecognitionException e) { throw new HibernateException( "Unable to render order-by fragment", e ); } }

Target:
public static List<AssociationOrderBy> parse(String fragment, SessionFactoryImplementor factory, ColumnMapper columnMapper) { TranslationContext context = new TranslationContext() { public SessionFactoryImplementor getSessionFactory() { return factory; } public Dialect getDialect() { return factory.getServiceRegistry().getService( JdbcServices.class ).getDialect(); } public SQLFunctionRegistry getSqlFunctionRegistry() { return factory.getSqlFunctionRegistry(); } public ColumnMapper getColumnMapper() { return columnMapper; } }; GeneratedOrderByLexer lexer = new GeneratedOrderByLexer( new StringReader( fragment ) ); OrderByFragmentParser parser = new OrderByFragmentParser( lexer, context ); try { parser.orderByFragment(); } catch ( HibernateException e ) { throw e; } catch ( Throwable t ) { throw log.unableToParseOrderByFragment( fragment, t ); } OGMOrderByRendered rendered = new OGMOrderByRendered(); try { rendered.orderByFragment( parser.getAST() ); return rendered.getOrderByItems(); } catch (RecognitionException e) { throw log.unableToRenderOrderByFragment( fragment, e ); } }
Source:
public AuthenticateRequest(@Provider Supplier<Credentials> splr) { authToken = splr.get(); }

Target:
AuthenticateRequest(@Provider Supplier<Credentials> splr) { authToken = splr.get(); checkNotNull(authToken.identity, "credential returned null"); }
Source:
private void verifyCacheHeaders(boolean cacheable, MockRestResponseChannel restResponseChannel) { if (cacheable) { Assert.assertTrue("Expires value should be in the future", RestUtils.getTimeFromDateString(restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)) > System.currentTimeMillis()); Assert.assertEquals("Cache-Control value not as expected", "max-age=" + FRONTEND_CONFIG.frontendCacheValiditySeconds, restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertNull("Pragma value should not have been set", restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } else { Assert.assertEquals("Expires value is incorrect for private blob", restResponseChannel.getHeader(RestUtils.Headers.DATE), restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)); Assert.assertEquals("Cache-Control value not as expected", "private, no-cache, no-store, proxy-revalidate", restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertEquals("Pragma value not as expected", "no-cache", restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } }

Target:
private void verifyCacheHeaders(boolean cacheable, MockRestResponseChannel restResponseChannel) { if (cacheable) { Assert.assertTrue("Expires value should be in the future", RestUtils.getTimeFromDateString(restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)) > System.currentTimeMillis()); Assert.assertEquals("Cache-Control value not as expected", "max-age=" + FRONTEND_CONFIG.frontendCacheValiditySeconds, restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertNull("Pragma value should not have been set", restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } else { Assert.assertEquals("Expires value is incorrect for non-cacheable blob", restResponseChannel.getHeader(RestUtils.Headers.DATE), restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)); Assert.assertEquals("Cache-Control value not as expected", "private, no-cache, no-store, proxy-revalidate", restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertEquals("Pragma value not as expected", "no-cache", restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } }
Source:
private void assertEquivalentAssignment(final Map<String, List<TaskId>> thisAssignment, final Map<String, List<TaskId>> otherAssignment) { for (final Map.Entry<String, List<TaskId>> entry : thisAssignment.entrySet()) { final String consumer = entry.getKey(); assertTrue(otherAssignment.containsKey(consumer)); final List<TaskId> thisTaskList = entry.getValue(); final List<TaskId> otherTaskList = otherAssignment.get(consumer); assertEquals(thisTaskList.size(), otherTaskList.size()); assertThat(new HashSet<>(thisTaskList), equalTo(new HashSet<>(otherTaskList))); } }

Target:
private void assertEquivalentAssignment(final Map<String, List<TaskId>> thisAssignment, final Map<String, List<TaskId>> otherAssignment) { assertEquals(thisAssignment.size(), otherAssignment.size()); for (final Map.Entry<String, List<TaskId>> entry : thisAssignment.entrySet()) { final String consumer = entry.getKey(); assertTrue(otherAssignment.containsKey(consumer)); final List<TaskId> thisTaskList = entry.getValue(); Collections.sort(thisTaskList); final List<TaskId> otherTaskList = otherAssignment.get(consumer); Collections.sort(otherTaskList); assertThat(thisTaskList, equalTo(otherTaskList)); } }
Source:
public Expression create(ExpressionConverter converter, IConfigurationElement element) { String name = element.getName(); if (name==null) return null; switch (name) { case HasFileExpression.TAG: return new HasFileExpression(element); case HasFileRecursivelyExpression.TAG: return new HasFileRecursivelyExpression(element); case HasFileWithSuffixRecursivelyExpression.TAG: return new HasFileWithSuffixRecursivelyExpression(element); case HasFolderExpression.TAG: return new HasFolderExpression(element); default: break; } return null; }

Target:
public Expression create(ExpressionConverter converter, IConfigurationElement element) { String name = element.getName(); if (name == null) { return null; } switch (name) { case HasFileExpression.TAG: return new HasFileExpression(element); case HasFileRecursivelyExpression.TAG: return new HasFileRecursivelyExpression(element); case HasFileWithSuffixRecursivelyExpression.TAG: return new HasFileWithSuffixRecursivelyExpression(element); case HasFolderExpression.TAG: return new HasFolderExpression(element); default: break; } return null; }
Source:
public List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint) { ProgramState programState = initialProgramState; if (leftOp.equals(rightOp)) { if (shouldNotInverse().equals(booleanConstraint)) { return ImmutableList.of(programState); } return ImmutableList.of(); } if (leftOp.id > 2 && rightOp.id > 2) { SymbolicValueRelation relationToFullfill = getSymbolicValueRelation(); if (relationToFullfill != null) { if (BooleanConstraint.FALSE.equals(booleanConstraint)) { relationToFullfill = relationToFullfill.inverse(); } Boolean fullFilled = programState.checkValidity(relationToFullfill); if (fullFilled == null) { programState = programState.addBinaryConstraint(relationToFullfill); } else if (!fullFilled.booleanValue()) { return ImmutableList.of(); } } } List<ProgramState> copiedConstraints = copyConstraint(leftOp, rightOp, programState, booleanConstraint); if (copiedConstraints.isEmpty()) { return ImmutableList.of(); } List<ProgramState> results = new ArrayList<>(); for (ProgramState ps : copiedConstraints) { List<ProgramState> copiedConstraintsRightToLeft = copyConstraint(rightOp, leftOp, ps, booleanConstraint); if (copiedConstraintsRightToLeft.size() == 1 && copiedConstraintsRightToLeft.get(0).equals(programState)) { results.add(programState.addConstraint(this, booleanConstraint)); } else { results.addAll(copiedConstraintsRightToLeft); } } return results; }

Target:
public List<ProgramState> setConstraint(ProgramState initialProgramState, BooleanConstraint booleanConstraint) { ProgramState programState = initialProgramState; if (leftOp.equals(rightOp)) { if (shouldNotInverse().equals(booleanConstraint)) { return ImmutableList.of(programState); } return ImmutableList.of(); } programState = checkRelation(booleanConstraint, programState); if (programState == null) { return ImmutableList.of(); } List<ProgramState> copiedConstraints = copyConstraint(leftOp, rightOp, programState, booleanConstraint); if (copiedConstraints.isEmpty()) { return ImmutableList.of(); } List<ProgramState> results = new ArrayList<>(); for (ProgramState ps : copiedConstraints) { List<ProgramState> copiedConstraintsRightToLeft = copyConstraint(rightOp, leftOp, ps, booleanConstraint); if (copiedConstraintsRightToLeft.size() == 1 && copiedConstraintsRightToLeft.get(0).equals(programState)) { results.add(programState.addConstraint(this, booleanConstraint)); } else { results.addAll(copiedConstraintsRightToLeft); } } return results; }
Source:
public void pack () { checkWidget(); int width = 0; if (buttonHandle != 0 && parent.getHeaderVisible() && !GTK.gtk_widget_get_visible(buttonHandle)) { GtkRequisition requisition = new GtkRequisition (); GTK.gtk_widget_show(buttonHandle); gtk_widget_get_preferred_size (buttonHandle, requisition); GTK.gtk_widget_hide(buttonHandle); width = requisition.width; } if ((parent.style & SWT.VIRTUAL) != 0) { boolean calcWidth = false; Rectangle itemBounds = null; int tableHeight = 0; if (parent.isVisible()) { Rectangle tableBounds = parent.getBounds(); tableHeight = tableBounds.height - parent.getHeaderHeight(); } else { calcWidth = true; } for (int i=0; i<parent.items.length; i++) { TableItem item = parent.items [i]; if (itemBounds == null && item != null) itemBounds = item.getBounds(); boolean isVisible = false; if (!calcWidth && itemBounds != null) { int itemTopBound = itemBounds.y + itemBounds.height * i + i; int itemBottomBound = itemTopBound + itemBounds.height; isVisible = (itemTopBound > 0 && itemBottomBound < tableHeight); } if (item != null && item.cached && (isVisible || calcWidth)) { width = Math.max (width, parent.calculateWidth (handle, item.handle)); } } } else { long iter = OS.g_malloc (GTK.GtkTreeIter_sizeof ()); if (GTK.gtk_tree_model_get_iter_first (parent.modelHandle, iter)) { do { width = Math.max (width, parent.calculateWidth (handle, iter)); } while (GTK.gtk_tree_model_iter_next(parent.modelHandle, iter)); } OS.g_free (iter); } setWidthInPixels(width); }

Target:
public void pack () { checkWidget(); int width = 0; if (buttonHandle != 0) { boolean hideHeader = !GTK.gtk_widget_get_visible(buttonHandle); GtkRequisition requisition = new GtkRequisition (); GTK.gtk_widget_show(buttonHandle); gtk_widget_get_preferred_size (buttonHandle, requisition); if (hideHeader) { GTK.gtk_widget_hide(buttonHandle); } width = requisition.width; } if ((parent.style & SWT.VIRTUAL) != 0) { boolean calcWidth = false; Rectangle itemBounds = null; int tableHeight = 0; if (parent.isVisible()) { Rectangle tableBounds = parent.getBounds(); tableHeight = tableBounds.height - parent.getHeaderHeight(); } else { calcWidth = true; } for (int i=0; i<parent.items.length; i++) { TableItem item = parent.items [i]; if (itemBounds == null && item != null) itemBounds = item.getBounds(); boolean isVisible = false; if (!calcWidth && itemBounds != null) { int itemTopBound = itemBounds.y + itemBounds.height * i + i; int itemBottomBound = itemTopBound + itemBounds.height; isVisible = (itemTopBound > 0 && itemBottomBound < tableHeight); } if (item != null && item.cached && (isVisible || calcWidth)) { width = Math.max (width, parent.calculateWidth (handle, item.handle)); } } } else { long iter = OS.g_malloc (GTK.GtkTreeIter_sizeof ()); if (GTK.gtk_tree_model_get_iter_first (parent.modelHandle, iter)) { do { width = Math.max (width, parent.calculateWidth (handle, iter)); } while (GTK.gtk_tree_model_iter_next(parent.modelHandle, iter)); } OS.g_free (iter); } setWidthInPixels(width); }
Source:
private void initializeCtrlTaskContextId() { if (dolphinDriver == null) { throw new RuntimeException("Cannot resolve ctrlTaskContextId because InjectionFuture<DolphinDriver> is null"); } ctrlTaskContextId = dolphinDriver.get().getCtrlTaskContextId(); }

Target:
private void initializeCtrlTaskContextId() { ctrlTaskContextId = dolphinDriver.get().getCtrlTaskContextId(); }
Source:
public void disableTemperatureNotifications() { BluetoothLeGattCharacteristic tempValueChar; try { tempValueChar = this.gattServices.get(TEMPERATURE) .findCharacteristic(TiSensorTagGatt.UUID_TEMP_SENSOR_VALUE); tempValueChar.disableValueNotifications(); } catch (KuraException e) { logger.error("Temperature notification disable failed", e); } }

Target:
public boolean disableTemperatureNotifications() { boolean result = false; BluetoothLeGattCharacteristic tempValueChar; try { tempValueChar = this.gattServices.get(TEMPERATURE) .findCharacteristic(TiSensorTagGatt.UUID_TEMP_SENSOR_VALUE); tempValueChar.disableValueNotifications(); result = true; } catch (KuraException e) { logger.error("Temperature notification disable failed", e); } return result; }
Source:
private void addConfigurationFields() { Group configGroup = Form.createGroup(this, 2, Messages.getString("DataBricksInfoForm.text.configuration"), 110); configGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); labelledCombo = new LabelledCombo(configGroup, "Cloud provider", "", cloudProviders); endpointText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.endPoint"), 1); clusterIDText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.clusterID"), 1); tokenText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.token"), 1, SWT.PASSWORD | SWT.BORDER | SWT.SINGLE); dbfsDepFolderText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.dbfsDepFolder"), 1); }

Target:
private void addConfigurationFields() { Group configGroup = Form.createGroup(this, 2, Messages.getString("DataBricksInfoForm.text.configuration"), 110); configGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); cloudProviderCombo = new LabelledCombo(configGroup, Messages.getString("DataBricksInfoForm.text.cloudProvider"), "", getProviders()); endpointText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.endPoint"), 1); clusterIDText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.clusterID"), 1); tokenText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.token"), 1, SWT.PASSWORD | SWT.BORDER | SWT.SINGLE); dbfsDepFolderText = new LabelledText(configGroup, Messages.getString("DataBricksInfoForm.text.dbfsDepFolder"), 1); }
Source:
private static <B extends Message.Builder> Class<B> getBuilderForType(TypeUrl typeUrl) { Class<B> builderClass; final String className = KnownTypes.getClassName(typeUrl) .value(); try { builderClass = (Class<B>) Class.forName(className) .getClasses()[0]; } catch (ClassNotFoundException e) { final String message = String.format( "Class for name %s could not be found. Try to rebuild the project. Make sure \"known_types.properties\" exists.", className); log().warn(message, e); builderClass = null; } catch (ClassCastException e) { final String message = String.format( "Class %s Must be assignable from com.google.protobuf.Message. Try to rebuild the project. Make sure type URL is valid.", className); log().warn(message, e); builderClass = null; } return builderClass; }

Target:
private static <B extends Message.Builder> Class<B> getBuilderForType(TypeUrl typeUrl) { Class<B> builderClass; final String className = KnownTypes.getClassName(typeUrl) .value(); try { builderClass = (Class<B>) Class.forName(className) .getClasses()[0]; } catch (ClassNotFoundException e) { final String message = String.format( BUILDER_CLASS_ERROR_LOGGING_PATTERN, className); log().warn(message, e); builderClass = null; } catch (ClassCastException e) { final String message = String.format( TYPE_CAST_ERROR_LOGGING_PATTERN, className); log().warn(message, e); builderClass = null; } return builderClass; }
Source:
void initTable(ApplicationConstants constants) { TextColumnWithTooltip<event_subscriber> eventNameColumn = new EnumColumn<event_subscriber, AuditLogType>() { @Override protected AuditLogType getRawValue(event_subscriber object) { return Enum.valueOf(AuditLogType.class, object.getevent_up_name()); } }; eventNameColumn.makeSortable(new Comparator<event_subscriber>() { @Override public int compare(event_subscriber o1, event_subscriber o2) { return new LexoNumericComparator().compare(o1.getevent_up_name(), o2.getevent_up_name()); } }); getTable().addColumn(eventNameColumn, constants.eventNameEventNotifier()); getTable().addActionButton(new WebAdminButtonDefinition<event_subscriber>(constants.manageEventsEventNotifier()) { @Override protected UICommand resolveCommand() { return getDetailModel().getManageEventsCommand(); } }); }

Target:
void initTable(ApplicationConstants constants) { TextColumnWithTooltip<event_subscriber> eventNameColumn = new EnumColumn<event_subscriber, AuditLogType>() { @Override protected AuditLogType getRawValue(event_subscriber object) { return Enum.valueOf(AuditLogType.class, object.getevent_up_name()); } }; eventNameColumn.makeSortable(new Comparator<event_subscriber>() { private final LexoNumericComparator lexoNumericComparator = new LexoNumericComparator(); @Override public int compare(event_subscriber o1, event_subscriber o2) { return lexoNumericComparator.compare(o1.getevent_up_name(), o2.getevent_up_name()); } }); getTable().addColumn(eventNameColumn, constants.eventNameEventNotifier()); getTable().addActionButton(new WebAdminButtonDefinition<event_subscriber>(constants.manageEventsEventNotifier()) { @Override protected UICommand resolveCommand() { return getDetailModel().getManageEventsCommand(); } }); }
Source:
public void beginTrainingWithTrainingLabelsForJPGTrainingSet(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormTrainingAsyncClient(httpClient, serviceVersion); beginTrainingLabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> trainingPoller = client.beginTraining(trainingFilesUrl, useTrainingLabels).getSyncPoller(); trainingPoller.waitForCompletion(); validateCustomModelData(trainingPoller.getFinalResult(), true); }); }

Target:
public void beginTrainingWithTrainingLabelsForJPGTrainingSet(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormTrainingAsyncClient(httpClient, serviceVersion); beginTrainingLabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> trainingPoller = client.beginTraining(trainingFilesUrl, useTrainingLabels, null, durationTestMode).getSyncPoller(); trainingPoller.waitForCompletion(); validateCustomModelData(trainingPoller.getFinalResult(), true); }); }