TODO Once we switch fully to automata, should this throw PaymentPluginApiException instead?
517967
public ReturnType dispatchWithTimeout(final Callable<PluginDispatcherReturnType<ReturnType>> task) throws TimeoutException, ExecutionException, InterruptedException {
        return dispatchWithTimeout(task, timeoutSeconds, DEFAULT_PLUGIN_TIMEOUT_UNIT);
    }
473442
public function processPayment(PaylandsMethod $paymentMethod)
    {
        /*
         * At this point, order must be created given a cart, and placed in PaymentBridge.
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderLoad(
                $this->paymentBridge,
                $paymentMethod
            );

        /*
         * Order Not found Exception must be thrown just here.
         */
        if (!$this->paymentBridge->getOrder()) {
            throw new PaymentOrderNotFoundException();
        }

        /*
         * Order exists right here.
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderCreated(
                $this->paymentBridge,
                $paymentMethod
            );

        /*
         * Try to make the payment transaction
         */
        try {
            $this->paylandsApiAdapter->validateCard($paymentMethod);

            $this->paylandsEventDispatcher->notifyCardValid($paymentMethod);

            if (!$paymentMethod->isOnlyTokenizeCard()) {
                $this->paylandsApiAdapter->createTransaction($paymentMethod);
            }

            /*
             * Payment paid done.
             *
             * Paid process has ended ( No matters result )
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderDone(
                    $this->paymentBridge,
                    $paymentMethod
                );

            if (PaylandsMethod::STATUS_OK !== $paymentMethod->getPaymentStatus()) {
                throw new PaymentException(sprintf('Order %s could not be paid',
                    $paymentMethod->getPaymentResult()['order']['uuid']
                ));
            }

            /*
             * Payment paid successfully.
             *
             * Paid process has ended successfully
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderSuccess(
                    $this->paymentBridge,
                    $paymentMethod
                );
        } catch (PaymentException $e) {
            /*
             * Payment paid failed.
             *
             * Paid process has ended failed
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderFail(
                    $this->paymentBridge,
                    $paymentMethod
                );

            throw $e;
        }

        return $this;
    }
649729
@Override
    protected void doExecute() throws Exception {
        final List<FunctionTemplate> templates = loadAllFunctionTemplates();

        final FunctionTemplate template = getFunctionTemplate(templates);
        final BindingTemplate bindingTemplate = loadBindingTemplate(template.getTriggerType());

        final Map params = prepareRequiredParameters(template, bindingTemplate);

        final String newFunctionClass = substituteParametersInTemplate(template, params);

        saveNewFunctionToFile(newFunctionClass);
    }
108198
@Override
  public final void makeOtherEntries(final Map<String, Object> pAddParam,
    final PaymentTo pEntity, final IRequestData pRequestData,
      final boolean pIsNew) throws Exception {
    String actionAdd = pRequestData.getParameter("actionAdd");
    if ("makeAccEntries".equals(actionAdd)) {
      this.prcPurchaseInvoiceSave.calculateTotalPayment(pAddParam,
        pEntity.getPurchaseInvoice());
      getSrvOrm().updateEntity(pAddParam, pEntity.getPurchaseInvoice());
    }
  }
870561
function Payment(options) {
  if (!(this instanceof Payment))
    return new Payment(options);

  this.merchantData = null;
  this.transactions = [];
  this.refundTo = [];
  this.memo = null;

  if (options)
    this.fromOptions(options);
}
672122
public function scanInstall()
    {

        if(!$this->lockSystemChanges)
        {
            foreach ($this->ApplicationContext->detectPluginDirectories()->getPluginDirectories() as $pluginDir) {
                if (is_dir($pluginDir)) {
                    $slug = basename($pluginDir);
                    if (!$this->PluginService->slugExists($slug)) {

                        $xml = $this->loadXML($pluginDir);
                        if ($xml) {

                            if(!$this->TransactionManager->isTransactionInProgress())
                                $this->TransactionManager->begin();

                            //INSERT PLUGIN INTO DB

                            $plugin = new Plugin();
                            $this->ModelMapper->defaultsOnModel($plugin);

                            $plugin = $this->SystemXMLConverter->xmlToPlugin($plugin, $xml);

                            $plugin->Slug = $slug;
                            $plugin->Path = $pluginDir;
                            $plugin->Installed = false;

                            try {
                                $this->PluginService->add($plugin);
                            } catch(ValidationException $ve) {
                                throw new Exception('Plugins: '.$ve->getMessage());
                            }
                        }

                    }
                }
            }

    //        $triggerReload = false;

            foreach ($this->PluginService->findAll()->getResults() as $plugin) {
                if(!is_dir($plugin->Path)) {
                    $plugin->PathInvalid = true;
                    if($plugin->isEnabled())
                    {
                        if(!$this->TransactionManager->isTransactionInProgress())
                            $this->TransactionManager->begin();

                        $plugin->Enabled = false;
                        $this->PluginService->edit($plugin);
                    }
                    if(!$plugin->isInstalled()) {
                        if(!$this->TransactionManager->isTransactionInProgress())
                            $this->TransactionManager->begin();

                        $this->PluginService->delete($plugin->Slug);
                    }
                    continue;
                }

                $this->autoupgradePlugin($plugin);
            }

            if($this->TransactionManager->isTransactionInProgress())
                $this->TransactionManager->commit();

        }

        foreach($this->ElementService->findAll()->getResults() as $element)
            $this->NodeService->createDBSchema($element);

//        if ($triggerReload)
//            $this->ApplicationContext->reload();


    }
683236
synchronized Plugin nextPlugin() {
    	if (!init) {
    		this.reset();
    	}
    	
        Plugin plugin = probeNextPlugin();
        if (plugin == null) {
            return null;
        }
        
        listPending.remove(plugin);
        plugin.setTimeStarted();
        listRunning.add(plugin);

        return plugin;
    }
57345
protected <I> boolean accepts(ScannerPlugin<I, ?> selectedPlugin, I item, String path, Scope scope) {
        boolean accepted = false;

        try {
            accepted = selectedPlugin.accepts(item, path, scope);
        } catch (IOException e) {
            LOGGER.error("Plugin " + selectedPlugin + " failed to check whether it can accept item " + path, e);
        }

        return accepted;
    }
980897
@SuppressWarnings("unchecked")
    @Override
    public <RESULT> OptionalThing<RESULT> required(TransactionShow<RESULT> txLambda) {
        try {
            return wrapOptional((RESULT) transactionManagerAdapter.required(adapter -> {
                return performTx(txLambda, adapter, TransactionGenre.REQUIRED);
            }), txLambda);
        } catch (Throwable e) {
            handleTransactionFailure(txLambda, e);
            return null; // unreachable
        }
    }
1277938
private void tryCommit()
    {
        try
        {
            JComponent editor = spinner.getEditor();
            if (editor instanceof JSpinner.DefaultEditor)
            {
                JSpinner.DefaultEditor defaultEditor =
                    (JSpinner.DefaultEditor)editor;
                defaultEditor.commitEdit();
            }
        }
        catch (ParseException e1)
        {
            // Ignored
        }
    }
138045
public void runInRetryableTransaction(Runnable runnable)
    throws DataAccessException {
        TransactionWrapper transaction=null;
        try {
            transaction = startTransaction();
            runnable.run();
        } catch (Throwable e) {
            if (canRetryTransaction(e)) {
                transaction = (TransactionWrapper)initTransactionRetry(transaction);
                ((ProcessExecutor)getTransactionRetrier()).runInTransaction(runnable);
            }
            else
                throw e;
        } finally {
            stopTransaction(transaction);
        }
    }
1269197
public static <S, I, T> void write(Automaton<S, I, T> automaton,
                                       Collection<? extends I> inputAlphabet,
                                       Appendable a) throws IOException {
        write(automaton.transitionGraphView(inputAlphabet), a);
    }
245019
@SuppressWarnings("UnusedDeclaration")
    public void init() throws Exception {
        initBuilderSpecific();
        resetFields();
        if (!UserPluginInfo.NO_PLUGIN_KEY.equals(getSelectedStagingPluginName())) {
            PluginSettings selectedStagingPluginSettings = getSelectedStagingPlugin();
            try {
                stagingStrategy = getArtifactoryServer().getStagingStrategy(selectedStagingPluginSettings, Util.rawEncode(project.getName()), project);
            } catch (Exception e) {
                log.log(Level.WARNING, "Failed to obtain staging strategy: " + e.getMessage(), e);
                strategyRequestFailed = true;
                strategyRequestErrorMessage = "Failed to obtain staging strategy '" +
                        selectedStagingPluginSettings.getPluginName() + "': " + e.getMessage() +
                        ".\nPlease review the log for further information.";
                stagingStrategy = null;
            }
            strategyPluginExists = (stagingStrategy != null) && !stagingStrategy.isEmpty();
        }

        prepareDefaultVersioning();
        prepareDefaultGlobalModule();
        prepareDefaultModules();
        prepareDefaultVcsSettings();
        prepareDefaultPromotionConfig();
    }
138968
function DoExpressCheckoutPayment($token, $payerId, $options = array()) {
    $values = array_merge($options, array('TOKEN'   => $token,
                                          'PAYERID' => $payerId));
    if (PAYPAL_DEV_MODE == 'true') $this->log('DoExpressCheckout - breakpoint 1 - ['.$token  . ' ' . $payerId . ' ' . "]\n\n[" . print_r($values, true) .']', $token);

    if ($this->_mode == 'payflow') {
      $values['ACTION'] = 'D'; /* ACTION=D denotes DoExpressCheckoutPayment via Payflow */
      $values['TENDER'] = 'P';
      $values['TRXTYPE'] = $this->_trxtype;
      $values['NOTIFYURL'] = zen_href_link('ipn_main_handler.php', '', 'SSL',false,false,true);
    } elseif ($this->_mode == 'nvp') {
      if (!isset($values['PAYMENTACTION']) || $this->checkHasApiCredentials() === FALSE) $values['PAYMENTACTION'] = ($this->_trxtype == 'S' || ($this->checkHasApiCredentials() === FALSE) ? 'Sale' : 'Authorization');
      $values['NOTIFYURL'] = urlencode(zen_href_link('ipn_main_handler.php', '', 'SSL',false,false,true));
    }
    $this->values = $values;
    $this->notify('NOTIFY_PAYPAL_DOEXPRESSCHECKOUTPAYMENT');
    if (PAYPAL_DEV_MODE == 'true') $this->log('DoExpressCheckout - breakpoint 2 '.print_r($this->values, true), $token);
    return $this->_request($this->values, 'DoExpressCheckoutPayment');
  }
620264
@SuppressWarnings("unused")
    @Override
    public void onPaymentError(int code, String response) {
        try {
            Toast.makeText(this, "Payment failed: " + code + " " + response, Toast.LENGTH_SHORT).show();
        } catch (Exception e) {
            Log.e(TAG, "Exception in onPaymentError", e);
        }
    }
1182912
void commitTransaction() throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "commitTransaction");

        try {
            jcaSession.commitLocalTransaction();
            uncommittedReceiveCount = 0;
        } catch (javax.resource.spi.IllegalStateException ise) {
            // No FFDC code needed
            // d238447 FFDC review. Generate FFDC
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "EXCEPTION_RECEIVED_CWSIA0053",
                                                                               new Object[] { ise, "JmsSessionImpl.commitTransaction (#1)" },
                                                                               ise,
                                                                               "JmsSessionImpl.commitTransaction#1",
                                                                               this,
                                                                               tc
                            );
        } catch (javax.resource.spi.LocalTransactionException lte) {
            // No FFDC code needed
            // d238447 FFDC Review. LocalT thrown if no transaction in progress. Wouldn't expect
            //   us to call commit if this was the case, so generate FFDC.
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "EXCEPTION_RECEIVED_CWSIA0053",
                                                                               new Object[] { lte, "JmsSessionImpl.commitTransaction (#2)" },
                                                                               lte,
                                                                               "JmsSessionImpl.commitTransaction#2",
                                                                               this,
                                                                               tc
                            );
        } catch (SIConnectionDroppedException e) { //PK60857  connection no longer available so tran will timeout and rollback on the server side
            // No FFDC code needed
            // Generate FFDC.
            rolledBackDueToConnectionFailure = true;
            throw (TransactionRolledBackException) JmsErrorUtils.newThrowable(
                                                                              TransactionRolledBackException.class, // subclass of JMSException
                                                                              "EXCEPTION_RECEIVED_CWSIA0053",
                                                                              new Object[] { e, "JmsSessionImpl.commitTransaction (#4)" },
                                                                              e,
                                                                              "JmsSessionImpl.commitTransaction#4",
                                                                              this,
                                                                              tc
                            );

        } catch (SIConnectionLostException e) { //PK60857  connection failed during the commit, result unknown.  This is a risk of 1PC, assume rollback.
            // No FFDC code needed
            // Generate FFDC.
            rolledBackDueToConnectionFailure = true;
            throw (TransactionRolledBackException) JmsErrorUtils.newThrowable(
                                                                              TransactionRolledBackException.class, // subclass of JMSException
                                                                              "EXCEPTION_RECEIVED_CWSIA0053",
                                                                              new Object[] { e, "JmsSessionImpl.commitTransaction (#5)" },
                                                                              e,
                                                                              "JmsSessionImpl.commitTransaction#5",
                                                                              this,
                                                                              tc
                            );
        }

        catch (Exception e) {
            // No FFDC code needed
            // d238447 FFDC review. Includes ResourceException, SIException, SIErrorException
            // Generate FFDC.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0053",
                                                            new Object[] { e, "JmsSessionImpl.commitTransaction (#3)" },
                                                            e,
                                                            "JmsSessionImpl.commitTransaction#3",
                                                            this,
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "commitTransaction");
    }
66470
private RuntimeException codeBug()
        throws RuntimeException
    {
        throw Kit.codeBug("ts.cursor=" + ts.cursor
                          + ", ts.tokenBeg=" + ts.tokenBeg
                          + ", currentToken=" + currentToken);
    }