private String encodeMap(Map<String, Object> destProps) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "encodeMap", destProps);

        // string result to return
        StringBuffer result = new StringBuffer("");

        // new HashMap which will contain only non-default NVPs
        Map<String, Object> nonDefaultProps = new HashMap<String, Object>();

        // Deal with each remaining property in turn.
        Iterator<Map.Entry<String, Object>> props = destProps.entrySet().iterator();
        while (props.hasNext()) {

            // Get the name and value of the property.
            Map.Entry<String, Object> nextProp = props.next();
            String propName = nextProp.getKey();
            Object propValue = nextProp.getValue();

            // make sure the value part goes out the same as it came in....
            // ie. if it contains an un-escaped '&', place '\\' behind it.
            // we only do this if the property value is a String.
            if (propValue instanceof String) {
                propValue = URIDestinationCreator.escapeValueString((String) propValue);
            }

            // for the name, get the default value
            Object propDefaultValue = MsgDestEncodingUtilsImpl.getDefaultPropertyValue(propName);

            // check to see if the value we have is the same as the default
            if (((propDefaultValue == null) && (propValue == null))
                || ((propDefaultValue != null) && (propDefaultValue.equals(propValue)))) {
                // Do nothing - we don't want to waste space encoding default values.
            }
            else {
                // if Queue, we don't want to add DEST_NAME as it will be added later manually
                if (this instanceof JmsQueue && !propName.equals(DEST_NAME)) {
                    // place the non-default name and value in the new HashMap
                    nonDefaultProps.put(propName, propValue);
                }
                // we don't want to add DEST_DISCRIM if its a topic, or the topic space if its default,
                // or the DEST_NAME, because they get added manually later.
                else if (this instanceof JmsTopic
                         && !DEST_DISCRIM.equals(propName)
                         && !DEST_NAME.equals(propName)
                         && !JmsTopicImpl.DEFAULT_TOPIC_SPACE.equals(propValue)) {
                    if (propValue != null) {
                        // place the non-default name and value in the new HashMap
                        nonDefaultProps.put(propName, propValue);
                    }
                }
            }
        }

        // Now prepare to loop through the new HashMap which only contains non-default properties,
        // and print each name and value separated by an "&" (unless its the last NVP).
        Iterator<Map.Entry<String, Object>> iter = nonDefaultProps.entrySet().iterator();

        // Queue specific stuff
        if (this instanceof JmsQueue) {
            // add the prefix
            result.append("queue://");

            // get the dest name out of the map
            String destName = (String) destProps.get(DEST_NAME);

            // guard against null values being printed as "null"
            if (destName == null)
                destName = "";

            // Validate the dest name value to escape unescaped illegal chars.
            // These escape chars would have been removed when the dest was created.
            destName = URIDestinationCreator.escapeDestName(destName);

            // put the name of the queue name as the first part of the result
            result.append(destName);
            // if there are no more NVPs, we don't want a '?' on the end of the name
            if (iter.hasNext()) {
                result.append("?");
            }
        }

        // Topic specific stuff
        else if (this instanceof JmsTopic) {
            // add prefix
            result.append("topic://");

            // get out the props we know names of
            String destName = (String) destProps.get(DEST_DISCRIM);
            String topicSpace = (String) destProps.get(DEST_NAME);

            // guard against null values being printed as "null"
            if (destName == null)
                destName = "";
            if (topicSpace == null)
                topicSpace = "";

            // Validate the dest name and topic space values to escape unescaped illegal chars.
            // These escape chars would have been removed when the dest was created.
            destName = URIDestinationCreator.escapeDestName(destName);
            topicSpace = URIDestinationCreator.escapeValueString(topicSpace);

            // Add the name of the topic first.
            result.append(destName);

            // Make sure topic space is the first NVP after topic name.
            // We don't want to print the topic space if it is the default value.
            if (!JmsTopicImpl.DEFAULT_TOPIC_SPACE.equals(topicSpace)) {

                //NB. By putting the constant first we avoid doing null/empty checking.
                result.append("?topicSpace=");
                result.append(topicSpace);

                // Now prepare the string for further properties if they exist.
                if (iter.hasNext())
                    result.append("&");
            }
            else {
                // We have not added the topic space in, but need to prepare the string
                // for further properties if they exist.
                if (iter.hasNext())
                    result.append("?");
            }
        }

        // If this isn't a Queue or a Topic, not much we can do other than alert the user
        else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Destination in question is neither a JmsQueue of JmsTopic");
        }

        // loop through the non-default NVPs and append to dest name
        while (iter.hasNext()) {

            Map.Entry<String, Object> nextProp = iter.next();

            // Liberty change : 	
            // Setting the name of the bus to null so that it does not get printed in 
            // the Message
            if (nextProp.getKey().equals(BUS_NAME)) {
                continue;
            }

            result.append(nextProp.getKey());
            result.append("=");
            result.append(nextProp.getValue());

            // only append an ampersand if there are more props to come
            if (iter.hasNext())
                result.append("&");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "encodeMap", result);
        return result.toString();
    }
private String encodeMap ( Map < String , Object > destProps ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeMap" , destProps ) ; StringBuffer result = new StringBuffer ( "" ) ; Map < String , Object > nonDefaultProps = new HashMap < String , Object > ( ) ; Iterator < Map . Entry < String , Object > > props = destProps . entrySet ( ) . iterator ( ) ; while ( props . hasNext ( ) ) { Map . Entry < String , Object > nextProp = props . next ( ) ; String propName = nextProp . getKey ( ) ; Object propValue = nextProp . getValue ( ) ; if ( propValue instanceof String ) { propValue = URIDestinationCreator . escapeValueString ( ( String ) propValue ) ; } Object propDefaultValue = MsgDestEncodingUtilsImpl . getDefaultPropertyValue ( propName ) ; if ( ( ( propDefaultValue == null ) && ( propValue == null ) ) || ( ( propDefaultValue != null ) && ( propDefaultValue . equals ( propValue ) ) ) ) { } else { if ( this instanceof JmsQueue && ! propName . equals ( DEST_NAME ) ) { nonDefaultProps . put ( propName , propValue ) ; } else if ( this instanceof JmsTopic && ! DEST_DISCRIM . equals ( propName ) && ! DEST_NAME . equals ( propName ) && ! JmsTopicImpl . DEFAULT_TOPIC_SPACE . equals ( propValue ) ) { if ( propValue != null ) { nonDefaultProps . put ( propName , propValue ) ; } } } } Iterator < Map . Entry < String , Object > > iter = nonDefaultProps . entrySet ( ) . iterator ( ) ; if ( this instanceof JmsQueue ) { result . append ( "queue://" ) ; String destName = ( String ) destProps . get ( DEST_NAME ) ; if ( destName == null ) destName = "" ; destName = URIDestinationCreator . escapeDestName ( destName ) ; result . append ( destName ) ; if ( iter . hasNext ( ) ) { result . append ( "?" ) ; } } else if ( this instanceof JmsTopic ) { result . append ( "topic://" ) ; String destName = ( String ) destProps . get ( DEST_DISCRIM ) ; String topicSpace = ( String ) destProps . get ( DEST_NAME ) ; if ( destName == null ) destName = "" ; if ( topicSpace == null ) topicSpace = "" ; destName = URIDestinationCreator . escapeDestName ( destName ) ; topicSpace = URIDestinationCreator . escapeValueString ( topicSpace ) ; result . append ( destName ) ; if ( ! JmsTopicImpl . DEFAULT_TOPIC_SPACE . equals ( topicSpace ) ) { result . append ( "?topicSpace=" ) ; result . append ( topicSpace ) ; if ( iter . hasNext ( ) ) result . append ( "&" ) ; } else { if ( iter . hasNext ( ) ) result . append ( "?" ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Destination in question is neither a JmsQueue of JmsTopic" ) ; } while ( iter . hasNext ( ) ) { Map . Entry < String , Object > nextProp = iter . next ( ) ; if ( nextProp . getKey ( ) . equals ( BUS_NAME ) ) { continue ; } result . append ( nextProp . getKey ( ) ) ; result . append ( "=" ) ; result . append ( nextProp . getValue ( ) ) ; if ( iter . hasNext ( ) ) result . append ( "&" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodeMap" , result ) ; return result . toString ( ) ; }
This method iterates through the property map of a destination
and constructs a string representing the name and property details.

@param destProps The destination property map
@return String The destination details in a String format