Issue TC-U-ABORT without any apdu - for MAP V1

@param tcapDialog
@param returnMessageOnError
@throws MAPException
501286
protected void fireTCAbortV1(Dialog tcapDialog, boolean returnMessageOnError) throws MAPException {

        if (this.getTCAPProvider().getPreviewMode()) {
            return;
        }

        TCUserAbortRequest tcUserAbort = this.getTCAPProvider().getDialogPrimitiveFactory().createUAbort(tcapDialog);
        if (returnMessageOnError)
            tcUserAbort.setReturnMessageOnError(true);

        try {
            tcapDialog.send(tcUserAbort);
        } catch (TCAPSendException e) {
            throw new MAPException(e.getMessage(), e);
        }
    }
1218496
protected void handleResponseBeanValidationErrorException(Object bean, Consumer<ExceptionMessageBuilder> locationBuilder,
            UserMessages messages, RuntimeException cause) {
        // cause is completely framework info so not show it
        final String msg = buildValidationErrorMessage(bean, locationBuilder, messages);
        if (warning) {
            logger.warn(msg);
        } else { // but keep framework information for various purpose of client
            throw new ResponseBeanValidationErrorException(msg, bean, messages);
        }
    }
351420
public void send(TCContinueRequest event) throws TCAPSendException {

        if (this.previewMode)
            return;

        if (!this.isStructured()) {
            throw new TCAPSendException("Unstructured dialogs do not use Continue");
        }
        try {
            this.dialogLock.lock();
            if (this.state == TRPseudoState.InitialReceived) {
                this.idleTimerActionTaken = true;
                restartIdleTimer();
                TCContinueMessageImpl tcbm = (TCContinueMessageImpl) TcapFactory.createTCContinueMessage();

                if (event.getApplicationContextName() != null) {

                    // set dialog portion
                    DialogPortion dp = TcapFactory.createDialogPortion();
                    dp.setUnidirectional(false);
                    DialogResponseAPDU apdu = TcapFactory.createDialogAPDUResponse();
                    apdu.setDoNotSendProtocolVersion(doNotSendProtocolVersion());
                    dp.setDialogAPDU(apdu);
                    apdu.setApplicationContextName(event.getApplicationContextName());
                    if (event.getUserInformation() != null) {
                        apdu.setUserInformation(event.getUserInformation());
                    }
                    // WHERE THE HELL THIS COMES FROM!!!!
                    // WHEN REJECTED IS USED !!!!!
                    Result res = TcapFactory.createResult();
                    res.setResultType(ResultType.Accepted);
                    ResultSourceDiagnostic rsd = TcapFactory.createResultSourceDiagnostic();
                    rsd.setDialogServiceUserType(DialogServiceUserType.Null);
                    apdu.setResultSourceDiagnostic(rsd);
                    apdu.setResult(res);
                    tcbm.setDialogPortion(dp);

                }

                tcbm.setOriginatingTransactionId(Utils.encodeTransactionId(this.localTransactionId, isSwapTcapIdBytes));
                tcbm.setDestinationTransactionId(this.remoteTransactionId);
                if (this.scheduledComponentList.size() > 0) {
                    Component[] componentsToSend = new Component[this.scheduledComponentList.size()];
                    this.prepareComponents(componentsToSend);
                    tcbm.setComponent(componentsToSend);

                }
                // local address may change, lets check it;
                if (event.getOriginatingAddress() != null && !event.getOriginatingAddress().equals(this.localAddress)) {
                    this.localAddress = event.getOriginatingAddress();
                }
                AsnOutputStream aos = new AsnOutputStream();
                try {
                    tcbm.encode(aos);
                    if (this.provider.getStack().getStatisticsEnabled()) {
                        this.provider.getStack().getCounterProviderImpl().updateTcContinueSentCount(this);
                    }
                    this.provider.send(aos.toByteArray(), event.getReturnMessageOnError(), this.remoteAddress,
                            this.localAddress, this.seqControl, this.networkId, this.localSsn, this.remotePc);
                    this.setState(TRPseudoState.Active);
                    this.scheduledComponentList.clear();
                } catch (Exception e) {
                    // FIXME: remove freshly added invokes to free invoke ID??
                    if (logger.isEnabledFor(Level.ERROR)) {
                        logger.error("Failed to send message: ", e);
                    }
                    throw new TCAPSendException("Failed to send TC-Continue message: " + e.getMessage(), e);
                }

            } else if (state == TRPseudoState.Active) {
                this.idleTimerActionTaken = true;
                restartIdleTimer();
                // in this we ignore acn and passed args(except qos)
                TCContinueMessageImpl tcbm = (TCContinueMessageImpl) TcapFactory.createTCContinueMessage();

                tcbm.setOriginatingTransactionId(Utils.encodeTransactionId(this.localTransactionId, isSwapTcapIdBytes));
                tcbm.setDestinationTransactionId(this.remoteTransactionId);
                if (this.scheduledComponentList.size() > 0) {
                    Component[] componentsToSend = new Component[this.scheduledComponentList.size()];
                    this.prepareComponents(componentsToSend);
                    tcbm.setComponent(componentsToSend);

                }

                AsnOutputStream aos = new AsnOutputStream();
                try {
                    tcbm.encode(aos);
                    this.provider.getStack().getCounterProviderImpl().updateTcContinueSentCount(this);
                    this.provider.send(aos.toByteArray(), event.getReturnMessageOnError(), this.remoteAddress,
                            this.localAddress, this.seqControl, this.networkId, this.localSsn, this.remotePc);
                    this.scheduledComponentList.clear();
                } catch (Exception e) {
                    // FIXME: remove freshly added invokes to free invoke ID??
                    if (logger.isEnabledFor(Level.ERROR)) {
                        logger.error("Failed to send message: ", e);
                    }
                    throw new TCAPSendException("Failed to send TC-Continue message: " + e.getMessage(), e);
                }
            } else {
                throw new TCAPSendException("Wrong state: " + this.state);
            }

        } finally {
            this.dialogLock.unlock();
        }
    }
388006
public void error(String message, Object... args) {
    error(String.format(message, args), getThrowable(args));
  }
581609
private String getErrorMessage(Throwable throwable) {

        StringBuffer result = new StringBuffer(512);

        result.append(
            CmsVaadinUtils.getMessageText(org.opencms.ui.components.Messages.GUI_ERROR_DIALOG_MESSAGE_0)).append(
                "<br />");

        // if a localized message is already set as a parameter, append it.
        result.append(getMessage(throwable));

        return result.toString();
    }
807180
public CompletableFuture<TxnStatus> abortTxn(final String scope,
                                                 final String stream,
                                                 final UUID txId,
                                                 final Version version,
                                                 final OperationContext contextOpt) {
        final OperationContext context = getNonNullOperationContext(scope, stream, contextOpt);
        return withRetriesAsync(() -> sealTxnBody(hostId, scope, stream, false, txId, version, context),
                RETRYABLE_PREDICATE, 3, executor);
    }
242471
@Override
    public MapMessage createMapMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createMapMessage");

        MapMessage mapMessage = null;

        try {
            mapMessage = jmsSession.createMapMessage();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createMapMessage", new Object[] { mapMessage });
        }

        return mapMessage;

    }
746920
@Override
  public void sendAbortSessionAnswer(AbortSessionAnswer answer) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException {
    send(Event.Type.SEND_SESSION_ABORT_ANSWER, answer);
  }
709046
@SuppressWarnings("unchecked")
  public RetryPolicy<R> abortOn(Class<? extends Throwable>... failures) {
    Assert.notNull(failures, "failures");
    Assert.isTrue(failures.length > 0, "Failures cannot be empty");
    return abortOn(Arrays.asList(failures));
  }
228773
private void fireTCAbortACNNotSupported(Dialog tcapDialog, MAPExtensionContainer mapExtensionContainer,
            ApplicationContextName alternativeApplicationContext, boolean returnMessageOnError) throws MAPException {

        if (this.getTCAPProvider().getPreviewMode()) {
            return;
        }

        if (tcapDialog.getApplicationContextName() == null) // MAP V1
            this.fireTCAbortV1(tcapDialog, returnMessageOnError);

        TCUserAbortRequest tcUserAbort = this.getTCAPProvider().getDialogPrimitiveFactory().createUAbort(tcapDialog);

        MAPRefuseInfoImpl mapRefuseInfoImpl = new MAPRefuseInfoImpl();
        mapRefuseInfoImpl.setReason(Reason.noReasonGiven);

        AsnOutputStream localasnOs = new AsnOutputStream();
        mapRefuseInfoImpl.encodeAll(localasnOs);

        UserInformation userInformation = TcapFactory.createUserInformation();

        userInformation.setOid(true);
        userInformation.setOidValue(MAPDialogueAS.MAP_DialogueAS.getOID());

        userInformation.setAsn(true);
        userInformation.setEncodeType(localasnOs.toByteArray());
        if (returnMessageOnError)
            tcUserAbort.setReturnMessageOnError(true);

        if (alternativeApplicationContext != null)
            tcUserAbort.setApplicationContextName(alternativeApplicationContext);
        else
            tcUserAbort.setApplicationContextName(tcapDialog.getApplicationContextName());
        tcUserAbort.setDialogServiceUserType(DialogServiceUserType.AcnNotSupported);
        tcUserAbort.setUserInformation(userInformation);

        try {
            tcapDialog.send(tcUserAbort);
        } catch (TCAPSendException e) {
            throw new MAPException(e.getMessage(), e);
        }
    }
756675
public static void failWithInvalidMethodSignException(boolean expression, SQLiteModelMethod method,
			String messageFormat, Object... args) {
		assertTrueOrInvalidMethodSignException(!expression, method, messageFormat, args);
	}
1007147
private static void abort(String message, Throwable e) throws CoreException
	{
		throw new CoreException((IStatus) new Status(IStatus.ERROR, IDebugConstants.PLUGIN_ID, 0, message, e));
	}
469145
public void invokeTask (Component parent, String retryMessage)
        throws Exception
    {
        while (true) {
            try {
                invoke();
                return;

            } catch (Exception e) {
                Object[] options = new Object[] {
                    "Retry operation", "Abort operation" };
                int rv = JOptionPane.showOptionDialog(
                    parent, retryMessage + "\n\n" + e.getMessage(),
                    "Operation failure", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE, null, options, options[1]);
                if (rv == 1) {
                    throw e;
                }
            }
        }
    }
251552
@Override
  public <T> T decode(Message message, java.lang.Class<T> yourDomainMessageObject) throws RecoderException {
    Object rc = null;
    ClassInfo c = storage.getClassInfo(yourDomainMessageObject);
    CommandDscr cd = c.getAnnotation(CommandDscr.class);
    if (cd != null) {
      try {
        if (message.getCommandCode() != cd.code()) {
          throw new IllegalArgumentException("Invalid message code " + message.getCommandCode());
        }
        if (message.getApplicationId() != 0 && message.getApplicationId() != cd.appId()) {
          throw new IllegalArgumentException("Invalid Application-Id " + message.getApplicationId());
        }
        for (CommandFlag f : cd.flags()) {
          switch (f) {
            case E:
              if (!message.isError()) {
                throw new IllegalArgumentException("Flag e is not set");
              }
              break;
            case P:
              if (!message.isProxiable()) {
                throw new IllegalArgumentException("Flag p is not set");
              }
              break;
            case R:
              if (!message.isRequest()) {
                throw new IllegalArgumentException("Flag m is not set");
              }
              break;
            case T:
              if (!message.isReTransmitted()) {
                throw new IllegalArgumentException("Flag t is not set");
              }
              break;
          }
        }
        // Find max constructor + lost avp set by setters
        int cacount = 0;
        Constructor<?> cm = null;
        Map<String, Class<?>> cmargs = new HashMap<String, Class<?>>();
        for (ConstructorInfo ci : c.getConstructorsInfo()) {
          if (ci.getAnnotation(Setter.class) != null) {
            // check params - all params must have avp annotation
            Class<?>[] params = ci.getConstructor().getParameterTypes();
            boolean correct = true;
            for (Class<?> j : params) {
              if (j.isArray()) {
                j = j.getComponentType();
              }
              if (storage.getClassInfo(j).getAnnotation(AvpDscr.class) == null) {
                correct = false;
                break;
              }
            }
            if (!correct) {
              continue;
            }
            // find max args constructor
            if (cacount < params.length) {
              cacount = params.length;
              cm = ci.getConstructor();
            }
          }
        }
        // fill cm args
        List<Object> initargs = new ArrayList<Object>();
        if (cm != null) {
          for (Class<?> ac : cm.getParameterTypes()) {
            Class<?> lac = ac.isArray() ? ac.getComponentType() : ac;
            cmargs.put(lac.getName(), ac);
            // Create params
            initargs.add(createChildByAvp(findChildDscr(cd.childs(), ac), ac, message.getAvps()));
          }
          // Create instance class
          rc = cm.newInstance(initargs.toArray());
        } else {
          rc = yourDomainMessageObject.newInstance();
        }
        //
        for (MethodInfo mi : c.getMethodsInfo()) {
          if (mi.getAnnotation(Setter.class) != null) {
            Class<?>[] pt = mi.getMethod().getParameterTypes();
            if (pt.length == 1 && storage.getClassInfo(pt[0]).getAnnotation(AvpDscr.class) != null) {
              Class<?> ptc = pt[0].isArray() ? pt[0].getComponentType() : pt[0];
              if (!cmargs.containsKey(ptc.getName())) {
                cmargs.put(ptc.getName(), ptc);
                mi.getMethod().invoke(rc, createChildByAvp(findChildDscr(cd.childs(), pt[0]), pt[0], message.getAvps()));
              }
            }
          }
        }
        // Fill undefined avp
        setUndefinedAvp(message.getAvps(), rc, c, cmargs);
      } catch (InstantiationException e) {
        throw new RecoderException(e);
      } catch (InvocationTargetException e) {
        throw new RecoderException(e);
      } catch (IllegalAccessException e) {
        throw new RecoderException(e);
      }
    }
    return (T) rc;
  }
389643
public int getMessageUserDataLengthOnSend() throws MAPException {

        try {
            switch (this.tcapDialog.getState()) {
                case Idle:
                    ApplicationContextName acn = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory()
                            .createApplicationContextName(this.appCntx.getOID());

                    TCBeginRequest tb = this.mapProviderImpl.encodeTCBegin(this.getTcapDialog(), acn, destReference,
                            origReference, this.extContainer, this.eriStyle, this.eriMsisdn, this.eriVlrNo);
                    return tcapDialog.getDataLength(tb);

                case Active:
                    // Its Active send TC-CONTINUE

                    TCContinueRequest tc = this.mapProviderImpl.encodeTCContinue(this.getTcapDialog(), false, null, null);
                    return tcapDialog.getDataLength(tc);

                case InitialReceived:
                    // Its first Reply to TC-Begin

                    ApplicationContextName acn1 = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory()
                            .createApplicationContextName(this.appCntx.getOID());

                    tc = this.mapProviderImpl.encodeTCContinue(this.getTcapDialog(), true, acn1, this.extContainer);
                    return tcapDialog.getDataLength(tc);
            }
        } catch (TCAPSendException e) {
            throw new MAPException("TCAPSendException when getMessageUserDataLengthOnSend", e);
        }

        throw new MAPException("Bad TCAP Dialog state: " + this.tcapDialog.getState());
    }
574688
private void abort(List<TransactionableResourceManagerListener> listeners) throws XAException
   {
      boolean exception = false;
      for (int i = 0, length = listeners.size(); i < length; i++)
      {
         TransactionableResourceManagerListener listener = listeners.get(i);
         try
         {
            listener.onAbort();
         }
         catch (Exception e)
         {
            log.error("Could not execute the method onAbort", e);
            exception = true;
         }
      }
      if (exception)
      {
         throw new XAException(XAException.XAER_RMERR);
      }
   }
660047
@Override
    public String execute(String[] options) {

        if (this.tcapStacks == null || this.tcapStacks.size() == 0) {
            logger.warn("TCAPStackImpl not set. Command will not be executed ");
            return TCAPAnsiOAMMessage.SERVER_ERROR;
        }

        // At least 1 option is passed?
        if (options == null || options.length < 2) {
            return TCAPAnsiOAMMessage.INVALID_COMMAND;
        }

        String firstOption = options[1];

        if (firstOption == null) {
            return TCAPAnsiOAMMessage.INVALID_COMMAND;
        }

        try {
            if (firstOption.equals("set")) {
                return this.manageSet(options);
            } else if (firstOption.equals("get")) {
                return this.manageGet(options);
            }
            // } catch (Exception e) {
            // logger.error(String.format("Error while executing command %s", Arrays.toString(options)), e);
            // return e.getMessage();
        } catch (Throwable t) {
            logger.error(String.format("Error while executing comand %s", Arrays.toString(options)), t);
            return t.getMessage();
        }

        return TCAPAnsiOAMMessage.INVALID_COMMAND;
    }