private void processNVPs(String nvps, JmsDestination dest, Map<String,String> nvpReturn) throws JMSException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processNVPs", new Object[]{nvps, dest});

    Map<String,String> propertyMap;
    if (nvpReturn==null) {
      // no map provided by caller, so make one of our own
      propertyMap = new HashMap<String,String>();
    }
    else {
      // use the callers map, after clearing it
      nvpReturn.clear();
      propertyMap = nvpReturn;
    }

    // Process any name value pairs
    if (nvps != null && !nvps.equals("")) {

      // Use a regular expression to split on an '&' only if it isn't preceeded by a '\'.
      // Statement goal = matching an '&' only if not preceeded by a '\'
      String[] nvpArray = splitOnNonEscapedChar(nvps, '&', -1);

      // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
      // At this point we have an array of strings in the format 'name=value'*
      // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

      // Begin processing on each NVP.
      for (int i = 0; i < nvpArray.length; i++) {
        String nvp = nvpArray[i];
        // First check that the URI element is correctly formed
        // ie. it contains an '=' char and has a value after the '='.
        int equalsIndex = nvp.indexOf(STRING_EQUALS_SIGN);
        if (equalsIndex == -1) {
          // doesn't have an equals
          JmsErrorUtils.newThrowable(   // d267332 just log an FFDC. Don't throw an exception and lose the destination
            JMSException.class,
            "MALFORMED_URI_ELEMENT_CWSIA0382",
            new Object[] { nvp, nvps },
            null,
            "URIDestinationCreator.processNVPs#1",
            this,
            tc);
            continue;
        }
        if (equalsIndex == nvp.length() - 1) {
          // '=' is the last char, so there is no value part
          JmsErrorUtils.newThrowable(   // d267332 just log an FFDC. Don't throw an exception and lose the destination
            JMSException.class,
            "MALFORMED_URI_ELEMENT_CWSIA0382",
            new Object[] { nvp, nvps },
            null,
            "URIDestinationCreator.processNVPs#2",
            this,
            tc);
            continue;
        }

        // For each element in the array separate the name and value, then process.
        String namePart = nvp.substring(0, equalsIndex);
        String valuePart = nvp.substring(equalsIndex + 1);

        // validate the name and value strings - check for unescaped illegal character etc..
        String[] validatedNVP = validateNVP(namePart, valuePart, nvps, dest);
        namePart = validatedNVP[0];
        valuePart = validatedNVP[1];

        // special case forward and reverse routing path NVPs
        if (namePart.equals(FORWARD_RP)) {
          String[] frp = valuePart.split("<#>");
          ((JmsDestinationImpl) dest).setForwardRoutingPath(frp);
          continue;
          // don't put this property in the map, and start the for loop again
        }
        else if (namePart.equals(REVERSE_RP)) {
          String[] rrp = valuePart.split("<#>");
          ((JmsDestinationImpl) dest).setReverseRoutingPath(rrp);
          continue;
          // don't put this property in the map, and start the for loop again
        }

        // add the NVP to the property map
        propertyMap.put(namePart, valuePart);
      }
    }

    // Do we need to perform topic wild card translation?
    if (dest instanceof JmsTopic && propertyMap.containsKey(MA88_BROKER_VERSION)) {

      String topicName = ((JmsTopicImpl) dest).getTopicName();
      // no point converting something thats empty, and avoids NPEs
      if (topicName != null) {
        // get the value of the brokerVersion property, and remove it from the map,
        // since it isn't needed by configureDestinationFromMap().
        String bVer = propertyMap.remove(MA88_BROKER_VERSION);
        if ("1".equals(bVer)) {
          // EB/MQSI topic syntax
          try {
            // perform the conversion
            topicName = twt.convertEventBrokerToSIB(topicName);
          }
          catch (ParseException pe) {
            // No FFDC code needed
            // d238447 FFDC review. Is this an internal or external error? Play it safe and
            //   generate an FFDC.
            JmsErrorUtils.newThrowable(   // d267332 just log an FFDC. Don't throw an exception and lose the destination
              JMSException.class,
              "MALFORMED_URI_ELEMENT_CWSIA0382",
              new Object[] { topicName, nvps },
              pe,
              "URIDestinationCreator.processNVPs#3",
              this,
              tc);
          }
        }
        else { // default to MA0C (Fuji) topic syntax
          try {
            // perform the conversion
            topicName = twt.convertMA0CToSIB(topicName);
          }
          catch (ParseException pe) {
            // No FFDC code needed
            // d238447 FFDC review.
            // Updated during d272111. ParseException can be generated in response to badly formed
            // input from user code, so don't FFDC.
            JmsErrorUtils.newThrowable(   // d267332 just log an FFDC. Don't throw an exception and lose the destination
              JMSException.class,
              "MALFORMED_URI_ELEMENT_CWSIA0382",
              new Object[] { topicName, nvps },
              pe,
              "URIDestinationCreator.processNVPs#4",
              this,
              tc);
          }
        }

        // put the converted topicName back into the Topic
        ((JmsTopicImpl)dest).setTopicName(topicName);

      } // if topicName != null

    } // end of if (need to convert topic wildcards)

    // configure the destination object using the map
    configureDestinationFromMap(dest, propertyMap, nvps);
  }
private void processNVPs ( String nvps , JmsDestination dest , Map < String , String > nvpReturn ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "processNVPs" , new Object [ ] { nvps , dest } ) ; Map < String , String > propertyMap ; if ( nvpReturn == null ) { propertyMap = new HashMap < String , String > ( ) ; } else { nvpReturn . clear ( ) ; propertyMap = nvpReturn ; } if ( nvps != null && ! nvps . equals ( "" ) ) { String [ ] nvpArray = splitOnNonEscapedChar ( nvps , '&' , - 1 ) ; for ( int i = 0 ; i < nvpArray . length ; i ++ ) { String nvp = nvpArray [ i ] ; int equalsIndex = nvp . indexOf ( STRING_EQUALS_SIGN ) ; if ( equalsIndex == - 1 ) { JmsErrorUtils . newThrowable ( JMSException . class , "MALFORMED_URI_ELEMENT_CWSIA0382" , new Object [ ] { nvp , nvps } , null , "URIDestinationCreator.processNVPs#1" , this , tc ) ; continue ; } if ( equalsIndex == nvp . length ( ) - 1 ) { JmsErrorUtils . newThrowable ( JMSException . class , "MALFORMED_URI_ELEMENT_CWSIA0382" , new Object [ ] { nvp , nvps } , null , "URIDestinationCreator.processNVPs#2" , this , tc ) ; continue ; } String namePart = nvp . substring ( 0 , equalsIndex ) ; String valuePart = nvp . substring ( equalsIndex + 1 ) ; String [ ] validatedNVP = validateNVP ( namePart , valuePart , nvps , dest ) ; namePart = validatedNVP [ 0 ] ; valuePart = validatedNVP [ 1 ] ; if ( namePart . equals ( FORWARD_RP ) ) { String [ ] frp = valuePart . split ( "<#>" ) ; ( ( JmsDestinationImpl ) dest ) . setForwardRoutingPath ( frp ) ; continue ; } else if ( namePart . equals ( REVERSE_RP ) ) { String [ ] rrp = valuePart . split ( "<#>" ) ; ( ( JmsDestinationImpl ) dest ) . setReverseRoutingPath ( rrp ) ; continue ; } propertyMap . put ( namePart , valuePart ) ; } } if ( dest instanceof JmsTopic && propertyMap . containsKey ( MA88_BROKER_VERSION ) ) { String topicName = ( ( JmsTopicImpl ) dest ) . getTopicName ( ) ; if ( topicName != null ) { String bVer = propertyMap . remove ( MA88_BROKER_VERSION ) ; if ( "1" . equals ( bVer ) ) { try { topicName = twt . convertEventBrokerToSIB ( topicName ) ; } catch ( ParseException pe ) { JmsErrorUtils . newThrowable ( JMSException . class , "MALFORMED_URI_ELEMENT_CWSIA0382" , new Object [ ] { topicName , nvps } , pe , "URIDestinationCreator.processNVPs#3" , this , tc ) ; } } else { try { topicName = twt . convertMA0CToSIB ( topicName ) ; } catch ( ParseException pe ) { JmsErrorUtils . newThrowable ( JMSException . class , "MALFORMED_URI_ELEMENT_CWSIA0382" , new Object [ ] { topicName , nvps } , pe , "URIDestinationCreator.processNVPs#4" , this , tc ) ; } } ( ( JmsTopicImpl ) dest ) . setTopicName ( topicName ) ; } } configureDestinationFromMap ( dest , propertyMap , nvps ) ; }
Configure a JmsDestination object with the data held as name-value pairs
in the nvps String.
@param nvps The name value pairs from a queue:// or topic:// uri.
@param dest The JmsTopicImpl or JmsQueueImpl to be configured.
@param nvpReturn If not null, use the provided map to return the processed NVPs. If provided,
the map must support the clear() operation.
@throws JMSException if the name value pairs are incorrectly formed.