Skip to content

Commit a5b50e6

Browse files
authored
Merge pull request #15 from browserstack/avoid_boolean_values
Avoid boolean
2 parents a22dded + 0d7b046 commit a5b50e6

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<plugin>
8686
<groupId>org.sonatype.plugins</groupId>
8787
<artifactId>nexus-staging-maven-plugin</artifactId>
88-
<version>1.6.3</version>
88+
<version>1.6.7</version>
8989
<extensions>true</extensions>
9090
<configuration>
9191
<serverId>ossrh</serverId>
@@ -130,7 +130,7 @@
130130
<plugin>
131131
<groupId>org.sonatype.plugins</groupId>
132132
<artifactId>nexus-staging-maven-plugin</artifactId>
133-
<version>1.6.3</version>
133+
<version>1.6.7</version>
134134
<extensions>true</extensions>
135135
<configuration>
136136
<serverId>ossrh</serverId>

src/main/java/com/browserstack/local/Local.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,24 @@ public class Local {
2323
private LocalProcess proc = null;
2424

2525
private final Map<String, String> parameters;
26+
private final Map<String, String> avoidValueParameters;
2627

2728
public Local() {
29+
avoidValueParameters = new HashMap<String, String>();
30+
avoidValueParameters.put("v", "-vvv");
31+
avoidValueParameters.put("force", "-force");
32+
avoidValueParameters.put("forcelocal", "-forcelocal");
33+
avoidValueParameters.put("onlyAutomate", "-onlyAutomate");
34+
avoidValueParameters.put("forceproxy", "-forceproxy");
35+
2836
parameters = new HashMap<String, String>();
29-
parameters.put("v", "-vvv");
3037
parameters.put("f", "-f");
31-
parameters.put("force", "-force");
3238
parameters.put("only", "-only");
33-
parameters.put("forcelocal", "-forcelocal");
3439
parameters.put("localIdentifier", "-localIdentifier");
35-
parameters.put("onlyAutomate", "-onlyAutomate");
3640
parameters.put("proxyHost", "-proxyHost");
3741
parameters.put("proxyPort", "-proxyPort");
3842
parameters.put("proxyUser", "-proxyUser");
3943
parameters.put("proxyPass", "-proxyPass");
40-
parameters.put("forceproxy", "-forceproxy");
41-
parameters.put("hosts", "-hosts");
4244
}
4345

4446
/**
@@ -75,7 +77,7 @@ public void start(Map<String, String> options) throws Exception {
7577

7678
JSONObject obj = new JSONObject(!stdout.equals("") ? stdout : stderr);
7779
if(!obj.getString("state").equals("connected")){
78-
throw new LocalException(obj.getString("message"));
80+
throw new LocalException(obj.getJSONObject("message").getString("message"));
7981
}
8082
else {
8183
pid = obj.getInt("pid");
@@ -124,13 +126,17 @@ private void makeCommand(Map<String, String> options, String opCode) {
124126
if (IGNORE_KEYS.contains(parameter)) {
125127
continue;
126128
}
127-
if (parameters.get(parameter) != null) {
128-
command.add(parameters.get(parameter));
129+
if (avoidValueParameters.get(parameter) != null && opt.getValue().trim().toLowerCase() != "false") {
130+
command.add(avoidValueParameters.get(parameter));
129131
} else {
130-
command.add("-" + parameter);
131-
}
132-
if (opt.getValue() != null) {
133-
command.add(opt.getValue().trim());
132+
if (parameters.get(parameter) != null) {
133+
command.add(parameters.get(parameter));
134+
} else {
135+
command.add("-" + parameter);
136+
}
137+
if (opt.getValue() != null) {
138+
command.add(opt.getValue().trim());
139+
}
134140
}
135141
}
136142
}

0 commit comments

Comments
 (0)