auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<Pair<Germplasm, Name>> getPairs(final CrossSetting crossSetting, final ImportedCrossesList importedCrossesList, final Integer userId, final Workbook workbook) { for (final ImportedCrosses importedCross : importedCrossesList.getImportedCrosses()) { if (importedCross.getSource() == null || StringUtils.isEmpty(importedCross.getSource()) || importedCross.getSource().equalsIgnoreCase(ImportedCrosses.NO_SEED_SOURCE)) { final GermplasmOriginGenerationParameters parameters = this.germplasmOriginParameterBuilder.build(workbook, importedCross); final String generatedSource = this.germplasmOriginGenerationService.generateOriginString(parameters); importedCross.setSource(generatedSource); } } final List<Pair<Germplasm, Name>> germplasmPairs = this.generateGermplasmNamePairs(crossSetting, importedCrossesList.getImportedCrosses(), userId, importedCrossesList.hasPlotDuplicate()); final List<Germplasm> germplasmList = this.extractGermplasmList(germplasmPairs); final Integer crossingNameTypeId = this.getIDForUserDefinedFieldCrossingName(); CrossingUtil.applyBreedingMethodSetting(this.germplasmDataManager, crossSetting, germplasmList); CrossingUtil.applyMethodNameType(this.germplasmDataManager, germplasmPairs, crossingNameTypeId); final boolean isValid = this.verifyGermplasmMethodPresent(germplasmList); if (!isValid) { throw new MiddlewareQueryException(this.messageSource.getMessage("error.save.cross.methods.unavailable", new Object[] {}, Locale.getDefault())); } return germplasmPairs; }

Target:
private List<Pair<Germplasm, Name>> getPairs(final CrossSetting crossSetting, final ImportedCrossesList importedCrossesList, final Integer userId, final Workbook workbook) { for (final ImportedCrosses importedCross : importedCrossesList.getImportedCrosses()) { if (importedCross.getSource() == null || StringUtils.isEmpty(importedCross.getSource()) || importedCross.getSource().equalsIgnoreCase(ImportedCrosses.NO_SEED_SOURCE)) { final GermplasmOriginGenerationParameters parameters = this.germplasmOriginParameterBuilder.build(workbook, importedCross); final String generatedSource = this.germplasmOriginGenerationService.generateOriginString(parameters); importedCross.setSource(generatedSource); } } final List<Pair<Germplasm, Name>> germplasmNamePairs = this.generateGermplasmNamePairs(crossSetting, importedCrossesList.getImportedCrosses(), userId, importedCrossesList.hasPlotDuplicate()); final List<Germplasm> germplasmList = this.extractGermplasmList(germplasmNamePairs); final Integer crossingNameTypeId = this.getIDForUserDefinedFieldCrossingName(); CrossingUtil.applyBreedingMethodSetting(this.germplasmDataManager, crossSetting, germplasmList); CrossingUtil.applyMethodNameType(this.germplasmDataManager, germplasmNamePairs, crossingNameTypeId); this.verifyGermplasmMethodPresent(germplasmList); return germplasmNamePairs; }
Source:
public static String getIdentifiableComponentName(Component component) throws IllegalStateException { if (component.getAlias() != null) { return component.getAlias(); } switch (component.getType()) { case EDITOR_COMPONENT_TYPE: case PLUGIN_COMPONENT_TYPE: return component.getId(); case DOCKERIMAGE_COMPONENT_TYPE: return component.getImage(); case KUBERNETES_COMPONENT_TYPE: case OPENSHIFT_COMPONENT_TYPE: String reference = component.getReference(); if (reference != null) { return reference; } else { return component.getType(); } default: throw new IllegalStateException( format("Unhandled component type: %s", component.getType())); } }

Target:
public static String getIdentifiableComponentName(Component component) throws IllegalStateException { if (component.getAlias() != null) { return component.getAlias(); } switch (component.getType()) { case EDITOR_COMPONENT_TYPE: case PLUGIN_COMPONENT_TYPE: return component.getId(); case DOCKERIMAGE_COMPONENT_TYPE: return component.getImage(); case KUBERNETES_COMPONENT_TYPE: case OPENSHIFT_COMPONENT_TYPE: String reference = component.getReference(); return reference == null ? component.getType() : reference; default: throw new IllegalStateException( format("Unhandled component type: %s", component.getType())); } }
Source:
public <C> C unwrap(Class<C> type) { if ( type.isAssignableFrom( HibernateConstraintViolation.class ) ) { return type.cast( this ); } throw log.getTypeNotSupportedForUnwrappingException( type ); }

Target:
public <C> C unwrap(Class<C> type) { if ( type.isAssignableFrom( ConstraintViolation.class ) ) { return type.cast( this ); } if ( type.isAssignableFrom( HibernateConstraintViolation.class ) ) { return type.cast( this ); } throw log.getTypeNotSupportedForUnwrappingException( type ); }
Source:
public CliCommand init(final Arguments args) throws Exception { this.userId = args.getId(); if (this.userId == null) { throw new MissingOptionException("The get_user command requires '-i' to be set with the username or Id"); } return this; }

Target:
public CliCommand init(final Arguments args) throws Exception { this.userId = args.getId(); if (Guard.isStringNullOrEmpty(this.userId)) { throw new MissingOptionException("The get_user command requires '-i' to be set with the username or Id"); } return this; }
Source:
public void clean() throws GitException, InterruptedException { reset(true); String cmd = "-fdx"; launchCommand("clean", cmd); }

Target:
public void clean() throws GitException, InterruptedException { this.clean(false); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); httpSession.setAttribute( FiltersHelper.Constants.AUTHENTICATED_KEY, FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, parameters) .getSucceeded() ); } finally { FiltersHelper.closeContext(ctx); } } } chain.doFilter(request, response); } catch (Exception ex) { String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.SESSION_ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); VdcQueryReturnValue returnValue = FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, parameters); if (!returnValue.getSucceeded()) { httpSession.removeAttribute(FiltersHelper.Constants.SESSION_ENGINE_SESSION_ID_KEY); } else { httpSession.setAttribute(FiltersHelper.Constants.SESSSION_USER_KEY, returnValue.getReturnValue()); } } finally { ctx.close(); } } } chain.doFilter(request, response); } catch (Exception ex) { String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
Source:
public RowExpressionService getRowExpressionService() { return new RowExpressionService() { @Override public DomainTranslator getDomainTranslator() { return domainTranslator; } @Override public ExpressionOptimizer getExpressionOptimizer() { return new RowExpressionOptimizer(metadata); } @Override public PredicateCompiler getPredicateCompiler() { return predicateCompiler; } @Override public DeterminismEvaluator getDeterminismEvaluator() { return determinismEvaluator; } @Override public String formatRowExpression(ConnectorSession session, RowExpression expression) { return new RowExpressionFormatter(functionManager).formatRowExpression(session, expression); } @Override public Object optimizeRowExpression(ConnectorSession session, RowExpression expression, Function<VariableReferenceExpression, Object> variableResolver, ExpressionOptimizer.Level optimizationLevel) { return new RowExpressionInterpreter(expression, metadata, session, optimizationLevel).optimize(variableResolver::apply); } }; }

Target:
public RowExpressionService getRowExpressionService() { return new RowExpressionService() { @Override public DomainTranslator getDomainTranslator() { return domainTranslator; } @Override public ExpressionOptimizer getExpressionOptimizer() { return new RowExpressionOptimizer(metadata); } @Override public PredicateCompiler getPredicateCompiler() { return predicateCompiler; } @Override public DeterminismEvaluator getDeterminismEvaluator() { return determinismEvaluator; } @Override public String formatRowExpression(ConnectorSession session, RowExpression expression) { return new RowExpressionFormatter(functionManager).formatRowExpression(session, expression); } }; }
Source:
public void tearDown() throws Exception { super.tearDown(); if (editor != null) { editor.close(false); editor = null; } }

Target:
public void tearDown() throws Exception { super.tearDown(); editor.close(false); editor= null; }
Source:
private RuleApplication applyRule() { SymbolAllocator symbolAllocator = new SymbolAllocator(symbols); Memo memo = new Memo(idAllocator, plan); Lookup lookup = Lookup.from(memo::resolve); Optional<PlanNode> result = inTransaction(session -> rule.apply(memo.getNode(memo.getRootGroup()), lookup, idAllocator, symbolAllocator, session)); return new RuleApplication( memo, lookup, symbolAllocator.getTypes(), result); }

Target:
private RuleApplication applyRule() { SymbolAllocator symbolAllocator = new SymbolAllocator(symbols); Memo memo = new Memo(idAllocator, plan); Lookup lookup = Lookup.from(memo::resolve); Optional<PlanNode> result = inTransaction(session -> rule.apply(memo.getNode(memo.getRootGroup()), lookup, idAllocator, symbolAllocator, session)); return new RuleApplication(lookup, symbolAllocator.getTypes(), result); }
Source:
public void downloadBlob(String container, String name, File destination, ExecutorService executor) { ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor); RandomAccessFile raf = null; File tempFile = new File(destination.getName() + "." + UUID.randomUUID()); try { long contentLength = api .getObjectApi(regionId, container) .getWithoutBody(name) .getPayload() .getContentMetadata() .getContentLength(); raf = new RandomAccessFile(tempFile, "rw"); raf.seek(contentLength - 1); raf.write(0); long partSize = getMinimumMultipartPartSize(); long from; long to; List<ListenableFuture<Void>> results = new ArrayList<ListenableFuture<Void>>(); for (from = 0; from < contentLength; from = from + partSize) { to = (from + partSize >= contentLength) ? contentLength - 1 : from + partSize - 1; BlobDownloader b = new BlobDownloader(regionId, container, name, raf, from, to); results.add(listeningExecutor.submit(b)); } Futures.getUnchecked(Futures.allAsList(results)); raf.getChannel().force(true); raf.getChannel().close(); raf.close(); if ( destination.exists() ) destination.delete(); if ( !tempFile.renameTo(destination) ) { throw new RuntimeException("Could not move temporary downloaded file to destination " + destination); } tempFile = null; } catch (IOException e) { throw new RuntimeException(e); } finally { Closeables2.closeQuietly(raf); if (tempFile != null) { tempFile.delete(); } } }

Target:
public void downloadBlob(String container, String name, File destination, ExecutorService executor) { ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor); RandomAccessFile raf = null; File tempFile = new File(destination.getName() + "." + UUID.randomUUID()); try { long contentLength = api .getObjectApi(regionId, container) .getWithoutBody(name) .getPayload() .getContentMetadata() .getContentLength(); raf = new RandomAccessFile(tempFile, "rw"); raf.seek(contentLength - 1); raf.write(0); long partSize = getMinimumMultipartPartSize(); long from; long to; List<ListenableFuture<Void>> results = new ArrayList<ListenableFuture<Void>>(); for (from = 0; from < contentLength; from = from + partSize) { to = (from + partSize >= contentLength) ? contentLength - 1 : from + partSize - 1; BlobDownloader b = new BlobDownloader(regionId, container, name, raf, from, to); results.add(listeningExecutor.submit(b)); } Futures.getUnchecked(Futures.allAsList(results)); raf.getChannel().force(true); raf.getChannel().close(); raf.close(); if (destination.exists()) { destination.delete(); } if (!tempFile.renameTo(destination)) { throw new RuntimeException("Could not move temporary downloaded file to destination " + destination); } tempFile = null; } catch (IOException e) { throw new RuntimeException(e); } finally { Closeables2.closeQuietly(raf); if (tempFile != null) { tempFile.delete(); } } }
Source:
public FunctionStatus getFunctionStatus(final String name) throws CatalogException { if (isClosed) { throw new CatalogException("Catalog is closed."); } try { return queue .execute( new SQLiteJob<FunctionStatus>() { @Override protected FunctionStatus job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException { try { SQLiteStatement statement = sqliteConnection.prepare( "SELECT function_name, function_description, function_outputType, function_isMultivalued, function_lang FROM registered_functions WHERE function_name=?"); statement.bind(1, name); if (!statement.step()) { return null; } String name = statement.columnString(0); String descrip = statement.columnString(1); String outputSchema = statement.columnString(2); Boolean isMultivalued = ((statement.columnInt(3) == 0) ? false : true); int lang = statement.columnInt(4); statement.dispose(); return new FunctionStatus( name, descrip, outputSchema, isMultivalued, MyriaConstants.FunctionLanguage.values()[lang], null); } catch (final SQLiteException e) { throw new CatalogException(e); } } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }

Target:
public FunctionStatus getFunctionStatus(final String name) throws CatalogException { if (isClosed) { throw new CatalogException("Catalog is closed."); } try { return queue .execute( new SQLiteJob<FunctionStatus>() { @Override protected FunctionStatus job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException { try { SQLiteStatement statement = sqliteConnection.prepare( "SELECT function_name, function_description, function_outputType, function_isMultiValued, function_lang FROM registered_functions WHERE function_name=?"); statement.bind(1, name); if (!statement.step()) { return null; } String name = statement.columnString(0); String descrip = statement.columnString(1); String outputType = statement.columnString(2); Boolean isMultiValued = ((statement.columnInt(3) == 0) ? false : true); int lang = statement.columnInt(4); statement.dispose(); return new FunctionStatus( name, descrip, outputType, isMultiValued, FunctionLanguage.values()[lang], null); } catch (final SQLiteException e) { throw new CatalogException(e); } } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }
Source:
public AbstractJackson2MessageConverter(ObjectMapper objectMapper, MimeType contentType, String... trustedPackages) { Assert.notNull(objectMapper, "'objectMapper' must not be null"); this.objectMapper = objectMapper; this.contentType = contentType; ((DefaultJackson2JavaTypeMapper) this.javaTypeMapper).setTrustedPackages(trustedPackages); }

Target:
protected AbstractJackson2MessageConverter(ObjectMapper objectMapper, MimeType contentType, String... trustedPackages) { Assert.notNull(objectMapper, "'objectMapper' must not be null"); Assert.notNull(contentType, "'contentType' must not be null"); this.objectMapper = objectMapper; this.contentType = contentType; ((DefaultJackson2JavaTypeMapper) this.javaTypeMapper).setTrustedPackages(trustedPackages); }
Source:
public void testPrepareFailure() { failureInterceptor.enable(); try { Exceptions.expectException(CacheException.class, () -> cache("LON", 0).put("k", "v")); } finally { failureInterceptor.disable(); } assertNull(cache("LON",0).get("k")); assertNull(cache("LON",1).get("k")); assertNull(backup("LON").get("k")); assertEquals(0, txTable(cache("LON", 0)).getLocalTransactions().size()); assertEquals(0, txTable(cache("LON", 1)).getLocalTransactions().size()); assertEquals(0, txTable(backup("LON")).getLocalTransactions().size()); }

Target:
public void testPrepareFailure() { failureInterceptor.enable(); try { Exceptions.expectException(CacheException.class, RollbackException.class, () -> cache("LON", 0).put("k", "v")); } finally { failureInterceptor.disable(); } assertNull(cache("LON",0).get("k")); assertNull(cache("LON",1).get("k")); assertNull(backup("LON").get("k")); assertEquals(0, txTable(cache("LON", 0)).getLocalTransactions().size()); assertEquals(0, txTable(cache("LON", 1)).getLocalTransactions().size()); assertEquals(0, txTable(backup("LON")).getLocalTransactions().size()); }
Source:
public int hashCode() { int result = inv.hashCode(); result = 31 * result + (side == null ? 0 : side.hashCode()); return result; }

Target:
public int hashCode() { int result = inv.hashCode(); result = 31 * result + Objects.hashCode(side); return result; }
Source:
public boolean isInternal() { return isInternal(this.name); }

Target:
public boolean isInternal() { return this.internal; }
Source:
public void setup(Method method) throws Exception { logger.info("test name: " + method.getName()); KerberosHelper.loginFromKeytab(MerlinConstants.CURRENT_USER_NAME); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setProcessWorkflow(aggregateWorkflowDir); }

Target:
public void setup(Method method) throws Exception { logger.info("test name: " + method.getName()); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setProcessWorkflow(aggregateWorkflowDir); }
Source:
private boolean isRequestEnabled(RequestOrResponseType requestType, PartitionId id) { Set<PartitionId> requestDisableInfo = requestsDisableInfo.get(requestType); if (requestDisableInfo != null && requestDisableInfo.contains(id)) { return false; } if (serverConfig.serverValidateRequestBasedOnStoreState) { Store store = storeManager.getStore(id); if (requestType == RequestOrResponseType.PutRequest && !POST_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { logger.error("{} is not allowed because current state of store is {}", requestType, id, store.getCurrentState()); return false; } if (UPDATE_REQUEST_TYPES.contains(requestType) && !UPDATE_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { logger.error("{} is not allowed because current state of store is {}", requestType, id, store.getCurrentState()); return false; } } return true; }

Target:
private boolean isRequestEnabled(RequestOrResponseType requestType, PartitionId id) { Set<PartitionId> requestDisableInfo = requestsDisableInfo.get(requestType); if (requestDisableInfo != null && requestDisableInfo.contains(id)) { return false; } if (serverConfig.serverValidateRequestBasedOnStoreState) { Store store = storeManager.getStore(id); if (requestType == RequestOrResponseType.PutRequest && !PUT_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { logger.warn("{} is not allowed because current state of store is {}", requestType, id, store.getCurrentState()); return false; } if (UPDATE_REQUEST_TYPES.contains(requestType) && !UPDATE_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { logger.warn("{} is not allowed because current state of store is {}", requestType, id, store.getCurrentState()); return false; } } return true; }
Source:
private void placeBreadcrumbFile( String folderPath, boolean success ) { String ext = ERROR; if ( success ) { ext = OK; } String breadcrumbFilename = folderPath + WI_STATUS + ext; File breadcrumb = new File( breadcrumbFilename ); try { if ( !breadcrumb.createNewFile() ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } } catch ( IOException e ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } }

Target:
private void placeBreadcrumbFile( String folderPath, boolean success ) { String ext = ERROR; if ( success ) { ext = OK; } File breadcrumb = new File( folderPath, WI_STATUS + ext ); try { if ( !breadcrumb.createNewFile() ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } } catch ( IOException e ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } }
Source:
public BitmapObjectFilter(BitmapBuilder bitmap) { this.bitmap = bitmap; }

Target:
BitmapObjectFilter(BitmapBuilder bitmap) { this.bitmap = bitmap; }
Source:
private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, BeanDefinitionRegistry registry, DubboClassPathBeanDefinitionScanner scanner) { Class<?> beanClass = resolveClass(beanDefinitionHolder); Service service = findAnnotation(beanClass, Service.class); Class<?> interfaceClass = resolveServiceInterfaceClass(beanClass, service); String annotatedServiceBeanName = beanDefinitionHolder.getBeanName(); AbstractBeanDefinition serviceBeanDefinition = buildServiceBeanDefinition(service, interfaceClass, annotatedServiceBeanName); String beanName = generateServiceBeanName(service, interfaceClass, annotatedServiceBeanName); if (scanner.checkCandidate(beanName, serviceBeanDefinition)) { registry.registerBeanDefinition(beanName, serviceBeanDefinition); if (logger.isInfoEnabled()) { logger.warn("The BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean has been registered with name : " + beanName); } } else { if (logger.isWarnEnabled()) { logger.warn("The Duplicated BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean[ bean name : " + beanName + "] was be found , Did @DubboComponentScan scan to same package in many times?"); } } }

Target:
private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, BeanDefinitionRegistry registry, DubboClassPathBeanDefinitionScanner scanner) { Class<?> beanClass = resolveClass(beanDefinitionHolder); Service service = findAnnotation(beanClass, Service.class); Class<?> interfaceClass = resolveServiceInterfaceClass(beanClass, service); String annotatedServiceBeanName = beanDefinitionHolder.getBeanName(); AbstractBeanDefinition serviceBeanDefinition = buildServiceBeanDefinition(service, interfaceClass, annotatedServiceBeanName); String beanName = generateServiceBeanName(service, interfaceClass, annotatedServiceBeanName); if (scanner.checkCandidate(beanName, serviceBeanDefinition)) { registry.registerBeanDefinition(beanName, serviceBeanDefinition); if (logger.isInfoEnabled()) { logger.info("The BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean has been registered with name : " + beanName); } } else { if (logger.isWarnEnabled()) { logger.warn("The Duplicated BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean[ bean name : " + beanName + "] was be found , Did @DubboComponentScan scan to same package in many times?"); } } }
Source:
public Clamp() { BooleanOutput leftClamp = Igneous.makeSolenoid(0); BooleanOutput rightClamp = Igneous.makeSolenoid(1); openControl = BooleanMixing.combine(leftClamp, rightClamp); heightControl = new FloatStatus(); min = new FloatStatus(0.0f); max = new FloatStatus(1.0f); FloatInputPoll encoder = Igneous.makeEncoder(0, 0, Igneous.MOTOR_FORWARD); FloatOutput speedControl = Igneous.makeTalonMotor(2, Igneous.MOTOR_FORWARD, 1.0f); BooleanInputPoll inputLimitTop = Igneous.makeDigitalInput(0); BooleanInputPoll inputLimitBottom = Igneous.makeDigitalInput(1); EventInput limitTop = EventMixing.filterEvent(inputLimitTop, true, Igneous.constantPeriodic); EventInput limitBottom = EventMixing.filterEvent(inputLimitBottom, true, Igneous.constantPeriodic); FloatMixing.pumpWhen(limitTop, encoder, max); FloatMixing.pumpWhen(limitBottom, encoder, min); PIDControl pid = new PIDControl(FloatMixing.normalizeFloat(encoder, min, max), (FloatStatus)heightControl, FloatMixing.always(1.0f), FloatMixing.always(0.0f), FloatMixing.always(0.0f)); Igneous.constantPeriodic.send(pid); pid.send(speedControl); }

Target:
public Clamp() { FloatStatus height = new FloatStatus(); heightControl = height; FloatInputPoll encoder = Igneous.makeEncoder(0, 1, false); FloatOutput speedControl = Igneous.makeTalonMotor(2, Igneous.MOTOR_REVERSE, 0.1f); EventInput limitTop = EventMixing.filterEvent(Igneous.makeDigitalInput(2), true, Igneous.constantPeriodic); EventInput limitBottom = EventMixing.filterEvent(Igneous.makeDigitalInput(3), true, Igneous.constantPeriodic); TuningContext context = new TuningContext("Clamp").publishSavingEvent(); FloatStatus min = context.getFloat("clamp-min", 0.0f); FloatStatus max = context.getFloat("clamp-max", 1.0f); FloatMixing.pumpWhen(limitTop, encoder, max); FloatMixing.pumpWhen(limitBottom, encoder, min); FloatStatus p = context.getFloat("clamp-p", 1.0f); FloatStatus i = context.getFloat("clamp-i", 0.0f); FloatStatus d = context.getFloat("clamp-d", 0.0f); PIDControl pid = new PIDControl(FloatMixing.normalizeFloat(encoder, min, max), height, p, i, d); Igneous.constantPeriodic.send(pid); pid.send(speedControl); }
Source:
private void setSegmentStatesAndEndOffsets() throws IOException { LogSegment firstSegment = log.getSegmentIterator().next().getValue(); firstSegment.setEndOffset(index.getCurrentEndOffset()); log.setActiveSegment(firstSegment.getName()); }

Target:
private void setSegmentStatesAndEndOffsets() throws IOException { LogSegment firstSegment = log.getFirstSegment(); firstSegment.setEndOffset(index.getCurrentEndOffset()); log.setActiveSegment(firstSegment.getName()); }
Source:
public static ParsingOptions createParsingOptions(Session session) { return new ParsingOptions(isParseDecimalLiteralsAsDouble(session)); }

Target:
public static ParsingOptions createParsingOptions(Session session) { return new ParsingOptions(isParseDecimalLiteralsAsDouble(session) ? AS_DOUBLE : AS_DECIMAL); }
Source:
private Boolean checkErrorLogMessage(SWTBotView logViewBot) { logViewBot.show(); SWTBotTree treeError = logViewBot.bot().tree(); String errorMessage = "Compilation error for expression \"service:monServiceQuiNexistePas\" : Cannot find method monServiceQuiNexistePas"; for (SWTBotTreeItem treeItem : treeError.getAllItems()) { if (errorMessage.equals(treeItem.getText())) { return true; } } return false; }

Target:
private Boolean checkErrorLogMessage(SWTBotView logViewBot) { logViewBot.show(); SWTBotTree treeError = logViewBot.bot().tree(); String errorMessage = "Compilation error for expression \"service:myImaginaryService\" : Cannot find method myImaginaryService"; for (SWTBotTreeItem treeItem : treeError.getAllItems()) { if (errorMessage.equals(treeItem.getText())) { return true; } } return false; }
Source:
private void parseCommandLine() { try { String[] args = Platform.getCommandLineArgs(); String ip = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTIP_KEY); if (StringUtils.isNotEmpty(ip)) { System.setProperty(EnvConstants.CLIENTIP_KEY, ip); } String port = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTPORT_KEY); if (StringUtils.isNotEmpty(port)) { System.setProperty(EnvConstants.CLIENTPORT_KEY, port); } } catch (Throwable e) { System.out.println(e.getLocalizedMessage()); e.printStackTrace(System.out); } }

Target:
private void parseCommandLine() { String[] args = Platform.getCommandLineArgs(); String ip = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTIP_KEY); if (StringUtils.isNotEmpty(ip)) { System.setProperty(EnvConstants.CLIENTIP_KEY, ip); } String port = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTPORT_KEY); if (StringUtils.isNotEmpty(port)) { System.setProperty(EnvConstants.CLIENTPORT_KEY, port); } }
Source:
private void optionsChanged() { if ((inMemStats == null) == this.getStatsParam().isInMemoryEnabled()) { if (inMemStats == null) { logger.info("Start recording in memory stats"); inMemStats = new InMemoryStats(); Stats.addListener(inMemStats); } else { logger.info("Stop recording in memory stats"); Stats.removeListener(inMemStats); inMemStats = null; } } if ((statsd == null) == this.getStatsParam().isStatsdEnabled()) { if (statsd == null) { logger.info("Start sending stats to statsd server"); try { statsd = new Statsd( this.getStatsParam().getStatsdHost(), this.getStatsParam().getStatsdPort(), this.getStatsParam().getStatsdPrefix()); Stats.addListener(statsd); } catch (Exception e) { logger.error(e.getMessage(), e); } } else { logger.info("Stop sending stats to statsd server"); Stats.removeListener(statsd); statsd = null; } } else if (statsd != null) { statsd.setPrefix(this.getStatsParam().getStatsdPrefix()); } }

Target:
private void optionsChanged() { boolean inMemStatsInit = inMemStats != null; if (inMemStatsInit != this.getStatsParam().isInMemoryEnabled()) { if (!inMemStatsInit) { LOG.info("Start recording in memory stats"); inMemStats = new InMemoryStats(); Stats.addListener(inMemStats); } else { LOG.info("Stop recording in memory stats"); Stats.removeListener(inMemStats); inMemStats.allCleared(); inMemStats = null; } } boolean statsdInit = statsd != null; if (statsdInit != this.getStatsParam().isStatsdEnabled()) { if (! statsdInit) { LOG.info("Start sending stats to statsd server"); try { statsd = newStatsD(this.getStatsParam()); Stats.addListener(statsd); } catch (Exception e) { LOG.error(e.getMessage(), e); } } else { LOG.info("Stop sending stats to statsd server"); Stats.removeListener(statsd); statsd = null; } } else if (statsdInit) { if (! StringUtils.equals(this.getStatsParam().getStatsdHost(), statsd.getHost()) || this.getStatsParam().getStatsdPort() != statsd.getPort()) { LOG.info("Restart sending stats to statsd server"); try { Stats.removeListener(statsd); statsd = newStatsD(this.getStatsParam()); Stats.addListener(statsd); } catch (Exception e) { LOG.error(e.getMessage(), e); } } else if (! StringUtils.equals(this.getStatsParam().getStatsdPrefix(), statsd.getPrefix())) { statsd.setPrefix(this.getStatsParam().getStatsdPrefix()); } } }
Source:
private Function<PollingContext<DeletedCertificate>, Mono<PollResponse<DeletedCertificate>>> createDeletePollOperation(String keyName) { return pollingContext -> withContext(context -> service.getDeletedCertificatePoller(vaultUrl, keyName, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .flatMap(deletedKeyResponse -> { if (deletedKeyResponse.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, deletedKeyResponse.getValue()))); })) .onErrorReturn(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue())); }

Target:
private Function<PollingContext<DeletedCertificate>, Mono<PollResponse<DeletedCertificate>>> createDeletePollOperation(String keyName) { return pollingContext -> withContext(context -> service.getDeletedCertificatePoller(vaultUrl, keyName, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .flatMap(deletedCertificateResponse -> { if (deletedCertificateResponse.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, deletedCertificateResponse.getValue()))); })) .onErrorReturn(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue())); }
Source:
public void setBranchName(String branchName) { this.branchName = branchName; if (nameText != null) nameText.setText(branchName); }

Target:
public void setBranchName(String branchName) { this.branchName = branchName; if (nameText != null) { nameText.setText(branchName); } }
Source:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) { out.println(MessageFormat.format( CLIText.get().noRemoteUriUnsubscribe, remote)); return; } String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null || !p.removeSubscriber(remote, dir)) { out.println(MessageFormat.format( CLIText.get().subscriptionDoesNotExist, remote)); return; } if (p.getSubscribers().size() == 0) pubsubConfig.removePublisher(p); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { out.println(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); return; } out.println(MessageFormat.format( CLIText.get().didUnsubscribe, remote, uriRoot)); }

Target:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) throw die(MessageFormat.format( CLIText.get().noRemoteUriUnsubscribe, remote)); String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null || !p.removeSubscriber(remote, dir)) throw die(MessageFormat.format( CLIText.get().subscriptionDoesNotExist, remote)); if (p.getSubscribers().size() == 0) pubsubConfig.removePublisher(p); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { throw die(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); } out.println(MessageFormat.format( CLIText.get().didUnsubscribe, remote, uriRoot)); }
Source:
public List<String> subscribeChildChanges(String path, IZkChildListener listener) { if (!checkIfPathBelongsToZkRealm(path)) { throw new IllegalArgumentException( "The given path does not map to the ZK realm for this DedicatedZkClient! Path: " + path + " ZK realm sharding key: " + _zkRealmShardingKey); } return _innerSharedZkClient.subscribeChildChanges(path, listener); }

Target:
public List<String> subscribeChildChanges(String path, IZkChildListener listener) { checkIfPathContainsShardingKey(path); return _innerSharedZkClient.subscribeChildChanges(path, listener); }
Source:
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException { final String storeType = indexSettings.getSettings() .get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), IndexModule.Type.FS.getSettingsKey()); IndexModule.Type type; if (IndexModule.Type.FS.match(storeType)) { type = IndexModule.defaultStoreType( IndexModule.NODE_STORE_ALLOW_MMAP.get(indexSettings.getNodeSettings(), Settings.EMPTY)); } else { type = IndexModule.Type.fromSettingsKey(storeType); } switch (type) { case HYBRIDFS: final FSDirectory primaryDirectory = FSDirectory.open(location, lockFactory); if (primaryDirectory instanceof MMapDirectory) { return new HybridDirectory(location, lockFactory, primaryDirectory); } else { return primaryDirectory; } case MMAPFS: return new MMapDirectory(location, lockFactory); case SIMPLEFS: return new SimpleFSDirectory(location, lockFactory); case NIOFS: return new NIOFSDirectory(location, lockFactory); default: throw new AssertionError("unexpected built-in store type [" + type + "]"); } }

Target:
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException { final String storeType = indexSettings.getSettings() .get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), IndexModule.Type.FS.getSettingsKey()); IndexModule.Type type; if (IndexModule.Type.FS.match(storeType)) { type = IndexModule.defaultStoreType( IndexModule.NODE_STORE_ALLOW_MMAP.getWithFallback(indexSettings.getNodeSettings())); } else { type = IndexModule.Type.fromSettingsKey(storeType); } switch (type) { case HYBRIDFS: final FSDirectory primaryDirectory = FSDirectory.open(location, lockFactory); if (primaryDirectory instanceof MMapDirectory) { return new HybridDirectory(location, lockFactory, primaryDirectory); } else { return primaryDirectory; } case MMAPFS: return new MMapDirectory(location, lockFactory); case SIMPLEFS: return new SimpleFSDirectory(location, lockFactory); case NIOFS: return new NIOFSDirectory(location, lockFactory); default: throw new AssertionError("unexpected built-in store type [" + type + "]"); } }
Source:
protected Protocol configureRendererProtocol() { Protocol protocol = new BasicProtocol(81); protocol.registerNetworkAction(RenderJoinEvent.class, RenderJoinEvent::new); protocol.registerNetworkAction(GameWaitingEvent.class, GameWaitingEvent::new); protocol.registerNetworkAction(GameAboutToStartEvent.class, GameAboutToStartEvent::new); protocol.registerNetworkAction(GameStartedEvent.class, GameStartedEvent::new); protocol.registerNetworkAction(GameFinishedEvent.class, GameFinishedEvent::new); protocol.registerNetworkAction(GameStoppedEvent.class, GameStoppedEvent::new); protocol.registerNetworkAction(PlayerAddedEvent.class, PlayerAddedEvent::new); protocol.registerNetworkAction(PlayerJumpedEvent.class, PlayerJumpedEvent::new); return protocol; }

Target:
protected Protocol configureRendererProtocol() { Protocol protocol = new BasicProtocol(RENDER_PORT_NUMBER); protocol.registerNetworkAction(RenderJoinEvent.class, RenderJoinEvent::new); protocol.registerNetworkAction(GameWaitingEvent.class, GameWaitingEvent::new); protocol.registerNetworkAction(GameAboutToStartEvent.class, GameAboutToStartEvent::new); protocol.registerNetworkAction(GameStartedEvent.class, GameStartedEvent::new); protocol.registerNetworkAction(GameFinishedEvent.class, GameFinishedEvent::new); protocol.registerNetworkAction(GameStoppedEvent.class, GameStoppedEvent::new); protocol.registerNetworkAction(PlayerAddedEvent.class, PlayerAddedEvent::new); protocol.registerNetworkAction(PlayerJumpedEvent.class, PlayerJumpedEvent::new); return protocol; }
Source:
public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(mContext); View userView = inflater.inflate(R.layout.add_user_layout, parent, false); TextView textViewUserName = (TextView) userView.findViewById(R.id.textViewUserName); ImageView imageUser = (ImageView) userView.findViewById(R.id.imageUser); CheckBox checkBox = (CheckBox) userView.findViewById(R.id.checkboxUser); User user = mUsers.get(position).getUser(); textViewUserName.setText(user.getName()); Bitmap userImage = user.getImg(); if (userImage == null){ imageUser.setImageBitmap(YieldsApplication.getDefaultUserImage()); } else { imageUser.setImageBitmap(userImage); } boolean b = mUsers.get(position).getBoolean(); checkBox.setChecked(b); final int pos = position; checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mUsers.get(pos).setBoolean(isChecked); if (mRemoveWhenUnchecked && !isChecked && pos!=0){ mUsers.remove(pos); ListAdapterUsersCheckBox.this.notifyDataSetChanged(); } if (mRemoveWhenUnchecked && pos==0){ buttonView.setChecked(!isChecked); } } }); return userView; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(mContext); View userView = inflater.inflate(R.layout.add_user_layout, parent, false); TextView textViewUserName = (TextView) userView.findViewById(R.id.textViewUserName); ImageView imageUser = (ImageView) userView.findViewById(R.id.imageUser); CheckBox checkBox = (CheckBox) userView.findViewById(R.id.checkboxUser); User user = mUsers.get(position).getKey(); textViewUserName.setText(user.getName()); Bitmap userImage = user.getImg(); if (userImage == null){ imageUser.setImageBitmap(YieldsApplication.getDefaultUserImage()); } else { imageUser.setImageBitmap(userImage); } boolean b = mUsers.get(position).getValue(); checkBox.setChecked(b); final int pos = position; checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mUsers.get(pos).setValue(isChecked); if (mRemoveWhenUnchecked && !isChecked && pos!=0){ mUsers.remove(pos); ListAdapterUsersCheckBox.this.notifyDataSetChanged(); } if (mRemoveWhenUnchecked && pos==0){ buttonView.setChecked(!isChecked); } } }); return userView; }
Source:
public void onPause() { super.onPause(); if ( !isInViewPager ) { if (player != null) isPaused = player.isPaused(); handleOnPause(); } }

Target:
public void onPause() { super.onPause(); if ( !isInViewPager ) { handleOnPause(); } }
Source:
private static String getHomeCommunityID(BusinessEntity entity) { if (entity.getIdentifierBag() != null && CollectionUtils.isNotEmpty(entity.getIdentifierBag(). getKeyedReference())) { for (KeyedReference key : entity.getIdentifierBag().getKeyedReference()) { if (key.getTModelKey().equals(UDDI_HOME_COMMUNITY_ID_KEY)) { return key.getKeyValue(); } } } return null; }

Target:
private static String getHomeCommunityID(BusinessEntity entity) { if (entity.getIdentifierBag() != null && CollectionUtils.isNotEmpty(entity.getIdentifierBag(). getKeyedReference())) { for (KeyedReference key : entity.getIdentifierBag().getKeyedReference()) { if (UDDIConstants.UDDI_HOME_COMMUNITY_ID_KEY.equalsIgnoreCase(key.getTModelKey())) { return key.getKeyValue(); } } } return null; }
Source:
private BuildCommand cmdClone(String workDir, int cloneDepth) { ArrayList<String> cloneArgs = new ArrayList<>(); cloneArgs.add("clone"); cloneArgs.add("--no-checkout"); cloneArgs.add(format("--branch=%s", material.branchWithDefault())); if (material.isShallowClone()) { cloneArgs.add(format("--depth=%s", String.valueOf(cloneDepth))); } cloneArgs.add(material.getUrlArgument().rawUrl()); cloneArgs.add(workDir); return exec("git", cloneArgs.toArray(new String[cloneArgs.size()])) .setTest(isNotRepository(workDir)); }

Target:
private BuildCommand cmdClone(String workDir, int cloneDepth) { ArrayList<String> cloneArgs = new ArrayList<>(); cloneArgs.add("clone"); cloneArgs.add("--no-checkout"); cloneArgs.add(format("--branch=%s", material.branchWithDefault())); if (material.isShallowClone()) { cloneArgs.add(format("--depth=%s", String.valueOf(cloneDepth))); } cloneArgs.add(material.getUrlArgument().forCommandLine()); cloneArgs.add(workDir); return exec("git", cloneArgs.toArray(new String[cloneArgs.size()])) .setTest(isNotRepository(workDir)); }
Source:
private static void addHook(Object[] tagsExpressionsAndBody, boolean before) { long timeout = DEFAULT_TIMEOUT; int order = DEFAULT_ORDER; Closure body = null; List<String> tagExpressions = new ArrayList<String>(); boolean isDefaultTimeout = true; boolean isDefaultOrder = true; for (Object o : tagsExpressionsAndBody) { if (o instanceof String) { tagExpressions.add((String) o); } else if (o instanceof Number && isDefaultTimeout) { timeout = ((Number) o).longValue(); isDefaultTimeout = false; } else if (o instanceof Number && isDefaultOrder) { order = ((Number) o).intValue(); isDefaultOrder = false; } else if (o instanceof Closure) { body = (Closure) o; } } TagExpression tagExpression = new TagExpression(tagExpressions); if (before) { GroovyBackend.getInstance().addBeforeHook(tagExpression, timeout, order, body); } else { GroovyBackend.getInstance().addAfterHook(tagExpression, timeout, order, body); } }

Target:
private static void addHook(Object[] tagsExpressionsAndBody, boolean before) { long timeoutMillis = DEFAULT_TIMEOUT; int order = DEFAULT_ORDER; Closure body = null; List<String> tagExpressions = new ArrayList<String>(); for (Object o : tagsExpressionsAndBody) { if (o instanceof String) { tagExpressions.add((String) o); } else if (o instanceof Long) { timeoutMillis = (Long) o; } else if (o instanceof Integer) { order = (Integer) o; } else if (o instanceof Closure) { body = (Closure) o; } } TagExpression tagExpression = new TagExpression(tagExpressions); if (before) { GroovyBackend.getInstance().addBeforeHook(tagExpression, timeoutMillis, order, body); } else { GroovyBackend.getInstance().addAfterHook(tagExpression, timeoutMillis, order, body); } }
Source:
public PrimaryKey getPrimaryKey(List<String> primaryKeyColumns) { Object[] fields = new Object[primaryKeyColumns.size()]; for (int i = 0; i < primaryKeyColumns.size(); i++) { fields[i] = getValue(primaryKeyColumns.get(i)); } return new PrimaryKey(fields); }

Target:
public PrimaryKey getPrimaryKey(List<String> primaryKeyColumns) { int numPrimaryKeyColumns = primaryKeyColumns.size(); Object[] values = new Object[numPrimaryKeyColumns]; for (int i = 0; i < numPrimaryKeyColumns; i++) { values[i] = getValue(primaryKeyColumns.get(i)); } return new PrimaryKey(values); }
Source:
protected CompletableFuture<JarRunResponseBody> handleRequest( @Nonnull final HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request, @Nonnull final DispatcherGateway gateway) throws RestHandlerException { configuration.set(DeploymentOptions.ATTACHED, false); configuration.set(DeploymentOptions.TARGET, EmbeddedExecutor.NAME); final JarHandlerContext context = JarHandlerContext.fromRequest(request, jarDir, log); context.applyOnConfiguration(configuration); SavepointRestoreSettings.toConfiguration(getSavepointRestoreSettings(request), configuration); final PackagedProgram program = context.toPackagedProgram(configuration); return CompletableFuture .supplyAsync(() -> applicationRunner.run(gateway, program, configuration), executor) .thenApply(jobIds -> { if (jobIds.isEmpty()) { throw new CompletionException(new ProgramInvocationException("No jobs submitted.")); } return new JarRunResponseBody(jobIds.get(0)); }); }

Target:
protected CompletableFuture<JarRunResponseBody> handleRequest( @Nonnull final HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request, @Nonnull final DispatcherGateway gateway) throws RestHandlerException { final Configuration effectiveConfiguration = new Configuration(configuration); effectiveConfiguration.set(DeploymentOptions.ATTACHED, false); effectiveConfiguration.set(DeploymentOptions.TARGET, EmbeddedExecutor.NAME); final JarHandlerContext context = JarHandlerContext.fromRequest(request, jarDir, log); context.applyToConfiguration(effectiveConfiguration); SavepointRestoreSettings.toConfiguration(getSavepointRestoreSettings(request), effectiveConfiguration); final PackagedProgram program = context.toPackagedProgram(effectiveConfiguration); return CompletableFuture .supplyAsync(() -> applicationRunner.run(gateway, program, effectiveConfiguration), executor) .thenApply(jobIds -> { if (jobIds.isEmpty()) { throw new CompletionException(new ProgramInvocationException("No jobs submitted.")); } return new JarRunResponseBody(jobIds.get(0)); }); }