auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean convertChildrenLinksForExportRecursive(Workpiece workpiece, IncludedStructuralElement structure, LegacyPrefsHelper prefs) throws DAOException, IOException { LinkedMetsResource link = structure.getLink(); if (Objects.nonNull(link)) { int linkedProcessId = ServiceManager.getProcessService().processIdFromUri(link.getUri()); Process process = ServiceManager.getProcessService().getById(linkedProcessId); if (!process.isExported()) { return false; } setLinkForExport(structure, process, prefs, workpiece); } for (Iterator<IncludedStructuralElement> iterator = structure.getChildren().iterator(); iterator.hasNext();) { if (!convertChildrenLinksForExportRecursive(workpiece, iterator.next(), prefs)) { iterator.remove(); } } return true; }

Target:
private boolean convertChildrenLinksForExportRecursive(Workpiece workpiece, IncludedStructuralElement structure, LegacyPrefsHelper prefs) throws DAOException, IOException { LinkedMetsResource link = structure.getLink(); if (Objects.nonNull(link)) { int linkedProcessId = ServiceManager.getProcessService().processIdFromUri(link.getUri()); Process process = ServiceManager.getProcessService().getById(linkedProcessId); if (!process.isExported()) { return true; } setLinkForExport(structure, process, prefs, workpiece); } for (Iterator<IncludedStructuralElement> iterator = structure.getChildren().iterator(); iterator.hasNext();) { if (convertChildrenLinksForExportRecursive(workpiece, iterator.next(), prefs)) { iterator.remove(); } } return false; }
Source:
public boolean isFinished() { checkState(initialized.get(), "Driver is not initialized"); checkLockNotHeld("Can not check finished status while holding the driver lock"); Optional<Boolean> result = tryWithLock(this::isFinishedInternal); return result.orElseGet(() -> state.get() != State.ALIVE || driverContext.isDone()); }

Target:
public boolean isFinished() { checkLockNotHeld("Can not check finished status while holding the driver lock"); Optional<Boolean> result = tryWithLock(this::isFinishedInternal); return result.orElseGet(() -> state.get() != State.ALIVE || driverContext.isDone()); }
Source:
public String getRunId() { DistributedLock runIdLock; String runId = null; try { runIdLock = coordinationUtils.getLock(CoordinationConstants.RUNID_LOCK_ID); clusterMembership = coordinationUtils.getClusterMembership(); if (runIdLock == null || metadataStore == null || clusterMembership == null) { throw new SamzaException("Failed to create utils for run id generation"); } } catch (Exception e) { LOG.warn(e.getMessage()); return null; } try { if (runIdLock.lock(CoordinationConstants.LOCK_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { LOG.info("lock acquired for run.id generation by this processor"); clusterMembership.registerProcessor(); int numberOfActiveProcessors = clusterMembership.getNumberOfProcessors(); if (numberOfActiveProcessors == 0) { String msg = String.format("Processor failed to fetch number of processors for run.id generation"); throw new SamzaException(msg); } if (numberOfActiveProcessors == 1) { runId = String.valueOf(System.currentTimeMillis()) + "-" + UUID.randomUUID().toString().substring(0, 8); LOG.info("Writing the run id for this run as {}", runId); metadataStore.put(CoordinationConstants.RUNID_STORE_KEY, runId.getBytes("UTF-8")); } else { runId = new String(metadataStore.get(CoordinationConstants.RUNID_STORE_KEY)); LOG.info("Read the run id for this run as {}", runId); } } } catch (TimeoutException e) { String msg = String.format("Processor timed out waiting to acquire lock for run.id generation"); throw new SamzaException(msg, e); } catch (UnsupportedEncodingException e) { String msg = String.format("Processor could not serialize/deserialize string for run.id generation"); throw new SamzaException(msg, e); } finally { runIdLock.unlock(); } return runId; }

Target:
public Optional<String> getRunId() { DistributedLock runIdLock; String runId = null; runIdLock = coordinationUtils.getLock(CoordinationConstants.RUNID_LOCK_ID); if (runIdLock == null) { throw new SamzaException("Failed to create utils for run id generation"); } try { if (runIdLock.lock(Duration.ofMillis(CoordinationConstants.LOCK_TIMEOUT_MS))) { LOG.info("lock acquired for run.id generation by this processor"); processorId = clusterMembership.registerProcessor(); int numberOfActiveProcessors = clusterMembership.getNumberOfProcessors(); if (numberOfActiveProcessors == 0) { String msg = String.format("Processor failed to fetch number of processors for run.id generation"); throw new SamzaException(msg); } if (numberOfActiveProcessors == 1) { runId = String.valueOf(System.currentTimeMillis()) + "-" + UUID.randomUUID().toString().substring(0, 8); LOG.info("Writing the run id for this run as {}", runId); metadataStore.put(CoordinationConstants.RUNID_STORE_KEY, runId.getBytes("UTF-8")); } else { runId = new String(metadataStore.get(CoordinationConstants.RUNID_STORE_KEY)); LOG.info("Read the run id for this run as {}", runId); } runIdLock.unlock(); } else { throw new SamzaException("Processor timed out waiting to acquire lock for run.id generation"); } } catch (UnsupportedEncodingException e) { throw new SamzaException("Processor could not serialize/deserialize string for run.id generation", e); } return Optional.ofNullable(runId); }
Source:
EventStore(@NonNull ImmutableConfig config, @NonNull Context appContext, @NonNull Logger logger, Delegate delegate) { super(appContext, "/bugsnag-errors/", 32, EVENT_COMPARATOR, logger, delegate); this.config = config; this.logger = logger; this.delegate = delegate; }

Target:
EventStore(@NonNull ImmutableConfig config, @NonNull Context appContext, @NonNull Logger logger, Delegate delegate) { super(appContext, "/bugsnag-errors/", MAX_EVENT_COUNT, EVENT_COMPARATOR, logger, delegate); this.config = config; this.logger = logger; this.delegate = delegate; }
Source:
public void testRandomWithInteger() { String strFuncRand = baseActivityTestRule.getActivity().getResources() .getString(R.string.formula_editor_function_rand); String strFunRandPar = baseActivityTestRule.getActivity().getResources() .getString(R.string.formula_editor_function_rand_parameter); onView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor() .performOpenFunctions(); onView(withText(strFuncRand + strFunRandPar)) .perform(click()); onFormulaEditor() .performOpenFunctions(); onView(withText(strFuncRand + strFunRandPar)) .perform(click()); onFormulaEditor() .performEnterNumber(1); onFormulaEditor() .performCompute(); onView(withId(R.id.formula_editor_compute_dialog_textview)) .check(matches(withText(String.valueOf(1.0)))); }

Target:
public void testRandomWithInteger() { String strFuncRand = UiTestUtils .getResourcesString(R.string.formula_editor_function_rand); String strFunRandPar = UiTestUtils .getResourcesString(R.string.formula_editor_function_rand_parameter); onBrickAtPosition(1).onChildView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor().performOpenCategory(FormulaEditorWrapper.Category.FUNCTIONS) .performSelect(strFuncRand + strFunRandPar); onFormulaEditor().performOpenCategory(FormulaEditorWrapper.Category.FUNCTIONS) .performSelect(strFuncRand + strFunRandPar); onFormulaEditor() .performEnterNumber(1); onFormulaEditor() .performCompute(); onView(withId(R.id.formula_editor_compute_dialog_textview)) .check(matches(withText(String.valueOf(1.0)))); }
Source:
public ActionForward route(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument = updateSuspensionCategoriesOnDocument(form); ActionForward forward = promptForSuspensionCategories(mapping, form, request, response, contractsGrantsInvoiceDocument, KFSConstants.ROUTE_METHOD); if (forward != null) { return forward; } if (contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().isFinalBillIndicator()) { ContractsGrantsInvoiceDocument oldDocument = (ContractsGrantsInvoiceDocument) SpringContext.getBean(DocumentService.class).getByDocumentHeaderId(contractsGrantsInvoiceDocument.getDocumentNumber()); if (!oldDocument.getInvoiceGeneralDetail().isFinalBillIndicator()) { forward = promptForFinalBillConfirmation(mapping, form, request, response, KFSConstants.ROUTE_METHOD); if (forward != null) { return forward; } } } return super.route(mapping, form, request, response); }

Target:
public ActionForward route(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument = ((ContractsGrantsInvoiceDocumentForm) form).getContractsGrantsInvoiceDocument(); if (contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().isFinalBillIndicator()) { ActionForward forward = promptForFinalBillConfirmation(mapping, form, request, response, KFSConstants.ROUTE_METHOD); if (forward != null) { return forward; } } return super.route(mapping, form, request, response); }
Source:
private DataContext getDataContext(Table table) { DataContext result = null; if (table != null) { Schema schema = table.getSchema(); if (schema != null) { for (DataContext dc : _delegates) { Schema dcSchema = dc.getSchemaByName(schema.getName()); if (dcSchema != null) { if (dcSchema == schema) { logger.debug("DataContext for '{}' resolved (using identity) to: '{}'", table, dcSchema); result = dc; break; } } } if (result == null) { for (DataContext dc : _delegates) { Schema dcSchema = dc.getSchemaByName(schema.getName()); if (dcSchema != null) { if (dcSchema.equals(schema) || (dcSchema instanceof DefaultTableAliasedSchema && ((DefaultTableAliasedSchema) dcSchema).getWrappedSchema().equals(schema))) { logger.debug("DataContext for '{}' resolved (using equals) to: '{}'", table, dcSchema); result = dc; break; } } } } } } if (result == null) { logger.warn("Couldn't resolve DataContext for {}", table); } return result; }

Target:
private DataContext getDataContext(Table table) { DataContext result = null; if (table != null) { Schema schema = table.getSchema(); if (schema != null) { for (DataContext dc : _delegates) { Schema dcSchema = dc.getSchemaByName(schema.getName()); if (dcSchema != null) { if (dcSchema == schema) { logger.debug("DataContext for '{}' resolved (using identity) to: '{}'", table, dcSchema); result = dc; break; } } } if (result == null) { for (DataContext dc : _delegates) { Schema dcSchema = dc.getSchemaByName(schema.getName()); if (dcSchema != null) { if (dcSchema.equals(schema) || (dcSchema instanceof WrappingSchema && ((WrappingSchema) dcSchema).getWrappedSchema().equals(schema))) { logger.debug("DataContext for '{}' resolved (using equals) to: '{}'", table, dcSchema); result = dc; break; } } } } } } if (result == null) { logger.warn("Couldn't resolve DataContext for {}", table); } return result; }
Source:
public void testConnection() { final long currentTime = System.currentTimeMillis(); while (!isTestsDone()) { if (System.currentTimeMillis() - currentTime > 600000) { Assert.fail("Failed to complete test within 600s"); } try { LOGGER.debug(completedTestCount + "/" + totalTestCount + " tests done. Waiting for completion"); Thread.sleep(1000); } catch (final InterruptedException e) { Assert.fail(e.getMessage()); } } LOGGER.debug(completedTestCount + "/" + totalTestCount + " tests done."); }

Target:
public void testConnection() { while (!isTestsDone()) { try { LOGGER.debug(completedTestCount + "/" + totalTestCount + " tests done. Waiting for completion"); Thread.sleep(1000); } catch (final InterruptedException e) { Assert.fail(e.getMessage()); } } LOGGER.debug(completedTestCount + "/" + totalTestCount + " tests done."); }
Source:
public void handle(HttpExchange exchange) throws IOException { long t1 = System.currentTimeMillis(); DataInputStream din = new DataInputStream(exchange.getRequestBody()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(bout); String path = exchange.getRequestURI().getPath(); if (path.startsWith("/")) path = path.substring(1); String[] subComponents = path.substring(MUTABLE_POINTERS_URL.length()).split("/"); String method = subComponents[0]; try { switch (method) { case "setPointer": setPointer(din, dout); break; case "getPointer": getPointer(din, dout); break; default: throw new IOException("Unknown method "+ method); } dout.flush(); dout.close(); byte[] b = bout.toByteArray(); exchange.sendResponseHeaders(200, b.length); exchange.getResponseBody().write(b); } catch (Exception e) { e.printStackTrace(); exchange.sendResponseHeaders(400, 0); } finally { exchange.close(); long t2 = System.currentTimeMillis(); if (LOGGING) System.out.println("Mutable pointers server handled " + method + " request in: " + (t2 - t1) + " mS"); } }

Target:
public void handle(HttpExchange exchange) throws IOException { long t1 = System.currentTimeMillis(); DataInputStream din = new DataInputStream(exchange.getRequestBody()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(bout); String path = exchange.getRequestURI().getPath(); if (path.startsWith("/")) path = path.substring(1); String[] subComponents = path.substring(MUTABLE_POINTERS_URL.length()).split("/"); String method = subComponents[0]; try { switch (method) { case "setPointer": setPointer(din, dout); break; case "getPointer": getPointer(din, dout); break; default: throw new IOException("Unknown method "+ method); } dout.flush(); dout.close(); byte[] b = bout.toByteArray(); exchange.sendResponseHeaders(200, b.length); exchange.getResponseBody().write(b); } catch (Exception e) { e.printStackTrace(); exchange.sendResponseHeaders(400, 0); OutputStream body = exchange.getResponseBody(); body.write(e.getMessage().getBytes()); } finally { exchange.close(); long t2 = System.currentTimeMillis(); if (LOGGING) System.out.println("Mutable pointers server handled " + method + " request in: " + (t2 - t1) + " mS"); } }
Source:
protected boolean validateQuota() { setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getQuotaId(), getStoragePool())); List<DiskImage> diskInfoList = getParameters().getDiskInfoDestinationList(); for (DiskImage diskImage : diskInfoList) { diskImage.setQuotaId(QuotaHelper.getInstance() .getQuotaIdToConsume(diskImage.getQuotaId(), getStoragePool())); } if (!isInternalExecution()) { return QuotaManager.validateMultiStorageQuota(getStoragePool().getQuotaEnforcementType(), getQuotaConsumeMap(diskInfoList), getCommandId(), getReturnValue().getCanDoActionMessages()); } return true; }

Target:
protected boolean validateQuota() { setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getQuotaId(), getStoragePool())); for (DiskImage diskImage : diskInfoDestinationMap.values()) { diskImage.setQuotaId(QuotaHelper.getInstance() .getQuotaIdToConsume(diskImage.getQuotaId(), getStoragePool())); } return QuotaManager.validateMultiStorageQuota(getStoragePool().getQuotaEnforcementType(), getQuotaConsumeMap(diskInfoDestinationMap.values()), getCommandId(), getReturnValue().getCanDoActionMessages()); }
Source:
static boolean isFitForDictionaryBasedPlan(QueryContext queryContext, IndexSegment indexSegment) { List<ExpressionContext> selectExpressions = queryContext.getSelectExpressions(); for (ExpressionContext expression : selectExpressions) { FunctionContext function = expression.getFunction(); String functionName = function.getFunctionName(); if (!functionName.equals("min") && !functionName.equals("max") && !functionName.equals("minmaxrange") && !functionName.equals("distinctcount")) { return false; } ExpressionContext argument = function.getArguments().get(0); if (argument.getType() != ExpressionContext.Type.IDENTIFIER) { return false; } String column = argument.getIdentifier(); Dictionary dictionary = indexSegment.getDataSource(column).getDictionary(); if (dictionary == null || !dictionary.isSorted()) { return false; } } return true; }

Target:
static boolean isFitForDictionaryBasedPlan(QueryContext queryContext, IndexSegment indexSegment) { List<ExpressionContext> selectExpressions = queryContext.getSelectExpressions(); for (ExpressionContext expression : selectExpressions) { FunctionContext function = expression.getFunction(); String functionName = function.getFunctionName(); if(!AggregationFunctionUtils.isFitForDictionaryBasedComputation(functionName)) { return false; } ExpressionContext argument = function.getArguments().get(0); if (argument.getType() != ExpressionContext.Type.IDENTIFIER) { return false; } String column = argument.getIdentifier(); Dictionary dictionary = indexSegment.getDataSource(column).getDictionary(); if (dictionary == null || !dictionary.isSorted()) { return false; } } return true; }
Source:
public UiContextResponse getContext() { JsonObject menu = appSettings.getMenu() != null ? new JsonParser().parse(appSettings.getMenu()).getAsJsonObject() : new JsonObject(); boolean authenticated = !(SecurityContextHolder.getContext().getAuthentication() instanceof AnonymousAuthenticationToken); boolean showCookieWall = cookieWallService.showCookieWall(); return UiContextResponse.builder() .setMenu(menu) .setNavBarLogo(appSettings.getLogoNavBarHref()) .setLogoTop(appSettings.getLogoTopHref()) .setLogoTopMaxHeight(appSettings.getLogoTopMaxHeight()) .setLoginHref(LOGIN_HREF) .setHelpLink(HELP_LINK_JSON) .setShowCookieWall(showCookieWall) .setAuthenticated(authenticated) .setAdditionalMessage(appSettings.getFooter()) .setVersion(this.molgenisVersion) .setBuildDate(this.molgenisBuildDate) .build(); }

Target:
public UiContextResponse getContext() { JsonObject menu = appSettings.getMenu() != null ? new JsonParser().parse(appSettings.getMenu()).getAsJsonObject() : new JsonObject(); boolean authenticated = SecurityUtils.currentUserIsAuthenticated(); boolean showCookieWall = cookieWallService.showCookieWall(); return UiContextResponse.builder() .setMenu(menu) .setCssHref(appSettings.getCssHref()) .setNavBarLogo(appSettings.getLogoNavBarHref()) .setLogoTop(appSettings.getLogoTopHref()) .setLogoTopMaxHeight(appSettings.getLogoTopMaxHeight()) .setLoginHref(LOGIN_HREF) .setHelpLink(HELP_LINK_JSON) .setShowCookieWall(showCookieWall) .setAuthenticated(authenticated) .setAdditionalMessage(appSettings.getFooter()) .setVersion(this.molgenisVersion) .setBuildDate(this.molgenisBuildDate) .build(); }
Source:
public boolean isEmpty() { return fInnerElements.isEmpty(); }

Target:
public boolean isEmpty() { return fSize == 0; }
Source:
public DeploymentRepository getValue() throws IllegalStateException, IllegalArgumentException { return this; }

Target:
public DeploymentRepository getValue() { return this; }
Source:
public void init(GUIController guiController, ScrollPane panelsScrollPane) { this.guiController = guiController; this.panelsScrollPane = panelsScrollPane; restorePanels(); selectPanel(0); }

Target:
public void init(GUIController guiController, ScrollPane panelsScrollPane) { this.guiController = guiController; this.panelsScrollPane = panelsScrollPane; restorePanels(); selectFirstPanel(); }
Source:
protected void readOsSection(XmlNode section) { _vmTemplate.setId(new Guid(section.Attributes.get("ovf:id").getValue())); XmlNode node = section.SelectSingleNode("Description"); if (node != null) { _vmTemplate.setOs(Integer.valueOf(node.InnerText)); } else { _vmTemplate.setOs(0); } }

Target:
protected void readOsSection(XmlNode section) { _vmTemplate.setId(new Guid(section.Attributes.get("ovf:id").getValue())); XmlNode node = section.SelectSingleNode("Description"); if (node != null) { _vmTemplate.setOs(OsRepositoryImpl.INSTANCE.getOsIdByUniqueName(node.InnerText)); } }
Source:
public String getInput() { Serializable input = getProperty(RetentionConstants.INPUT_PROPERTY_KEY); if (input instanceof String) { return (String) input; } return null; }

Target:
public String getInput() { return (String) getProperty(RetentionConstants.INPUT_PROPERTY_KEY); }
Source:
public FormValidation doCreateTokenByCredentials( @QueryParameter String apiUrl, @QueryParameter String credentialsId) { Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER); if (isEmpty(credentialsId)) { return FormValidation.error("Please specify credentials to create token"); } StandardUsernamePasswordCredentials creds = firstOrNull(lookupCredentials( StandardUsernamePasswordCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, fromUri(defaultIfBlank(apiUrl, GITHUB_URL)).build()), withId(credentialsId)); if (creds == null) { creds = firstOrNull(lookupCredentials( StandardUsernamePasswordCredentials.class, Jenkins.getInstance(), Jenkins.getAuthentication(), fromUri(defaultIfBlank(apiUrl, GITHUB_URL)).build()), withId(credentialsId)); } GHAuthorization token; if (null == creds) { return FormValidation.error("Can't create GH token - credentials are null."); } try { token = createToken( creds.getUsername(), Secret.toString(creds.getPassword()), defaultIfBlank(apiUrl, GITHUB_URL) ); } catch (Exception e) { return FormValidation.error(e, "Can't create GH token - %s", e.getMessage()); } StandardCredentials credentials = createCredentials(apiUrl, token.getToken(), creds.getUsername()); return FormValidation.ok("Created credentials with id %s (can use it for GitHub Server Config)", credentials.getId()); }

Target:
public FormValidation doCreateTokenByCredentials( @QueryParameter String apiUrl, @QueryParameter String credentialsId) { Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER); if (isEmpty(credentialsId)) { return FormValidation.error("Please specify credentials to create token"); } StandardUsernamePasswordCredentials creds = firstOrNull(lookupCredentials( StandardUsernamePasswordCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, fromUri(defaultIfBlank(apiUrl, GITHUB_URL)).build()), withId(credentialsId)); if (creds == null) { creds = firstOrNull(lookupCredentials( StandardUsernamePasswordCredentials.class, Jenkins.getInstance(), Jenkins.getAuthentication(), fromUri(defaultIfBlank(apiUrl, GITHUB_URL)).build()), withId(credentialsId)); } GHAuthorization token; if (Objects.isNull(creds)) { return FormValidation.error("Can't create GH token - credentials are null."); } try { token = createToken( creds.getUsername(), Secret.toString(creds.getPassword()), defaultIfBlank(apiUrl, GITHUB_URL) ); } catch (IOException e) { return FormValidation.error(e, "Can't create GH token - %s", e.getMessage()); } StandardCredentials credentials = createCredentials(apiUrl, token.getToken(), creds.getUsername()); return FormValidation.ok("Created credentials with id %s (can use it for GitHub Server Config)", credentials.getId()); }
Source:
public List<Token> getTokensOf(TokenType... types) { if (typeToTokensMap == null) { typeToTokensMap = Maps.newHashMap(); for (Token token : tokens) { List<Token> subtokens = typeToTokensMap.get(token.getType()); if (subtokens == null) { subtokens = Lists.newArrayList(token); typeToTokensMap.put(token.getType(), subtokens); } else { subtokens.add(token); } } } if (types.length == 1) { List<Token> tokens = typeToTokensMap.get(types[0]); return (tokens != null) ? tokens : Lists.<Token>newArrayList(); } List<Token> subtokens = Lists.newArrayList(); for (TokenType type : types) { List<Token> tokens = typeToTokensMap.get(type); subtokens.addAll((tokens != null) ? tokens : Lists.<Token>newArrayList()); } return subtokens; }

Target:
public List<Token> getTokensOf(TokenType... types) { if (typeToTokensMap == null) { typeToTokensMap = Maps.newHashMap(); for (Token token : tokens) { List<Token> subtokens = typeToTokensMap.get(token.getType()); if (subtokens == null) { subtokens = Lists.newArrayList(token); typeToTokensMap.put(token.getType(), subtokens); } else { subtokens.add(token); } } } if (types.length == 1) { List<Token> tokens = typeToTokensMap.get(types[0]); return (tokens != null) ? tokens : Collections.<Token>emptyList(); } List<Token> subtokens = Lists.newArrayList(); for (TokenType type : types) { List<Token> tokens = typeToTokensMap.get(type); if (tokens != null) { subtokens.addAll(tokens); } } return subtokens; }
Source:
public static boolean hasDefaultModifier(Collection<Modifier> modifiers) { for (Modifier m : modifiers) { if (m.name().equals("DEFAULT")) { return true; } } return false; }

Target:
public static boolean hasDefaultModifier(Collection<Modifier> modifiers) { return DEFAULT != null && modifiers.contains(DEFAULT); }
Source:
public static String providerIdToProviderName(@NonNull String providerId) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: return "Google"; case FacebookAuthProvider.PROVIDER_ID: return "Facebook"; case TwitterAuthProvider.PROVIDER_ID: return "Twitter"; case GithubAuthProvider.PROVIDER_ID: return "Github"; case PhoneAuthProvider.PROVIDER_ID: return "Phone number"; case EmailAuthProvider.PROVIDER_ID: case EMAIL_LINK_PROVIDER: return "Email"; default: return null; } }

Target:
public static String providerIdToProviderName(@NonNull String providerId) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_google); case FacebookAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_facebook); case TwitterAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_twitter); case GithubAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_github); case PhoneAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_phone); case EmailAuthProvider.PROVIDER_ID: case EMAIL_LINK_PROVIDER: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_email); default: return null; } }
Source:
private char forDigit(int digit) { digit = digit & 0xF; return (char) (digit < 10 ? '0' + digit : 55 + digit); }

Target:
private static char forDigit(int digit) { return CHAR_MAP[digit & 0xF]; }
Source:
public void setSedModel(SedModel sedModel) { this.sedModel = sedModel; }

Target:
public void setSedModel(SedModel sedModel) { this.sedModel = sedModel; updateSortedStarTable(); }
Source:
public double sum(String colName) { double[] colArray = toDoubleArray(colName); double arraySum = StatUtils.sum(colArray); return arraySum; }

Target:
public double sum(String colName) { return StatUtils.sum(toDoubleArray(colName)); }
Source:
public List<String> getReviews(String taskUrl) { if (deserializationJob.getResult() == null) { String repositoryUrl = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(taskUrl) .getRepositoryUrlFromTaskUrl(taskUrl); deserialize(new File(getSaveFileName(), URLEncoder.encode(repositoryUrl))); } List<String> reviewUrls = taskReviewsMap.get(taskUrl); return reviewUrls == null ? new ArrayList<String>() : reviewUrls; }

Target:
public Collection<ITask> getReviews(String taskUrl) { if (deserializationJob.getResult() == null) { String repositoryUrl = repositoryManager.getConnectorForRepositoryTaskUrl(taskUrl) .getRepositoryUrlFromTaskUrl(taskUrl); deserialize(new File(getSaveFileName(), URLEncoder.encode(repositoryUrl))); } System.out.println(taskReviewsMap.size()); List<String> reviewUrls = taskReviewsMap.get(taskUrl); if (reviewUrls == null) { return Collections.emptyList(); } List<ITask> reviews = new ArrayList<ITask>(); for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = repositoryManager.getConnectorForRepositoryTaskUrl(reviewUrl); if (connector == null) { continue; } String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); String reviewId = connector.getTaskIdFromTaskUrl(reviewUrl); if (repositoryUrl == null || reviewId == null) { continue; } ITask review = taskList.getTask(repositoryUrl, reviewId); if (review != null) { reviews.add(review); } else { } } return reviews; }
Source:
public void remove(TopicPartition topicPartition) { removed.add(topicPartition); next.remove(topicPartition); sessionPartitions.remove(topicPartition); }

Target:
public void remove(TopicPartition topicPartition) { if (sessionPartitions.remove(topicPartition) != null) { removed.add(topicPartition); } }
Source:
protected Composite createWidgets(Composite parent, CDKServer cdkServer, FormToolkit toolkit) { Composite composite = initializeSectionWidget(parent, toolkit); createChooseCredentialsWidgets(composite, toolkit); createEnvironmentWidgets(composite, toolkit, cdkServer); addRegistrationWidgets(parent, cdkServer, toolkit); return composite; }

Target:
protected Composite createWidgets(Composite parent, CDKServer cdkServer, FormToolkit toolkit) { Composite composite = initializeSectionWidget(parent, toolkit); createChooseCredentialsWidgets(composite, toolkit); createEnvironmentWidgets(composite, toolkit, cdkServer); addRegistrationWidgets(composite, cdkServer, toolkit); return composite; }
Source:
protected boolean validate() { StorageServerConnections paramConnection = getConnection(); if (StringUtils.isNotEmpty(paramConnection.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_NOT_EMPTY); } if (!isValidConnection(paramConnection)) { return false; } Guid storagePoolId = Guid.isNullOrEmpty(getParameters().getVdsId()) ? null : getVds().getStoragePoolId(); if (isConnWithSameDetailsExists(paramConnection, storagePoolId)) { String storageId = getDuplicateStorageDomainId(paramConnection, storagePoolId); String storageDomainName = getStorageDomainNameById(storageId); addValidationMessageVariable("storage", storageId); addValidationMessageVariable("storageDomainName", storageDomainName); return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_NFS_ALREADY_EXISTS); } if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { if (getVds() == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (getVds().getStatus() != VDSStatus.Up) { return failValidation(EngineMessage.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } } return true; }

Target:
protected boolean validate() { StorageServerConnections paramConnection = getConnection(); if (StringUtils.isNotEmpty(paramConnection.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_NOT_EMPTY); } if (!isValidConnection(paramConnection)) { return false; } Guid storagePoolId = Guid.isNullOrEmpty(getParameters().getVdsId()) ? null : getVds().getStoragePoolId(); if (isConnWithSameDetailsExists(paramConnection, storagePoolId)) { List<StorageServerConnections> storageServerConnections = null; String storageId = ""; String storageDomainName = ""; storageServerConnections = getConnWithSameDetailsExists(paramConnection, storagePoolId); if (storageServerConnections != null && storageServerConnections.size() > 0 ) { storageId = storageServerConnections.get(0).getId(); } if (getStorageDomainsByConnId(storageId) != null && getStorageDomainsByConnId(storageId).size() > 0) { if ( getStorageDomainsByConnId(storageId).get(0).getStorageStaticData() != null ) { storageDomainName = getStorageDomainsByConnId(storageId).get(0).getStorageStaticData().getName(); } } addValidationMessageVariable("storage", storageId); addValidationMessageVariable("storageDomainName", storageDomainName); return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS_INFO); } if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { if (getVds() == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (getVds().getStatus() != VDSStatus.Up) { return failValidation(EngineMessage.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } } return true; }
Source:
private void updateGpodnetPreferenceScreen() { final boolean loggedIn = GpodnetPreferences.loggedIn(); findPreference(PREF_GPODNET_LOGIN).setEnabled(!loggedIn); findPreference(PREF_GPODNET_SETLOGIN_INFORMATION).setEnabled(loggedIn); findPreference(PREF_GPODNET_SYNC).setEnabled(loggedIn); findPreference(PREF_GPODNET_FORCE_FULL_SYNC).setEnabled(loggedIn); findPreference(PREF_GPODNET_LOGOUT).setEnabled(loggedIn); findPreference(PREF_GPODNET_NOTIFICATIONS).setEnabled(loggedIn); if (loggedIn) { String format = getActivity().getString(R.string.pref_gpodnet_login_status); String summary = String.format(format, GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID()); findPreference(PREF_GPODNET_LOGOUT).setSummary(HtmlCompat.fromHtml(summary, HtmlCompat.FROM_HTML_MODE_LEGACY)); updateLastGpodnetSyncReport(SyncService.isLastSyncSuccessful(getContext()), SyncService.getLastSyncAttempt(getContext())); } else { findPreference(PREF_GPODNET_LOGOUT).setSummary(null); } findPreference(PREF_GPODNET_HOSTNAME).setSummary(GpodnetPreferences.getHostname()); }

Target:
private void updateGpodnetPreferenceScreen() { final boolean loggedIn = GpodnetPreferences.loggedIn(); findPreference(PREF_GPODNET_LOGIN).setEnabled(!loggedIn); findPreference(PREF_GPODNET_SETLOGIN_INFORMATION).setEnabled(loggedIn); findPreference(PREF_GPODNET_SYNC).setEnabled(loggedIn); findPreference(PREF_GPODNET_FORCE_FULL_SYNC).setEnabled(loggedIn); findPreference(PREF_GPODNET_LOGOUT).setEnabled(loggedIn); findPreference(PREF_GPODNET_NOTIFICATIONS).setEnabled(loggedIn); if (loggedIn) { String format = getActivity().getString(R.string.pref_gpodnet_login_status); String summary = String.format(format, GpodnetPreferences.getUsername(), GpodnetPreferences.getDeviceID()); Spanned formattedSummary = HtmlCompat.fromHtml(summary, HtmlCompat.FROM_HTML_MODE_LEGACY); findPreference(PREF_GPODNET_LOGOUT).setSummary(formattedSummary); updateLastGpodnetSyncReport(SyncService.isLastSyncSuccessful(getContext()), SyncService.getLastSyncAttempt(getContext())); } else { findPreference(PREF_GPODNET_LOGOUT).setSummary(null); } findPreference(PREF_GPODNET_HOSTNAME).setSummary(GpodnetPreferences.getHostname()); }
Source:
private boolean filterMaxSpeed(Position position, Position last) { if (filterMaxSpeed != 0 && last != null) { double distance = position.getDouble(Position.KEY_DISTANCE); long time = position.getFixTime().getTime() - last.getFixTime().getTime(); return UnitsConverter.knotsFromMps(distance / (time / 1000.0)) > filterMaxSpeed; } return false; }

Target:
private boolean filterMaxSpeed(Position position, Position last) { if (filterMaxSpeed != 0 && last != null) { double distance = position.getDouble(Position.KEY_DISTANCE); double time = position.getFixTime().getTime() - last.getFixTime().getTime(); return UnitsConverter.knotsFromMps(distance / (time / 1000)) > filterMaxSpeed; } return false; }
Source:
public Object instantiateItem(ViewGroup collection, int position) { int resId = PAGE_READING_LISTS; switch (position) { case PAGE_READING_LISTS: resId = R.id.list_of_lists_page; break; case PAGE_LIST_DETAIL: resId = R.id.list_detail_page; break; default: } return getView().findViewById(resId); }

Target:
public Object instantiateItem(ViewGroup collection, int position) { int resId; switch (position) { case PAGE_LIST_DETAIL: resId = R.id.list_detail_page; break; case PAGE_READING_LISTS: default: resId = R.id.list_of_lists_page; break; } return getView().findViewById(resId); }
Source:
private void drawWaypoints(UiDrawer uiDrawer, ArrayList<Waypoint> waypoints, SolCam cam, MapDrawer mapDrawer) { Vector2 camPos = cam.getPosition(); for (Waypoint waypoint : waypoints) { float closeness = 1 - waypoint.position.dst(camPos) / MAX_ICON_DIST; float size; if(closeness < 0.5f) { size = BORDER_ICON_SZ * 0.5f; } else { size = BORDER_ICON_SZ * closeness; } Vector2 position = new Vector2(); SolMath.toRel(waypoint.position, position, cam.getAngle(), camPos); float len = position.len(); float newLen = len - .25f * .3f; position.scl(newLen / len); if(cam.isRelVisible(position)) { continue; } float prefX = displayDimensions.getRatio() / 2 - size / 2; float prefY = .5f - size / 2; float dimensionsRatio = prefX / prefY; boolean prefXAxis = position.y == 0 || dimensionsRatio < SolMath.abs(position.x / position.y); float mul = SolMath.abs(prefXAxis ? (prefX / position.x) : (prefY / position.y)); position.scl(mul); position.add(displayDimensions.getRatio() /2, .5f); mapDrawer.drawWaypointIcon(size, position, mapDrawer.getWaypointTexture(), uiDrawer, waypoint.color); } }

Target:
private void drawWaypoints(UiDrawer uiDrawer, ArrayList<Waypoint> waypoints, SolCam cam, MapDrawer mapDrawer) { Vector2 camPos = cam.getPosition(); for (Waypoint waypoint : waypoints) { float closeness = 1 - waypoint.position.dst(camPos) / MAX_ICON_DIST; float size; if (closeness < 0.5f) { size = BORDER_ICON_SZ * 0.5f; } else { size = BORDER_ICON_SZ * closeness; } Vector2 position = new Vector2(); SolMath.toRel(waypoint.position, position, cam.getAngle(), camPos); float len = position.len(); float newLen = len - (.25f * .3f); position.scl(newLen / len); if (cam.isRelVisible(position)) { continue; } float prefX = (displayDimensions.getRatio() - size) / 2; float prefY = .5f - size / 2; float dimensionsRatio = prefX / prefY; boolean prefXAxis = position.y == 0 || dimensionsRatio < SolMath.abs(position.x / position.y); float mul = SolMath.abs(prefXAxis ? (prefX / position.x) : (prefY / position.y)); position.scl(mul); position.add(displayDimensions.getRatio() / 2, .5f); mapDrawer.drawWaypointIcon(size, position, mapDrawer.getWaypointTexture(), uiDrawer, waypoint.color); } }
Source:
public void setIgnoreEmptyResponses(boolean ignoreEmptyResponses) { }

Target:
public void setIgnoreEmptyResponses(boolean ignoreEmptyResponses) { if (logger.isWarnEnabled()) { logger.warn("'ignoreEmptyResponses' is no longer supported. " + "Use 'requiresReply = true' instead. " + "If it is necessary, configure some downstream Filter to skip empty string payloads."); } }
Source:
public byte[] read(final int length) { try { return InputStreamUtils.readFully(inputStream, length); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public byte[] read(final int length) { try { return InputStreamUtils.readFully(inputStream, length); } catch (IOException e) { throw new RuntimeIOException(e); } }
Source:
protected int doWork() throws Exception { try (Connection connection = ConnectionFactory.createConnection(getConf())) { try (Admin admin = connection.getAdmin()) { admin.snapshot(new SnapshotDescription(snapshotName, tableName, snapshotType)); } } catch (Exception e) { System.err.println("failed to take the snapshot: " + e.getMessage()); return -1; } return 0; }

Target:
protected int doWork() throws Exception { try (Connection connection = ConnectionFactory.createConnection(getConf()); Admin admin = connection.getAdmin()) { admin.snapshot(new SnapshotDescription(snapshotName, tableName, snapshotType)); } catch (Exception e) { System.err.println("failed to take the snapshot: " + e.getMessage()); return -1; } return 0; }
Source:
public static void assertEquality(Object one, Object two) { assertEquals(one, two); assertEquals(two, one); assertEquals(one.hashCode(), two.hashCode()); assertEquality(one); assertEquality(two); }

Target:
public static void assertEquality(Object one, Object two) { checkNotNull(one, "Must provide a value"); checkNotNull(two, "Must provide a value"); assertEquals(one, two); assertEquals(two, one); assertEquals(one.hashCode(), two.hashCode()); assertEquality(one); assertEquality(two); }
Source:
private Callback<Long> fetchAccountUpdateBodyCallback(CopyingAsyncWritableChannel channel) { return buildCallback(frontendMetrics.postAccountsReadRequestMetrics, bytesRead -> { updateAccounts(FrontendUtils.readJsonFromChannel(channel)); restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, 0); finalCallback.onCompletion(null, null); }, uri, LOGGER, finalCallback); }

Target:
private Callback<Long> fetchAccountUpdateBodyCallback(CopyingAsyncWritableChannel channel) { return buildCallback(frontendMetrics.postAccountsReadRequestMetrics, bytesRead -> { updateAccounts(readJsonFromChannel(channel)); restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime()); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, 0); finalCallback.onCompletion(null, null); }, uri, LOGGER, finalCallback); }
Source:
public String getViewLabelPrefix() { if (!fType.equals(XmlAnalysisModuleType.PATTERN)) { return null; } String viewLabel = TmfXmlStrings.EMPTY_STRING; List<Element> head = TmfXmlUtils.getChildElements(fSourceElement, TmfXmlStrings.HEAD); if (head.size() == 1) { List<Element> labels = TmfXmlUtils.getChildElements(head.get(0), TmfXmlStrings.VIEW_LABEL_PREFIX); if (!labels.isEmpty()) { viewLabel = labels.get(0).getAttribute(TmfXmlStrings.VALUE); } } return viewLabel.equals(TmfXmlStrings.EMPTY_STRING) ? null : viewLabel; }

Target:
public @NonNull String getViewLabelPrefix() { if (!fType.equals(XmlAnalysisModuleType.PATTERN)) { return TmfXmlStrings.EMPTY_STRING; } String viewLabel = TmfXmlStrings.EMPTY_STRING; List<Element> head = TmfXmlUtils.getChildElements(fSourceElement, TmfXmlStrings.HEAD); if (head.size() == 1) { List<Element> labels = TmfXmlUtils.getChildElements(head.get(0), TmfXmlStrings.VIEW_LABEL_PREFIX); if (!labels.isEmpty()) { viewLabel = labels.get(0).getAttribute(TmfXmlStrings.VALUE); } } return viewLabel; }
Source:
public void addL10nSubstitution(HTMLNode node, String key, String[] patterns, HTMLNode[] values) { List<HTMLNode> newContent = getL10nSubstitution(key, patterns, values); if (newContent != null) { node.addChildren(newContent); } }

Target:
public void addL10nSubstitution(HTMLNode node, String key, String[] patterns, HTMLNode[] values) { List<HTMLNode> newContent = getHTMLWithSubstitutions(key, patterns, values); node.addChildren(newContent); }
Source:
public static Error invalidParams(String message, Object params) { return error(INVALID_PARAMS, String.format("Invalid params: %s", message), params); }

Target:
public static Error invalidParams(String message, Object params) { return error(INVALID_PARAMS, String.format("Invalid parameters: %s", message), params); }
Source:
@Override public boolean send(CarbonMessage carbonMessage, CarbonCallback carbonCallback) throws ClientConnectorException { return false; }

Target:
public boolean send(CarbonMessage carbonMessage, CarbonCallback carbonCallback) throws ClientConnectorException { return false; }
Source:
public PythonInterpreterInfo build(String target, Path venvDir){ LOG.info(String.format("Invoking the .venv builder with target %s at %s", target, venvDir)); try { Process process = new ProcessBuilder(executable.toString(), "--target", target, "--venv-dir", venvDir.toString(), "--pip" ).start(); process.waitFor(); BufferedReader output = new BufferedReader(new InputStreamReader(process.getInputStream())); LOG.info("Output of the .venv builder:"); output.lines().forEach(l -> LOG.info(" " + l)); PythonInterpreterInfo result = new PythonInterpreterInfo(); result.setBinary(venvDir.resolve("bin/python").toString()); result.setChroot(venvDir.toString()); return result; } catch(IOException | InterruptedException ie) { throw new RuntimeException("An error occurred while running the .venv builder", ie); } }

Target:
public PythonInterpreterInfo build(String target, Path venvDir) { LOG.info(String.format("Invoking the .venv builder with target %s at %s", target, venvDir)); try { GeneralCommandLine command = buildAndRunVenvBuilder(target, venvDir); final ProcessOutput processOutput = getProcessOutput(command); if(processOutput.checkSuccess(LOG)) { PythonInterpreterInfo result = new PythonInterpreterInfo(); result.setBinary(venvDir.resolve("bin/python").toString()); result.setChroot(venvDir.toString()); return result; } else { throw new RuntimeException(String.format("Failed to create a Python virtual environment in %s", venvDir)); } } catch(ExecutionException ee) { throw new RuntimeException("An error occurred while running the .venv builder", ee); } }
Source:
public PointSensitivityBuilder presentValueSensitivity( ResolvedCdsIndex cdsIndex, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData) { if (isExpired(cdsIndex, ratesProvider)) { return PointSensitivityBuilder.none(); } ResolvedCds cds = cdsIndex.toSingleNameCds(); LocalDate stepinDate = cds.getStepinDateOffset().adjust(ratesProvider.getValuationDate(), refData); LocalDate effectiveStartDate = cds.calculateEffectiveStartDate(stepinDate); double recoveryRate = underlyingPricer.recoveryRate(cds, ratesProvider); Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider); double signedNotional = cds.getBuySell().normalize(cds.getNotional()); PointSensitivityBuilder protectionLegSensi = underlyingPricer.protectionLegSensitivity( cds, rates.getFirst(), rates.getSecond(), referenceDate, effectiveStartDate, recoveryRate) .multipliedBy(signedNotional * rates.getThird()); PointSensitivityBuilder riskyAnnuitySensi = underlyingPricer.riskyAnnuitySensitivity( cds, rates.getFirst(), rates.getSecond(), referenceDate, stepinDate, effectiveStartDate) .multipliedBy(-cds.getFixedRate() * signedNotional * rates.getThird()); return protectionLegSensi.combinedWith(riskyAnnuitySensi); }

Target:
public PointSensitivityBuilder presentValueSensitivity( ResolvedCdsIndex cdsIndex, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData) { if (isExpired(cdsIndex, ratesProvider)) { return PointSensitivityBuilder.none(); } ResolvedCds cds = cdsIndex.toSingleNameCds(); LocalDate stepinDate = cds.getStepinDateOffset().adjust(ratesProvider.getValuationDate(), refData); LocalDate effectiveStartDate = cds.calculateEffectiveStartDate(stepinDate); double recoveryRate = underlyingPricer.recoveryRate(cds, ratesProvider); Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider); double signedNotional = cds.getBuySell().normalize(cds.getNotional()); PointSensitivityBuilder protectionLegSensi = underlyingPricer.protectionLegSensitivity( cds, rates.getFirst(), rates.getSecond(), referenceDate, effectiveStartDate, recoveryRate); protectionLegSensi = protectionLegSensi.multipliedBy(signedNotional * rates.getThird()); PointSensitivityBuilder riskyAnnuitySensi = underlyingPricer.riskyAnnuitySensitivity( cds, rates.getFirst(), rates.getSecond(), referenceDate, stepinDate, effectiveStartDate); riskyAnnuitySensi = riskyAnnuitySensi.multipliedBy(-cds.getFixedRate() * signedNotional * rates.getThird()); return protectionLegSensi.combinedWith(riskyAnnuitySensi); }
Source:
public void beforeFormPresentMain() throws Exception { try (SandboxedInstance sandboxedInstance = getSandboxedInstance( "org.talend.components.salesforce.runtime.SalesforceSourceOrSink", true)) { SalesforceRuntimeSourceOrSink ss = (SalesforceRuntimeSourceOrSink) sandboxedInstance.getInstance(); ss.initialize(null, this); ValidationResult vr = ss.validate(null); if (vr.getStatus() == ValidationResult.Result.OK) { try { moduleNames = ss.getSchemaNames(null); } catch (Exception ex) { throw new ComponentException(ExceptionUtil.exceptionToValidationResult(ex)); } selectedModuleNames.setPossibleValues(moduleNames); getForm(Form.MAIN).setAllowBack(true); getForm(Form.MAIN).setAllowFinish(true); } else { throw new ComponentException(vr); } } }

Target:
public void beforeFormPresentMain() throws Exception { try (SandboxedInstance sandboxedInstance = getSandboxedInstance(SOURCE_OR_SINK_CLASS, USE_CURRENT_JVM_PROPS)) { SalesforceRuntimeSourceOrSink ss = (SalesforceRuntimeSourceOrSink) sandboxedInstance.getInstance(); ss.initialize(null, this); ValidationResult vr = ss.validate(null); if (vr.getStatus() == ValidationResult.Result.OK) { try { moduleNames = ss.getSchemaNames(null); } catch (Exception ex) { throw new ComponentException(ExceptionUtil.exceptionToValidationResult(ex)); } selectedModuleNames.setPossibleValues(moduleNames); getForm(Form.MAIN).setAllowBack(true); getForm(Form.MAIN).setAllowFinish(true); } else { throw new ComponentException(vr); } } }