null topic check

@param topic  The topic to be checked.

@throws InvalidTopicSyntaxException if the topic is null
356412
private final void checkTopicNotNull(String topic) 
    throws InvalidTopicSyntaxException
  {
    if (topic == null)
      throw new InvalidTopicSyntaxException(
        NLS.format(
          "INVALID_TOPIC_ERROR_CWSIH0005",
          new Object[] { topic }));
  }
150578
boolean isInconsistenceContext(String topic, Session session) {
		return null == topic || null == session || topic.isEmpty();
	}
807292
@Override
	public synchronized TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
        checkNotClosed();
        
        RemoteTopicSession session = new RemoteTopicSession(idProvider.createID(),
        		                                            this,
        		                                            transportHub.createEndpoint(),
        		                                            transacted,
        		                                            acknowledgeMode);
        registerSession(session);
        session.remoteInit();
        return session;
    }
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);
  }
123106
@SuppressWarnings("nls")
	private void checkNotNull(Object sourceClass, Object eventSetName, Object alistenerType, Object listenerMethodName)
	{
		if (sourceClass == null)
		{
			throw new NullPointerException(Messages.getString("beans.0C"));
		}
		if (eventSetName == null)
		{
			throw new NullPointerException(Messages.getString("beans.53"));
		}
		if (alistenerType == null)
		{
			throw new NullPointerException(Messages.getString("beans.54"));
		}
		if (listenerMethodName == null)
		{
			throw new NullPointerException(Messages.getString("beans.52"));
		}
	}
1076441
public void addTopicAcl(SIBUuid12 destName, TopicAcl acl)
    throws
      SIDiscriminatorSyntaxException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "addTopicAcl", new Object[] { destName, acl });

    String discriminator = null;
    // Postpend # wildcard to the fully qualified topic supplied
    // TO DO check the topicsyntax

    String theTopic = "";
    if(destName != null)
    {
      String destNameStr = destName.toString();
      theTopic = buildAddTopicExpression(destNameStr, acl.getTopic());
    }

    // Careful, only do this if the original topic is not null
    if(acl.getTopic() != null)
    {
      discriminator = theTopic + "//.";
    }
    else
    {
      discriminator = theTopic;
    }

    // Put the acl into the matchspace
    try
    {
      addTarget(acl, // N.B we use the raw CP as key
              discriminator, // wildcarded topic expression
              null, // selector string
              null, // selector domain
              null, // this'll pick up the default resolver
              acl,
              null,
              null); // selector properties
    }
    catch (QuerySyntaxException e)
    {
      // No FFDC code needed
    }
    catch (InvalidTopicSyntaxException e)
    {
      // No FFDC code needed

      SibTr.exception(tc, e);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addTopicAcl", "SIDiscriminatorSyntaxException");

      throw new SIDiscriminatorSyntaxException(
        nls.getFormattedMessage(
          "INVALID_TOPIC_ERROR_CWSIP0372",
          new Object[] { theTopic },
          null));
    }
    catch (MatchingException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.matching.MessageProcessorMatching.addTopicAcl",
        "1:1954:1.117.1.11",
        this);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addTopicAcl", "SIErrorException");

      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] {
          "com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
          "1:1962:1.117.1.11",
          e });

      throw new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
            "1:1970:1.117.1.11",
            e },
          null),
        e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addTopicAcl");
  }
30902
public SpecTopic getClosestTopic(final SpecTopic topic, final SpecNode callerNode, final boolean checkParentNode) {
        /*
         * Check this level to see if the topic exists
         */
        final List<SpecTopic> topics = getSpecTopics();
        for (final SpecTopic childTopic : topics) {
            if (childTopic == topic || childTopic.getId().equals(topic.getId())) {
                return childTopic;
            }
        }

        /*
         * If we get to this stage, then the topic wasn't directly at this level. So we should try this levels, child levels
         * first.
         */
        final List<Level> childLevels = getChildLevels();
        for (final Level childLevel : childLevels) {
            if (callerNode == childLevel) {
                continue;
            } else {
                final SpecTopic childLevelTopic = childLevel.getClosestTopic(topic, callerNode, false);
                if (childLevelTopic != null) {
                    return childLevelTopic;
                }
            }
        }

        /*
         * If we still haven't found the closest node then check this nodes parents.
         */
        if (getParent() != null && checkParentNode) {
            return getParent().getClosestTopic(topic, this, checkParentNode);
        }

        return null;
    }
745265
def unpause_topic(self, topic):
        """"""
        nsq.assert_valid_topic_name(topic)
        return self._request('POST', '/topic/unpause', fields={'topic': topic})
1237501
public boolean preValidateInfoTopic(final InfoTopic infoTopic, final ContentSpec contentSpec, final Map<String,
            InfoTopic> infoTopics) {
        // Check if the app should be shutdown
        if (isShuttingDown.get()) {
            shutdown.set(true);
            return false;
        }

        boolean valid = true;

        // Checks that the id isn't null and is a valid topic ID
        if (infoTopic.getId() == null || !infoTopic.getId().matches(CSConstants.ALL_TOPIC_ID_REGEX)) {
            log.error(String.format(ProcessorConstants.ERROR_INVALID_TOPIC_ID_MSG, infoTopic.getLineNumber(), infoTopic.getText()));
            valid = false;
        }

        // Check that we aren't using translations for anything but existing topics
        if (!infoTopic.isTopicAnExistingTopic()) {
            // Check that we aren't processing translations
            if (processingOptions.isTranslation()) {
                log.error(String.format(ProcessorConstants.ERROR_TOPIC_NO_NEW_TRANSLATION_TOPIC, infoTopic.getLineNumber(),
                        infoTopic.getText()));
                valid = false;
            }
        }

        // Check that we are allowed to create new topics
        if (!infoTopic.isTopicAnExistingTopic() && !processingOptions.isAllowNewTopics()) {
            log.error(String.format(ProcessorConstants.ERROR_TOPIC_NO_NEW_TOPIC_BUILD, infoTopic.getLineNumber(), infoTopic.getText()));
            valid = false;
        }

        // Existing Topics
        if (infoTopic.isTopicAnExistingTopic()) {
            // Check that tags aren't trying to be removed
            if (!infoTopic.getRemoveTags(false).isEmpty()) {
                log.error(String.format(ProcessorConstants.ERROR_TOPIC_EXISTING_TOPIC_CANNOT_REMOVE_TAGS, infoTopic.getLineNumber(),
                        infoTopic.getText()));
                valid = false;
            }

            // Check that tags aren't trying to be added to a revision
            if (processingOptions.isPrintChangeWarnings() && infoTopic.getRevision() != null && !infoTopic.getTags(false).isEmpty()) {
                log.warn(
                        String.format(ProcessorConstants.WARN_TAGS_IGNORE_MSG, infoTopic.getLineNumber(), "revision", infoTopic.getText()));
            }

            // Check that the assigned writer and description haven't been set
            if (infoTopic.getAssignedWriter(false) != null || infoTopic.getDescription(false) != null) {
                log.error(
                        String.format(ProcessorConstants.ERROR_TOPIC_EXISTING_BAD_OPTIONS, infoTopic.getLineNumber(), infoTopic.getText()));
                valid = false;
            }

            // Check that we aren't processing translations
            if (!infoTopic.getTags(true).isEmpty() && processingOptions.isTranslation()) {
                log.error(String.format(ProcessorConstants.ERROR_TOPIC_NO_TAGS_TRANSLATION_TOPIC, infoTopic.getLineNumber(),
                        infoTopic.getText()));
                valid = false;
            }
        }
        // Duplicated Topics
        else if (infoTopic.isTopicADuplicateTopic()) {
            String temp = "N" + infoTopic.getId().substring(1);

            // Check that the topic exists in the content specification
            if (!infoTopics.containsKey(temp)) {
                log.error(String.format(ProcessorConstants.ERROR_TOPIC_NONEXIST_MSG, infoTopic.getLineNumber(), infoTopic.getText()));
                valid = false;
            }
            // Cloned Topics
        } else if (infoTopic.isTopicAClonedTopic()) {
            // Check if a description or type exists. If one does then generate an error.
            if (infoTopic.getDescription(false) != null && !infoTopic.getDescription(false).equals("")) {
                log.error(String.format(ProcessorConstants.ERROR_TOPIC_CLONED_BAD_OPTIONS, infoTopic.getLineNumber(), infoTopic.getText()));
                valid = false;
            }
            // Duplicated Cloned Topics
        } else if (infoTopic.isTopicAClonedDuplicateTopic()) {
            // Find the duplicate topic in the content spec
            final String topicId = infoTopic.getId().substring(1);
            int count = 0;
            for (final Entry<String, InfoTopic> entry : infoTopics.entrySet()) {
                final String uniqueTopicId = entry.getKey();

                if (uniqueTopicId.endsWith(topicId) && !uniqueTopicId.endsWith(infoTopic.getId())) {
                    count++;
                }
            }

            // Check that the topic exists
            if (count == 0) {
                log.error(String.format(ProcessorConstants.ERROR_TOPIC_NONEXIST_MSG, infoTopic.getLineNumber(), infoTopic.getText()));
                valid = false;
            }
            // Check that the referenced topic is unique
            else if (count > 1) {
                log.error(
                        String.format(ProcessorConstants.ERROR_TOPIC_DUPLICATE_CLONES_MSG, infoTopic.getLineNumber(), infoTopic.getText()));
                valid = false;
            }
        }

        // Check for conflicting conditions
        checkForConflictingCondition(infoTopic, contentSpec);

        return valid;
    }
173855
private boolean postValidateAssignedWriter(final ITopicNode topic) {
        final String writer = topic.getAssignedWriter(true);
        if (!isNullOrEmpty(writer)) {
            // Check Assigned Writer exists
            TagWrapper tag = null;
            try {
                tag = tagProvider.getTagByName(writer);
            } catch (NotFoundException e) {

            }
            if (tag == null) {
                log.error(String.format(ProcessorConstants.ERROR_WRITER_NONEXIST_MSG, topic.getLineNumber(), topic.getText()));
                return false;
            }

            // Check that the writer tag is actually part of the Assigned Writer category
            if (!tag.containedInCategory(serverEntities.getWriterCategoryId())) {
                log.error(String.format(ProcessorConstants.ERROR_INVALID_WRITER_MSG, topic.getLineNumber(), topic.getText()));
                return false;
            }
        }

        return true;
    }
395722
private void checkTopicSubscribePermission(String topic) {
        SecurityManager sm = System.getSecurityManager();
        if (sm == null)
            return;

        sm.checkPermission(new TopicPermission(topic, SUBSCRIBE));
    }
769668
public TopicProducer<String> createTopicTextMessageProducer(final String topic)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new TopicProducer<String>(connectionFactory, jmsConfig, topic, new TextMessageProducerCallback());
    }
326354
@Override
	public synchronized TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
        checkNotClosed();
        LocalTopicSession session =  new LocalTopicSession(idProvider.createID(),this,engine,transacted,acknowledgeMode);
        registerSession(session);
        return session;
    }
754349
public int topicQueueSize(final String topic) {
    final TopicQueue topicQueue = this.topics.get(topic);
    return topicQueue == null ? 0 : topicQueue.queue.size();
  }
600239
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControls(String topic) {
		logger.debug("Looking for messageController for topic '{}' from JsTopicControls annotation", topic);
		Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlsAnnotationLiteral());
		if(select.isUnsatisfied()) {
			return null;
		}
		return getJsTopicMessageControllerFromIterable(topic, select);
	}
902856
public void removeTopic(String topic)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "removeTopic", topic);

    if (_subscriptionState == null)
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "removeTopic", "Topic not found");
    }
    else
      _subscriptionState.removeTopic(topic);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "removeTopic");
  }
1166863
public static void checkTopicName( String topicName ) throws JMSException
    {
        if (topicName == null)
            throw new FFMQException("Topic name is not set","INVALID_DESTINATION_NAME");      
        if (topicName.length() > FFMQConstants.MAX_TOPIC_NAME_SIZE)
            throw new FFMQException("Topic name '"+topicName+"' is too long ("+topicName.length()+" > "+FFMQConstants.MAX_TOPIC_NAME_SIZE+")","INVALID_DESTINATION_NAME");
        checkDestinationName(topicName);
    }