Skip to content

Commit 479e4ee

Browse files
committed
add missing tag
1 parent 69dff94 commit 479e4ee

File tree

1 file changed

+5
-3
lines changed
  • sparkler-core/sparkler-plugins/url-injector/src/main/java/edu/usc/irds/sparkler/plugin

1 file changed

+5
-3
lines changed

sparkler-core/sparkler-plugins/url-injector/src/main/java/edu/usc/irds/sparkler/plugin/UrlInjector.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private List<UrlInjectorObj> appendForm(Collection<String> urls, List<String> to
7676
for (String temp : tokens) {
7777
String json = root.toString();
7878
json = json.replace("${token}", temp);
79-
root.put("TAG", this.pluginConfig.get("tag"));
79+
root.put("TAG", this.pluginConfig.getOrDefault("tag", "no tag defined"));
8080
UrlInjectorObj o = new UrlInjectorObj(u, json, method);
8181
fixedUrls.add(o);
8282
}
@@ -94,12 +94,14 @@ private List<UrlInjectorObj> appendForm(Collection<String> urls, List<String> to
9494
// each token to each url.
9595
private List<UrlInjectorObj> replaceURLToken(Collection<String> urls, List<String> tokens) {
9696
List<UrlInjectorObj> fixedUrls = new ArrayList<>();
97+
JSONObject root = new JSONObject();
9798
for (Iterator<String> iterator = urls.iterator(); iterator.hasNext();) {
9899
String u = iterator.next();
99100
for (String temp : tokens) {
100101
String rep = u.replace("${token}", temp);
101102
String method = getHTTPMethod(rep);
102103
rep = trimHTTPMethod(rep);
104+
root.put("TAG", this.pluginConfig.getOrDefault("tag", "no tag defined"));
103105
UrlInjectorObj o = new UrlInjectorObj(rep, null, method);
104106
fixedUrls.add(o);
105107
}
@@ -125,7 +127,7 @@ private List<UrlInjectorObj> appendJSON(Collection<String> urls, List<String> to
125127
try {
126128
json = (JSONObject) parser.parse(parsedJsonStr);
127129
root.put("JSON", json);
128-
root.put("TAG", this.pluginConfig.get("tag"));
130+
root.put("TAG", this.pluginConfig.getOrDefault("tag", "no tag defined"));
129131
} catch (ParseException e) {
130132
// TODO Auto-generated catch block
131133
e.printStackTrace();
@@ -157,7 +159,7 @@ private List<UrlInjectorObj> appendSelenium(Collection<String> urls, List<String
157159
if (tokens.size() > 0) {
158160
for (String temp : tokens) {
159161
String json = root.toString();
160-
root.put("TAG", this.pluginConfig.get("tag"));
162+
root.put("TAG", this.pluginConfig.getOrDefault("tag", "no tag defined"));
161163
json = json.replace("${token}", temp);
162164
UrlInjectorObj o = new UrlInjectorObj(u, json, method);
163165
fixedUrls.add(o);

0 commit comments

Comments
 (0)