Validates an UPC-E message. The message can also be UPC-A in which case the
message is compacted to a UPC-E message if possible. If it's not possible
an IllegalArgumentException is thrown

@param sMsg
the message to validate
@return {@link EValidity}
192947
@Nonnull
  public static EValidity validateMessage (@Nullable final String sMsg)
  {
    final int nLen = StringHelper.getLength (sMsg);
    if (nLen >= 7 && nLen <= 8)
    {
      final byte nNumberSystem = _extractNumberSystem (sMsg);
      if (nNumberSystem >= 0 && nNumberSystem <= 1)
        return EValidity.VALID;
    }
    return EValidity.INVALID;
  }
1070915
public Result check(IMessage message) {
    if (message == null) {
      throw new IllegalArgumentException("Message is null");
    }
    if (!enable) {
      return SUCCESS;
    }
    // todo
    return null;
  }
1101093
public void processMessage(JsMessage jsMsg) throws SIResourceException
   {
     if (tc.isEntryEnabled())
       SibTr.entry(tc, "processMessage", new Object[] { jsMsg });
    
     int priority = jsMsg.getPriority().intValue();
     Reliability reliability = jsMsg.getReliability();
       
     SIBUuid12 streamID = jsMsg.getGuaranteedStreamUUID();
     StreamSet streamSet = getStreamSet(streamID, true);
     
     InternalInputStream internalInputStream = null;
     synchronized(streamSet)
     {
       internalInputStream = (InternalInputStream) streamSet.getStream(priority, reliability);        

       // This may be the first message which has required this stream    
       if(internalInputStream == null && 
        (reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0))
       {
         internalInputStream = createStream(streamSet, priority, reliability);      
       }
     }
        
     if (tc.isEntryEnabled())
       SibTr.exit(tc, "processMessage");
   }
962242
protected static char calcChecksumChar (@Nonnull final String sMsg, @Nonnegative final int nLength)
  {
    ValueEnforcer.notNull (sMsg, "Msg");
    ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, sMsg.length ());

    return asChar (calcChecksum (sMsg.toCharArray (), nLength));
  }
1351372
public boolean isValid() {
        for (ValidationResult result : results) {
            for (ValidationMessage<Origin> message : result.getMessages()) {
                if (Severity.ERROR.equals(message.getSeverity())) {
                    return false;
                }
            }
        }
        return true;
    }
856590
public static ValidationStatus getInfoMsgLevel(final String msg) {
    if (msg.startsWith("ERROR")) {
      return ValidationStatus.ERROR;
    }
    if (msg.startsWith("WARN")) {
      return ValidationStatus.WARN;
    }
    return ValidationStatus.PASS;
  }
660204
protected final void validateSuccess(final Status status) {
        String statusValue = status.getStatusCode().getValue();
        if (!StatusCode.SUCCESS.equals(statusValue)) {
            final StatusMessage statusMessage = status.getStatusMessage();
            if (statusMessage != null) {
                statusValue += " / " + statusMessage.getMessage();
            }
            throw new SAMLException("Response is not success ; actual " + statusValue);
        }
    }
1100595
public static <T> Validation<T> notNull(String msg) {
        return SimpleValidation.from(Objects::nonNull, msg);
    }
639838
protected void validate(BasicMessageWithExtraData<REQ> envelope) {
        if (envelope.getBasicMessage().getResourceId() == null) {
            throw new IllegalArgumentException(
                    String.format("resourceId of a [%s] cannot be null", envelope.getClass().getName()));
        }
    }
1110218
public static void log (@Nonnull final Logger aLogger,
                          @Nonnull final IErrorLevel aErrorLevel,
                          @Nonnull final String sMsg)
  {
    log (aLogger, aErrorLevel, sMsg, null);
  }
584592
public String validate() {

		String result = null;
		if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty())
			result = "The message configuration cannot be null or empty.";
		else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null)
			result = "The message configuration does not contain the messaging type.";
		else if( Utils.isEmptyOrWhitespaces( this.applicationName ))
			result = "The application name cannot be null or empty.";
		else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath ))
			result = "The scoped instance's path cannot be null or empty.";

		return result;
	}
1250040
public static <T extends CharSequence> T validateEmail(T value, String errorMsg) throws ValidateException {
		if (false == isEmail(value)) {
			throw new ValidateException(errorMsg);
		}
		return value;
	}
1134870
@Override
    public void unlockMsg(long lockID, Transaction transaction, boolean incrementUnlock) throws MessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "unlockMsg", new Object[] { Long.valueOf(lockID), transaction, Boolean.valueOf(incrementUnlock) });

        if (failedInitInRestore)
        {
            initialiseNonPersistent(true);
        }

        if (incrementUnlock)
        {
            // If we do not wish to increment the count, there is no point checking
            // against redelivery threshold
            redeliveryCountReached = false;

            try
            {
                if (PRE_UNLOCKED_1 != null)
                {
                    PRE_UNLOCKED_1.messageEventOccurred(MessageEvents.PRE_UNLOCKED, this, transaction);
                }
                if (PRE_UNLOCKED_2 != null)
                {
                    PRE_UNLOCKED_2.messageEventOccurred(MessageEvents.PRE_UNLOCKED, this, transaction);
                }
            } catch (SIException e)
            {
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.store.items.MessageItem.unlockMsg",
                                            "1:2955:1.244.1.40",
                                            this);

                SibTr.exception(tc, e);

                // Something went wrong so make sure we unlock the message
                redeliveryCountReached = false;
            }

        }

        // If the pre_unlocked callback redirected the message to the exc dest,
        // then unlock the message.
        if (!redeliveryCountReached)
        {
            unlock(lockID, transaction, incrementUnlock);

            SIMPItemStream itemStream = (SIMPItemStream) getItemStream();
            BaseDestinationHandler bdh = getDestinationHandler(false, itemStream);

            // proceede if and only if the redeliverycount column exists
            if (bdh.isRedeliveryCountPersisted() && bdh.getMessageProcessor().getMessageStore().isRedeliveryCountColumnAvailable()) {

                int rdl_count = guessRedeliveredCount();

                persistRedeliveredCount(rdl_count);

                //updating the value in MFP.
                if (msg != null)
                    msg.setRedeliveredCount(rdl_count);

            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "unlockMsg");
    }
978655
public static void log (@Nonnull final Logger aLogger,
                          @Nonnull final IHasErrorLevel aErrorLevelProvider,
                          @Nonnull final String sMsg)
  {
    log (aLogger, aErrorLevelProvider.getErrorLevel (), sMsg, null);
  }
1067095
public void verifyMessageSize(int maxMessageSize) {
       Iterator<MessageAndOffset> shallowIter =  internalIterator(true);
       while(shallowIter.hasNext()) {
           MessageAndOffset messageAndOffset = shallowIter.next();
           int payloadSize = messageAndOffset.message.payloadSize();
           if(payloadSize > maxMessageSize) {
               throw new MessageSizeTooLargeException("payload size of " + payloadSize + " larger than " + maxMessageSize);
           }
       }
    }
1269980
@Nullable
  public static String getCompactMessage (final String sMsg)
  {
    UPCA.validateMessage (sMsg);
    final String sUPCA = UPCA.handleChecksum (sMsg, EEANChecksumMode.AUTO);
    final byte nNumberSystem = _extractNumberSystem (sUPCA);
    if (nNumberSystem != 0 && nNumberSystem != 1)
      return null;

    final byte nCheck = StringParser.parseByte (sUPCA.substring (11, 12), (byte) -1);
    if (nCheck == (byte) -1)
      return null;

    final StringBuilder aSB = new StringBuilder ();
    aSB.append (Byte.toString (nNumberSystem));
    final String manufacturer = sUPCA.substring (1, 1 + 5);
    final String product = sUPCA.substring (6, 6 + 5);
    // Rule 1
    String mtemp = manufacturer.substring (2, 2 + 3);
    String ptemp = product.substring (0, 0 + 2);
    if ("000|100|200".indexOf (mtemp) >= 0 && "00".equals (ptemp))
    {
      aSB.append (manufacturer.substring (0, 2));
      aSB.append (product.substring (2, 2 + 3));
      aSB.append (mtemp.charAt (0));
    }
    else
    {
      // Rule 2
      ptemp = product.substring (0, 0 + 3);
      if ("300|400|500|600|700|800|900".indexOf (mtemp) >= 0 && "000".equals (ptemp))
      {
        aSB.append (manufacturer.substring (0, 0 + 3));
        aSB.append (product.substring (3, 3 + 2));
        aSB.append ('3');
      }
      else
      {
        // Rule 3
        mtemp = manufacturer.substring (3, 3 + 2);
        ptemp = product.substring (0, 0 + 4);
        if ("10|20|30|40|50|60|70|80|90".indexOf (mtemp) >= 0 && "0000".equals (ptemp))
        {
          aSB.append (manufacturer.substring (0, 0 + 4));
          aSB.append (product.substring (4, 4 + 1));
          aSB.append ('4');
        }
        else
        {
          // Rule 4
          mtemp = manufacturer.substring (4, 4 + 1);
          ptemp = product.substring (4, 4 + 1);
          if (!"0".equals (mtemp) && "5|6|7|8|9".indexOf (ptemp) >= 0)
          {
            aSB.append (manufacturer);
            aSB.append (ptemp);
          }
          else
          {
            return null;
          }
        }
      }
    }
    aSB.append (Byte.toString (nCheck));
    return aSB.toString ();
  }
451569
function SMSDataValidator(data) {
  MessagingUserStatus.call(this, 'sms validator');

  if(!helpers.validatePhoneNumber(data.to)) {
    // To phone number is invalid
    this.state.code = this.StatusCodes.INVALID;
    this.state.message = 'Invalid "to" phone number: ' + data.to;

  } else if(data.from && !helpers.validatePhoneNumber(data.from)) {
    // From phone number is invalid (if it is input through API)
    this.state.code = this.StatusCodes.INVALID;
    this.state.message = 'Invalid "from" phone number: ' + data.from;

  } else if(!helpers.validateMessage(data.message)) {
    // Message string is invalid
    this.state.code = this.StatusCodes.INVALID;
    this.state.message = 'Invalid message: ' + data.message;

  } else {
    // Input data is valid
    this.state.code = this.StatusCodes.VALID;
    this.state.message = 'Ok';
  }
}