openmq icon indicating copy to clipboard operation
openmq copied to clipboard

Fix whitespaces

Open kalinchan opened this issue 1 year ago • 0 comments

Credit to @breakponchito

See https://github.com/payara/Payara/issues/4551

The following block of code process the arguments to prepare the execution of the broker:

openmq/mq/main/mq-jmsra/jmsra-ra/src/main/java/com/sun/messaging/jms/blc/EmbeddedBrokerRunner.java at master · eclipse-ee4j/openmq

the following block:

   if (brokerExtraArgs != null && !("".equals(brokerExtraArgs))) {
        StringTokenizer st = new StringTokenizer(brokerExtraArgs, " ");
        while (st.hasMoreTokens()) {
            String t = st.nextToken();
            v.add(t);
        }
    }

process the brokerArgs and separates considering the delimiter as a white space, that is why when sending the following attribute:

brokerArgs= -jrehome "C:\Program Files\Java\jdk-11.0.12" is processed as follows:

-jrehome "C:\Program Files\Java\jdk-11.0.12" this is saved on a Vector that is processed after

then the following block of code validates the sequence of parameters. The expected case is waiting the path after the property -jrehome but after the previous separation we have two values after the property:

openmq/mq/main/mq-broker/broker-core/src/main/java/com/sun/messaging/jmq/jmsserver/Broker.java at master · eclipse-ee4j/openmq

that is why the following exception is thrown because the third position is not expected

openmq/mq/main/mq-broker/broker-core/src/main/java/com/sun/messaging/jmq/jmsserver/Broker.java at master · eclipse-ee4j/openmq

[2021-10-20T17:49:14.044-0500] [Payara 5.2021.9-SNAPSHOT] [SEVERE] [] [] [tid: _ThreadID=150 _ThreadName=JMS_PROXY_default_JMS_host-kernel(1) SelectorRunner] [timeMillis: 1634770154044] [levelValue: 1000] [[ java.lang.IllegalArgumentException: unknown option Files\Java\jdk-11.0.12"

kalinchan avatar Sep 23 '24 10:09 kalinchan