Checks the topic for any wildcards as a Event topic can not
contain wildcard characters, the MatchOne and MatchMany

@param topic  The topic to be checked

@throws InvalidTopicSyntaxException if topic is syntactically invalid
499210
public void checkEventTopicSyntax(String topic)
    throws InvalidTopicSyntaxException
  {
    checkTopicNotNull(topic);
		    
    if (topic.indexOf(MatchSpace.SUBTOPIC_MQSI_MATCHONE_CHAR) > -1 || 
      topic.indexOf(MatchSpace.SUBTOPIC_MQSI_MATCHMANY_CHAR) > -1)
      throw new InvalidTopicSyntaxException(
         NLS.format(
           "INVALID_TOPIC_ERROR_CWSIH0006",
           new Object[] { topic }));
  }
14013
function serializeTopics(topics) {
    return topics.map(function (topic) {
        if (typeof (topic) === 'string') {
            return topic;
        }
        else if (Array.isArray(topic)) {
            topic.forEach(function (topic) {
                if (topic !== null && bytes_1.hexDataLength(topic) !== 32) {
                    errors.throwError('invalid topic', errors.INVALID_ARGUMENT, { argument: 'topic', value: topic });
                }
            });
            return topic.join(',');
        }
        else if (topic === null) {
            return '';
        }
        return errors.throwError('invalid topic value', errors.INVALID_ARGUMENT, { argument: 'topic', value: topic });
    }).join('&');
}
1011529
public void setTopicIds(String v) {
    if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_topicIds == null)
      jcasType.jcas.throwFeatMissing("topicIds", "de.julielab.jules.types.Token");
    jcasType.ll_cas.ll_setStringValue(addr, ((Token_Type)jcasType).casFeatCode_topicIds, v);}
102468
private static void validateCategories(String... categories) {

        for (String category : categories) {
            if (!category.matches(FCM_TOPIC_PATTERN)) {
                throw new IllegalArgumentException(String.format("%s does not match %s", category, FCM_TOPIC_PATTERN));
            }
        }
    }
1104935
@Override
    public JmsTopic createTopic(String name) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTopic", name);
        JmsTopic topic = null;

        // if name string is null throw exception
        if (name == null) {
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
                                                                           InvalidDestinationException.class,
                                                                           "INVALID_VALUE_CWSIA0003",
                                                                           new Object[] { "Topic name", null },
                                                                           tc
                            );
        }

        // if name is "queue://" throw exception
        if (name != null && name.startsWith(JmsQueueImpl.QUEUE_PREFIX)) {
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
                                                                           InvalidDestinationException.class,
                                                                           "MALFORMED_DESCRIPTOR_CWSIA0047",
                                                                           new Object[] { "Topic", name },
                                                                           tc
                            );
        }

        name = name.trim();
        topic = (JmsTopic) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.TOPIC);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createTopic", topic);
        return topic;
    }
39646
private static void checkPartForTextType(HashMap<String, Collection<String>> bodies, Part part) throws IOException, MessagingException {
        Object content = part.getContent();
        if (content instanceof CharSequence) {
            String ct = part.getContentType();
            Collection<String> value = bodies.get(ct);
            if (value != null) {
                value.add(content.toString());
            } else {
                value = new LinkedList<>();
                value.add(content.toString());
                bodies.put(ct, value);
            }
        } else if (content instanceof Multipart) {
            Multipart mp = (Multipart) content;
            for(int i = 0; i < mp.getCount(); i++) {
                checkPartForTextType(bodies, mp.getBodyPart(i));
            }
        }
    }
777681
void checkTopicPublishPermission(String topic) {
        SecurityManager sm = System.getSecurityManager();
        if (sm == null)
            return;

        sm.checkPermission(new TopicPermission(topic, PUBLISH));
    }
511368
static public function CheckTopicFilter($topic_filter)
    {
        if (!isset($topic_filter[0]) || isset($topic_filter[65535])) {
            throw new Exception('Topic filter must be at 1~65535 bytes long');
        }
        self::ValidateUTF8($topic_filter);

        if (false !== strpos($topic_filter, chr(0))) {
            throw new Exception('Null character is not allowed in topic');
        }

        $length = strlen($topic_filter);

        /*
         The multi-level wildcard character MUST be specified either on its own or following a topic level separator.
         In either case it MUST be the last character specified in the Topic Filter [MQTT-4.7.1-2].
         */
        if (($p = strpos($topic_filter, '#')) !== false) {
            if ($p != $length - 1) {
                throw new Exception('"#" MUST be the last char in topic filter');
            } else if ($length > 1 && $topic_filter[$length - 2] != '/') {
                throw new Exception('"#" MUST occupy an entire level of the filter');
            }
        }

        $levels = explode('/', $topic_filter);
        foreach ($levels as $l) {
            if ($l == '') {
                continue;
            } else if (strpos($l, '+') !== false && isset($l[1])) {
                /*
                 The single-level wildcard can be used at any level in the Topic Filter, including first and last levels.
                 Where it is used it MUST occupy an entire level of the filter [MQTT-4.7.1-3].
                 */
                throw new Exception('"+" MUST occupy an entire level of the filter');
            }
        }

        if ($topic_filter[0] == '#') {
            Debug::Log(Debug::DEBUG, 'If you want to subscribe topic begin with $, please subscribe both "#" and "$SOMETOPIC/#"');
        }
    }
882377
@Override
	public final void deleteTemporaryTopic(String topicName) throws JMSException
    {
        DeleteTemporaryTopicQuery query = new DeleteTemporaryTopicQuery();
        query.setTopicName(topicName);
        transportEndpoint.blockingRequest(query);
    }
1358308
protected boolean checkTopicsForInvalidDuplicates(final ContentSpec contentSpec) {
        boolean valid = true;

        // Find all Topics that have two or more different revisions
        final List<ITopicNode> allTopicNodes = contentSpec.getAllTopicNodes();
        final Map<Integer, Map<Integer, Set<ITopicNode>>> invalidTopicNodes = new HashMap<Integer, Map<Integer, Set<ITopicNode>>>();

        for (final ITopicNode topicNode1 : allTopicNodes) {
            if (!topicNode1.isTopicAnExistingTopic()) continue;

            for (final ITopicNode topicNode2 : allTopicNodes) {
                // If the Topic isn't an existing topic and doesn't match the first spec topic's id, then continue
                if (topicNode1 == topicNode2 || !topicNode2.isTopicAnExistingTopic() || !topicNode1.getDBId().equals(topicNode2.getDBId()))
                    continue;

                // Check if the revisions between the two topics are the same
                if (topicNode1.getRevision() == null && topicNode2.getRevision() != null || topicNode1.getRevision() != null &&
                        topicNode2.getRevision() == null || topicNode1.getRevision() != null && !topicNode1.getRevision().equals(
                        topicNode2.getRevision())) {
                    if (!invalidTopicNodes.containsKey(topicNode1.getDBId())) {
                        invalidTopicNodes.put(topicNode1.getDBId(), new HashMap<Integer, Set<ITopicNode>>());
                    }

                    final Map<Integer, Set<ITopicNode>> revisionsToTopicNode = invalidTopicNodes.get(topicNode1.getDBId());
                    if (!revisionsToTopicNode.containsKey(topicNode1.getRevision())) {
                        revisionsToTopicNode.put(topicNode1.getRevision(), new HashSet<ITopicNode>());
                    }

                    revisionsToTopicNode.get(topicNode1.getRevision()).add(topicNode1);

                    valid = false;
                }
            }
        }

        // Loop through and generate an error message for each invalid topic
        for (final Entry<Integer, Map<Integer, Set<ITopicNode>>> entry : invalidTopicNodes.entrySet()) {
            final Integer topicId = entry.getKey();
            final Map<Integer, Set<ITopicNode>> revisionsToTopicNode = entry.getValue();

            final List<String> revNumbers = new ArrayList<String>();
            final List<Integer> revisions = new ArrayList<Integer>(revisionsToTopicNode.keySet());
            Collections.sort(revisions, new NullNumberSort<Integer>());

            for (final Integer revision : revisions) {
                final List<ITopicNode> topicNodes = new ArrayList<ITopicNode>(revisionsToTopicNode.get(revision));

                // Build up the line numbers message
                final StringBuilder lineNumbers = new StringBuilder();
                if (topicNodes.size() > 1) {
                    // Sort the Topics by line numbers
                    Collections.sort(topicNodes, new TopicNodeLineNumberComparator());

                    for (int i = 0; i < topicNodes.size(); i++) {
                        if (i == topicNodes.size() - 1) {
                            lineNumbers.append(" and ");
                        } else if (lineNumbers.length() != 0) {
                            lineNumbers.append(", ");
                        }

                        lineNumbers.append(topicNodes.get(i).getLineNumber());
                    }
                } else if (topicNodes.size() == 1) {
                    lineNumbers.append(topicNodes.get(0).getLineNumber());
                }

                // Build the revision message
                revNumbers.add(
                        String.format(ProcessorConstants.ERROR_TOPIC_WITH_DIFFERENT_REVS_REV_MSG, (revision == null ? "Latest" : revision),
                                lineNumbers));
            }

            final StringBuilder message = new StringBuilder(String.format(ProcessorConstants.ERROR_TOPIC_WITH_DIFFERENT_REVS_MSG, topicId));
            for (final String revNumber : revNumbers) {
                message.append(String.format(ProcessorConstants.CSLINE_MSG, revNumber));
            }

            log.error(message.toString());
        }

        return valid;
    }
12401
@Override
	public final void deleteTemporaryTopic(String topicName) throws JMSException
    {
        engine.deleteTopic(topicName);
        unregisterTemporaryTopic(topicName);
    }
10356
public static boolean survived(String topic, List<Pattern> blacklist, List<Pattern> whitelist) {
    if (stringInPatterns(topic, blacklist)) {
      return false;
    }
    return (whitelist.isEmpty() || stringInPatterns(topic, whitelist));
  }
223130
public static Topic asRef( Topic topic ) throws JMSException
    {
        if (topic == null)
            return null;
            
        if (topic instanceof TopicRef)
            return topic;
        
        return new TopicRef(topic.getTopicName());
    }
8
public TopicProducer<Object> createTopicJsonProducer(final String topic)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new TopicProducer<Object>(connectionFactory, jmsConfig, topic, producerCallback);
    }
1305515
public static List<String> checkTopicRootElement(final ServerSettingsWrapper serverSettings, final BaseTopicWrapper<?> topic,
            final Document doc) {
        final List<String> xmlErrors = new ArrayList<String>();
        final ServerEntitiesWrapper serverEntities = serverSettings.getEntities();

        if (isTopicANormalTopic(topic, serverSettings)) {
            if (!doc.getDocumentElement().getNodeName().equals(DocBookUtilities.TOPIC_ROOT_NODE_NAME)) {
                xmlErrors.add("Topics must be a <" + DocBookUtilities.TOPIC_ROOT_NODE_NAME + ">.");
            }
        } else {
            if (topic.hasTag(serverEntities.getRevisionHistoryTagId())) {
                if (!doc.getDocumentElement().getNodeName().equals("appendix")) {
                    xmlErrors.add("Revision History topics must be an <appendix>.");
                }

                // Check to make sure that a revhistory entry exists
                final NodeList revHistoryList = doc.getElementsByTagName("revhistory");
                if (revHistoryList.getLength() == 0) {
                    xmlErrors.add("No <revhistory> element found. A <revhistory> must exist for Revision Histories.");
                }
            } else if (topic.hasTag(serverEntities.getLegalNoticeTagId())) {
                if (!doc.getDocumentElement().getNodeName().equals("legalnotice")) {
                    xmlErrors.add("Legal Notice topics must be a <legalnotice>.");
                }
            } else if (topic.hasTag(serverEntities.getAuthorGroupTagId())) {
                if (!doc.getDocumentElement().getNodeName().equals("authorgroup")) {
                    xmlErrors.add("Author Group topics must be an <authorgroup>.");
                }
            } else if (topic.hasTag(serverEntities.getAbstractTagId())) {
                if (!doc.getDocumentElement().getNodeName().equals("abstract")) {
                    xmlErrors.add("Abstract topics must be an <abstract>.");
                }
            } else if (topic.hasTag(serverEntities.getInfoTagId())) {
                if (DocBookVersion.DOCBOOK_50.getId().equals(topic.getXmlFormat())) {
                    if (!doc.getDocumentElement().getNodeName().equals("info")) {
                        xmlErrors.add("Info topics must be an <info>.");
                    }
                } else {
                    if (!doc.getDocumentElement().getNodeName().equals("sectioninfo")) {
                        xmlErrors.add("Info topics must be a <sectioninfo>.");
                    }
                }
            }
        }

        return xmlErrors;
    }
356412
private final void checkTopicNotNull(String topic) 
    throws InvalidTopicSyntaxException
  {
    if (topic == null)
      throw new InvalidTopicSyntaxException(
        NLS.format(
          "INVALID_TOPIC_ERROR_CWSIH0005",
          new Object[] { topic }));
  }
56684
private void prepareTopic(final Map<String, InternalTopicMetadata> topicPartitions) {
    log.debug("Starting to validate internal topics {} in partition assignor.", topicPartitions);

    // first construct the topics to make ready
    final Map<String, InternalTopicConfig> topicsToMakeReady = new HashMap<>();

    for (final InternalTopicMetadata metadata : topicPartitions.values()) {
      final InternalTopicConfig topic = metadata.config;
      final int numPartitions = metadata.numPartitions;

      if (numPartitions < 0) {
        throw new StreamsException(String.format("%sTopic [%s] number of partitions not defined", logPrefix, topic.name()));
      }

      topic.setNumberOfPartitions(numPartitions);
      topicsToMakeReady.put(topic.name(), topic);
    }

    if (!topicsToMakeReady.isEmpty()) {
      internalTopicManager.makeReady(topicsToMakeReady);
    }

    log.debug("Completed validating internal topics {} in partition assignor.", topicPartitions);
  }