private static String stripPrefixIfNecessary()

in qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java [95:123]


    private static String stripPrefixIfNecessary(String address, AmqpConnection conn, byte typeByte, JmsDestination consumerDestination) {
        if (address == null) {
            return null;
        }

        if (typeByte == UNKNOWN_TYPE) {
            String queuePrefix = conn.getQueuePrefix();
            if (queuePrefix != null && address.startsWith(queuePrefix)) {
                return address.substring(queuePrefix.length());
            }

            String topicPrefix = conn.getTopicPrefix();
            if (topicPrefix != null && address.startsWith(topicPrefix)) {
                return address.substring(topicPrefix.length());
            }
        } else if (typeByte == QUEUE_TYPE) {
            String queuePrefix = conn.getQueuePrefix();
            if (queuePrefix != null && address.startsWith(queuePrefix)) {
                return address.substring(queuePrefix.length());
            }
        } else if (typeByte == TOPIC_TYPE) {
            String topicPrefix = conn.getTopicPrefix();
            if (topicPrefix != null && address.startsWith(topicPrefix)) {
                return address.substring(topicPrefix.length());
            }
        }

        return address;
    }