Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fish 28 improving fix for openmq white spaces for paths #12

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
**/target/**
# Ignore examples .class
**/src/share/java/examples/**/*.class
*.iml
.idea
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@

package com.sun.messaging.jms.blc;

import java.util.Enumeration;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -86,6 +83,18 @@ public class EmbeddedBrokerRunner
protected static transient final String _lgrMID_ERR = _lgrMIDPrefix + "3001: ";
protected static transient final String _lgrMID_EXC = _lgrMIDPrefix + "4001: ";

private static Set<String> parameterNames;

static {
parameterNames = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("-loglevel", "-save", "-shared",
"-debug", "-dbuser", "-dbpassword", "-dbpwd", "-diag", "-name", "-port", "-nobind", "-metrics", "-password",
"-pwd", "-ldappassword", "-ldappwd", "-read-stdin", "-passfile", "-backup", "-restore", "-cluster",
"-force", "-silent", "-s", "-ttyerrors", "-te", "-tty", "-D", "-varhome", "-jmqvarhome", "-imqhome",
"-libhome", "-javahome", "-jrehome", "-bgnd", "-init", "-version", "-v", "-ntservice", "-adminkeyfile",
"-help", "-h", "-remove", "-reset", "-upgrade-store-nobackup", "-useRmiRegistry", "-startRmiRegistry",
"-rmiRegistryPort", "-activateServices")));
}

public EmbeddedBrokerRunner(
String brokerTypeArgIgnored, String brokerInstanceName, String brokerBindAddress, int brokerPort,
String brokerHomeDir, String brokerLibDir, String brokerVarDir, String brokerJavaDir,
Expand Down Expand Up @@ -212,11 +221,15 @@ private String[] assembleBrokerArgs(String brokerInstanceName,
Vector<String> v = new Vector<String>();

//Add extra args first; explicit config will override args
if (brokerExtraArgs != null && !("".equals(brokerExtraArgs)) ) {
if (brokerExtraArgs != null && !("".equals(brokerExtraArgs))) {
StringTokenizer st = new StringTokenizer(brokerExtraArgs, " ");
while (st.hasMoreTokens()) {
String t = st.nextToken();
v.add(t);
if (st.countTokens() > 2) {
processBrokerExtraArgs(st, v);
} else {
while (st.hasMoreTokens()) {
String t = st.nextToken();
v.add(t);
}
}
}

Expand Down Expand Up @@ -272,6 +285,32 @@ private String[] assembleBrokerArgs(String brokerInstanceName,
return brokerArgs;
}

/**
* This method separates the parameter names from the values considering blank spaces
*
* @param st StringTokenizer containing the available tokens
* @param v Reference of the Vector object to save the parameter and the value in consecutive order
*/
private static void processBrokerExtraArgs(StringTokenizer st, Vector<String> v) {
StringBuilder builderValue = new StringBuilder();
while (st.hasMoreTokens()) {
String s = st.nextToken();
if (parameterNames.contains(s)) {
if (builderValue.length() > 0) {
v.add(builderValue.toString());
builderValue.delete(0, builderValue.length());
}
v.add(s);
continue;
}
builderValue.append(s + " ");
}

if (builderValue.length() > 0) {
v.add(builderValue.toString());
}
}

/**
* Create the in-JVM broker instance
*
Expand Down