1 | package com.jsql.util; | |
2 | ||
3 | import com.jsql.model.InjectionModel; | |
4 | import com.jsql.model.bean.util.Interaction; | |
5 | import com.jsql.model.bean.util.Request; | |
6 | import com.jsql.model.exception.InjectionFailureException; | |
7 | import com.jsql.model.injection.method.AbstractMethodInjection; | |
8 | import org.apache.commons.lang3.StringUtils; | |
9 | import org.apache.logging.log4j.LogManager; | |
10 | import org.apache.logging.log4j.Logger; | |
11 | ||
12 | import java.net.IDN; | |
13 | import java.net.MalformedURLException; | |
14 | import java.net.URI; | |
15 | import java.net.URISyntaxException; | |
16 | import java.util.AbstractMap.SimpleEntry; | |
17 | import java.util.ArrayList; | |
18 | import java.util.Arrays; | |
19 | import java.util.List; | |
20 | import java.util.Objects; | |
21 | import java.util.concurrent.CopyOnWriteArrayList; | |
22 | import java.util.regex.Matcher; | |
23 | import java.util.regex.Pattern; | |
24 | import java.util.stream.Collectors; | |
25 | ||
26 | public class ParameterUtil { | |
27 | ||
28 | /** | |
29 | * Log4j logger sent to view. | |
30 | */ | |
31 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
32 | ||
33 | /** | |
34 | * Query string built from the URL submitted by user. | |
35 | */ | |
36 | private List<SimpleEntry<String, String>> listQueryString = new CopyOnWriteArrayList<>(); | |
37 | ||
38 | /** | |
39 | * Request submitted by user. | |
40 | */ | |
41 | private List<SimpleEntry<String, String>> listRequest = new CopyOnWriteArrayList<>(); | |
42 | ||
43 | /** | |
44 | * Header submitted by user. | |
45 | */ | |
46 | private List<SimpleEntry<String, String>> listHeader = new CopyOnWriteArrayList<>(); | |
47 | ||
48 | private String rawRequest = StringUtils.EMPTY; | |
49 | private String rawHeader = StringUtils.EMPTY; | |
50 | private boolean isMultipartRequest = false; | |
51 | private static final String FORMAT_KEY_VALUE = "%s=%s"; | |
52 | ||
53 | private final InjectionModel injectionModel; | |
54 | | |
55 | public ParameterUtil(InjectionModel injectionModel) { | |
56 | this.injectionModel = injectionModel; | |
57 | } | |
58 | | |
59 | /** | |
60 | * Send each parameters from the GUI to the model in order to | |
61 | * start the preparation of injection, the injection process is | |
62 | * started in a new thread via model function inputValidation(). | |
63 | */ | |
64 | public void controlInput( | |
65 | String urlQuery, | |
66 | String rawRequest, | |
67 | String rawHeader, | |
68 | AbstractMethodInjection methodInjection, | |
69 | String typeRequest, | |
70 | boolean isScanning | |
71 | ) { | |
72 | try { | |
73 | String urlQueryFixed = urlQuery; | |
74 | | |
75 | // Keep single check | |
76 |
1
1. controlInput : negated conditional → NO_COVERAGE |
if (urlQueryFixed.isEmpty()) { |
77 | throw new MalformedURLException("empty URL"); | |
78 |
1
1. controlInput : negated conditional → NO_COVERAGE |
} else if (!urlQueryFixed.matches("(?i)^https?://.*")) { |
79 |
1
1. controlInput : negated conditional → NO_COVERAGE |
if (!urlQueryFixed.matches("(?i)^\\w+://.*")) { |
80 | | |
81 | LOGGER.log(LogLevelUtil.CONSOLE_INFORM, "Undefined URL protocol, forcing to [http://]"); | |
82 | urlQueryFixed = "http://"+ urlQueryFixed; | |
83 | | |
84 | } else { | |
85 | throw new MalformedURLException("unknown URL protocol"); | |
86 | } | |
87 | } | |
88 | ||
89 | String authority = URI.create(urlQueryFixed).getAuthority(); | |
90 |
1
1. controlInput : negated conditional → NO_COVERAGE |
if (authority == null) { |
91 | throw new MalformedURLException("incorrect domain authority"); | |
92 | } | |
93 | String authorityPunycode = IDN.toASCII(authority); | |
94 |
1
1. controlInput : negated conditional → NO_COVERAGE |
if (!authority.equals(authorityPunycode)) { |
95 | LOGGER.log(LogLevelUtil.CONSOLE_INFORM, "Punycode domain detected, using [{}] instead of [{}]", authorityPunycode, authority); | |
96 | urlQueryFixed = urlQueryFixed.replace(authority, authorityPunycode); | |
97 | } | |
98 | ||
99 |
1
1. controlInput : removed call to com/jsql/util/ParameterUtil::initializeQueryString → NO_COVERAGE |
this.initializeQueryString(urlQueryFixed); |
100 |
1
1. controlInput : removed call to com/jsql/util/ParameterUtil::initializeHeader → NO_COVERAGE |
this.initializeHeader(rawHeader); |
101 |
1
1. controlInput : removed call to com/jsql/util/ParameterUtil::initializeRequest → NO_COVERAGE |
this.initializeRequest(rawRequest); |
102 | ||
103 |
1
1. controlInput : removed call to com/jsql/util/ConnectionUtil::setMethodInjection → NO_COVERAGE |
this.injectionModel.getMediatorUtils().getConnectionUtil().setMethodInjection(methodInjection); |
104 |
1
1. controlInput : removed call to com/jsql/util/ConnectionUtil::setTypeRequest → NO_COVERAGE |
this.injectionModel.getMediatorUtils().getConnectionUtil().setTypeRequest(typeRequest); |
105 | | |
106 |
1
1. controlInput : negated conditional → NO_COVERAGE |
if (isScanning) { |
107 |
1
1. controlInput : removed call to com/jsql/model/InjectionModel::beginInjection → NO_COVERAGE |
this.injectionModel.beginInjection(); |
108 | } else { | |
109 | // Start the model injection process in a thread | |
110 | new Thread( | |
111 | this.injectionModel::beginInjection, | |
112 | "ThreadBeginInjection" | |
113 | ) | |
114 |
1
1. controlInput : removed call to java/lang/Thread::start → NO_COVERAGE |
.start(); |
115 | } | |
116 | } catch (IllegalArgumentException | MalformedURLException | URISyntaxException e) { | |
117 | | |
118 | LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Incorrect Url: {}", e.getMessage()); | |
119 | | |
120 | // Incorrect URL, reset the start button | |
121 | var request = new Request(); | |
122 |
1
1. controlInput : removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE |
request.setMessage(Interaction.END_PREPARATION); |
123 |
1
1. controlInput : removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE |
this.injectionModel.sendToViews(request); |
124 | } | |
125 | } | |
126 | ||
127 | /** | |
128 | * Check integrity of parameters defined by user. | |
129 | * @throws InjectionFailureException when params integrity is failure | |
130 | */ | |
131 | public void checkParametersFormat() throws InjectionFailureException { | |
132 | | |
133 |
1
1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkOneOrLessStar → SURVIVED |
this.checkOneOrLessStar(); |
134 |
1
1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkStarMatchMethod → SURVIVED |
this.checkStarMatchMethod(); |
135 |
1
1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkMethodNotEmpty → KILLED |
this.checkMethodNotEmpty(); |
136 |
1
1. checkParametersFormat : removed call to com/jsql/util/ParameterUtil::checkMultipart → NO_COVERAGE |
this.checkMultipart(); |
137 | } | |
138 | ||
139 | private void checkMultipart() throws InjectionFailureException { | |
140 | ||
141 | isMultipartRequest = false; | |
142 | ||
143 | if ( | |
144 | this.getListHeader() | |
145 | .stream() | |
146 |
2
1. lambda$checkMultipart$0 : replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE 2. lambda$checkMultipart$0 : replaced boolean return with false for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE |
.filter(entry -> "Content-Type".equals(entry.getKey())) |
147 |
1
1. checkMultipart : negated conditional → NO_COVERAGE |
.anyMatch(entry -> |
148 |
2
1. lambda$checkMultipart$1 : replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$1 → NO_COVERAGE 2. lambda$checkMultipart$1 : negated conditional → NO_COVERAGE |
entry.getValue() != null |
149 |
1
1. lambda$checkMultipart$1 : negated conditional → NO_COVERAGE |
&& entry.getValue().contains("multipart/form-data") |
150 |
1
1. lambda$checkMultipart$1 : negated conditional → NO_COVERAGE |
&& entry.getValue().contains("boundary=") |
151 | ) | |
152 | ) { | |
153 | LOGGER.log(LogLevelUtil.CONSOLE_DEFAULT, "Multipart boundary found in header"); | |
154 | Matcher matcherBoundary = Pattern.compile("boundary=([^;]*)").matcher(this.getHeaderFromEntries()); | |
155 |
1
1. checkMultipart : negated conditional → NO_COVERAGE |
if (matcherBoundary.find()) { |
156 | String boundary = matcherBoundary.group(1); | |
157 |
1
1. checkMultipart : negated conditional → NO_COVERAGE |
if (!this.rawRequest.contains(boundary)) { |
158 | throw new InjectionFailureException( | |
159 | String.format("Incorrect multipart data, boundary not found in body: %s", boundary) | |
160 | ); | |
161 | } else { | |
162 | isMultipartRequest = true; | |
163 | } | |
164 | } | |
165 | } | |
166 | } | |
167 | ||
168 | private void checkOneOrLessStar() throws InjectionFailureException { | |
169 | | |
170 | var nbStarInParameter = 0; | |
171 | | |
172 |
1
1. checkOneOrLessStar : negated conditional → SURVIVED |
if (this.getQueryStringFromEntries().contains(InjectionModel.STAR)) { |
173 |
1
1. checkOneOrLessStar : Changed increment from 1 to -1 → SURVIVED |
nbStarInParameter++; |
174 | } | |
175 |
1
1. checkOneOrLessStar : negated conditional → SURVIVED |
if (this.getRequestFromEntries().contains(InjectionModel.STAR)) { |
176 |
1
1. checkOneOrLessStar : Changed increment from 1 to -1 → SURVIVED |
nbStarInParameter++; |
177 | } | |
178 |
1
1. checkOneOrLessStar : negated conditional → SURVIVED |
if (this.getHeaderFromEntries().contains(InjectionModel.STAR)) { |
179 |
1
1. checkOneOrLessStar : Changed increment from 1 to -1 → SURVIVED |
nbStarInParameter++; |
180 | } | |
181 | | |
182 | // Injection Point | |
183 |
2
1. checkOneOrLessStar : negated conditional → SURVIVED 2. checkOneOrLessStar : changed conditional boundary → SURVIVED |
if ( |
184 | nbStarInParameter > 1 | |
185 |
2
1. checkOneOrLessStar : negated conditional → SURVIVED 2. checkOneOrLessStar : changed conditional boundary → SURVIVED |
|| StringUtils.countMatches(this.getQueryStringFromEntries(), "*") > 1 |
186 |
2
1. checkOneOrLessStar : negated conditional → SURVIVED 2. checkOneOrLessStar : changed conditional boundary → SURVIVED |
|| StringUtils.countMatches(this.getRequestFromEntries(), "*") > 1 |
187 |
2
1. checkOneOrLessStar : negated conditional → SURVIVED 2. checkOneOrLessStar : changed conditional boundary → SURVIVED |
|| StringUtils.countMatches(this.getHeaderFromEntries(), "*") > 1 |
188 | ) { | |
189 | throw new InjectionFailureException("Character insertion [*] must be used once in Query String, Request or Header parameters"); | |
190 | } | |
191 | } | |
192 | | |
193 | public void checkStarMatchMethod() throws InjectionFailureException { | |
194 | | |
195 | AbstractMethodInjection methodInjection = this.injectionModel.getMediatorUtils().getConnectionUtil().getMethodInjection(); | |
196 | boolean isCheckingAllParam = this.injectionModel.getMediatorUtils().getPreferencesUtil().isCheckingAllParam(); | |
197 | ||
198 | if ( | |
199 |
1
1. checkStarMatchMethod : negated conditional → SURVIVED |
this.getQueryStringFromEntries().contains(InjectionModel.STAR) |
200 |
2
1. checkStarMatchMethod : negated conditional → SURVIVED 2. checkStarMatchMethod : negated conditional → SURVIVED |
&& methodInjection != this.injectionModel.getMediatorMethod().getQuery() |
201 | && !isCheckingAllParam | |
202 | ) { | |
203 | throw new InjectionFailureException("Select method GET to use character [*] or remove [*] from GET parameters"); | |
204 | } else if ( | |
205 |
1
1. checkStarMatchMethod : negated conditional → SURVIVED |
this.getRequestFromEntries().contains(InjectionModel.STAR) |
206 |
2
1. checkStarMatchMethod : negated conditional → SURVIVED 2. checkStarMatchMethod : negated conditional → SURVIVED |
&& methodInjection != this.injectionModel.getMediatorMethod().getRequest() |
207 | && !isCheckingAllParam | |
208 | ) { | |
209 | throw new InjectionFailureException("Select a Request method (like POST) to use [*], or remove [*] from Request parameters"); | |
210 | } else if ( | |
211 |
1
1. checkStarMatchMethod : negated conditional → SURVIVED |
this.getHeaderFromEntries().contains(InjectionModel.STAR) |
212 |
2
1. checkStarMatchMethod : negated conditional → SURVIVED 2. checkStarMatchMethod : negated conditional → SURVIVED |
&& methodInjection != this.injectionModel.getMediatorMethod().getHeader() |
213 | && !isCheckingAllParam | |
214 | ) { | |
215 | throw new InjectionFailureException("Select method Header to use character [*] or remove [*] from Header parameters"); | |
216 | } | |
217 | } | |
218 | | |
219 | public void checkMethodNotEmpty() throws InjectionFailureException { | |
220 | | |
221 | AbstractMethodInjection methodInjection = this.injectionModel.getMediatorUtils().getConnectionUtil().getMethodInjection(); | |
222 | boolean isCheckingAllParam = this.injectionModel.getMediatorUtils().getPreferencesUtil().isCheckingAllParam(); | |
223 | | |
224 | if ( | |
225 |
2
1. checkMethodNotEmpty : negated conditional → KILLED 2. checkMethodNotEmpty : negated conditional → KILLED |
methodInjection == this.injectionModel.getMediatorMethod().getQuery() |
226 | && !isCheckingAllParam | |
227 |
1
1. checkMethodNotEmpty : negated conditional → KILLED |
&& this.getListQueryString().isEmpty() |
228 |
1
1. checkMethodNotEmpty : negated conditional → KILLED |
&& !this.injectionModel.getMediatorUtils().getConnectionUtil().getUrlBase().contains(InjectionModel.STAR) |
229 | ) { | |
230 | throw new InjectionFailureException("No query string"); | |
231 | } else if ( | |
232 |
1
1. checkMethodNotEmpty : negated conditional → KILLED |
methodInjection == this.injectionModel.getMediatorMethod().getRequest() |
233 |
1
1. checkMethodNotEmpty : negated conditional → KILLED |
&& this.getListRequest().isEmpty() |
234 | ) { | |
235 | throw new InjectionFailureException("Incorrect Request format"); | |
236 | } else if ( | |
237 |
1
1. checkMethodNotEmpty : negated conditional → KILLED |
methodInjection == this.injectionModel.getMediatorMethod().getHeader() |
238 |
1
1. checkMethodNotEmpty : negated conditional → KILLED |
&& this.getListHeader().isEmpty() |
239 | ) { | |
240 | throw new InjectionFailureException("Incorrect Header format"); | |
241 | } | |
242 | } | |
243 | | |
244 | public String initializeStar(SimpleEntry<String, String> parameterToInject) { | |
245 | | |
246 | String characterInsertionByUser; | |
247 | ||
248 |
1
1. initializeStar : negated conditional → NO_COVERAGE |
if (parameterToInject == null) { |
249 | characterInsertionByUser = InjectionModel.STAR; | |
250 | } else { | |
251 | | |
252 | characterInsertionByUser = parameterToInject.getValue(); | |
253 | parameterToInject.setValue(InjectionModel.STAR); | |
254 | } | |
255 | | |
256 |
1
1. initializeStar : replaced return value with "" for com/jsql/util/ParameterUtil::initializeStar → NO_COVERAGE |
return characterInsertionByUser; |
257 | } | |
258 | ||
259 | public void initializeQueryString(String urlQuery) throws MalformedURLException, URISyntaxException { | |
260 | ||
261 | // Format and get rid of anchor fragment using native URL | |
262 | var url = new URI(urlQuery).toURL(); | |
263 | | |
264 | if ( | |
265 |
1
1. initializeQueryString : negated conditional → KILLED |
StringUtils.isEmpty(urlQuery) |
266 |
1
1. initializeQueryString : negated conditional → KILLED |
|| StringUtils.isEmpty(url.getHost()) |
267 | ) { | |
268 | throw new MalformedURLException("empty URL"); | |
269 | } | |
270 | | |
271 |
1
1. initializeQueryString : removed call to com/jsql/util/ConnectionUtil::setUrlByUser → SURVIVED |
this.injectionModel.getMediatorUtils().getConnectionUtil().setUrlByUser(urlQuery); |
272 |
1
1. initializeQueryString : removed call to com/jsql/util/ConnectionUtil::setUrlBase → KILLED |
this.injectionModel.getMediatorUtils().getConnectionUtil().setUrlBase(urlQuery); |
273 | | |
274 |
1
1. initializeQueryString : removed call to java/util/List::clear → SURVIVED |
this.listQueryString.clear(); |
275 | | |
276 | // Parse url and GET query string | |
277 | var regexQueryString = Pattern.compile("(.*\\?)(.*)").matcher(urlQuery); | |
278 | | |
279 |
1
1. initializeQueryString : negated conditional → KILLED |
if (!regexQueryString.find()) { |
280 | return; | |
281 | } | |
282 | | |
283 |
1
1. initializeQueryString : removed call to com/jsql/util/ConnectionUtil::setUrlBase → SURVIVED |
this.injectionModel.getMediatorUtils().getConnectionUtil().setUrlBase(regexQueryString.group(1)); |
284 | | |
285 |
1
1. initializeQueryString : negated conditional → SURVIVED |
if (StringUtils.isNotEmpty(url.getQuery())) { |
286 | this.listQueryString = Pattern.compile("&") | |
287 | .splitAsStream(url.getQuery()) | |
288 |
1
1. lambda$initializeQueryString$2 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initializeQueryString$2 → KILLED |
.map(keyValue -> Arrays.copyOf(keyValue.split("="), 2)) |
289 |
1
1. lambda$initializeQueryString$3 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initializeQueryString$3 → SURVIVED |
.map(keyValue -> new SimpleEntry<>( |
290 | keyValue[0], | |
291 |
1
1. lambda$initializeQueryString$3 : negated conditional → SURVIVED |
keyValue[1] == null ? StringUtils.EMPTY : keyValue[1] |
292 | )) | |
293 | .collect(Collectors.toList()); | |
294 | } | |
295 | } | |
296 | ||
297 | public void initializeRequest(String rawRequest) { | |
298 | ||
299 | this.rawRequest = rawRequest; | |
300 |
1
1. initializeRequest : removed call to java/util/List::clear → SURVIVED |
this.listRequest.clear(); |
301 | ||
302 |
1
1. initializeRequest : negated conditional → SURVIVED |
if (StringUtils.isNotEmpty(rawRequest)) { |
303 |
1
1. initializeRequest : negated conditional → SURVIVED |
if (isMultipartRequest()) { |
304 | // Pass request containing star * param without any parsing | |
305 | this.listRequest = new ArrayList<>(List.of(new SimpleEntry<>( | |
306 | rawRequest, | |
307 | "" | |
308 | ))); | |
309 | } else { | |
310 | this.listRequest = Pattern.compile("&") | |
311 | .splitAsStream(rawRequest) | |
312 |
1
1. lambda$initializeRequest$4 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initializeRequest$4 → KILLED |
.map(keyValue -> Arrays.copyOf(keyValue.split("="), 2)) |
313 |
1
1. lambda$initializeRequest$5 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initializeRequest$5 → SURVIVED |
.map(keyValue -> new SimpleEntry<>( |
314 | keyValue[0], | |
315 |
1
1. lambda$initializeRequest$5 : negated conditional → SURVIVED |
keyValue[1] == null ? StringUtils.EMPTY : keyValue[1] |
316 | )) | |
317 | .collect(Collectors.toList()); | |
318 | } | |
319 | } | |
320 | } | |
321 | ||
322 | public void initializeHeader(String rawHeader) { | |
323 | | |
324 | this.rawHeader = rawHeader; | |
325 |
1
1. initializeHeader : removed call to java/util/List::clear → SURVIVED |
this.listHeader.clear(); |
326 | ||
327 |
1
1. initializeHeader : negated conditional → SURVIVED |
if (StringUtils.isNotEmpty(rawHeader)) { |
328 | this.listHeader = Pattern.compile("\\\\r\\\\n") | |
329 | .splitAsStream(rawHeader) | |
330 |
1
1. lambda$initializeHeader$6 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initializeHeader$6 → KILLED |
.map(keyValue -> Arrays.copyOf(keyValue.split(":"), 2)) |
331 |
1
1. lambda$initializeHeader$7 : replaced return value with null for com/jsql/util/ParameterUtil::lambda$initializeHeader$7 → SURVIVED |
.map(keyValue -> new SimpleEntry<>( |
332 | keyValue[0], | |
333 |
1
1. lambda$initializeHeader$7 : negated conditional → SURVIVED |
keyValue[1] == null ? StringUtils.EMPTY : keyValue[1] |
334 | )) | |
335 | .collect(Collectors.toList()); | |
336 | } | |
337 | } | |
338 | | |
339 | public String getQueryStringFromEntries() { | |
340 |
1
1. getQueryStringFromEntries : replaced return value with "" for com/jsql/util/ParameterUtil::getQueryStringFromEntries → SURVIVED |
return this.listQueryString.stream() |
341 | .filter(Objects::nonNull) | |
342 | .map(entry -> { | |
343 | if ( | |
344 |
1
1. lambda$getQueryStringFromEntries$8 : negated conditional → SURVIVED |
this.injectionModel.getMediatorStrategy().getStrategy() == this.injectionModel.getMediatorStrategy().getMultibit() |
345 |
1
1. lambda$getQueryStringFromEntries$8 : negated conditional → NO_COVERAGE |
&& entry.getValue() != null |
346 |
1
1. lambda$getQueryStringFromEntries$8 : negated conditional → NO_COVERAGE |
&& entry.getValue().contains(InjectionModel.STAR) |
347 | ) { | |
348 |
1
1. lambda$getQueryStringFromEntries$8 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → NO_COVERAGE |
return String.format(FORMAT_KEY_VALUE, entry.getKey(), InjectionModel.STAR); |
349 | } else { | |
350 |
1
1. lambda$getQueryStringFromEntries$8 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → SURVIVED |
return String.format(FORMAT_KEY_VALUE, entry.getKey(), entry.getValue()); |
351 | } | |
352 | }) | |
353 | .collect(Collectors.joining("&")); | |
354 | } | |
355 | ||
356 | public String getRequestFromEntries() { | |
357 |
1
1. getRequestFromEntries : replaced return value with "" for com/jsql/util/ParameterUtil::getRequestFromEntries → SURVIVED |
return this.listRequest.stream() |
358 | .filter(Objects::nonNull) | |
359 |
1
1. lambda$getRequestFromEntries$9 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getRequestFromEntries$9 → SURVIVED |
.map(entry -> String.format( |
360 | FORMAT_KEY_VALUE, | |
361 | entry.getKey(), | |
362 |
1
1. lambda$getRequestFromEntries$9 : negated conditional → SURVIVED |
StringUtils.isEmpty(entry.getValue()) ? "" : entry.getValue() |
363 | )) | |
364 | .collect(Collectors.joining("&")); | |
365 | } | |
366 | | |
367 | public String getHeaderFromEntries() { | |
368 |
1
1. getHeaderFromEntries : replaced return value with "" for com/jsql/util/ParameterUtil::getHeaderFromEntries → SURVIVED |
return this.listHeader.stream() |
369 | .filter(Objects::nonNull) | |
370 |
1
1. lambda$getHeaderFromEntries$10 : replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getHeaderFromEntries$10 → SURVIVED |
.map(entry -> String.format( |
371 | "%s:%s", | |
372 | entry.getKey(), | |
373 | entry.getValue() | |
374 | )) | |
375 | .collect(Collectors.joining("\\r\\n")); | |
376 | } | |
377 | ||
378 | public boolean isRequestSoap() { | |
379 |
2
1. isRequestSoap : replaced boolean return with false for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE 2. isRequestSoap : replaced boolean return with true for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE |
return this.rawRequest |
380 | .trim() | |
381 | .matches("^(<soapenv:|<\\?xml).*"); | |
382 | } | |
383 | ||
384 | | |
385 | // Getters / setters | |
386 | | |
387 | public String getRawRequest() { | |
388 |
1
1. getRawRequest : replaced return value with "" for com/jsql/util/ParameterUtil::getRawRequest → NO_COVERAGE |
return this.rawRequest; |
389 | } | |
390 | ||
391 | public String getRawHeader() { | |
392 |
1
1. getRawHeader : replaced return value with "" for com/jsql/util/ParameterUtil::getRawHeader → NO_COVERAGE |
return this.rawHeader; |
393 | } | |
394 | ||
395 | public List<SimpleEntry<String, String>> getListRequest() { | |
396 |
1
1. getListRequest : replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListRequest → SURVIVED |
return this.listRequest; |
397 | } | |
398 | ||
399 | public void setListRequest(List<SimpleEntry<String, String>> listRequest) { | |
400 | this.listRequest = listRequest; | |
401 | } | |
402 | ||
403 | public List<SimpleEntry<String, String>> getListHeader() { | |
404 |
1
1. getListHeader : replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListHeader → SURVIVED |
return this.listHeader; |
405 | } | |
406 | ||
407 | public void setListHeader(List<SimpleEntry<String, String>> listHeader) { | |
408 | this.listHeader = listHeader; | |
409 | } | |
410 | | |
411 | public List<SimpleEntry<String, String>> getListQueryString() { | |
412 |
1
1. getListQueryString : replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListQueryString → SURVIVED |
return this.listQueryString; |
413 | } | |
414 | | |
415 | public void setListQueryString(List<SimpleEntry<String, String>> listQueryString) { | |
416 | this.listQueryString = listQueryString; | |
417 | } | |
418 | ||
419 | public boolean isMultipartRequest() { | |
420 |
2
1. isMultipartRequest : replaced boolean return with false for com/jsql/util/ParameterUtil::isMultipartRequest → SURVIVED 2. isMultipartRequest : replaced boolean return with true for com/jsql/util/ParameterUtil::isMultipartRequest → SURVIVED |
return isMultipartRequest; |
421 | } | |
422 | } | |
Mutations | ||
76 |
1.1 |
|
78 |
1.1 |
|
79 |
1.1 |
|
90 |
1.1 |
|
94 |
1.1 |
|
99 |
1.1 |
|
100 |
1.1 |
|
101 |
1.1 |
|
103 |
1.1 |
|
104 |
1.1 |
|
106 |
1.1 |
|
107 |
1.1 |
|
114 |
1.1 |
|
122 |
1.1 |
|
123 |
1.1 |
|
133 |
1.1 |
|
134 |
1.1 |
|
135 |
1.1 |
|
136 |
1.1 |
|
146 |
1.1 2.2 |
|
147 |
1.1 |
|
148 |
1.1 2.2 |
|
149 |
1.1 |
|
150 |
1.1 |
|
155 |
1.1 |
|
157 |
1.1 |
|
172 |
1.1 |
|
173 |
1.1 |
|
175 |
1.1 |
|
176 |
1.1 |
|
178 |
1.1 |
|
179 |
1.1 |
|
183 |
1.1 2.2 |
|
185 |
1.1 2.2 |
|
186 |
1.1 2.2 |
|
187 |
1.1 2.2 |
|
199 |
1.1 |
|
200 |
1.1 2.2 |
|
205 |
1.1 |
|
206 |
1.1 2.2 |
|
211 |
1.1 |
|
212 |
1.1 2.2 |
|
225 |
1.1 2.2 |
|
227 |
1.1 |
|
228 |
1.1 |
|
232 |
1.1 |
|
233 |
1.1 |
|
237 |
1.1 |
|
238 |
1.1 |
|
248 |
1.1 |
|
256 |
1.1 |
|
265 |
1.1 |
|
266 |
1.1 |
|
271 |
1.1 |
|
272 |
1.1 |
|
274 |
1.1 |
|
279 |
1.1 |
|
283 |
1.1 |
|
285 |
1.1 |
|
288 |
1.1 |
|
289 |
1.1 |
|
291 |
1.1 |
|
300 |
1.1 |
|
302 |
1.1 |
|
303 |
1.1 |
|
312 |
1.1 |
|
313 |
1.1 |
|
315 |
1.1 |
|
325 |
1.1 |
|
327 |
1.1 |
|
330 |
1.1 |
|
331 |
1.1 |
|
333 |
1.1 |
|
340 |
1.1 |
|
344 |
1.1 |
|
345 |
1.1 |
|
346 |
1.1 |
|
348 |
1.1 |
|
350 |
1.1 |
|
357 |
1.1 |
|
359 |
1.1 |
|
362 |
1.1 |
|
368 |
1.1 |
|
370 |
1.1 |
|
379 |
1.1 2.2 |
|
388 |
1.1 |
|
392 |
1.1 |
|
396 |
1.1 |
|
404 |
1.1 |
|
412 |
1.1 |
|
420 |
1.1 2.2 |