ParameterUtil.java

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

Mutations

85

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

87

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

88

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

97

1.1
Location : controlInput
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

101

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

105

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

110

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ParameterUtil::initQueryString → NO_COVERAGE

111

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ParameterUtil::initHeader → NO_COVERAGE

112

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ParameterUtil::initRequest → NO_COVERAGE

114

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setMethodInjection → NO_COVERAGE

115

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setTypeRequest → NO_COVERAGE

117

1.1
Location : controlInput
Killed by : none
negated conditional → NO_COVERAGE

118

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/model/InjectionModel::beginInjection → NO_COVERAGE

120

1.1
Location : controlInput
Killed by : none
removed call to java/lang/Thread::start → NO_COVERAGE

126

1.1
Location : controlInput
Killed by : none
removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE

135

1.1
Location : checkParametersFormat
Killed by : none
removed call to com/jsql/util/ParameterUtil::checkOneOrLessStar → SURVIVED
Covering tests

136

1.1
Location : checkParametersFormat
Killed by : none
removed call to com/jsql/util/ParameterUtil::checkStarMatchMethod → SURVIVED
Covering tests

137

1.1
Location : checkParametersFormat
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
removed call to com/jsql/util/ParameterUtil::checkMethodNotEmpty → KILLED

138

1.1
Location : checkParametersFormat
Killed by : none
removed call to com/jsql/util/ParameterUtil::checkMultipart → NO_COVERAGE

139

1.1
Location : checkParametersFormat
Killed by : none
negated conditional → NO_COVERAGE

151

1.1
Location : isInvalidName
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : isInvalidName
Killed by : none
changed conditional boundary → NO_COVERAGE

153

1.1
Location : isInvalidName
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : isInvalidName
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : isInvalidName
Killed by : none
changed conditional boundary → NO_COVERAGE

154

1.1
Location : isInvalidName
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE

157

1.1
Location : isInvalidName
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE

2.2
Location : isInvalidName
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isInvalidName → NO_COVERAGE

166

1.1
Location : lambda$checkMultipart$0
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE

2.2
Location : lambda$checkMultipart$0
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::lambda$checkMultipart$0 → NO_COVERAGE

167

1.1
Location : checkMultipart
Killed by : none
negated conditional → NO_COVERAGE

168

1.1
Location : lambda$checkMultipart$1
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::lambda$checkMultipart$1 → NO_COVERAGE

2.2
Location : lambda$checkMultipart$1
Killed by : none
negated conditional → NO_COVERAGE

169

1.1
Location : lambda$checkMultipart$1
Killed by : none
negated conditional → NO_COVERAGE

170

1.1
Location : lambda$checkMultipart$1
Killed by : none
negated conditional → NO_COVERAGE

175

1.1
Location : checkMultipart
Killed by : none
negated conditional → NO_COVERAGE

177

1.1
Location : checkMultipart
Killed by : none
negated conditional → NO_COVERAGE

191

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

192

1.1
Location : checkOneOrLessStar
Killed by : none
Changed increment from 1 to -1 → SURVIVED
Covering tests

194

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

195

1.1
Location : checkOneOrLessStar
Killed by : none
Changed increment from 1 to -1 → SURVIVED
Covering tests

197

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

198

1.1
Location : checkOneOrLessStar
Killed by : none
Changed increment from 1 to -1 → SURVIVED
Covering tests

202

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

204

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

205

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

206

1.1
Location : checkOneOrLessStar
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkOneOrLessStar
Killed by : none
changed conditional boundary → SURVIVED Covering tests

217

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

218

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED Covering tests

223

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

224

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED Covering tests

229

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

230

1.1
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED
Covering tests

2.2
Location : checkStarMatchMethod
Killed by : none
negated conditional → SURVIVED Covering tests

242

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

2.2
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

244

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

245

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

249

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

250

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

254

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

255

1.1
Location : checkMethodNotEmpty
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

263

1.1
Location : initStar
Killed by : none
negated conditional → NO_COVERAGE

269

1.1
Location : initStar
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::initStar → NO_COVERAGE

277

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
negated conditional → KILLED

278

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
negated conditional → KILLED

283

1.1
Location : initQueryString
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setUrlByUser → SURVIVED
Covering tests

284

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
removed call to com/jsql/util/ConnectionUtil::setUrlBase → KILLED

285

1.1
Location : initQueryString
Killed by : none
removed call to java/util/List::clear → SURVIVED
Covering tests

289

1.1
Location : initQueryString
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
negated conditional → KILLED

293

1.1
Location : initQueryString
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setUrlBase → SURVIVED
Covering tests

295

1.1
Location : initQueryString
Killed by : none
negated conditional → SURVIVED
Covering tests

298

1.1
Location : lambda$initQueryString$2
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initQueryString$2 → KILLED

299

1.1
Location : lambda$initQueryString$3
Killed by : none
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initQueryString$3 → SURVIVED
Covering tests

301

1.1
Location : lambda$initQueryString$3
Killed by : none
negated conditional → SURVIVED
Covering tests

308

1.1
Location : initRequest
Killed by : none
removed call to java/util/List::clear → SURVIVED
Covering tests

309

1.1
Location : initRequest
Killed by : none
negated conditional → SURVIVED
Covering tests

310

1.1
Location : initRequest
Killed by : none
negated conditional → SURVIVED
Covering tests

319

1.1
Location : lambda$initRequest$4
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initRequest$4 → KILLED

320

1.1
Location : lambda$initRequest$5
Killed by : none
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initRequest$5 → SURVIVED
Covering tests

322

1.1
Location : lambda$initRequest$5
Killed by : none
negated conditional → SURVIVED
Covering tests

330

1.1
Location : initHeader
Killed by : none
removed call to java/util/List::clear → SURVIVED
Covering tests

331

1.1
Location : initHeader
Killed by : none
negated conditional → SURVIVED
Covering tests

334

1.1
Location : lambda$initHeader$6
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initHeader$6 → KILLED

335

1.1
Location : lambda$initHeader$7
Killed by : none
replaced return value with null for com/jsql/util/ParameterUtil::lambda$initHeader$7 → SURVIVED
Covering tests

337

1.1
Location : lambda$initHeader$7
Killed by : none
negated conditional → SURVIVED
Covering tests

343

1.1
Location : getQueryStringFromEntries
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getQueryStringFromEntries → SURVIVED
Covering tests

347

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
negated conditional → SURVIVED
Covering tests

348

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
negated conditional → NO_COVERAGE

349

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
negated conditional → NO_COVERAGE

351

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → NO_COVERAGE

353

1.1
Location : lambda$getQueryStringFromEntries$8
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getQueryStringFromEntries$8 → SURVIVED
Covering tests

360

1.1
Location : getRequestFromEntries
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getRequestFromEntries → SURVIVED
Covering tests

362

1.1
Location : lambda$getRequestFromEntries$9
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getRequestFromEntries$9 → SURVIVED
Covering tests

365

1.1
Location : lambda$getRequestFromEntries$9
Killed by : none
negated conditional → SURVIVED
Covering tests

371

1.1
Location : getHeaderFromEntries
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getHeaderFromEntries → SURVIVED
Covering tests

373

1.1
Location : lambda$getHeaderFromEntries$10
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::lambda$getHeaderFromEntries$10 → SURVIVED
Covering tests

378

1.1
Location : isRequestSoap
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE

2.2
Location : isRequestSoap
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::isRequestSoap → NO_COVERAGE

387

1.1
Location : getRawRequest
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getRawRequest → NO_COVERAGE

391

1.1
Location : getRawHeader
Killed by : none
replaced return value with "" for com/jsql/util/ParameterUtil::getRawHeader → NO_COVERAGE

395

1.1
Location : getListRequest
Killed by : none
replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListRequest → SURVIVED
Covering tests

399

1.1
Location : getListHeader
Killed by : none
replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListHeader → SURVIVED
Covering tests

403

1.1
Location : getListQueryString
Killed by : none
replaced return value with Collections.emptyList for com/jsql/util/ParameterUtil::getListQueryString → SURVIVED
Covering tests

407

1.1
Location : isMultipartRequest
Killed by : none
replaced boolean return with false for com/jsql/util/ParameterUtil::isMultipartRequest → NO_COVERAGE

2.2
Location : isMultipartRequest
Killed by : none
replaced boolean return with true for com/jsql/util/ParameterUtil::isMultipartRequest → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.22.1