Search is not available for this dataset
hexsha
stringlengths 40
40
| repo
stringlengths 6
126
| path
stringlengths 6
1.02k
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
220
| return_type
stringlengths 1
110
⌀ | original_string
stringlengths 39
223k
| original_docstring
stringlengths 16
34.8k
| docstring
stringlengths 11
3.41k
| docstring_tokens
sequence | code
stringlengths 26
223k
| code_tokens
sequence | short_docstring
stringlengths 0
3.02k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict | input_ids
sequence | attention_mask
sequence | labels
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
332064d33c9c5305df92a483147da8c4b57ceefb | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/util/ModelFactory.java | [
"MIT"
] | Java | generateTestResultDTO | TestResultsDTO | public static TestResultsDTO generateTestResultDTO(String repoName, List<String> successfulTestNames, List<String> failedTestNames, ProgrammingLanguage programmingLanguage,
boolean enableStaticAnalysisReports) {
var notification = new TestResultsDTO();
var testSuite = new TestsuiteDTO();
testSuite.setName("TestSuiteName1");
testSuite.setTime(ZonedDateTime.now().toEpochSecond());
testSuite.setErrors(0);
testSuite.setSkipped(0);
testSuite.setFailures(failedTestNames.size());
testSuite.setTests(successfulTestNames.size() + failedTestNames.size());
testSuite.setTestCases(successfulTestNames.stream().map(name -> {
var testcase = new TestCaseDTO();
testcase.setName(name);
testcase.setClassname("Class");
return testcase;
}).collect(Collectors.toList()));
testSuite.getTestCases().addAll(failedTestNames.stream().map(name -> {
var testcase = new TestCaseDTO();
testcase.setName(name);
testcase.setClassname("Class");
var error = new TestCaseDetailMessageDTO();
error.setMessage(name + " error message");
testcase.setErrors(List.of(error));
return testcase;
}).collect(Collectors.toList()));
var commitDTO = new CommitDTO();
commitDTO.setHash(TestConstants.COMMIT_HASH_STRING);
commitDTO.setRepositorySlug(repoName);
if (enableStaticAnalysisReports) {
var reports = generateStaticCodeAnalysisReports(programmingLanguage);
notification.setStaticCodeAnalysisReports(reports);
}
notification.setCommits(List.of(commitDTO));
notification.setResults(List.of(testSuite));
notification.setSuccessful(successfulTestNames.size());
notification.setFailures(failedTestNames.size());
notification.setRunDate(ZonedDateTime.now());
notification.setLogs(List.of());
return notification;
} | /**
* Creates a dummy DTO used by Jenkins, which notifies about new programming exercise results.
*
* @param repoName name of the repository
* @param successfulTestNames names of successful tests
* @param failedTestNames names of failed tests
* @param programmingLanguage programming language to use
* @param enableStaticAnalysisReports should the notification include static analysis reports
* @return TestResultDTO with dummy data
*/ | Creates a dummy DTO used by Jenkins, which notifies about new programming exercise results. | [
"Creates",
"a",
"dummy",
"DTO",
"used",
"by",
"Jenkins",
"which",
"notifies",
"about",
"new",
"programming",
"exercise",
"results",
"."
] | public static TestResultsDTO generateTestResultDTO(String repoName, List<String> successfulTestNames, List<String> failedTestNames, ProgrammingLanguage programmingLanguage,
boolean enableStaticAnalysisReports) {
var notification = new TestResultsDTO();
var testSuite = new TestsuiteDTO();
testSuite.setName("TestSuiteName1");
testSuite.setTime(ZonedDateTime.now().toEpochSecond());
testSuite.setErrors(0);
testSuite.setSkipped(0);
testSuite.setFailures(failedTestNames.size());
testSuite.setTests(successfulTestNames.size() + failedTestNames.size());
testSuite.setTestCases(successfulTestNames.stream().map(name -> {
var testcase = new TestCaseDTO();
testcase.setName(name);
testcase.setClassname("Class");
return testcase;
}).collect(Collectors.toList()));
testSuite.getTestCases().addAll(failedTestNames.stream().map(name -> {
var testcase = new TestCaseDTO();
testcase.setName(name);
testcase.setClassname("Class");
var error = new TestCaseDetailMessageDTO();
error.setMessage(name + " error message");
testcase.setErrors(List.of(error));
return testcase;
}).collect(Collectors.toList()));
var commitDTO = new CommitDTO();
commitDTO.setHash(TestConstants.COMMIT_HASH_STRING);
commitDTO.setRepositorySlug(repoName);
if (enableStaticAnalysisReports) {
var reports = generateStaticCodeAnalysisReports(programmingLanguage);
notification.setStaticCodeAnalysisReports(reports);
}
notification.setCommits(List.of(commitDTO));
notification.setResults(List.of(testSuite));
notification.setSuccessful(successfulTestNames.size());
notification.setFailures(failedTestNames.size());
notification.setRunDate(ZonedDateTime.now());
notification.setLogs(List.of());
return notification;
} | [
"public",
"static",
"TestResultsDTO",
"generateTestResultDTO",
"(",
"String",
"repoName",
",",
"List",
"<",
"String",
">",
"successfulTestNames",
",",
"List",
"<",
"String",
">",
"failedTestNames",
",",
"ProgrammingLanguage",
"programmingLanguage",
",",
"boolean",
"enableStaticAnalysisReports",
")",
"{",
"var",
"notification",
"=",
"new",
"TestResultsDTO",
"(",
")",
";",
"var",
"testSuite",
"=",
"new",
"TestsuiteDTO",
"(",
")",
";",
"testSuite",
".",
"setName",
"(",
"\"TestSuiteName1\"",
")",
";",
"testSuite",
".",
"setTime",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
".",
"toEpochSecond",
"(",
")",
")",
";",
"testSuite",
".",
"setErrors",
"(",
"0",
")",
";",
"testSuite",
".",
"setSkipped",
"(",
"0",
")",
";",
"testSuite",
".",
"setFailures",
"(",
"failedTestNames",
".",
"size",
"(",
")",
")",
";",
"testSuite",
".",
"setTests",
"(",
"successfulTestNames",
".",
"size",
"(",
")",
"+",
"failedTestNames",
".",
"size",
"(",
")",
")",
";",
"testSuite",
".",
"setTestCases",
"(",
"successfulTestNames",
".",
"stream",
"(",
")",
".",
"map",
"(",
"name",
"->",
"{",
"var",
"testcase",
"=",
"new",
"TestCaseDTO",
"(",
")",
";",
"testcase",
".",
"setName",
"(",
"name",
")",
";",
"testcase",
".",
"setClassname",
"(",
"\"Class\"",
")",
";",
"return",
"testcase",
";",
"}",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
";",
"testSuite",
".",
"getTestCases",
"(",
")",
".",
"addAll",
"(",
"failedTestNames",
".",
"stream",
"(",
")",
".",
"map",
"(",
"name",
"->",
"{",
"var",
"testcase",
"=",
"new",
"TestCaseDTO",
"(",
")",
";",
"testcase",
".",
"setName",
"(",
"name",
")",
";",
"testcase",
".",
"setClassname",
"(",
"\"Class\"",
")",
";",
"var",
"error",
"=",
"new",
"TestCaseDetailMessageDTO",
"(",
")",
";",
"error",
".",
"setMessage",
"(",
"name",
"+",
"\" error message\"",
")",
";",
"testcase",
".",
"setErrors",
"(",
"List",
".",
"of",
"(",
"error",
")",
")",
";",
"return",
"testcase",
";",
"}",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
";",
"var",
"commitDTO",
"=",
"new",
"CommitDTO",
"(",
")",
";",
"commitDTO",
".",
"setHash",
"(",
"TestConstants",
".",
"COMMIT_HASH_STRING",
")",
";",
"commitDTO",
".",
"setRepositorySlug",
"(",
"repoName",
")",
";",
"if",
"(",
"enableStaticAnalysisReports",
")",
"{",
"var",
"reports",
"=",
"generateStaticCodeAnalysisReports",
"(",
"programmingLanguage",
")",
";",
"notification",
".",
"setStaticCodeAnalysisReports",
"(",
"reports",
")",
";",
"}",
"notification",
".",
"setCommits",
"(",
"List",
".",
"of",
"(",
"commitDTO",
")",
")",
";",
"notification",
".",
"setResults",
"(",
"List",
".",
"of",
"(",
"testSuite",
")",
")",
";",
"notification",
".",
"setSuccessful",
"(",
"successfulTestNames",
".",
"size",
"(",
")",
")",
";",
"notification",
".",
"setFailures",
"(",
"failedTestNames",
".",
"size",
"(",
")",
")",
";",
"notification",
".",
"setRunDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"notification",
".",
"setLogs",
"(",
"List",
".",
"of",
"(",
")",
")",
";",
"return",
"notification",
";",
"}"
] | Creates a dummy DTO used by Jenkins, which notifies about new programming exercise results. | [
"Creates",
"a",
"dummy",
"DTO",
"used",
"by",
"Jenkins",
"which",
"notifies",
"about",
"new",
"programming",
"exercise",
"results",
"."
] | [] | [
{
"param": "repoName",
"type": "String"
},
{
"param": "successfulTestNames",
"type": "List<String>"
},
{
"param": "failedTestNames",
"type": "List<String>"
},
{
"param": "programmingLanguage",
"type": "ProgrammingLanguage"
},
{
"param": "enableStaticAnalysisReports",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "repoName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "successfulTestNames",
"type": "List<String>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "failedTestNames",
"type": "List<String>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "programmingLanguage",
"type": "ProgrammingLanguage",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enableStaticAnalysisReports",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
7766,
3447,
19792,
2103,
4709,
1253,
19792,
12,
780,
3538,
461,
16,
987,
32,
780,
34,
6873,
4709,
1557,
16,
987,
32,
780,
34,
2535,
4709,
1557,
16,
13586,
11987,
3779,
5402,
11987,
3779,
16,
203,
5411,
1250,
4237,
5788,
9418,
18631,
13,
288,
203,
3639,
569,
3851,
273,
394,
7766,
3447,
19792,
5621,
203,
203,
3639,
569,
1842,
13587,
273,
394,
7766,
30676,
19792,
5621,
203,
3639,
1842,
13587,
18,
542,
461,
2932,
4709,
13587,
461,
21,
8863,
203,
3639,
1842,
13587,
18,
542,
950,
12,
62,
20461,
18,
3338,
7675,
869,
14638,
8211,
10663,
203,
3639,
1842,
13587,
18,
542,
4229,
12,
20,
1769,
203,
3639,
1842,
13587,
18,
542,
16425,
12,
20,
1769,
203,
3639,
1842,
13587,
18,
542,
14479,
12,
7307,
4709,
1557,
18,
1467,
10663,
203,
3639,
1842,
13587,
18,
542,
14650,
12,
18418,
4709,
1557,
18,
1467,
1435,
397,
2535,
4709,
1557,
18,
1467,
10663,
203,
3639,
1842,
13587,
18,
542,
4709,
30744,
12,
18418,
4709,
1557,
18,
3256,
7675,
1458,
12,
529,
317,
288,
203,
5411,
569,
1842,
3593,
273,
394,
7766,
2449,
19792,
5621,
203,
5411,
1842,
3593,
18,
542,
461,
12,
529,
1769,
203,
5411,
1842,
3593,
18,
542,
20531,
2932,
797,
8863,
203,
5411,
327,
1842,
3593,
31,
203,
3639,
289,
2934,
14676,
12,
10808,
1383,
18,
869,
682,
1435,
10019,
203,
3639,
1842,
13587,
18,
588,
4709,
30744,
7675,
1289,
1595,
12,
7307,
4709,
1557,
18,
3256,
7675,
1458,
12,
529,
317,
288,
203,
5411,
569,
1842,
3593,
273,
394,
7766,
2449,
19792,
5621,
203,
5411,
1842,
3593,
18,
542,
461,
12,
529,
1769,
203,
5411,
1842,
3593,
18,
542,
20531,
2932,
797,
8863,
203,
5411,
569,
555,
273,
394,
7766,
2449,
6109,
1079,
19792,
5621,
203,
5411,
555,
18,
542,
1079,
12,
529,
397,
315,
555,
883,
8863,
203,
5411,
1842,
3593,
18,
542,
4229,
12,
682,
18,
792,
12,
1636,
10019,
203,
5411,
327,
1842,
3593,
31,
203,
3639,
289,
2934,
14676,
12,
10808,
1383,
18,
869,
682,
1435,
10019,
203,
203,
3639,
569,
3294,
19792,
273,
394,
10269,
19792,
5621,
203,
3639,
3294,
19792,
18,
542,
2310,
12,
4709,
2918,
18,
18658,
67,
15920,
67,
5804,
1769,
203,
3639,
3294,
19792,
18,
542,
3305,
9966,
12,
7422,
461,
1769,
203,
203,
3639,
309,
261,
7589,
5788,
9418,
18631,
13,
288,
203,
5411,
569,
10557,
273,
2103,
5788,
1085,
9418,
18631,
12,
12890,
11987,
3779,
1769,
203,
5411,
3851,
18,
542,
5788,
1085,
9418,
18631,
12,
20195,
1769,
203,
3639,
289,
203,
203,
3639,
3851,
18,
542,
23072,
12,
682,
18,
792,
12,
7371,
19792,
10019,
203,
3639,
3851,
18,
542,
3447,
12,
682,
18,
792,
12,
3813,
13587,
10019,
203,
3639,
3851,
18,
542,
14277,
12,
18418,
4709,
1557,
18,
1467,
10663,
203,
3639,
3851,
18,
542,
14479,
12,
7307,
4709,
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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
10210,
279,
9609,
463,
4296,
1399,
635,
20034,
16,
1492,
19527,
2973,
394,
5402,
11987,
24165,
1686,
18,
203,
377,
380,
203,
377,
380,
632,
891,
3538,
461,
508,
434,
326,
3352,
203,
377,
380,
632,
891,
6873,
4709,
1557,
1257,
434,
6873,
7434,
203,
377,
380,
632,
891,
2535,
4709,
1557,
1257,
434,
2535,
7434,
203,
377,
380,
632,
891,
5402,
11987,
3779,
5402,
11987,
2653,
358,
999,
203,
377,
380,
632,
891,
4237,
5788,
9418,
18631,
1410,
326,
3851,
2341,
760,
6285,
10557,
203,
377,
380,
632,
2463,
7766,
1253,
19792,
598,
9609,
501,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
332064d33c9c5305df92a483147da8c4b57ceefb | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/util/ModelFactory.java | [
"MIT"
] | Java | generateTestResultsDTOWithCustomFeedback | TestResultsDTO | public static TestResultsDTO generateTestResultsDTOWithCustomFeedback(String repoName, List<String> successfulTestNames, List<String> failedTestNames,
ProgrammingLanguage programmingLanguage, boolean enableStaticAnalysisReports) {
var notification = generateTestResultDTO(repoName, successfulTestNames, failedTestNames, programmingLanguage, enableStaticAnalysisReports);
var testSuite = new TestsuiteDTO();
testSuite.setName("customFeedbacks");
testSuite.setErrors(0);
testSuite.setSkipped(0);
testSuite.setFailures(failedTestNames.size());
testSuite.setTests(successfulTestNames.size() + failedTestNames.size());
final List<TestCaseDTO> testCases = new ArrayList<>();
// successful with message
{
var testCase = new TestCaseDTO();
testCase.setName("CustomSuccessMessage");
var successInfo = new TestCaseDetailMessageDTO();
successInfo.setMessage("Successful test with message");
testCase.setSuccessInfos(List.of(successInfo));
testCases.add(testCase);
}
// successful without message
{
var testCase = new TestCaseDTO();
testCase.setName("CustomSuccessNoMessage");
var successInfo = new TestCaseDetailMessageDTO();
testCase.setSuccessInfos(List.of(successInfo));
testCases.add(testCase);
}
// failed with message
{
var testCase = new TestCaseDTO();
testCase.setName("CustomFailedMessage");
var failedInfo = new TestCaseDetailMessageDTO();
failedInfo.setMessage("Failed test with message");
testCase.setFailures(List.of(failedInfo));
testCases.add(testCase);
}
// failed without message
{
var testCase = new TestCaseDTO();
testCase.setName("CustomFailedNoMessage");
var failedInfo = new TestCaseDetailMessageDTO();
testCase.setFailures(List.of(failedInfo));
testCases.add(testCase);
}
testSuite.setTestCases(testCases);
var results = new ArrayList<>(notification.getResults());
results.add(testSuite);
notification.setResults(results);
return notification;
} | /**
* Creates a dummy DTO with custom feedbacks used by Jenkins, which notifies about new programming exercise results.
*
* Uses {@link #generateTestResultDTO(String, List, List, ProgrammingLanguage, boolean)} as basis.
* Then adds a new {@link TestsuiteDTO} with name "CustomFeedbacks" to it.
* This Testsuite has four {@link TestCaseDTO}s:
* <ul>
* <li>CustomSuccessMessage: successful test with a message</li>
* <li>CustomSuccessNoMessage: successful test without message</li>
* <li>CustomFailedMessage: failed test with a message</li>
* </ul>
*
* @param repoName name of the repository
* @param successfulTestNames names of successful tests
* @param failedTestNames names of failed tests
* @param programmingLanguage programming language to use
* @param enableStaticAnalysisReports should the notification include static analysis reports
* @return TestResultDTO with dummy data
*/ | Creates a dummy DTO with custom feedbacks used by Jenkins, which notifies about new programming exercise results.
Uses #generateTestResultDTO(String, List, List, ProgrammingLanguage, boolean) as basis.
Then adds a new TestsuiteDTO with name "CustomFeedbacks" to it.
This Testsuite has four TestCaseDTOs:
CustomSuccessMessage: successful test with a message
CustomSuccessNoMessage: successful test without message
CustomFailedMessage: failed test with a message
| [
"Creates",
"a",
"dummy",
"DTO",
"with",
"custom",
"feedbacks",
"used",
"by",
"Jenkins",
"which",
"notifies",
"about",
"new",
"programming",
"exercise",
"results",
".",
"Uses",
"#generateTestResultDTO",
"(",
"String",
"List",
"List",
"ProgrammingLanguage",
"boolean",
")",
"as",
"basis",
".",
"Then",
"adds",
"a",
"new",
"TestsuiteDTO",
"with",
"name",
"\"",
"CustomFeedbacks",
"\"",
"to",
"it",
".",
"This",
"Testsuite",
"has",
"four",
"TestCaseDTOs",
":",
"CustomSuccessMessage",
":",
"successful",
"test",
"with",
"a",
"message",
"CustomSuccessNoMessage",
":",
"successful",
"test",
"without",
"message",
"CustomFailedMessage",
":",
"failed",
"test",
"with",
"a",
"message"
] | public static TestResultsDTO generateTestResultsDTOWithCustomFeedback(String repoName, List<String> successfulTestNames, List<String> failedTestNames,
ProgrammingLanguage programmingLanguage, boolean enableStaticAnalysisReports) {
var notification = generateTestResultDTO(repoName, successfulTestNames, failedTestNames, programmingLanguage, enableStaticAnalysisReports);
var testSuite = new TestsuiteDTO();
testSuite.setName("customFeedbacks");
testSuite.setErrors(0);
testSuite.setSkipped(0);
testSuite.setFailures(failedTestNames.size());
testSuite.setTests(successfulTestNames.size() + failedTestNames.size());
final List<TestCaseDTO> testCases = new ArrayList<>();
{
var testCase = new TestCaseDTO();
testCase.setName("CustomSuccessMessage");
var successInfo = new TestCaseDetailMessageDTO();
successInfo.setMessage("Successful test with message");
testCase.setSuccessInfos(List.of(successInfo));
testCases.add(testCase);
}
{
var testCase = new TestCaseDTO();
testCase.setName("CustomSuccessNoMessage");
var successInfo = new TestCaseDetailMessageDTO();
testCase.setSuccessInfos(List.of(successInfo));
testCases.add(testCase);
}
{
var testCase = new TestCaseDTO();
testCase.setName("CustomFailedMessage");
var failedInfo = new TestCaseDetailMessageDTO();
failedInfo.setMessage("Failed test with message");
testCase.setFailures(List.of(failedInfo));
testCases.add(testCase);
}
{
var testCase = new TestCaseDTO();
testCase.setName("CustomFailedNoMessage");
var failedInfo = new TestCaseDetailMessageDTO();
testCase.setFailures(List.of(failedInfo));
testCases.add(testCase);
}
testSuite.setTestCases(testCases);
var results = new ArrayList<>(notification.getResults());
results.add(testSuite);
notification.setResults(results);
return notification;
} | [
"public",
"static",
"TestResultsDTO",
"generateTestResultsDTOWithCustomFeedback",
"(",
"String",
"repoName",
",",
"List",
"<",
"String",
">",
"successfulTestNames",
",",
"List",
"<",
"String",
">",
"failedTestNames",
",",
"ProgrammingLanguage",
"programmingLanguage",
",",
"boolean",
"enableStaticAnalysisReports",
")",
"{",
"var",
"notification",
"=",
"generateTestResultDTO",
"(",
"repoName",
",",
"successfulTestNames",
",",
"failedTestNames",
",",
"programmingLanguage",
",",
"enableStaticAnalysisReports",
")",
";",
"var",
"testSuite",
"=",
"new",
"TestsuiteDTO",
"(",
")",
";",
"testSuite",
".",
"setName",
"(",
"\"customFeedbacks\"",
")",
";",
"testSuite",
".",
"setErrors",
"(",
"0",
")",
";",
"testSuite",
".",
"setSkipped",
"(",
"0",
")",
";",
"testSuite",
".",
"setFailures",
"(",
"failedTestNames",
".",
"size",
"(",
")",
")",
";",
"testSuite",
".",
"setTests",
"(",
"successfulTestNames",
".",
"size",
"(",
")",
"+",
"failedTestNames",
".",
"size",
"(",
")",
")",
";",
"final",
"List",
"<",
"TestCaseDTO",
">",
"testCases",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"{",
"var",
"testCase",
"=",
"new",
"TestCaseDTO",
"(",
")",
";",
"testCase",
".",
"setName",
"(",
"\"CustomSuccessMessage\"",
")",
";",
"var",
"successInfo",
"=",
"new",
"TestCaseDetailMessageDTO",
"(",
")",
";",
"successInfo",
".",
"setMessage",
"(",
"\"Successful test with message\"",
")",
";",
"testCase",
".",
"setSuccessInfos",
"(",
"List",
".",
"of",
"(",
"successInfo",
")",
")",
";",
"testCases",
".",
"add",
"(",
"testCase",
")",
";",
"}",
"{",
"var",
"testCase",
"=",
"new",
"TestCaseDTO",
"(",
")",
";",
"testCase",
".",
"setName",
"(",
"\"CustomSuccessNoMessage\"",
")",
";",
"var",
"successInfo",
"=",
"new",
"TestCaseDetailMessageDTO",
"(",
")",
";",
"testCase",
".",
"setSuccessInfos",
"(",
"List",
".",
"of",
"(",
"successInfo",
")",
")",
";",
"testCases",
".",
"add",
"(",
"testCase",
")",
";",
"}",
"{",
"var",
"testCase",
"=",
"new",
"TestCaseDTO",
"(",
")",
";",
"testCase",
".",
"setName",
"(",
"\"CustomFailedMessage\"",
")",
";",
"var",
"failedInfo",
"=",
"new",
"TestCaseDetailMessageDTO",
"(",
")",
";",
"failedInfo",
".",
"setMessage",
"(",
"\"Failed test with message\"",
")",
";",
"testCase",
".",
"setFailures",
"(",
"List",
".",
"of",
"(",
"failedInfo",
")",
")",
";",
"testCases",
".",
"add",
"(",
"testCase",
")",
";",
"}",
"{",
"var",
"testCase",
"=",
"new",
"TestCaseDTO",
"(",
")",
";",
"testCase",
".",
"setName",
"(",
"\"CustomFailedNoMessage\"",
")",
";",
"var",
"failedInfo",
"=",
"new",
"TestCaseDetailMessageDTO",
"(",
")",
";",
"testCase",
".",
"setFailures",
"(",
"List",
".",
"of",
"(",
"failedInfo",
")",
")",
";",
"testCases",
".",
"add",
"(",
"testCase",
")",
";",
"}",
"testSuite",
".",
"setTestCases",
"(",
"testCases",
")",
";",
"var",
"results",
"=",
"new",
"ArrayList",
"<",
">",
"(",
"notification",
".",
"getResults",
"(",
")",
")",
";",
"results",
".",
"add",
"(",
"testSuite",
")",
";",
"notification",
".",
"setResults",
"(",
"results",
")",
";",
"return",
"notification",
";",
"}"
] | Creates a dummy DTO with custom feedbacks used by Jenkins, which notifies about new programming exercise results. | [
"Creates",
"a",
"dummy",
"DTO",
"with",
"custom",
"feedbacks",
"used",
"by",
"Jenkins",
"which",
"notifies",
"about",
"new",
"programming",
"exercise",
"results",
"."
] | [
"// successful with message",
"// successful without message",
"// failed with message",
"// failed without message"
] | [
{
"param": "repoName",
"type": "String"
},
{
"param": "successfulTestNames",
"type": "List<String>"
},
{
"param": "failedTestNames",
"type": "List<String>"
},
{
"param": "programmingLanguage",
"type": "ProgrammingLanguage"
},
{
"param": "enableStaticAnalysisReports",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "repoName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "successfulTestNames",
"type": "List<String>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "failedTestNames",
"type": "List<String>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "programmingLanguage",
"type": "ProgrammingLanguage",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "enableStaticAnalysisReports",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
7766,
3447,
19792,
2103,
4709,
3447,
19792,
1190,
3802,
15888,
12,
780,
3538,
461,
16,
987,
32,
780,
34,
6873,
4709,
1557,
16,
987,
32,
780,
34,
2535,
4709,
1557,
16,
203,
5411,
13586,
11987,
3779,
5402,
11987,
3779,
16,
1250,
4237,
5788,
9418,
18631,
13,
288,
203,
3639,
569,
3851,
273,
2103,
4709,
1253,
19792,
12,
7422,
461,
16,
6873,
4709,
1557,
16,
2535,
4709,
1557,
16,
5402,
11987,
3779,
16,
4237,
5788,
9418,
18631,
1769,
203,
203,
3639,
569,
1842,
13587,
273,
394,
7766,
30676,
19792,
5621,
203,
3639,
1842,
13587,
18,
542,
461,
2932,
3662,
15888,
87,
8863,
203,
3639,
1842,
13587,
18,
542,
4229,
12,
20,
1769,
203,
3639,
1842,
13587,
18,
542,
16425,
12,
20,
1769,
203,
3639,
1842,
13587,
18,
542,
14479,
12,
7307,
4709,
1557,
18,
1467,
10663,
203,
3639,
1842,
13587,
18,
542,
14650,
12,
18418,
4709,
1557,
18,
1467,
1435,
397,
2535,
4709,
1557,
18,
1467,
10663,
203,
203,
3639,
727,
987,
32,
4709,
2449,
19792,
34,
1842,
30744,
273,
394,
2407,
29667,
5621,
203,
203,
3639,
368,
6873,
598,
883,
203,
3639,
288,
203,
5411,
569,
1842,
2449,
273,
394,
7766,
2449,
19792,
5621,
203,
5411,
1842,
2449,
18,
542,
461,
2932,
3802,
4510,
1079,
8863,
203,
5411,
569,
2216,
966,
273,
394,
7766,
2449,
6109,
1079,
19792,
5621,
203,
5411,
2216,
966,
18,
542,
1079,
2932,
14277,
1842,
598,
883,
8863,
203,
5411,
1842,
2449,
18,
542,
4510,
7655,
12,
682,
18,
792,
12,
4768,
966,
10019,
203,
5411,
1842,
30744,
18,
1289,
12,
3813,
2449,
1769,
203,
3639,
289,
203,
203,
3639,
368,
6873,
2887,
883,
203,
3639,
288,
203,
5411,
569,
1842,
2449,
273,
394,
7766,
2449,
19792,
5621,
203,
5411,
1842,
2449,
18,
542,
461,
2932,
3802,
4510,
2279,
1079,
8863,
203,
5411,
569,
2216,
966,
273,
394,
7766,
2449,
6109,
1079,
19792,
5621,
203,
5411,
1842,
2449,
18,
542,
4510,
7655,
12,
682,
18,
792,
12,
4768,
966,
10019,
203,
5411,
1842,
30744,
18,
1289,
12,
3813,
2449,
1769,
203,
3639,
289,
203,
203,
3639,
368,
2535,
598,
883,
203,
3639,
288,
203,
5411,
569,
1842,
2449,
273,
394,
7766,
2449,
19792,
5621,
203,
5411,
1842,
2449,
18,
542,
461,
2932,
3802,
2925,
1079,
8863,
203,
5411,
569,
2535,
966,
273,
394,
7766,
2449,
6109,
1079,
19792,
5621,
203,
5411,
2535,
966,
18,
542,
1079,
2932,
2925,
1842,
598,
883,
8863,
203,
5411,
1842,
2449,
18,
542,
14479,
12,
682,
18,
792,
12,
7307,
966,
10019,
203,
5411,
1842,
30744,
18,
1289,
12,
3813,
2449,
1769,
203,
3639,
289,
203,
203,
3639,
368,
2535,
2887,
883,
203,
3639,
288,
203,
5411,
569,
1842,
2449,
273,
394,
7766,
2449,
19792,
5621,
203,
5411,
1842,
2449,
18,
542,
461,
2932,
3802,
2925,
2279,
1079,
8863,
203,
5411,
569,
2535,
966,
273,
394,
7766,
2449,
6109,
1079,
19792,
5621,
203,
5411,
1842,
2449,
18,
542,
14479,
12,
682,
18,
792,
12,
7307,
966,
10019,
203,
5411,
1842,
30744,
18,
1289,
12,
3813,
2449,
1769,
203,
3639,
289,
203,
203,
3639,
1842,
13587,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
10210,
279,
9609,
463,
4296,
598,
1679,
10762,
87,
1399,
635,
20034,
16,
1492,
19527,
2973,
394,
5402,
11987,
24165,
1686,
18,
203,
377,
380,
203,
377,
380,
14854,
8901,
1232,
468,
7163,
4709,
1253,
19792,
12,
780,
16,
987,
16,
987,
16,
13586,
11987,
3779,
16,
1250,
16869,
487,
10853,
18,
203,
377,
380,
9697,
4831,
279,
394,
8901,
1232,
7766,
30676,
19792,
97,
598,
508,
315,
3802,
15888,
87,
6,
358,
518,
18,
203,
377,
380,
1220,
7766,
30676,
711,
12792,
8901,
1232,
7766,
2449,
19792,
97,
87,
30,
203,
377,
380,
411,
332,
34,
203,
377,
380,
377,
411,
549,
34,
3802,
4510,
1079,
30,
6873,
1842,
598,
279,
883,
1757,
549,
34,
203,
377,
380,
377,
411,
549,
2
] |
332064d33c9c5305df92a483147da8c4b57ceefb | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/util/ModelFactory.java | [
"MIT"
] | Java | generateBambooBuildResultWithLogs | BambooBuildResultNotificationDTO | public static BambooBuildResultNotificationDTO generateBambooBuildResultWithLogs(String repoName, List<String> successfulTestNames, List<String> failedTestNames) {
var notification = generateBambooBuildResult(repoName, successfulTestNames, failedTestNames);
notification.getBuild().getTestSummary().setDescription("No tests found");
String logWith254Chars = "a".repeat(254);
var buildLogDTO254Chars = new BambooBuildLogDTO();
buildLogDTO254Chars.setDate(ZonedDateTime.now());
buildLogDTO254Chars.setLog(logWith254Chars);
var buildLogDTO255Chars = new BambooBuildLogDTO();
buildLogDTO255Chars.setDate(ZonedDateTime.now());
buildLogDTO255Chars.setLog(logWith254Chars + "a");
var buildLogDTO256Chars = new BambooBuildLogDTO();
buildLogDTO256Chars.setDate(ZonedDateTime.now());
buildLogDTO256Chars.setLog(logWith254Chars + "aa");
var largeBuildLogDTO = new BambooBuildLogDTO();
largeBuildLogDTO.setDate(ZonedDateTime.now());
largeBuildLogDTO.setLog(logWith254Chars + logWith254Chars);
var logTypicalErrorLog = new BambooBuildLogDTO();
logTypicalErrorLog.setDate(ZonedDateTime.now());
logTypicalErrorLog.setLog("error: the java class ABC does not exist");
var logTypicalDuplicatedErrorLog = new BambooBuildLogDTO();
logTypicalDuplicatedErrorLog.setDate(ZonedDateTime.now());
logTypicalDuplicatedErrorLog.setLog("error: the java class ABC does not exist");
var logCompilationError = new BambooBuildLogDTO();
logCompilationError.setDate(ZonedDateTime.now());
logCompilationError.setLog("COMPILATION ERROR");
var logBuildError = new BambooBuildLogDTO();
logBuildError.setDate(ZonedDateTime.now());
logBuildError.setLog("BUILD FAILURE");
var logWarning = new BambooBuildLogDTO();
logWarning.setDate(ZonedDateTime.now());
logWarning.setLog("[WARNING]");
var logWarningIllegalReflectiveAccess = new BambooBuildLogDTO();
logWarningIllegalReflectiveAccess.setDate(ZonedDateTime.now());
logWarningIllegalReflectiveAccess.setLog("WARNING: Illegal reflective access by");
notification.getBuild().getJobs().iterator().next().setLogs(List.of(buildLogDTO254Chars, buildLogDTO255Chars, buildLogDTO256Chars, largeBuildLogDTO, logTypicalErrorLog,
logTypicalDuplicatedErrorLog, logWarning, logWarningIllegalReflectiveAccess, logCompilationError, logBuildError));
return notification;
} | /**
* Generate a Bamboo notification with build logs of various sizes
*
* @param repoName repository name
* @param successfulTestNames names of successful tests
* @param failedTestNames names of failed tests
* @return notification with build logs
*/ | Generate a Bamboo notification with build logs of various sizes
@param repoName repository name
@param successfulTestNames names of successful tests
@param failedTestNames names of failed tests
@return notification with build logs | [
"Generate",
"a",
"Bamboo",
"notification",
"with",
"build",
"logs",
"of",
"various",
"sizes",
"@param",
"repoName",
"repository",
"name",
"@param",
"successfulTestNames",
"names",
"of",
"successful",
"tests",
"@param",
"failedTestNames",
"names",
"of",
"failed",
"tests",
"@return",
"notification",
"with",
"build",
"logs"
] | public static BambooBuildResultNotificationDTO generateBambooBuildResultWithLogs(String repoName, List<String> successfulTestNames, List<String> failedTestNames) {
var notification = generateBambooBuildResult(repoName, successfulTestNames, failedTestNames);
notification.getBuild().getTestSummary().setDescription("No tests found");
String logWith254Chars = "a".repeat(254);
var buildLogDTO254Chars = new BambooBuildLogDTO();
buildLogDTO254Chars.setDate(ZonedDateTime.now());
buildLogDTO254Chars.setLog(logWith254Chars);
var buildLogDTO255Chars = new BambooBuildLogDTO();
buildLogDTO255Chars.setDate(ZonedDateTime.now());
buildLogDTO255Chars.setLog(logWith254Chars + "a");
var buildLogDTO256Chars = new BambooBuildLogDTO();
buildLogDTO256Chars.setDate(ZonedDateTime.now());
buildLogDTO256Chars.setLog(logWith254Chars + "aa");
var largeBuildLogDTO = new BambooBuildLogDTO();
largeBuildLogDTO.setDate(ZonedDateTime.now());
largeBuildLogDTO.setLog(logWith254Chars + logWith254Chars);
var logTypicalErrorLog = new BambooBuildLogDTO();
logTypicalErrorLog.setDate(ZonedDateTime.now());
logTypicalErrorLog.setLog("error: the java class ABC does not exist");
var logTypicalDuplicatedErrorLog = new BambooBuildLogDTO();
logTypicalDuplicatedErrorLog.setDate(ZonedDateTime.now());
logTypicalDuplicatedErrorLog.setLog("error: the java class ABC does not exist");
var logCompilationError = new BambooBuildLogDTO();
logCompilationError.setDate(ZonedDateTime.now());
logCompilationError.setLog("COMPILATION ERROR");
var logBuildError = new BambooBuildLogDTO();
logBuildError.setDate(ZonedDateTime.now());
logBuildError.setLog("BUILD FAILURE");
var logWarning = new BambooBuildLogDTO();
logWarning.setDate(ZonedDateTime.now());
logWarning.setLog("[WARNING]");
var logWarningIllegalReflectiveAccess = new BambooBuildLogDTO();
logWarningIllegalReflectiveAccess.setDate(ZonedDateTime.now());
logWarningIllegalReflectiveAccess.setLog("WARNING: Illegal reflective access by");
notification.getBuild().getJobs().iterator().next().setLogs(List.of(buildLogDTO254Chars, buildLogDTO255Chars, buildLogDTO256Chars, largeBuildLogDTO, logTypicalErrorLog,
logTypicalDuplicatedErrorLog, logWarning, logWarningIllegalReflectiveAccess, logCompilationError, logBuildError));
return notification;
} | [
"public",
"static",
"BambooBuildResultNotificationDTO",
"generateBambooBuildResultWithLogs",
"(",
"String",
"repoName",
",",
"List",
"<",
"String",
">",
"successfulTestNames",
",",
"List",
"<",
"String",
">",
"failedTestNames",
")",
"{",
"var",
"notification",
"=",
"generateBambooBuildResult",
"(",
"repoName",
",",
"successfulTestNames",
",",
"failedTestNames",
")",
";",
"notification",
".",
"getBuild",
"(",
")",
".",
"getTestSummary",
"(",
")",
".",
"setDescription",
"(",
"\"No tests found\"",
")",
";",
"String",
"logWith254Chars",
"=",
"\"a\"",
".",
"repeat",
"(",
"254",
")",
";",
"var",
"buildLogDTO254Chars",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"buildLogDTO254Chars",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"buildLogDTO254Chars",
".",
"setLog",
"(",
"logWith254Chars",
")",
";",
"var",
"buildLogDTO255Chars",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"buildLogDTO255Chars",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"buildLogDTO255Chars",
".",
"setLog",
"(",
"logWith254Chars",
"+",
"\"a\"",
")",
";",
"var",
"buildLogDTO256Chars",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"buildLogDTO256Chars",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"buildLogDTO256Chars",
".",
"setLog",
"(",
"logWith254Chars",
"+",
"\"aa\"",
")",
";",
"var",
"largeBuildLogDTO",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"largeBuildLogDTO",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"largeBuildLogDTO",
".",
"setLog",
"(",
"logWith254Chars",
"+",
"logWith254Chars",
")",
";",
"var",
"logTypicalErrorLog",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"logTypicalErrorLog",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"logTypicalErrorLog",
".",
"setLog",
"(",
"\"error: the java class ABC does not exist\"",
")",
";",
"var",
"logTypicalDuplicatedErrorLog",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"logTypicalDuplicatedErrorLog",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"logTypicalDuplicatedErrorLog",
".",
"setLog",
"(",
"\"error: the java class ABC does not exist\"",
")",
";",
"var",
"logCompilationError",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"logCompilationError",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"logCompilationError",
".",
"setLog",
"(",
"\"COMPILATION ERROR\"",
")",
";",
"var",
"logBuildError",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"logBuildError",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"logBuildError",
".",
"setLog",
"(",
"\"BUILD FAILURE\"",
")",
";",
"var",
"logWarning",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"logWarning",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"logWarning",
".",
"setLog",
"(",
"\"[WARNING]\"",
")",
";",
"var",
"logWarningIllegalReflectiveAccess",
"=",
"new",
"BambooBuildLogDTO",
"(",
")",
";",
"logWarningIllegalReflectiveAccess",
".",
"setDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"logWarningIllegalReflectiveAccess",
".",
"setLog",
"(",
"\"WARNING: Illegal reflective access by\"",
")",
";",
"notification",
".",
"getBuild",
"(",
")",
".",
"getJobs",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
".",
"setLogs",
"(",
"List",
".",
"of",
"(",
"buildLogDTO254Chars",
",",
"buildLogDTO255Chars",
",",
"buildLogDTO256Chars",
",",
"largeBuildLogDTO",
",",
"logTypicalErrorLog",
",",
"logTypicalDuplicatedErrorLog",
",",
"logWarning",
",",
"logWarningIllegalReflectiveAccess",
",",
"logCompilationError",
",",
"logBuildError",
")",
")",
";",
"return",
"notification",
";",
"}"
] | Generate a Bamboo notification with build logs of various sizes
@param repoName repository name
@param successfulTestNames names of successful tests
@param failedTestNames names of failed tests
@return notification with build logs | [
"Generate",
"a",
"Bamboo",
"notification",
"with",
"build",
"logs",
"of",
"various",
"sizes",
"@param",
"repoName",
"repository",
"name",
"@param",
"successfulTestNames",
"names",
"of",
"successful",
"tests",
"@param",
"failedTestNames",
"names",
"of",
"failed",
"tests",
"@return",
"notification",
"with",
"build",
"logs"
] | [] | [
{
"param": "repoName",
"type": "String"
},
{
"param": "successfulTestNames",
"type": "List<String>"
},
{
"param": "failedTestNames",
"type": "List<String>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "repoName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "successfulTestNames",
"type": "List<String>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "failedTestNames",
"type": "List<String>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
605,
301,
1075,
83,
3116,
1253,
4386,
19792,
2103,
38,
301,
1075,
83,
3116,
1253,
1190,
7777,
12,
780,
3538,
461,
16,
987,
32,
780,
34,
6873,
4709,
1557,
16,
987,
32,
780,
34,
2535,
4709,
1557,
13,
288,
203,
3639,
569,
3851,
273,
2103,
38,
301,
1075,
83,
3116,
1253,
12,
7422,
461,
16,
6873,
4709,
1557,
16,
2535,
4709,
1557,
1769,
203,
3639,
3851,
18,
588,
3116,
7675,
588,
4709,
4733,
7675,
542,
3291,
2932,
2279,
7434,
1392,
8863,
203,
203,
3639,
514,
613,
1190,
26261,
7803,
273,
315,
69,
9654,
9374,
12,
26261,
1769,
203,
203,
3639,
569,
1361,
1343,
19792,
26261,
7803,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
1361,
1343,
19792,
26261,
7803,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
3639,
1361,
1343,
19792,
26261,
7803,
18,
542,
1343,
12,
1330,
1190,
26261,
7803,
1769,
203,
203,
3639,
569,
1361,
1343,
19792,
10395,
7803,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
1361,
1343,
19792,
10395,
7803,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
3639,
1361,
1343,
19792,
10395,
7803,
18,
542,
1343,
12,
1330,
1190,
26261,
7803,
397,
315,
69,
8863,
203,
203,
3639,
569,
1361,
1343,
19792,
5034,
7803,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
1361,
1343,
19792,
5034,
7803,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
3639,
1361,
1343,
19792,
5034,
7803,
18,
542,
1343,
12,
1330,
1190,
26261,
7803,
397,
315,
7598,
8863,
203,
203,
3639,
569,
7876,
3116,
1343,
19792,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
7876,
3116,
1343,
19792,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
3639,
7876,
3116,
1343,
19792,
18,
542,
1343,
12,
1330,
1190,
26261,
7803,
397,
613,
1190,
26261,
7803,
1769,
203,
203,
3639,
569,
613,
18488,
1706,
668,
1343,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
613,
18488,
1706,
668,
1343,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
3639,
613,
18488,
1706,
668,
1343,
18,
542,
1343,
2932,
1636,
30,
326,
2252,
667,
29253,
1552,
486,
1005,
8863,
203,
203,
3639,
569,
613,
18488,
1706,
19682,
690,
668,
1343,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
613,
18488,
1706,
19682,
690,
668,
1343,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
3639,
613,
18488,
1706,
19682,
690,
668,
1343,
18,
542,
1343,
2932,
1636,
30,
326,
2252,
667,
29253,
1552,
486,
1005,
8863,
203,
203,
3639,
569,
613,
19184,
668,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
613,
19184,
668,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
3639,
613,
19184,
668,
18,
542,
1343,
2932,
31075,
48,
2689,
5475,
8863,
203,
203,
3639,
569,
613,
3116,
668,
273,
394,
605,
301,
1075,
83,
3116,
1343,
19792,
5621,
203,
3639,
613,
3116,
668,
18,
542,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
6654,
279,
605,
301,
1075,
83,
3851,
598,
1361,
5963,
434,
11191,
8453,
203,
377,
380,
203,
377,
380,
632,
891,
3538,
461,
3352,
508,
203,
377,
380,
632,
891,
6873,
4709,
1557,
1257,
434,
6873,
7434,
203,
377,
380,
632,
891,
2535,
4709,
1557,
1257,
434,
2535,
7434,
203,
377,
380,
632,
2463,
3851,
598,
1361,
5963,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
332064d33c9c5305df92a483147da8c4b57ceefb | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/util/ModelFactory.java | [
"MIT"
] | Java | generateTextSubmissions | null | public static List<TextSubmission> generateTextSubmissions(int count) {
if (count > 10) {
throw new IllegalArgumentException();
}
// Example texts for submissions
String[] submissionTexts = {
"Differences: \nAntipatterns: \n-Have one problem and two solutions(one problematic and one refactored)\n-Antipatterns are a sign of bad architecture and bad coding \nPattern:\n-Have one problem and one solution\n-Patterns are a sign of elaborated architecutre and coding",
"The main difference between patterns and antipatterns is, that patterns show you a good way to do something and antipatterns show a bad way to do something. Nevertheless patterns may become antipatterns in the course of changing understanding of how good software engineering looks like. One example for that is functional decomposition, which used to be a pattern and \"good practice\". Over the time it turned out that it is not a goog way to solve problems, so it became a antipattern.\n\nA pattern itsself is a proposed solution to a problem that occurs often and in different situations.\nIn contrast to that a antipattern shows commonly made mistakes when dealing with a certain problem. Nevertheless a refactored solution is aswell proposed.",
"1.Patterns can evolve into Antipatterns when change occurs\\n2. Pattern has one solution, whereas anti pattern can have subtypes of solution\\n3. Antipattern has negative consequences and symptom, where as patterns looks only into benefits and consequences",
"Patterns: A way to Model code in differents ways \nAntipattern: A way of how Not to Model code",
"Antipatterns are used when there are common mistakes in software management and development to find these, while patterns by themselves are used to build software systems in the context of frequent change by reducing complexity and isolating the change.\nAnother difference is that the antipatterns have problematic solution and then refactored solution, while patterns only have a solution.",
"- In patterns we have a problem and a solution, in antipatterns we have a problematic solution and a refactored solution instead\n- patterns represent best practices from the industry etc. so proven concepts, whereas antipatterns shed a light on common mistakes during software development etc.",
"1) Patterns have one solution, antipatterns have to solutions (one problematic and one refactored).\n2) for the coice of patterns code has to be written; for antipatterns, the bad smell code already exists",
"Design Patterns:\n\nSolutions which are productive and efficient and are developed by Software Engineers over the years of practice and solving problems.\n\nAnti Patterns:\n\nKnown solutions which are actually bad or defective to certain kind of problems.",
"Patterns has one problem and one solution.\nAntipatterns have one problematic solution and a solution for that. The antipattern happens when a solution that is been used for a long time can not apply anymore. ",
"Patterns identify problems and present solutions.\nAntipatterns identify problems but two kinds of solutions. One problematic solution and a better \"refactored\" version of the solution. Problematic solutions are suggested not to be used because they results in smells or hinder future work." };
// Create Submissions with id's 0 - count
List<TextSubmission> textSubmissions = new ArrayList<>();
for (int i = 0; i < count; i++) {
TextSubmission textSubmission = new TextSubmission((long) i).text(submissionTexts[i]);
textSubmission.setLanguage(Language.ENGLISH);
textSubmissions.add(textSubmission);
}
return textSubmissions;
} | /**
* Generates example TextSubmissions
* @param count How many submissions should be generated (max. 10)
* @return A list containing the generated TextSubmissions
*/ | Generates example TextSubmissions
@param count How many submissions should be generated (max. 10)
@return A list containing the generated TextSubmissions | [
"Generates",
"example",
"TextSubmissions",
"@param",
"count",
"How",
"many",
"submissions",
"should",
"be",
"generated",
"(",
"max",
".",
"10",
")",
"@return",
"A",
"list",
"containing",
"the",
"generated",
"TextSubmissions"
] | public static List<TextSubmission> generateTextSubmissions(int count) {
if (count > 10) {
throw new IllegalArgumentException();
}
String[] submissionTexts = {
"Differences: \nAntipatterns: \n-Have one problem and two solutions(one problematic and one refactored)\n-Antipatterns are a sign of bad architecture and bad coding \nPattern:\n-Have one problem and one solution\n-Patterns are a sign of elaborated architecutre and coding",
"The main difference between patterns and antipatterns is, that patterns show you a good way to do something and antipatterns show a bad way to do something. Nevertheless patterns may become antipatterns in the course of changing understanding of how good software engineering looks like. One example for that is functional decomposition, which used to be a pattern and \"good practice\". Over the time it turned out that it is not a goog way to solve problems, so it became a antipattern.\n\nA pattern itsself is a proposed solution to a problem that occurs often and in different situations.\nIn contrast to that a antipattern shows commonly made mistakes when dealing with a certain problem. Nevertheless a refactored solution is aswell proposed.",
"1.Patterns can evolve into Antipatterns when change occurs\\n2. Pattern has one solution, whereas anti pattern can have subtypes of solution\\n3. Antipattern has negative consequences and symptom, where as patterns looks only into benefits and consequences",
"Patterns: A way to Model code in differents ways \nAntipattern: A way of how Not to Model code",
"Antipatterns are used when there are common mistakes in software management and development to find these, while patterns by themselves are used to build software systems in the context of frequent change by reducing complexity and isolating the change.\nAnother difference is that the antipatterns have problematic solution and then refactored solution, while patterns only have a solution.",
"- In patterns we have a problem and a solution, in antipatterns we have a problematic solution and a refactored solution instead\n- patterns represent best practices from the industry etc. so proven concepts, whereas antipatterns shed a light on common mistakes during software development etc.",
"1) Patterns have one solution, antipatterns have to solutions (one problematic and one refactored).\n2) for the coice of patterns code has to be written; for antipatterns, the bad smell code already exists",
"Design Patterns:\n\nSolutions which are productive and efficient and are developed by Software Engineers over the years of practice and solving problems.\n\nAnti Patterns:\n\nKnown solutions which are actually bad or defective to certain kind of problems.",
"Patterns has one problem and one solution.\nAntipatterns have one problematic solution and a solution for that. The antipattern happens when a solution that is been used for a long time can not apply anymore. ",
"Patterns identify problems and present solutions.\nAntipatterns identify problems but two kinds of solutions. One problematic solution and a better \"refactored\" version of the solution. Problematic solutions are suggested not to be used because they results in smells or hinder future work." };
List<TextSubmission> textSubmissions = new ArrayList<>();
for (int i = 0; i < count; i++) {
TextSubmission textSubmission = new TextSubmission((long) i).text(submissionTexts[i]);
textSubmission.setLanguage(Language.ENGLISH);
textSubmissions.add(textSubmission);
}
return textSubmissions;
} | [
"public",
"static",
"List",
"<",
"TextSubmission",
">",
"generateTextSubmissions",
"(",
"int",
"count",
")",
"{",
"if",
"(",
"count",
">",
"10",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"String",
"[",
"]",
"submissionTexts",
"=",
"{",
"\"Differences: \\nAntipatterns: \\n-Have one problem and two solutions(one problematic and one refactored)\\n-Antipatterns are a sign of bad architecture and bad coding \\nPattern:\\n-Have one problem and one solution\\n-Patterns are a sign of elaborated architecutre and coding\"",
",",
"\"The main difference between patterns and antipatterns is, that patterns show you a good way to do something and antipatterns show a bad way to do something. Nevertheless patterns may become antipatterns in the course of changing understanding of how good software engineering looks like. One example for that is functional decomposition, which used to be a pattern and \\\"good practice\\\". Over the time it turned out that it is not a goog way to solve problems, so it became a antipattern.\\n\\nA pattern itsself is a proposed solution to a problem that occurs often and in different situations.\\nIn contrast to that a antipattern shows commonly made mistakes when dealing with a certain problem. Nevertheless a refactored solution is aswell proposed.\"",
",",
"\"1.Patterns can evolve into Antipatterns when change occurs\\\\n2. Pattern has one solution, whereas anti pattern can have subtypes of solution\\\\n3. Antipattern has negative consequences and symptom, where as patterns looks only into benefits and consequences\"",
",",
"\"Patterns: A way to Model code in differents ways \\nAntipattern: A way of how Not to Model code\"",
",",
"\"Antipatterns are used when there are common mistakes in software management and development to find these, while patterns by themselves are used to build software systems in the context of frequent change by reducing complexity and isolating the change.\\nAnother difference is that the antipatterns have problematic solution and then refactored solution, while patterns only have a solution.\"",
",",
"\"- In patterns we have a problem and a solution, in antipatterns we have a problematic solution and a refactored solution instead\\n- patterns represent best practices from the industry etc. so proven concepts, whereas antipatterns shed a light on common mistakes during software development etc.\"",
",",
"\"1) Patterns have one solution, antipatterns have to solutions (one problematic and one refactored).\\n2) for the coice of patterns code has to be written; for antipatterns, the bad smell code already exists\"",
",",
"\"Design Patterns:\\n\\nSolutions which are productive and efficient and are developed by Software Engineers over the years of practice and solving problems.\\n\\nAnti Patterns:\\n\\nKnown solutions which are actually bad or defective to certain kind of problems.\"",
",",
"\"Patterns has one problem and one solution.\\nAntipatterns have one problematic solution and a solution for that. The antipattern happens when a solution that is been used for a long time can not apply anymore. \"",
",",
"\"Patterns identify problems and present solutions.\\nAntipatterns identify problems but two kinds of solutions. One problematic solution and a better \\\"refactored\\\" version of the solution. Problematic solutions are suggested not to be used because they results in smells or hinder future work.\"",
"}",
";",
"List",
"<",
"TextSubmission",
">",
"textSubmissions",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"TextSubmission",
"textSubmission",
"=",
"new",
"TextSubmission",
"(",
"(",
"long",
")",
"i",
")",
".",
"text",
"(",
"submissionTexts",
"[",
"i",
"]",
")",
";",
"textSubmission",
".",
"setLanguage",
"(",
"Language",
".",
"ENGLISH",
")",
";",
"textSubmissions",
".",
"add",
"(",
"textSubmission",
")",
";",
"}",
"return",
"textSubmissions",
";",
"}"
] | Generates example TextSubmissions
@param count How many submissions should be generated (max. | [
"Generates",
"example",
"TextSubmissions",
"@param",
"count",
"How",
"many",
"submissions",
"should",
"be",
"generated",
"(",
"max",
"."
] | [
"// Example texts for submissions",
"// Create Submissions with id's 0 - count"
] | [
{
"param": "count",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "count",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
987,
32,
1528,
17865,
34,
2103,
1528,
1676,
7300,
12,
474,
1056,
13,
288,
203,
3639,
309,
261,
1883,
405,
1728,
13,
288,
203,
5411,
604,
394,
2754,
5621,
203,
3639,
289,
203,
203,
3639,
368,
5090,
15219,
364,
22071,
203,
3639,
514,
8526,
8515,
30114,
273,
288,
203,
7734,
315,
10428,
2980,
30,
521,
82,
14925,
625,
1344,
87,
30,
521,
82,
17,
17944,
1245,
6199,
471,
2795,
22567,
12,
476,
6199,
2126,
471,
1245,
283,
3493,
7653,
5153,
82,
17,
14925,
625,
1344,
87,
854,
279,
1573,
434,
5570,
27418,
471,
5570,
14848,
521,
82,
3234,
5581,
82,
17,
17944,
1245,
6199,
471,
1245,
6959,
64,
82,
17,
11268,
854,
279,
1573,
434,
415,
378,
280,
690,
6637,
305,
557,
322,
266,
471,
14848,
3113,
203,
7734,
315,
1986,
2774,
7114,
3086,
6884,
471,
392,
14587,
1344,
87,
353,
16,
716,
6884,
2405,
1846,
279,
7494,
4031,
358,
741,
5943,
471,
392,
14587,
1344,
87,
2405,
279,
5570,
4031,
358,
741,
5943,
18,
24496,
451,
12617,
6884,
2026,
12561,
392,
14587,
1344,
87,
316,
326,
4362,
434,
12770,
3613,
15167,
434,
3661,
7494,
17888,
4073,
264,
310,
10192,
3007,
18,
6942,
3454,
364,
716,
353,
18699,
26288,
16,
1492,
1399,
358,
506,
279,
1936,
471,
1239,
19747,
27164,
2412,
18,
10752,
326,
813,
518,
21826,
596,
716,
518,
353,
486,
279,
24759,
4031,
358,
12439,
9688,
16,
1427,
518,
506,
71,
339,
279,
392,
14587,
1344,
8403,
82,
64,
82,
37,
1936,
518,
1049,
19079,
353,
279,
20084,
6959,
358,
279,
6199,
716,
9938,
16337,
471,
316,
3775,
28474,
8403,
82,
382,
23119,
358,
716,
279,
392,
14587,
1344,
17975,
2975,
715,
7165,
27228,
3223,
1347,
21964,
598,
279,
8626,
6199,
18,
24496,
451,
12617,
279,
283,
3493,
7653,
6959,
353,
487,
30389,
20084,
1199,
16,
203,
7734,
315,
21,
18,
11268,
848,
2113,
5390,
1368,
18830,
625,
1344,
87,
1347,
2549,
9938,
1695,
82,
22,
18,
6830,
711,
1245,
6959,
16,
1625,
345,
30959,
1936,
848,
1240,
720,
2352,
434,
6959,
1695,
82,
23,
18,
18830,
625,
1344,
711,
6092,
356,
17190,
471,
5382,
337,
362,
16,
1625,
487,
6884,
10192,
1338,
1368,
27641,
18352,
471,
356,
17190,
3113,
203,
7734,
315,
11268,
30,
432,
4031,
358,
3164,
981,
316,
3775,
87,
16226,
521,
82,
14925,
625,
1344,
30,
432,
4031,
434,
3661,
2288,
358,
3164,
981,
3113,
203,
7734,
315,
14925,
625,
1344,
87,
854,
1399,
1347,
1915,
854,
2975,
27228,
3223,
316,
17888,
11803,
471,
17772,
358,
1104,
4259,
16,
1323,
6884,
635,
20968,
854,
1399,
358,
1361,
17888,
14908,
316,
326,
819,
434,
13821,
319,
2549,
635,
9299,
2822,
21610,
471,
16249,
1776,
326,
2549,
8403,
82,
37,
24413,
7114,
353,
716,
326,
392,
14587,
1344,
87,
1240,
6199,
2126,
6959,
471,
1508,
283,
3493,
7653,
6959,
16,
1323,
6884,
1338,
1240,
279,
6959,
1199,
16,
203,
7734,
3701,
657,
6884,
732,
1240,
279,
6199,
471,
279,
6959,
16,
316,
392,
14587,
1344,
87,
732,
1240,
279,
6199,
2126,
6959,
471,
279,
283,
3493,
7653,
6959,
3560,
64,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
31902,
3454,
3867,
1676,
7300,
203,
377,
380,
632,
891,
1056,
9017,
4906,
22071,
1410,
506,
4374,
261,
1896,
18,
1728,
13,
203,
377,
380,
632,
2463,
432,
666,
4191,
326,
4374,
3867,
1676,
7300,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1fe78b28851529b5e2eae697a048aba612533451 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/metis/PostService.java | [
"MIT"
] | Java | createPost | Post | public Post createPost(Long courseId, Post post) {
final User user = this.userRepository.getUserWithGroupsAndAuthorities();
// checks
if (post.getId() != null) {
throw new BadRequestAlertException("A new post cannot already have an ID", METIS_POST_ENTITY_NAME, "idexists");
}
Course course = preCheckUserAndCourse(user, courseId);
preCheckPostValidity(post);
// set author to current user
post.setAuthor(user);
// set default value display priority -> NONE
post.setDisplayPriority(DisplayPriority.NONE);
// announcements can only be created by instructors
if (post.getCourseWideContext() == CourseWideContext.ANNOUNCEMENT) {
authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, user);
// display priority of announcement is set to pinned per default
post.setDisplayPriority(DisplayPriority.PINNED);
}
Post savedPost = postRepository.save(post);
sendNotification(savedPost);
return savedPost;
} | /**
* Checks course, user and post validity,
* determines the post's author, persists the post,
* and sends a notification to affected user groups
*
* @param courseId id of the course the post belongs to
* @param post post to create
* @return created post that was persisted
*/ | Checks course, user and post validity,
determines the post's author, persists the post,
and sends a notification to affected user groups
@param courseId id of the course the post belongs to
@param post post to create
@return created post that was persisted | [
"Checks",
"course",
"user",
"and",
"post",
"validity",
"determines",
"the",
"post",
"'",
"s",
"author",
"persists",
"the",
"post",
"and",
"sends",
"a",
"notification",
"to",
"affected",
"user",
"groups",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"post",
"post",
"to",
"create",
"@return",
"created",
"post",
"that",
"was",
"persisted"
] | public Post createPost(Long courseId, Post post) {
final User user = this.userRepository.getUserWithGroupsAndAuthorities();
if (post.getId() != null) {
throw new BadRequestAlertException("A new post cannot already have an ID", METIS_POST_ENTITY_NAME, "idexists");
}
Course course = preCheckUserAndCourse(user, courseId);
preCheckPostValidity(post);
post.setAuthor(user);
post.setDisplayPriority(DisplayPriority.NONE);
if (post.getCourseWideContext() == CourseWideContext.ANNOUNCEMENT) {
authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.INSTRUCTOR, course, user);
post.setDisplayPriority(DisplayPriority.PINNED);
}
Post savedPost = postRepository.save(post);
sendNotification(savedPost);
return savedPost;
} | [
"public",
"Post",
"createPost",
"(",
"Long",
"courseId",
",",
"Post",
"post",
")",
"{",
"final",
"User",
"user",
"=",
"this",
".",
"userRepository",
".",
"getUserWithGroupsAndAuthorities",
"(",
")",
";",
"if",
"(",
"post",
".",
"getId",
"(",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"BadRequestAlertException",
"(",
"\"A new post cannot already have an ID\"",
",",
"METIS_POST_ENTITY_NAME",
",",
"\"idexists\"",
")",
";",
"}",
"Course",
"course",
"=",
"preCheckUserAndCourse",
"(",
"user",
",",
"courseId",
")",
";",
"preCheckPostValidity",
"(",
"post",
")",
";",
"post",
".",
"setAuthor",
"(",
"user",
")",
";",
"post",
".",
"setDisplayPriority",
"(",
"DisplayPriority",
".",
"NONE",
")",
";",
"if",
"(",
"post",
".",
"getCourseWideContext",
"(",
")",
"==",
"CourseWideContext",
".",
"ANNOUNCEMENT",
")",
"{",
"authorizationCheckService",
".",
"checkHasAtLeastRoleInCourseElseThrow",
"(",
"Role",
".",
"INSTRUCTOR",
",",
"course",
",",
"user",
")",
";",
"post",
".",
"setDisplayPriority",
"(",
"DisplayPriority",
".",
"PINNED",
")",
";",
"}",
"Post",
"savedPost",
"=",
"postRepository",
".",
"save",
"(",
"post",
")",
";",
"sendNotification",
"(",
"savedPost",
")",
";",
"return",
"savedPost",
";",
"}"
] | Checks course, user and post validity,
determines the post's author, persists the post,
and sends a notification to affected user groups | [
"Checks",
"course",
"user",
"and",
"post",
"validity",
"determines",
"the",
"post",
"'",
"s",
"author",
"persists",
"the",
"post",
"and",
"sends",
"a",
"notification",
"to",
"affected",
"user",
"groups"
] | [
"// checks",
"// set author to current user",
"// set default value display priority -> NONE",
"// announcements can only be created by instructors",
"// display priority of announcement is set to pinned per default"
] | [
{
"param": "courseId",
"type": "Long"
},
{
"param": "post",
"type": "Post"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "courseId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "post",
"type": "Post",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
5616,
752,
3349,
12,
3708,
4362,
548,
16,
5616,
1603,
13,
288,
203,
3639,
727,
2177,
729,
273,
333,
18,
1355,
3305,
18,
588,
1299,
1190,
3621,
1876,
3594,
1961,
5621,
203,
203,
3639,
368,
4271,
203,
3639,
309,
261,
2767,
18,
26321,
1435,
480,
446,
13,
288,
203,
5411,
604,
394,
23223,
13298,
503,
2932,
37,
394,
1603,
2780,
1818,
1240,
392,
1599,
3113,
6791,
5127,
67,
3798,
67,
11101,
67,
1985,
16,
315,
77,
561,
1486,
8863,
203,
3639,
289,
203,
3639,
385,
3117,
4362,
273,
675,
1564,
1299,
1876,
39,
3117,
12,
1355,
16,
4362,
548,
1769,
203,
3639,
675,
1564,
3349,
19678,
12,
2767,
1769,
203,
203,
3639,
368,
444,
2869,
358,
783,
729,
203,
3639,
1603,
18,
542,
3594,
12,
1355,
1769,
203,
3639,
368,
444,
805,
460,
2562,
4394,
317,
11829,
203,
3639,
1603,
18,
542,
4236,
8183,
12,
4236,
8183,
18,
9826,
1769,
203,
3639,
368,
14281,
1346,
848,
1338,
506,
2522,
635,
316,
1697,
1383,
203,
3639,
309,
261,
2767,
18,
588,
39,
3117,
11075,
1042,
1435,
422,
385,
3117,
11075,
1042,
18,
1258,
3417,
2124,
1441,
3212,
13,
288,
203,
5411,
6093,
1564,
1179,
18,
1893,
5582,
25070,
2996,
382,
39,
3117,
12427,
8282,
12,
2996,
18,
706,
13915,
916,
16,
4362,
16,
729,
1769,
203,
5411,
368,
2562,
4394,
434,
25199,
353,
444,
358,
26193,
1534,
805,
203,
5411,
1603,
18,
542,
4236,
8183,
12,
4236,
8183,
18,
52,
706,
50,
2056,
1769,
203,
3639,
289,
203,
3639,
5616,
5198,
3349,
273,
1603,
3305,
18,
5688,
12,
2767,
1769,
203,
203,
3639,
1366,
4386,
12,
14077,
3349,
1769,
203,
203,
3639,
327,
5198,
3349,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
13074,
4362,
16,
729,
471,
1603,
13800,
16,
203,
377,
380,
12949,
326,
1603,
1807,
2869,
16,
13508,
1486,
326,
1603,
16,
203,
377,
380,
471,
9573,
279,
3851,
358,
9844,
729,
3252,
203,
377,
380,
203,
377,
380,
632,
891,
4362,
548,
612,
434,
326,
4362,
326,
1603,
11081,
358,
203,
377,
380,
632,
891,
1603,
377,
1603,
358,
752,
203,
377,
380,
632,
2463,
2522,
1603,
716,
1703,
14249,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1fe78b28851529b5e2eae697a048aba612533451 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/metis/PostService.java | [
"MIT"
] | Java | updatePost | Post | public Post updatePost(Long courseId, Post post) {
final User user = userRepository.getUserWithGroupsAndAuthorities();
// check
if (post.getId() == null) {
throw new BadRequestAlertException("Invalid id", METIS_POST_ENTITY_NAME, "idnull");
}
final Course course = preCheckUserAndCourse(user, courseId);
Post existingPost = postRepository.findByIdElseThrow(post.getId());
preCheckPostValidity(existingPost);
mayUpdateOrDeletePostingElseThrow(existingPost, user, course);
// update: allow overwriting of values only for depicted fields if user is at least student
existingPost.setTitle(post.getTitle());
existingPost.setContent(post.getContent());
existingPost.setVisibleForStudents(post.isVisibleForStudents());
existingPost.setTags(post.getTags());
// update: allow overwriting of certain values if they are at least TAs in this course
if (authorizationCheckService.isAtLeastTeachingAssistantInCourse(course, user)) {
existingPost.setDisplayPriority(post.getDisplayPriority());
// allow changing the post context (moving it to another context)
existingPost.setLecture(post.getLecture());
existingPost.setExercise(post.getExercise());
existingPost.setCourseWideContext(post.getCourseWideContext());
existingPost.setCourse(post.getCourse());
}
Post updatedPost = postRepository.save(existingPost);
if (updatedPost.getExercise() != null) {
// protect sample solution, grading instructions, etc.
updatedPost.getExercise().filterSensitiveInformation();
}
return updatedPost;
} | /**
* Checks course, user and post validity,
* updates non-restricted field of the post, persists the post,
* and ensures that sensitive information is filtered out
*
* @param courseId id of the course the post belongs to
* @param post post to update
* @return updated post that was persisted
*/ | Checks course, user and post validity,
updates non-restricted field of the post, persists the post,
and ensures that sensitive information is filtered out
@param courseId id of the course the post belongs to
@param post post to update
@return updated post that was persisted | [
"Checks",
"course",
"user",
"and",
"post",
"validity",
"updates",
"non",
"-",
"restricted",
"field",
"of",
"the",
"post",
"persists",
"the",
"post",
"and",
"ensures",
"that",
"sensitive",
"information",
"is",
"filtered",
"out",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"post",
"post",
"to",
"update",
"@return",
"updated",
"post",
"that",
"was",
"persisted"
] | public Post updatePost(Long courseId, Post post) {
final User user = userRepository.getUserWithGroupsAndAuthorities();
if (post.getId() == null) {
throw new BadRequestAlertException("Invalid id", METIS_POST_ENTITY_NAME, "idnull");
}
final Course course = preCheckUserAndCourse(user, courseId);
Post existingPost = postRepository.findByIdElseThrow(post.getId());
preCheckPostValidity(existingPost);
mayUpdateOrDeletePostingElseThrow(existingPost, user, course);
existingPost.setTitle(post.getTitle());
existingPost.setContent(post.getContent());
existingPost.setVisibleForStudents(post.isVisibleForStudents());
existingPost.setTags(post.getTags());
if (authorizationCheckService.isAtLeastTeachingAssistantInCourse(course, user)) {
existingPost.setDisplayPriority(post.getDisplayPriority());
existingPost.setLecture(post.getLecture());
existingPost.setExercise(post.getExercise());
existingPost.setCourseWideContext(post.getCourseWideContext());
existingPost.setCourse(post.getCourse());
}
Post updatedPost = postRepository.save(existingPost);
if (updatedPost.getExercise() != null) {
updatedPost.getExercise().filterSensitiveInformation();
}
return updatedPost;
} | [
"public",
"Post",
"updatePost",
"(",
"Long",
"courseId",
",",
"Post",
"post",
")",
"{",
"final",
"User",
"user",
"=",
"userRepository",
".",
"getUserWithGroupsAndAuthorities",
"(",
")",
";",
"if",
"(",
"post",
".",
"getId",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"BadRequestAlertException",
"(",
"\"Invalid id\"",
",",
"METIS_POST_ENTITY_NAME",
",",
"\"idnull\"",
")",
";",
"}",
"final",
"Course",
"course",
"=",
"preCheckUserAndCourse",
"(",
"user",
",",
"courseId",
")",
";",
"Post",
"existingPost",
"=",
"postRepository",
".",
"findByIdElseThrow",
"(",
"post",
".",
"getId",
"(",
")",
")",
";",
"preCheckPostValidity",
"(",
"existingPost",
")",
";",
"mayUpdateOrDeletePostingElseThrow",
"(",
"existingPost",
",",
"user",
",",
"course",
")",
";",
"existingPost",
".",
"setTitle",
"(",
"post",
".",
"getTitle",
"(",
")",
")",
";",
"existingPost",
".",
"setContent",
"(",
"post",
".",
"getContent",
"(",
")",
")",
";",
"existingPost",
".",
"setVisibleForStudents",
"(",
"post",
".",
"isVisibleForStudents",
"(",
")",
")",
";",
"existingPost",
".",
"setTags",
"(",
"post",
".",
"getTags",
"(",
")",
")",
";",
"if",
"(",
"authorizationCheckService",
".",
"isAtLeastTeachingAssistantInCourse",
"(",
"course",
",",
"user",
")",
")",
"{",
"existingPost",
".",
"setDisplayPriority",
"(",
"post",
".",
"getDisplayPriority",
"(",
")",
")",
";",
"existingPost",
".",
"setLecture",
"(",
"post",
".",
"getLecture",
"(",
")",
")",
";",
"existingPost",
".",
"setExercise",
"(",
"post",
".",
"getExercise",
"(",
")",
")",
";",
"existingPost",
".",
"setCourseWideContext",
"(",
"post",
".",
"getCourseWideContext",
"(",
")",
")",
";",
"existingPost",
".",
"setCourse",
"(",
"post",
".",
"getCourse",
"(",
")",
")",
";",
"}",
"Post",
"updatedPost",
"=",
"postRepository",
".",
"save",
"(",
"existingPost",
")",
";",
"if",
"(",
"updatedPost",
".",
"getExercise",
"(",
")",
"!=",
"null",
")",
"{",
"updatedPost",
".",
"getExercise",
"(",
")",
".",
"filterSensitiveInformation",
"(",
")",
";",
"}",
"return",
"updatedPost",
";",
"}"
] | Checks course, user and post validity,
updates non-restricted field of the post, persists the post,
and ensures that sensitive information is filtered out | [
"Checks",
"course",
"user",
"and",
"post",
"validity",
"updates",
"non",
"-",
"restricted",
"field",
"of",
"the",
"post",
"persists",
"the",
"post",
"and",
"ensures",
"that",
"sensitive",
"information",
"is",
"filtered",
"out"
] | [
"// check",
"// update: allow overwriting of values only for depicted fields if user is at least student",
"// update: allow overwriting of certain values if they are at least TAs in this course",
"// allow changing the post context (moving it to another context)",
"// protect sample solution, grading instructions, etc."
] | [
{
"param": "courseId",
"type": "Long"
},
{
"param": "post",
"type": "Post"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "courseId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "post",
"type": "Post",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
5616,
1089,
3349,
12,
3708,
4362,
548,
16,
5616,
1603,
13,
288,
203,
3639,
727,
2177,
729,
273,
729,
3305,
18,
588,
1299,
1190,
3621,
1876,
3594,
1961,
5621,
203,
203,
3639,
368,
866,
203,
3639,
309,
261,
2767,
18,
26321,
1435,
422,
446,
13,
288,
203,
5411,
604,
394,
23223,
13298,
503,
2932,
1941,
612,
3113,
6791,
5127,
67,
3798,
67,
11101,
67,
1985,
16,
315,
350,
2011,
8863,
203,
3639,
289,
203,
3639,
727,
385,
3117,
4362,
273,
675,
1564,
1299,
1876,
39,
3117,
12,
1355,
16,
4362,
548,
1769,
203,
3639,
5616,
2062,
3349,
273,
1603,
3305,
18,
4720,
5132,
12427,
8282,
12,
2767,
18,
26321,
10663,
203,
3639,
675,
1564,
3349,
19678,
12,
11711,
3349,
1769,
203,
3639,
2026,
1891,
1162,
2613,
3349,
310,
12427,
8282,
12,
11711,
3349,
16,
729,
16,
4362,
1769,
203,
203,
3639,
368,
1089,
30,
1699,
23492,
434,
924,
1338,
364,
5993,
933,
329,
1466,
309,
729,
353,
622,
4520,
18110,
203,
3639,
2062,
3349,
18,
542,
4247,
12,
2767,
18,
588,
4247,
10663,
203,
3639,
2062,
3349,
18,
542,
1350,
12,
2767,
18,
588,
1350,
10663,
203,
3639,
2062,
3349,
18,
542,
6207,
1290,
19943,
4877,
12,
2767,
18,
291,
6207,
1290,
19943,
4877,
10663,
203,
3639,
2062,
3349,
18,
542,
3453,
12,
2767,
18,
588,
3453,
10663,
203,
203,
3639,
368,
1089,
30,
1699,
23492,
434,
8626,
924,
309,
2898,
854,
622,
4520,
399,
1463,
316,
333,
4362,
203,
3639,
309,
261,
12218,
1564,
1179,
18,
291,
25070,
56,
13798,
310,
2610,
17175,
382,
39,
3117,
12,
5566,
16,
729,
3719,
288,
203,
5411,
2062,
3349,
18,
542,
4236,
8183,
12,
2767,
18,
588,
4236,
8183,
10663,
203,
5411,
368,
1699,
12770,
326,
1603,
819,
261,
81,
13767,
518,
358,
4042,
819,
13,
203,
5411,
2062,
3349,
18,
542,
48,
386,
594,
12,
2767,
18,
588,
48,
386,
594,
10663,
203,
5411,
2062,
3349,
18,
542,
424,
20603,
12,
2767,
18,
588,
424,
20603,
10663,
203,
5411,
2062,
3349,
18,
542,
39,
3117,
11075,
1042,
12,
2767,
18,
588,
39,
3117,
11075,
1042,
10663,
203,
5411,
2062,
3349,
18,
542,
39,
3117,
12,
2767,
18,
588,
39,
3117,
10663,
203,
3639,
289,
203,
203,
3639,
5616,
3526,
3349,
273,
1603,
3305,
18,
5688,
12,
11711,
3349,
1769,
203,
203,
3639,
309,
261,
7007,
3349,
18,
588,
424,
20603,
1435,
480,
446,
13,
288,
203,
5411,
368,
17151,
3296,
6959,
16,
21717,
12509,
16,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
13074,
4362,
16,
729,
471,
1603,
13800,
16,
203,
377,
380,
4533,
1661,
17,
29306,
652,
434,
326,
1603,
16,
13508,
1486,
326,
1603,
16,
203,
377,
380,
471,
11932,
716,
16692,
1779,
353,
5105,
596,
203,
377,
380,
203,
377,
380,
632,
891,
4362,
548,
612,
434,
326,
4362,
326,
1603,
11081,
358,
203,
377,
380,
632,
891,
1603,
377,
1603,
358,
1089,
203,
377,
380,
632,
2463,
3526,
1603,
716,
1703,
14249,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1fe78b28851529b5e2eae697a048aba612533451 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/metis/PostService.java | [
"MIT"
] | Java | changeDisplayPriority | Post | public Post changeDisplayPriority(Long courseId, Long postId, DisplayPriority displayPriority) {
Post post = postRepository.findByIdElseThrow(postId);
post.setDisplayPriority(displayPriority);
return updatePost(courseId, post);
} | /**
* Invokes the updatePost method to persist the change of displayPriority
*
* @param courseId id of the course the post belongs to
* @param postId id of the post to change the pin state for
* @param displayPriority new displayPriority
* @return updated post that was persisted
*/ | Invokes the updatePost method to persist the change of displayPriority
@param courseId id of the course the post belongs to
@param postId id of the post to change the pin state for
@param displayPriority new displayPriority
@return updated post that was persisted | [
"Invokes",
"the",
"updatePost",
"method",
"to",
"persist",
"the",
"change",
"of",
"displayPriority",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"postId",
"id",
"of",
"the",
"post",
"to",
"change",
"the",
"pin",
"state",
"for",
"@param",
"displayPriority",
"new",
"displayPriority",
"@return",
"updated",
"post",
"that",
"was",
"persisted"
] | public Post changeDisplayPriority(Long courseId, Long postId, DisplayPriority displayPriority) {
Post post = postRepository.findByIdElseThrow(postId);
post.setDisplayPriority(displayPriority);
return updatePost(courseId, post);
} | [
"public",
"Post",
"changeDisplayPriority",
"(",
"Long",
"courseId",
",",
"Long",
"postId",
",",
"DisplayPriority",
"displayPriority",
")",
"{",
"Post",
"post",
"=",
"postRepository",
".",
"findByIdElseThrow",
"(",
"postId",
")",
";",
"post",
".",
"setDisplayPriority",
"(",
"displayPriority",
")",
";",
"return",
"updatePost",
"(",
"courseId",
",",
"post",
")",
";",
"}"
] | Invokes the updatePost method to persist the change of displayPriority
@param courseId id of the course the post belongs to
@param postId id of the post to change the pin state for
@param displayPriority new displayPriority
@return updated post that was persisted | [
"Invokes",
"the",
"updatePost",
"method",
"to",
"persist",
"the",
"change",
"of",
"displayPriority",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"postId",
"id",
"of",
"the",
"post",
"to",
"change",
"the",
"pin",
"state",
"for",
"@param",
"displayPriority",
"new",
"displayPriority",
"@return",
"updated",
"post",
"that",
"was",
"persisted"
] | [] | [
{
"param": "courseId",
"type": "Long"
},
{
"param": "postId",
"type": "Long"
},
{
"param": "displayPriority",
"type": "DisplayPriority"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "courseId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "postId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "displayPriority",
"type": "DisplayPriority",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
5616,
2549,
4236,
8183,
12,
3708,
4362,
548,
16,
3407,
1603,
548,
16,
9311,
8183,
2562,
8183,
13,
288,
203,
3639,
5616,
1603,
273,
1603,
3305,
18,
4720,
5132,
12427,
8282,
12,
2767,
548,
1769,
203,
3639,
1603,
18,
542,
4236,
8183,
12,
5417,
8183,
1769,
203,
203,
3639,
327,
1089,
3349,
12,
5566,
548,
16,
1603,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
22737,
326,
1089,
3349,
707,
358,
3898,
326,
2549,
434,
2562,
8183,
203,
377,
380,
203,
377,
380,
632,
891,
4362,
548,
1850,
612,
434,
326,
4362,
326,
1603,
11081,
358,
203,
377,
380,
632,
891,
1603,
548,
5411,
612,
434,
326,
1603,
358,
2549,
326,
7092,
919,
364,
203,
377,
380,
632,
891,
2562,
8183,
282,
394,
2562,
8183,
203,
377,
380,
632,
2463,
3526,
1603,
716,
1703,
14249,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1fe78b28851529b5e2eae697a048aba612533451 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/metis/PostService.java | [
"MIT"
] | Java | sendNotification | null | void sendNotification(Post post) {
// notify via exercise
if (post.getExercise() != null) {
// set exercise retrieved from database to show title in notification
Exercise exercise = exerciseRepository.findByIdElseThrow(post.getExercise().getId());
post.setExercise(exercise);
groupNotificationService.notifyAllGroupsAboutNewPostForExercise(post);
// protect sample solution, grading instructions, etc.
post.getExercise().filterSensitiveInformation();
}
// notify via lecture
if (post.getLecture() != null) {
// set lecture retrieved from database to show title in notification
Lecture lecture = lectureRepository.findByIdElseThrow(post.getLecture().getId());
post.setLecture(lecture);
groupNotificationService.notifyAllGroupsAboutNewPostForLecture(post);
}
} | /**
* Sends notification to affected groups
*
* @param post post that triggered the notification
*/ | Sends notification to affected groups
@param post post that triggered the notification | [
"Sends",
"notification",
"to",
"affected",
"groups",
"@param",
"post",
"post",
"that",
"triggered",
"the",
"notification"
] | void sendNotification(Post post) {
if (post.getExercise() != null) {
Exercise exercise = exerciseRepository.findByIdElseThrow(post.getExercise().getId());
post.setExercise(exercise);
groupNotificationService.notifyAllGroupsAboutNewPostForExercise(post);
post.getExercise().filterSensitiveInformation();
}
if (post.getLecture() != null) {
Lecture lecture = lectureRepository.findByIdElseThrow(post.getLecture().getId());
post.setLecture(lecture);
groupNotificationService.notifyAllGroupsAboutNewPostForLecture(post);
}
} | [
"void",
"sendNotification",
"(",
"Post",
"post",
")",
"{",
"if",
"(",
"post",
".",
"getExercise",
"(",
")",
"!=",
"null",
")",
"{",
"Exercise",
"exercise",
"=",
"exerciseRepository",
".",
"findByIdElseThrow",
"(",
"post",
".",
"getExercise",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"post",
".",
"setExercise",
"(",
"exercise",
")",
";",
"groupNotificationService",
".",
"notifyAllGroupsAboutNewPostForExercise",
"(",
"post",
")",
";",
"post",
".",
"getExercise",
"(",
")",
".",
"filterSensitiveInformation",
"(",
")",
";",
"}",
"if",
"(",
"post",
".",
"getLecture",
"(",
")",
"!=",
"null",
")",
"{",
"Lecture",
"lecture",
"=",
"lectureRepository",
".",
"findByIdElseThrow",
"(",
"post",
".",
"getLecture",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"post",
".",
"setLecture",
"(",
"lecture",
")",
";",
"groupNotificationService",
".",
"notifyAllGroupsAboutNewPostForLecture",
"(",
"post",
")",
";",
"}",
"}"
] | Sends notification to affected groups
@param post post that triggered the notification | [
"Sends",
"notification",
"to",
"affected",
"groups",
"@param",
"post",
"post",
"that",
"triggered",
"the",
"notification"
] | [
"// notify via exercise",
"// set exercise retrieved from database to show title in notification",
"// protect sample solution, grading instructions, etc.",
"// notify via lecture",
"// set lecture retrieved from database to show title in notification"
] | [
{
"param": "post",
"type": "Post"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "post",
"type": "Post",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
918,
1366,
4386,
12,
3349,
1603,
13,
288,
203,
3639,
368,
5066,
3970,
24165,
203,
3639,
309,
261,
2767,
18,
588,
424,
20603,
1435,
480,
446,
13,
288,
203,
5411,
368,
444,
24165,
10295,
628,
2063,
358,
2405,
2077,
316,
3851,
203,
5411,
1312,
20603,
24165,
273,
24165,
3305,
18,
4720,
5132,
12427,
8282,
12,
2767,
18,
588,
424,
20603,
7675,
26321,
10663,
203,
5411,
1603,
18,
542,
424,
20603,
12,
8913,
30708,
1769,
203,
5411,
1041,
4386,
1179,
18,
12336,
1595,
3621,
24813,
1908,
3349,
1290,
424,
20603,
12,
2767,
1769,
203,
5411,
368,
17151,
3296,
6959,
16,
21717,
12509,
16,
5527,
18,
203,
5411,
1603,
18,
588,
424,
20603,
7675,
2188,
14220,
5369,
5621,
203,
3639,
289,
203,
3639,
368,
5066,
3970,
884,
299,
594,
203,
3639,
309,
261,
2767,
18,
588,
48,
386,
594,
1435,
480,
446,
13,
288,
203,
5411,
368,
444,
884,
299,
594,
10295,
628,
2063,
358,
2405,
2077,
316,
3851,
203,
5411,
511,
386,
594,
884,
299,
594,
273,
884,
299,
594,
3305,
18,
4720,
5132,
12427,
8282,
12,
2767,
18,
588,
48,
386,
594,
7675,
26321,
10663,
203,
5411,
1603,
18,
542,
48,
386,
594,
12,
1582,
594,
1769,
203,
5411,
1041,
4386,
1179,
18,
12336,
1595,
3621,
24813,
1908,
3349,
1290,
48,
386,
594,
12,
2767,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2479,
87,
3851,
358,
9844,
3252,
203,
377,
380,
203,
377,
380,
632,
891,
1603,
1603,
716,
10861,
326,
3851,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
735fcdb4ece341621ebe018055531d2c32c0f288 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/CoyoteAdapter.java | [
"MIT"
] | Java | parsePathParameters | null | protected void parsePathParameters(org.apache.coyote.Request req,
Request request) {
// Process in bytes (this is default format so this is normally a NO-OP
req.decodedURI().toBytes();
ByteChunk uriBC = req.decodedURI().getByteChunk();
int semicolon = uriBC.indexOf(';', 0);
// Performance optimisation. Return as soon as it is known there are no
// path parameters;
if (semicolon == -1) {
return;
}
// What encoding to use? Some platforms, eg z/os, use a default
// encoding that doesn't give the expected result so be explicit
Charset charset = connector.getURICharset();
if (log.isDebugEnabled()) {
log.debug(sm.getString("coyoteAdapter.debug", "uriBC",
uriBC.toString()));
log.debug(sm.getString("coyoteAdapter.debug", "semicolon",
String.valueOf(semicolon)));
log.debug(sm.getString("coyoteAdapter.debug", "enc", charset.name()));
}
while (semicolon > -1) {
// Parse path param, and extract it from the decoded request URI
int start = uriBC.getStart();
int end = uriBC.getEnd();
int pathParamStart = semicolon + 1;
int pathParamEnd = ByteChunk.findBytes(uriBC.getBuffer(),
start + pathParamStart, end,
new byte[] {';', '/'});
String pv = null;
if (pathParamEnd >= 0) {
if (charset != null) {
pv = new String(uriBC.getBuffer(), start + pathParamStart,
pathParamEnd - pathParamStart, charset);
}
// Extract path param from decoded request URI
byte[] buf = uriBC.getBuffer();
for (int i = 0; i < end - start - pathParamEnd; i++) {
buf[start + semicolon + i]
= buf[start + i + pathParamEnd];
}
uriBC.setBytes(buf, start,
end - start - pathParamEnd + semicolon);
} else {
if (charset != null) {
pv = new String(uriBC.getBuffer(), start + pathParamStart,
(end - start) - pathParamStart, charset);
}
uriBC.setEnd(start + semicolon);
}
if (log.isDebugEnabled()) {
log.debug(sm.getString("coyoteAdapter.debug", "pathParamStart",
String.valueOf(pathParamStart)));
log.debug(sm.getString("coyoteAdapter.debug", "pathParamEnd",
String.valueOf(pathParamEnd)));
log.debug(sm.getString("coyoteAdapter.debug", "pv", pv));
}
if (pv != null) {
int equals = pv.indexOf('=');
if (equals > -1) {
String name = pv.substring(0, equals);
String value = pv.substring(equals + 1);
request.addPathParameter(name, value);
if (log.isDebugEnabled()) {
log.debug(sm.getString("coyoteAdapter.debug", "equals",
String.valueOf(equals)));
log.debug(sm.getString("coyoteAdapter.debug", "name",
name));
log.debug(sm.getString("coyoteAdapter.debug", "value",
value));
}
}
}
semicolon = uriBC.indexOf(';', semicolon);
}
} | /**
* Extract the path parameters from the request. This assumes parameters are
* of the form /path;name=value;name2=value2/ etc. Currently only really
* interested in the session ID that will be in this form. Other parameters
* can safely be ignored.
*
* @param req The Coyote request object
* @param request The Servlet request object
*/ | Extract the path parameters from the request. This assumes parameters are
of the form /path;name=value;name2=value2/ etc. Currently only really
interested in the session ID that will be in this form. Other parameters
can safely be ignored.
@param req The Coyote request object
@param request The Servlet request object | [
"Extract",
"the",
"path",
"parameters",
"from",
"the",
"request",
".",
"This",
"assumes",
"parameters",
"are",
"of",
"the",
"form",
"/",
"path",
";",
"name",
"=",
"value",
";",
"name2",
"=",
"value2",
"/",
"etc",
".",
"Currently",
"only",
"really",
"interested",
"in",
"the",
"session",
"ID",
"that",
"will",
"be",
"in",
"this",
"form",
".",
"Other",
"parameters",
"can",
"safely",
"be",
"ignored",
".",
"@param",
"req",
"The",
"Coyote",
"request",
"object",
"@param",
"request",
"The",
"Servlet",
"request",
"object"
] | protected void parsePathParameters(org.apache.coyote.Request req,
Request request) {
req.decodedURI().toBytes();
ByteChunk uriBC = req.decodedURI().getByteChunk();
int semicolon = uriBC.indexOf(';', 0);
if (semicolon == -1) {
return;
}
Charset charset = connector.getURICharset();
if (log.isDebugEnabled()) {
log.debug(sm.getString("coyoteAdapter.debug", "uriBC",
uriBC.toString()));
log.debug(sm.getString("coyoteAdapter.debug", "semicolon",
String.valueOf(semicolon)));
log.debug(sm.getString("coyoteAdapter.debug", "enc", charset.name()));
}
while (semicolon > -1) {
int start = uriBC.getStart();
int end = uriBC.getEnd();
int pathParamStart = semicolon + 1;
int pathParamEnd = ByteChunk.findBytes(uriBC.getBuffer(),
start + pathParamStart, end,
new byte[] {';', '/'});
String pv = null;
if (pathParamEnd >= 0) {
if (charset != null) {
pv = new String(uriBC.getBuffer(), start + pathParamStart,
pathParamEnd - pathParamStart, charset);
}
byte[] buf = uriBC.getBuffer();
for (int i = 0; i < end - start - pathParamEnd; i++) {
buf[start + semicolon + i]
= buf[start + i + pathParamEnd];
}
uriBC.setBytes(buf, start,
end - start - pathParamEnd + semicolon);
} else {
if (charset != null) {
pv = new String(uriBC.getBuffer(), start + pathParamStart,
(end - start) - pathParamStart, charset);
}
uriBC.setEnd(start + semicolon);
}
if (log.isDebugEnabled()) {
log.debug(sm.getString("coyoteAdapter.debug", "pathParamStart",
String.valueOf(pathParamStart)));
log.debug(sm.getString("coyoteAdapter.debug", "pathParamEnd",
String.valueOf(pathParamEnd)));
log.debug(sm.getString("coyoteAdapter.debug", "pv", pv));
}
if (pv != null) {
int equals = pv.indexOf('=');
if (equals > -1) {
String name = pv.substring(0, equals);
String value = pv.substring(equals + 1);
request.addPathParameter(name, value);
if (log.isDebugEnabled()) {
log.debug(sm.getString("coyoteAdapter.debug", "equals",
String.valueOf(equals)));
log.debug(sm.getString("coyoteAdapter.debug", "name",
name));
log.debug(sm.getString("coyoteAdapter.debug", "value",
value));
}
}
}
semicolon = uriBC.indexOf(';', semicolon);
}
} | [
"protected",
"void",
"parsePathParameters",
"(",
"org",
".",
"apache",
".",
"coyote",
".",
"Request",
"req",
",",
"Request",
"request",
")",
"{",
"req",
".",
"decodedURI",
"(",
")",
".",
"toBytes",
"(",
")",
";",
"ByteChunk",
"uriBC",
"=",
"req",
".",
"decodedURI",
"(",
")",
".",
"getByteChunk",
"(",
")",
";",
"int",
"semicolon",
"=",
"uriBC",
".",
"indexOf",
"(",
"';'",
",",
"0",
")",
";",
"if",
"(",
"semicolon",
"==",
"-",
"1",
")",
"{",
"return",
";",
"}",
"Charset",
"charset",
"=",
"connector",
".",
"getURICharset",
"(",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"uriBC\"",
",",
"uriBC",
".",
"toString",
"(",
")",
")",
")",
";",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"semicolon\"",
",",
"String",
".",
"valueOf",
"(",
"semicolon",
")",
")",
")",
";",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"enc\"",
",",
"charset",
".",
"name",
"(",
")",
")",
")",
";",
"}",
"while",
"(",
"semicolon",
">",
"-",
"1",
")",
"{",
"int",
"start",
"=",
"uriBC",
".",
"getStart",
"(",
")",
";",
"int",
"end",
"=",
"uriBC",
".",
"getEnd",
"(",
")",
";",
"int",
"pathParamStart",
"=",
"semicolon",
"+",
"1",
";",
"int",
"pathParamEnd",
"=",
"ByteChunk",
".",
"findBytes",
"(",
"uriBC",
".",
"getBuffer",
"(",
")",
",",
"start",
"+",
"pathParamStart",
",",
"end",
",",
"new",
"byte",
"[",
"]",
"{",
"';'",
",",
"'/'",
"}",
")",
";",
"String",
"pv",
"=",
"null",
";",
"if",
"(",
"pathParamEnd",
">=",
"0",
")",
"{",
"if",
"(",
"charset",
"!=",
"null",
")",
"{",
"pv",
"=",
"new",
"String",
"(",
"uriBC",
".",
"getBuffer",
"(",
")",
",",
"start",
"+",
"pathParamStart",
",",
"pathParamEnd",
"-",
"pathParamStart",
",",
"charset",
")",
";",
"}",
"byte",
"[",
"]",
"buf",
"=",
"uriBC",
".",
"getBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"end",
"-",
"start",
"-",
"pathParamEnd",
";",
"i",
"++",
")",
"{",
"buf",
"[",
"start",
"+",
"semicolon",
"+",
"i",
"]",
"=",
"buf",
"[",
"start",
"+",
"i",
"+",
"pathParamEnd",
"]",
";",
"}",
"uriBC",
".",
"setBytes",
"(",
"buf",
",",
"start",
",",
"end",
"-",
"start",
"-",
"pathParamEnd",
"+",
"semicolon",
")",
";",
"}",
"else",
"{",
"if",
"(",
"charset",
"!=",
"null",
")",
"{",
"pv",
"=",
"new",
"String",
"(",
"uriBC",
".",
"getBuffer",
"(",
")",
",",
"start",
"+",
"pathParamStart",
",",
"(",
"end",
"-",
"start",
")",
"-",
"pathParamStart",
",",
"charset",
")",
";",
"}",
"uriBC",
".",
"setEnd",
"(",
"start",
"+",
"semicolon",
")",
";",
"}",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"pathParamStart\"",
",",
"String",
".",
"valueOf",
"(",
"pathParamStart",
")",
")",
")",
";",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"pathParamEnd\"",
",",
"String",
".",
"valueOf",
"(",
"pathParamEnd",
")",
")",
")",
";",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"pv\"",
",",
"pv",
")",
")",
";",
"}",
"if",
"(",
"pv",
"!=",
"null",
")",
"{",
"int",
"equals",
"=",
"pv",
".",
"indexOf",
"(",
"'='",
")",
";",
"if",
"(",
"equals",
">",
"-",
"1",
")",
"{",
"String",
"name",
"=",
"pv",
".",
"substring",
"(",
"0",
",",
"equals",
")",
";",
"String",
"value",
"=",
"pv",
".",
"substring",
"(",
"equals",
"+",
"1",
")",
";",
"request",
".",
"addPathParameter",
"(",
"name",
",",
"value",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"equals\"",
",",
"String",
".",
"valueOf",
"(",
"equals",
")",
")",
")",
";",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"name\"",
",",
"name",
")",
")",
";",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteAdapter.debug\"",
",",
"\"value\"",
",",
"value",
")",
")",
";",
"}",
"}",
"}",
"semicolon",
"=",
"uriBC",
".",
"indexOf",
"(",
"';'",
",",
"semicolon",
")",
";",
"}",
"}"
] | Extract the path parameters from the request. | [
"Extract",
"the",
"path",
"parameters",
"from",
"the",
"request",
"."
] | [
"// Process in bytes (this is default format so this is normally a NO-OP",
"// Performance optimisation. Return as soon as it is known there are no",
"// path parameters;",
"// What encoding to use? Some platforms, eg z/os, use a default",
"// encoding that doesn't give the expected result so be explicit",
"// Parse path param, and extract it from the decoded request URI",
"// Extract path param from decoded request URI"
] | [
{
"param": "req",
"type": "org.apache.coyote.Request"
},
{
"param": "request",
"type": "Request"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "req",
"type": "org.apache.coyote.Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1109,
743,
2402,
12,
3341,
18,
19211,
18,
2894,
93,
1168,
18,
691,
1111,
16,
203,
5411,
1567,
590,
13,
288,
203,
203,
3639,
368,
4389,
316,
1731,
261,
2211,
353,
805,
740,
1427,
333,
353,
15849,
279,
3741,
17,
3665,
203,
3639,
1111,
18,
26646,
3098,
7675,
869,
2160,
5621,
203,
203,
3639,
3506,
5579,
2003,
16283,
273,
1111,
18,
26646,
3098,
7675,
588,
3216,
5579,
5621,
203,
3639,
509,
23682,
273,
2003,
16283,
18,
31806,
2668,
31,
2187,
374,
1769,
203,
3639,
368,
11217,
1359,
5213,
10742,
18,
2000,
487,
17136,
487,
518,
353,
4846,
1915,
854,
1158,
203,
3639,
368,
589,
1472,
31,
203,
3639,
309,
261,
12000,
17280,
422,
300,
21,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
368,
18734,
2688,
358,
999,
35,
10548,
17422,
16,
9130,
998,
19,
538,
16,
999,
279,
805,
203,
3639,
368,
2688,
716,
3302,
1404,
8492,
326,
2665,
563,
1427,
506,
5515,
203,
3639,
12080,
4856,
273,
8703,
18,
588,
3098,
9652,
5621,
203,
203,
3639,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
5411,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
2894,
93,
1168,
4216,
18,
4148,
3113,
315,
1650,
16283,
3113,
203,
10792,
2003,
16283,
18,
10492,
1435,
10019,
203,
5411,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
2894,
93,
1168,
4216,
18,
4148,
3113,
315,
12000,
17280,
3113,
203,
10792,
514,
18,
1132,
951,
12,
12000,
17280,
3719,
1769,
203,
5411,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
2894,
93,
1168,
4216,
18,
4148,
3113,
315,
1331,
3113,
4856,
18,
529,
1435,
10019,
203,
3639,
289,
203,
203,
3639,
1323,
261,
12000,
17280,
405,
300,
21,
13,
288,
203,
5411,
368,
2884,
589,
579,
16,
471,
2608,
518,
628,
326,
6383,
590,
3699,
203,
5411,
509,
787,
273,
2003,
16283,
18,
588,
1685,
5621,
203,
5411,
509,
679,
273,
2003,
16283,
18,
588,
1638,
5621,
203,
203,
5411,
509,
589,
786,
1685,
273,
23682,
397,
404,
31,
203,
5411,
509,
589,
786,
1638,
273,
3506,
5579,
18,
4720,
2160,
12,
1650,
16283,
18,
588,
1892,
9334,
203,
10792,
787,
397,
589,
786,
1685,
16,
679,
16,
203,
10792,
394,
1160,
8526,
288,
13506,
2187,
2023,
22938,
203,
203,
5411,
514,
9770,
273,
446,
31,
203,
203,
5411,
309,
261,
803,
786,
1638,
1545,
374,
13,
288,
203,
7734,
309,
261,
9999,
480,
446,
13,
288,
203,
10792,
9770,
273,
394,
514,
12,
1650,
16283,
18,
588,
1892,
9334,
787,
397,
589,
786,
1685,
16,
203,
27573,
589,
786,
1638,
300,
589,
786,
1685,
16,
4856,
1769,
203,
7734,
289,
203,
7734,
368,
8152,
589,
579,
628,
6383,
590,
3699,
203,
7734,
1160,
8526,
1681,
273,
2003,
16283,
18,
588,
1892,
5621,
203,
7734,
364,
261,
474,
277,
273,
374,
31,
277,
411,
679,
300,
787,
300,
589,
786,
1638,
31,
277,
27245,
288,
203,
10792,
1681,
63,
1937,
397,
23682,
397,
277,
65,
203,
13491,
273,
1681,
63,
1937,
397,
277,
397,
589,
786,
1638,
15533,
203,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
8152,
326,
589,
1472,
628,
326,
590,
18,
1220,
13041,
1472,
854,
203,
377,
380,
434,
326,
646,
342,
803,
31,
529,
33,
1132,
31,
529,
22,
33,
1132,
22,
19,
5527,
18,
15212,
1338,
8654,
203,
377,
380,
20506,
316,
326,
1339,
1599,
716,
903,
506,
316,
333,
646,
18,
4673,
1472,
203,
377,
380,
848,
15303,
506,
5455,
18,
203,
377,
380,
203,
377,
380,
632,
891,
1111,
1021,
7695,
93,
1168,
590,
733,
203,
377,
380,
632,
891,
590,
1021,
7971,
590,
733,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
735fcdb4ece341621ebe018055531d2c32c0f288 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/CoyoteAdapter.java | [
"MIT"
] | Java | parseSessionSslId | null | protected void parseSessionSslId(Request request) {
if (request.getRequestedSessionId() == null &&
SSL_ONLY.equals(request.getServletContext()
.getEffectiveSessionTrackingModes()) &&
request.connector.secure) {
String sessionId = (String) request.getAttribute(SSLSupport.SESSION_ID_KEY);
if (sessionId != null) {
request.setRequestedSessionId(sessionId);
request.setRequestedSessionSSL(true);
}
}
} | /**
* Look for SSL session ID if required. Only look for SSL Session ID if it
* is the only tracking method enabled.
*
* @param request The Servlet request object
*/ | Look for SSL session ID if required. Only look for SSL Session ID if it
is the only tracking method enabled.
@param request The Servlet request object | [
"Look",
"for",
"SSL",
"session",
"ID",
"if",
"required",
".",
"Only",
"look",
"for",
"SSL",
"Session",
"ID",
"if",
"it",
"is",
"the",
"only",
"tracking",
"method",
"enabled",
".",
"@param",
"request",
"The",
"Servlet",
"request",
"object"
] | protected void parseSessionSslId(Request request) {
if (request.getRequestedSessionId() == null &&
SSL_ONLY.equals(request.getServletContext()
.getEffectiveSessionTrackingModes()) &&
request.connector.secure) {
String sessionId = (String) request.getAttribute(SSLSupport.SESSION_ID_KEY);
if (sessionId != null) {
request.setRequestedSessionId(sessionId);
request.setRequestedSessionSSL(true);
}
}
} | [
"protected",
"void",
"parseSessionSslId",
"(",
"Request",
"request",
")",
"{",
"if",
"(",
"request",
".",
"getRequestedSessionId",
"(",
")",
"==",
"null",
"&&",
"SSL_ONLY",
".",
"equals",
"(",
"request",
".",
"getServletContext",
"(",
")",
".",
"getEffectiveSessionTrackingModes",
"(",
")",
")",
"&&",
"request",
".",
"connector",
".",
"secure",
")",
"{",
"String",
"sessionId",
"=",
"(",
"String",
")",
"request",
".",
"getAttribute",
"(",
"SSLSupport",
".",
"SESSION_ID_KEY",
")",
";",
"if",
"(",
"sessionId",
"!=",
"null",
")",
"{",
"request",
".",
"setRequestedSessionId",
"(",
"sessionId",
")",
";",
"request",
".",
"setRequestedSessionSSL",
"(",
"true",
")",
";",
"}",
"}",
"}"
] | Look for SSL session ID if required. | [
"Look",
"for",
"SSL",
"session",
"ID",
"if",
"required",
"."
] | [] | [
{
"param": "request",
"type": "Request"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1109,
2157,
15840,
548,
12,
691,
590,
13,
288,
203,
3639,
309,
261,
2293,
18,
588,
11244,
18030,
1435,
422,
446,
597,
203,
7734,
7419,
67,
10857,
18,
14963,
12,
2293,
18,
588,
4745,
1042,
1435,
203,
13491,
263,
588,
28531,
2157,
12642,
18868,
10756,
597,
203,
13491,
590,
18,
23159,
18,
8869,
13,
288,
203,
5411,
514,
10338,
273,
261,
780,
13,
590,
18,
588,
1499,
12,
1260,
3045,
416,
655,
18,
7042,
67,
734,
67,
3297,
1769,
203,
5411,
309,
261,
3184,
548,
480,
446,
13,
288,
203,
7734,
590,
18,
542,
11244,
18030,
12,
3184,
548,
1769,
203,
7734,
590,
18,
542,
11244,
2157,
6745,
12,
3767,
1769,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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203,
377,
380,
632,
891,
590,
1021,
7971,
590,
733,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
735fcdb4ece341621ebe018055531d2c32c0f288 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/CoyoteAdapter.java | [
"MIT"
] | Java | parseSessionCookiesId | null | protected void parseSessionCookiesId(Request request) {
// If session tracking via cookies has been disabled for the current
// context, don't go looking for a session ID in a cookie as a cookie
// from a parent context with a session ID may be present which would
// overwrite the valid session ID encoded in the URL
Context context = request.getMappingData().context;
if (context != null && !context.getServletContext()
.getEffectiveSessionTrackingModes().contains(
SessionTrackingMode.COOKIE)) {
return;
}
// Parse session id from cookies
ServerCookies serverCookies = request.getServerCookies();
int count = serverCookies.getCookieCount();
if (count <= 0) {
return;
}
String sessionCookieName = SessionConfig.getSessionCookieName(context);
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
if (scookie.getName().equals(sessionCookieName)) {
// Override anything requested in the URL
if (!request.isRequestedSessionIdFromCookie()) {
// Accept only the first session id cookie
convertMB(scookie.getValue());
request.setRequestedSessionId
(scookie.getValue().toString());
request.setRequestedSessionCookie(true);
request.setRequestedSessionURL(false);
if (log.isDebugEnabled()) {
log.debug(" Requested cookie session id is " +
request.getRequestedSessionId());
}
} else {
if (!request.isRequestedSessionIdValid()) {
// Replace the session id until one is valid
convertMB(scookie.getValue());
request.setRequestedSessionId
(scookie.getValue().toString());
}
}
}
}
} | /**
* Parse session id in Cookie.
*
* @param request The Servlet request object
*/ | Parse session id in Cookie.
@param request The Servlet request object | [
"Parse",
"session",
"id",
"in",
"Cookie",
".",
"@param",
"request",
"The",
"Servlet",
"request",
"object"
] | protected void parseSessionCookiesId(Request request) {
Context context = request.getMappingData().context;
if (context != null && !context.getServletContext()
.getEffectiveSessionTrackingModes().contains(
SessionTrackingMode.COOKIE)) {
return;
}
ServerCookies serverCookies = request.getServerCookies();
int count = serverCookies.getCookieCount();
if (count <= 0) {
return;
}
String sessionCookieName = SessionConfig.getSessionCookieName(context);
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
if (scookie.getName().equals(sessionCookieName)) {
if (!request.isRequestedSessionIdFromCookie()) {
convertMB(scookie.getValue());
request.setRequestedSessionId
(scookie.getValue().toString());
request.setRequestedSessionCookie(true);
request.setRequestedSessionURL(false);
if (log.isDebugEnabled()) {
log.debug(" Requested cookie session id is " +
request.getRequestedSessionId());
}
} else {
if (!request.isRequestedSessionIdValid()) {
convertMB(scookie.getValue());
request.setRequestedSessionId
(scookie.getValue().toString());
}
}
}
}
} | [
"protected",
"void",
"parseSessionCookiesId",
"(",
"Request",
"request",
")",
"{",
"Context",
"context",
"=",
"request",
".",
"getMappingData",
"(",
")",
".",
"context",
";",
"if",
"(",
"context",
"!=",
"null",
"&&",
"!",
"context",
".",
"getServletContext",
"(",
")",
".",
"getEffectiveSessionTrackingModes",
"(",
")",
".",
"contains",
"(",
"SessionTrackingMode",
".",
"COOKIE",
")",
")",
"{",
"return",
";",
"}",
"ServerCookies",
"serverCookies",
"=",
"request",
".",
"getServerCookies",
"(",
")",
";",
"int",
"count",
"=",
"serverCookies",
".",
"getCookieCount",
"(",
")",
";",
"if",
"(",
"count",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"String",
"sessionCookieName",
"=",
"SessionConfig",
".",
"getSessionCookieName",
"(",
"context",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"ServerCookie",
"scookie",
"=",
"serverCookies",
".",
"getCookie",
"(",
"i",
")",
";",
"if",
"(",
"scookie",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"sessionCookieName",
")",
")",
"{",
"if",
"(",
"!",
"request",
".",
"isRequestedSessionIdFromCookie",
"(",
")",
")",
"{",
"convertMB",
"(",
"scookie",
".",
"getValue",
"(",
")",
")",
";",
"request",
".",
"setRequestedSessionId",
"(",
"scookie",
".",
"getValue",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"request",
".",
"setRequestedSessionCookie",
"(",
"true",
")",
";",
"request",
".",
"setRequestedSessionURL",
"(",
"false",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\" Requested cookie session id is \"",
"+",
"request",
".",
"getRequestedSessionId",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"request",
".",
"isRequestedSessionIdValid",
"(",
")",
")",
"{",
"convertMB",
"(",
"scookie",
".",
"getValue",
"(",
")",
")",
";",
"request",
".",
"setRequestedSessionId",
"(",
"scookie",
".",
"getValue",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Parse session id in Cookie. | [
"Parse",
"session",
"id",
"in",
"Cookie",
"."
] | [
"// If session tracking via cookies has been disabled for the current",
"// context, don't go looking for a session ID in a cookie as a cookie",
"// from a parent context with a session ID may be present which would",
"// overwrite the valid session ID encoded in the URL",
"// Parse session id from cookies",
"// Override anything requested in the URL",
"// Accept only the first session id cookie",
"// Replace the session id until one is valid"
] | [
{
"param": "request",
"type": "Request"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1109,
2157,
16089,
548,
12,
691,
590,
13,
288,
203,
203,
3639,
368,
971,
1339,
11093,
3970,
7237,
711,
2118,
5673,
364,
326,
783,
203,
3639,
368,
819,
16,
2727,
1404,
1960,
7849,
364,
279,
1339,
1599,
316,
279,
3878,
487,
279,
3878,
203,
3639,
368,
628,
279,
982,
819,
598,
279,
1339,
1599,
2026,
506,
3430,
1492,
4102,
203,
3639,
368,
6156,
326,
923,
1339,
1599,
3749,
316,
326,
1976,
203,
3639,
1772,
819,
273,
590,
18,
588,
3233,
751,
7675,
2472,
31,
203,
3639,
309,
261,
2472,
480,
446,
597,
401,
2472,
18,
588,
4745,
1042,
1435,
203,
7734,
263,
588,
28531,
2157,
12642,
18868,
7675,
12298,
12,
203,
13491,
3877,
12642,
2309,
18,
13584,
3719,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
368,
2884,
1339,
612,
628,
7237,
203,
3639,
3224,
16089,
1438,
16089,
273,
590,
18,
588,
2081,
16089,
5621,
203,
3639,
509,
1056,
273,
1438,
16089,
18,
588,
6151,
1380,
5621,
203,
3639,
309,
261,
1883,
1648,
374,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
514,
1339,
6151,
461,
273,
3877,
809,
18,
588,
2157,
6151,
461,
12,
2472,
1769,
203,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
1056,
31,
277,
27245,
288,
203,
5411,
3224,
6151,
888,
2538,
273,
1438,
16089,
18,
588,
6151,
12,
77,
1769,
203,
5411,
309,
261,
1017,
2538,
18,
17994,
7675,
14963,
12,
3184,
6151,
461,
3719,
288,
203,
7734,
368,
1439,
6967,
3764,
316,
326,
1976,
203,
7734,
309,
16051,
2293,
18,
291,
11244,
18030,
1265,
6151,
10756,
288,
203,
10792,
368,
8662,
1338,
326,
1122,
1339,
612,
3878,
203,
10792,
1765,
7969,
12,
1017,
2538,
18,
24805,
10663,
203,
10792,
590,
18,
542,
11244,
18030,
203,
13491,
261,
1017,
2538,
18,
24805,
7675,
10492,
10663,
203,
10792,
590,
18,
542,
11244,
2157,
6151,
12,
3767,
1769,
203,
10792,
590,
18,
542,
11244,
2157,
1785,
12,
5743,
1769,
203,
10792,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
13491,
613,
18,
4148,
2932,
25829,
3878,
1339,
612,
353,
315,
397,
203,
18701,
590,
18,
588,
11244,
18030,
10663,
203,
10792,
289,
203,
7734,
289,
469,
288,
203,
10792,
309,
16051,
2293,
18,
291,
11244,
18030,
1556,
10756,
288,
203,
13491,
368,
6910,
326,
1339,
612,
3180,
1245,
353,
923,
203,
13491,
1765,
7969,
12,
1017,
2538,
18,
24805,
10663,
203,
13491,
590,
18,
542,
11244,
18030,
203,
18701,
261,
1017,
2538,
18,
24805,
7675,
10492,
10663,
203,
10792,
289,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2884,
1339,
612,
316,
10201,
18,
203,
377,
380,
203,
377,
380,
632,
891,
590,
1021,
7971,
590,
733,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
735fcdb4ece341621ebe018055531d2c32c0f288 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/CoyoteAdapter.java | [
"MIT"
] | Java | convertURI | null | protected void convertURI(MessageBytes uri, Request request) throws IOException {
ByteChunk bc = uri.getByteChunk();
int length = bc.getLength();
CharChunk cc = uri.getCharChunk();
cc.allocate(length, -1);
Charset charset = connector.getURICharset();
B2CConverter conv = request.getURIConverter();
if (conv == null) {
conv = new B2CConverter(charset, true);
request.setURIConverter(conv);
} else {
conv.recycle();
}
try {
conv.convert(bc, cc, true);
uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());
} catch (IOException ioe) {
// Should never happen as B2CConverter should replace
// problematic characters
request.getResponse().sendError(HttpServletResponse.SC_BAD_REQUEST);
}
} | /**
* Character conversion of the URI.
*
* @param uri MessageBytes object containing the URI
* @param request The Servlet request object
* @throws IOException if a IO exception occurs sending an error to the client
*/ | Character conversion of the URI.
@param uri MessageBytes object containing the URI
@param request The Servlet request object
@throws IOException if a IO exception occurs sending an error to the client | [
"Character",
"conversion",
"of",
"the",
"URI",
".",
"@param",
"uri",
"MessageBytes",
"object",
"containing",
"the",
"URI",
"@param",
"request",
"The",
"Servlet",
"request",
"object",
"@throws",
"IOException",
"if",
"a",
"IO",
"exception",
"occurs",
"sending",
"an",
"error",
"to",
"the",
"client"
] | protected void convertURI(MessageBytes uri, Request request) throws IOException {
ByteChunk bc = uri.getByteChunk();
int length = bc.getLength();
CharChunk cc = uri.getCharChunk();
cc.allocate(length, -1);
Charset charset = connector.getURICharset();
B2CConverter conv = request.getURIConverter();
if (conv == null) {
conv = new B2CConverter(charset, true);
request.setURIConverter(conv);
} else {
conv.recycle();
}
try {
conv.convert(bc, cc, true);
uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());
} catch (IOException ioe) {
request.getResponse().sendError(HttpServletResponse.SC_BAD_REQUEST);
}
} | [
"protected",
"void",
"convertURI",
"(",
"MessageBytes",
"uri",
",",
"Request",
"request",
")",
"throws",
"IOException",
"{",
"ByteChunk",
"bc",
"=",
"uri",
".",
"getByteChunk",
"(",
")",
";",
"int",
"length",
"=",
"bc",
".",
"getLength",
"(",
")",
";",
"CharChunk",
"cc",
"=",
"uri",
".",
"getCharChunk",
"(",
")",
";",
"cc",
".",
"allocate",
"(",
"length",
",",
"-",
"1",
")",
";",
"Charset",
"charset",
"=",
"connector",
".",
"getURICharset",
"(",
")",
";",
"B2CConverter",
"conv",
"=",
"request",
".",
"getURIConverter",
"(",
")",
";",
"if",
"(",
"conv",
"==",
"null",
")",
"{",
"conv",
"=",
"new",
"B2CConverter",
"(",
"charset",
",",
"true",
")",
";",
"request",
".",
"setURIConverter",
"(",
"conv",
")",
";",
"}",
"else",
"{",
"conv",
".",
"recycle",
"(",
")",
";",
"}",
"try",
"{",
"conv",
".",
"convert",
"(",
"bc",
",",
"cc",
",",
"true",
")",
";",
"uri",
".",
"setChars",
"(",
"cc",
".",
"getBuffer",
"(",
")",
",",
"cc",
".",
"getStart",
"(",
")",
",",
"cc",
".",
"getLength",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"request",
".",
"getResponse",
"(",
")",
".",
"sendError",
"(",
"HttpServletResponse",
".",
"SC_BAD_REQUEST",
")",
";",
"}",
"}"
] | Character conversion of the URI. | [
"Character",
"conversion",
"of",
"the",
"URI",
"."
] | [
"// Should never happen as B2CConverter should replace",
"// problematic characters"
] | [
{
"param": "uri",
"type": "MessageBytes"
},
{
"param": "request",
"type": "Request"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "uri",
"type": "MessageBytes",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1765,
3098,
12,
1079,
2160,
2003,
16,
1567,
590,
13,
1216,
1860,
288,
203,
203,
3639,
3506,
5579,
6533,
273,
2003,
18,
588,
3216,
5579,
5621,
203,
3639,
509,
769,
273,
6533,
18,
588,
1782,
5621,
203,
3639,
3703,
5579,
4946,
273,
2003,
18,
588,
2156,
5579,
5621,
203,
3639,
4946,
18,
16247,
12,
2469,
16,
300,
21,
1769,
203,
203,
3639,
12080,
4856,
273,
8703,
18,
588,
3098,
9652,
5621,
203,
203,
3639,
605,
22,
39,
5072,
6292,
273,
590,
18,
588,
3098,
5072,
5621,
203,
3639,
309,
261,
4896,
422,
446,
13,
288,
203,
5411,
6292,
273,
394,
605,
22,
39,
5072,
12,
9999,
16,
638,
1769,
203,
5411,
590,
18,
542,
3098,
5072,
12,
4896,
1769,
203,
3639,
289,
469,
288,
203,
5411,
6292,
18,
266,
13946,
5621,
203,
3639,
289,
203,
203,
3639,
775,
288,
203,
5411,
6292,
18,
6283,
12,
13459,
16,
4946,
16,
638,
1769,
203,
5411,
2003,
18,
542,
7803,
12,
952,
18,
588,
1892,
9334,
4946,
18,
588,
1685,
9334,
4946,
18,
588,
1782,
10663,
203,
3639,
289,
1044,
261,
14106,
10847,
13,
288,
203,
5411,
368,
9363,
5903,
5865,
487,
605,
22,
39,
5072,
1410,
1453,
203,
5411,
368,
6199,
2126,
3949,
203,
5411,
590,
18,
588,
1064,
7675,
4661,
668,
12,
2940,
29910,
18,
2312,
67,
16234,
67,
5519,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
6577,
4105,
434,
326,
3699,
18,
203,
377,
380,
203,
377,
380,
632,
891,
2003,
2350,
2160,
733,
4191,
326,
3699,
203,
377,
380,
632,
891,
590,
1021,
7971,
590,
733,
203,
377,
380,
632,
15069,
1860,
309,
279,
1665,
1520,
9938,
5431,
392,
555,
358,
326,
1004,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
735fcdb4ece341621ebe018055531d2c32c0f288 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/CoyoteAdapter.java | [
"MIT"
] | Java | convertMB | null | protected void convertMB(MessageBytes mb) {
// This is of course only meaningful for bytes
if (mb.getType() != MessageBytes.T_BYTES) {
return;
}
ByteChunk bc = mb.getByteChunk();
CharChunk cc = mb.getCharChunk();
int length = bc.getLength();
cc.allocate(length, -1);
// Default encoding: fast conversion
byte[] bbuf = bc.getBuffer();
char[] cbuf = cc.getBuffer();
int start = bc.getStart();
for (int i = 0; i < length; i++) {
cbuf[i] = (char) (bbuf[i + start] & 0xff);
}
mb.setChars(cbuf, 0, length);
} | /**
* Character conversion of the a US-ASCII MessageBytes.
*
* @param mb The MessageBytes instance containing the bytes that should be converted to chars
*/ | Character conversion of the a US-ASCII MessageBytes.
@param mb The MessageBytes instance containing the bytes that should be converted to chars | [
"Character",
"conversion",
"of",
"the",
"a",
"US",
"-",
"ASCII",
"MessageBytes",
".",
"@param",
"mb",
"The",
"MessageBytes",
"instance",
"containing",
"the",
"bytes",
"that",
"should",
"be",
"converted",
"to",
"chars"
] | protected void convertMB(MessageBytes mb) {
if (mb.getType() != MessageBytes.T_BYTES) {
return;
}
ByteChunk bc = mb.getByteChunk();
CharChunk cc = mb.getCharChunk();
int length = bc.getLength();
cc.allocate(length, -1);
byte[] bbuf = bc.getBuffer();
char[] cbuf = cc.getBuffer();
int start = bc.getStart();
for (int i = 0; i < length; i++) {
cbuf[i] = (char) (bbuf[i + start] & 0xff);
}
mb.setChars(cbuf, 0, length);
} | [
"protected",
"void",
"convertMB",
"(",
"MessageBytes",
"mb",
")",
"{",
"if",
"(",
"mb",
".",
"getType",
"(",
")",
"!=",
"MessageBytes",
".",
"T_BYTES",
")",
"{",
"return",
";",
"}",
"ByteChunk",
"bc",
"=",
"mb",
".",
"getByteChunk",
"(",
")",
";",
"CharChunk",
"cc",
"=",
"mb",
".",
"getCharChunk",
"(",
")",
";",
"int",
"length",
"=",
"bc",
".",
"getLength",
"(",
")",
";",
"cc",
".",
"allocate",
"(",
"length",
",",
"-",
"1",
")",
";",
"byte",
"[",
"]",
"bbuf",
"=",
"bc",
".",
"getBuffer",
"(",
")",
";",
"char",
"[",
"]",
"cbuf",
"=",
"cc",
".",
"getBuffer",
"(",
")",
";",
"int",
"start",
"=",
"bc",
".",
"getStart",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"cbuf",
"[",
"i",
"]",
"=",
"(",
"char",
")",
"(",
"bbuf",
"[",
"i",
"+",
"start",
"]",
"&",
"0xff",
")",
";",
"}",
"mb",
".",
"setChars",
"(",
"cbuf",
",",
"0",
",",
"length",
")",
";",
"}"
] | Character conversion of the a US-ASCII MessageBytes. | [
"Character",
"conversion",
"of",
"the",
"a",
"US",
"-",
"ASCII",
"MessageBytes",
"."
] | [
"// This is of course only meaningful for bytes",
"// Default encoding: fast conversion"
] | [
{
"param": "mb",
"type": "MessageBytes"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mb",
"type": "MessageBytes",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1765,
7969,
12,
1079,
2160,
4903,
13,
288,
203,
203,
3639,
368,
1220,
353,
434,
4362,
1338,
26271,
364,
1731,
203,
3639,
309,
261,
1627,
18,
588,
559,
1435,
480,
2350,
2160,
18,
56,
67,
13718,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
3506,
5579,
6533,
273,
4903,
18,
588,
3216,
5579,
5621,
203,
3639,
3703,
5579,
4946,
273,
4903,
18,
588,
2156,
5579,
5621,
203,
3639,
509,
769,
273,
6533,
18,
588,
1782,
5621,
203,
3639,
4946,
18,
16247,
12,
2469,
16,
300,
21,
1769,
203,
203,
3639,
368,
2989,
2688,
30,
4797,
4105,
203,
3639,
1160,
8526,
324,
4385,
273,
6533,
18,
588,
1892,
5621,
203,
3639,
1149,
8526,
2875,
696,
273,
4946,
18,
588,
1892,
5621,
203,
3639,
509,
787,
273,
6533,
18,
588,
1685,
5621,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
769,
31,
277,
27245,
288,
203,
5411,
2875,
696,
63,
77,
65,
273,
261,
3001,
13,
261,
70,
4385,
63,
77,
397,
787,
65,
473,
374,
5297,
1769,
203,
3639,
289,
203,
3639,
4903,
18,
542,
7803,
12,
71,
4385,
16,
374,
16,
769,
1769,
203,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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2350,
2160,
791,
4191,
326,
1731,
716,
1410,
506,
5970,
358,
5230,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
735fcdb4ece341621ebe018055531d2c32c0f288 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/CoyoteAdapter.java | [
"MIT"
] | Java | normalize | null | public static boolean normalize(MessageBytes uriMB) {
ByteChunk uriBC = uriMB.getByteChunk();
final byte[] b = uriBC.getBytes();
final int start = uriBC.getStart();
int end = uriBC.getEnd();
// An empty URL is not acceptable
if (start == end) {
return false;
}
int pos = 0;
int index = 0;
// Replace '\' with '/'
// Check for null byte
for (pos = start; pos < end; pos++) {
if (b[pos] == (byte) '\\') {
if (ALLOW_BACKSLASH) {
b[pos] = (byte) '/';
} else {
return false;
}
}
if (b[pos] == (byte) 0) {
return false;
}
}
// The URL must start with '/'
if (b[start] != (byte) '/') {
return false;
}
// Replace "//" with "/"
for (pos = start; pos < (end - 1); pos++) {
if (b[pos] == (byte) '/') {
while ((pos + 1 < end) && (b[pos + 1] == (byte) '/')) {
copyBytes(b, pos, pos + 1, end - pos - 1);
end--;
}
}
}
// If the URI ends with "/." or "/..", then we append an extra "/"
// Note: It is possible to extend the URI by 1 without any side effect
// as the next character is a non-significant WS.
if (((end - start) >= 2) && (b[end - 1] == (byte) '.')) {
if ((b[end - 2] == (byte) '/')
|| ((b[end - 2] == (byte) '.')
&& (b[end - 3] == (byte) '/'))) {
b[end] = (byte) '/';
end++;
}
}
uriBC.setEnd(end);
index = 0;
// Resolve occurrences of "/./" in the normalized path
while (true) {
index = uriBC.indexOf("/./", 0, 3, index);
if (index < 0) {
break;
}
copyBytes(b, start + index, start + index + 2,
end - start - index - 2);
end = end - 2;
uriBC.setEnd(end);
}
index = 0;
// Resolve occurrences of "/../" in the normalized path
while (true) {
index = uriBC.indexOf("/../", 0, 4, index);
if (index < 0) {
break;
}
// Prevent from going outside our context
if (index == 0) {
return false;
}
int index2 = -1;
for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos --) {
if (b[pos] == (byte) '/') {
index2 = pos;
}
}
copyBytes(b, start + index2, start + index + 3,
end - start - index - 3);
end = end + index2 - index - 3;
uriBC.setEnd(end);
index = index2;
}
return true;
} | /**
* This method normalizes "\", "//", "/./" and "/../".
*
* @param uriMB URI to be normalized
*
* @return <code>false</code> if normalizing this URI would require going
* above the root, or if the URI contains a null byte, otherwise
* <code>true</code>
*/ |
@return false if normalizing this URI would require going
above the root, or if the URI contains a null byte, otherwise
true | [
"@return",
"false",
"if",
"normalizing",
"this",
"URI",
"would",
"require",
"going",
"above",
"the",
"root",
"or",
"if",
"the",
"URI",
"contains",
"a",
"null",
"byte",
"otherwise",
"true"
] | public static boolean normalize(MessageBytes uriMB) {
ByteChunk uriBC = uriMB.getByteChunk();
final byte[] b = uriBC.getBytes();
final int start = uriBC.getStart();
int end = uriBC.getEnd();
if (start == end) {
return false;
}
int pos = 0;
int index = 0;
for (pos = start; pos < end; pos++) {
if (b[pos] == (byte) '\\') {
if (ALLOW_BACKSLASH) {
b[pos] = (byte) '/';
} else {
return false;
}
}
if (b[pos] == (byte) 0) {
return false;
}
}
if (b[start] != (byte) '/') {
return false;
}
for (pos = start; pos < (end - 1); pos++) {
if (b[pos] == (byte) '/') {
while ((pos + 1 < end) && (b[pos + 1] == (byte) '/')) {
copyBytes(b, pos, pos + 1, end - pos - 1);
end--;
}
}
}
if (((end - start) >= 2) && (b[end - 1] == (byte) '.')) {
if ((b[end - 2] == (byte) '/')
|| ((b[end - 2] == (byte) '.')
&& (b[end - 3] == (byte) '/'))) {
b[end] = (byte) '/';
end++;
}
}
uriBC.setEnd(end);
index = 0;
while (true) {
index = uriBC.indexOf("/./", 0, 3, index);
if (index < 0) {
break;
}
copyBytes(b, start + index, start + index + 2,
end - start - index - 2);
end = end - 2;
uriBC.setEnd(end);
}
index = 0;
while (true) {
index = uriBC.indexOf("/../", 0, 4, index);
if (index < 0) {
break;
}
if (index == 0) {
return false;
}
int index2 = -1;
for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos --) {
if (b[pos] == (byte) '/') {
index2 = pos;
}
}
copyBytes(b, start + index2, start + index + 3,
end - start - index - 3);
end = end + index2 - index - 3;
uriBC.setEnd(end);
index = index2;
}
return true;
} | [
"public",
"static",
"boolean",
"normalize",
"(",
"MessageBytes",
"uriMB",
")",
"{",
"ByteChunk",
"uriBC",
"=",
"uriMB",
".",
"getByteChunk",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"b",
"=",
"uriBC",
".",
"getBytes",
"(",
")",
";",
"final",
"int",
"start",
"=",
"uriBC",
".",
"getStart",
"(",
")",
";",
"int",
"end",
"=",
"uriBC",
".",
"getEnd",
"(",
")",
";",
"if",
"(",
"start",
"==",
"end",
")",
"{",
"return",
"false",
";",
"}",
"int",
"pos",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"pos",
"=",
"start",
";",
"pos",
"<",
"end",
";",
"pos",
"++",
")",
"{",
"if",
"(",
"b",
"[",
"pos",
"]",
"==",
"(",
"byte",
")",
"'\\\\'",
")",
"{",
"if",
"(",
"ALLOW_BACKSLASH",
")",
"{",
"b",
"[",
"pos",
"]",
"=",
"(",
"byte",
")",
"'/'",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"b",
"[",
"pos",
"]",
"==",
"(",
"byte",
")",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"b",
"[",
"start",
"]",
"!=",
"(",
"byte",
")",
"'/'",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"pos",
"=",
"start",
";",
"pos",
"<",
"(",
"end",
"-",
"1",
")",
";",
"pos",
"++",
")",
"{",
"if",
"(",
"b",
"[",
"pos",
"]",
"==",
"(",
"byte",
")",
"'/'",
")",
"{",
"while",
"(",
"(",
"pos",
"+",
"1",
"<",
"end",
")",
"&&",
"(",
"b",
"[",
"pos",
"+",
"1",
"]",
"==",
"(",
"byte",
")",
"'/'",
")",
")",
"{",
"copyBytes",
"(",
"b",
",",
"pos",
",",
"pos",
"+",
"1",
",",
"end",
"-",
"pos",
"-",
"1",
")",
";",
"end",
"--",
";",
"}",
"}",
"}",
"if",
"(",
"(",
"(",
"end",
"-",
"start",
")",
">=",
"2",
")",
"&&",
"(",
"b",
"[",
"end",
"-",
"1",
"]",
"==",
"(",
"byte",
")",
"'.'",
")",
")",
"{",
"if",
"(",
"(",
"b",
"[",
"end",
"-",
"2",
"]",
"==",
"(",
"byte",
")",
"'/'",
")",
"||",
"(",
"(",
"b",
"[",
"end",
"-",
"2",
"]",
"==",
"(",
"byte",
")",
"'.'",
")",
"&&",
"(",
"b",
"[",
"end",
"-",
"3",
"]",
"==",
"(",
"byte",
")",
"'/'",
")",
")",
")",
"{",
"b",
"[",
"end",
"]",
"=",
"(",
"byte",
")",
"'/'",
";",
"end",
"++",
";",
"}",
"}",
"uriBC",
".",
"setEnd",
"(",
"end",
")",
";",
"index",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"index",
"=",
"uriBC",
".",
"indexOf",
"(",
"\"/./\"",
",",
"0",
",",
"3",
",",
"index",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"break",
";",
"}",
"copyBytes",
"(",
"b",
",",
"start",
"+",
"index",
",",
"start",
"+",
"index",
"+",
"2",
",",
"end",
"-",
"start",
"-",
"index",
"-",
"2",
")",
";",
"end",
"=",
"end",
"-",
"2",
";",
"uriBC",
".",
"setEnd",
"(",
"end",
")",
";",
"}",
"index",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"index",
"=",
"uriBC",
".",
"indexOf",
"(",
"\"/../\"",
",",
"0",
",",
"4",
",",
"index",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"break",
";",
"}",
"if",
"(",
"index",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"int",
"index2",
"=",
"-",
"1",
";",
"for",
"(",
"pos",
"=",
"start",
"+",
"index",
"-",
"1",
";",
"(",
"pos",
">=",
"0",
")",
"&&",
"(",
"index2",
"<",
"0",
")",
";",
"pos",
"--",
")",
"{",
"if",
"(",
"b",
"[",
"pos",
"]",
"==",
"(",
"byte",
")",
"'/'",
")",
"{",
"index2",
"=",
"pos",
";",
"}",
"}",
"copyBytes",
"(",
"b",
",",
"start",
"+",
"index2",
",",
"start",
"+",
"index",
"+",
"3",
",",
"end",
"-",
"start",
"-",
"index",
"-",
"3",
")",
";",
"end",
"=",
"end",
"+",
"index2",
"-",
"index",
"-",
"3",
";",
"uriBC",
".",
"setEnd",
"(",
"end",
")",
";",
"index",
"=",
"index2",
";",
"}",
"return",
"true",
";",
"}"
] | This method normalizes "\", "//", "/./" and "/../". | [
"This",
"method",
"normalizes",
"\"",
"\\",
"\"",
"\"",
"//",
"\"",
"\"",
"/",
".",
"/",
"\"",
"and",
"\"",
"/",
"..",
"/",
"\"",
"."
] | [
"// An empty URL is not acceptable",
"// Replace '\\' with '/'",
"// Check for null byte",
"// The URL must start with '/'",
"// Replace \"//\" with \"/\"",
"// If the URI ends with \"/.\" or \"/..\", then we append an extra \"/\"",
"// Note: It is possible to extend the URI by 1 without any side effect",
"// as the next character is a non-significant WS.",
"// Resolve occurrences of \"/./\" in the normalized path",
"// Resolve occurrences of \"/../\" in the normalized path",
"// Prevent from going outside our context"
] | [
{
"param": "uriMB",
"type": "MessageBytes"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "uriMB",
"type": "MessageBytes",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
3883,
12,
1079,
2160,
2003,
7969,
13,
288,
203,
203,
3639,
3506,
5579,
2003,
16283,
273,
2003,
7969,
18,
588,
3216,
5579,
5621,
203,
3639,
727,
1160,
8526,
324,
273,
2003,
16283,
18,
588,
2160,
5621,
203,
3639,
727,
509,
787,
273,
2003,
16283,
18,
588,
1685,
5621,
203,
3639,
509,
679,
273,
2003,
16283,
18,
588,
1638,
5621,
203,
203,
3639,
368,
1922,
1008,
1976,
353,
486,
14206,
203,
3639,
309,
261,
1937,
422,
679,
13,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
203,
3639,
509,
949,
273,
374,
31,
203,
3639,
509,
770,
273,
374,
31,
203,
203,
3639,
368,
6910,
14118,
598,
2023,
203,
3639,
368,
2073,
364,
446,
1160,
203,
3639,
364,
261,
917,
273,
787,
31,
949,
411,
679,
31,
949,
27245,
288,
203,
5411,
309,
261,
70,
63,
917,
65,
422,
261,
7229,
13,
5282,
13,
288,
203,
7734,
309,
261,
13511,
67,
8720,
24079,
13,
288,
203,
10792,
324,
63,
917,
65,
273,
261,
7229,
13,
2023,
31,
203,
7734,
289,
469,
288,
203,
10792,
327,
629,
31,
203,
7734,
289,
203,
5411,
289,
203,
5411,
309,
261,
70,
63,
917,
65,
422,
261,
7229,
13,
374,
13,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
368,
1021,
1976,
1297,
787,
598,
2023,
203,
3639,
309,
261,
70,
63,
1937,
65,
480,
261,
7229,
13,
2023,
13,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
203,
3639,
368,
6910,
31828,
598,
4016,
203,
3639,
364,
261,
917,
273,
787,
31,
949,
411,
261,
409,
300,
404,
1769,
949,
27245,
288,
203,
5411,
309,
261,
70,
63,
917,
65,
422,
261,
7229,
13,
2023,
13,
288,
203,
7734,
1323,
14015,
917,
397,
404,
411,
679,
13,
597,
261,
70,
63,
917,
397,
404,
65,
422,
261,
7229,
13,
2023,
3719,
288,
203,
10792,
1610,
2160,
12,
70,
16,
949,
16,
949,
397,
404,
16,
679,
300,
949,
300,
404,
1769,
203,
10792,
679,
413,
31,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
368,
971,
326,
3699,
3930,
598,
2206,
1199,
578,
2206,
838,
3113,
1508,
732,
714,
392,
2870,
4016,
203,
3639,
368,
3609,
30,
2597,
353,
3323,
358,
2133,
326,
3699,
635,
404,
2887,
1281,
4889,
5426,
203,
3639,
368,
487,
326,
1024,
3351,
353,
279,
1661,
17,
2977,
11120,
7649,
18,
203,
3639,
309,
261,
12443,
409,
300,
787,
13,
1545,
576,
13,
597,
261,
70,
63,
409,
300,
404,
65,
422,
261,
7229,
13,
2611,
3719,
288,
203,
5411,
309,
14015,
70,
63,
409,
300,
576,
65,
422,
261,
7229,
13,
2023,
13,
203,
7734,
747,
14015,
70,
63,
409,
300,
576,
65,
422,
261,
7229,
13,
2611,
13,
203,
10792,
597,
261,
70,
63,
409,
300,
890,
65,
422,
261,
7229,
13,
2023,
20349,
288,
203,
7734,
324,
63,
409,
65,
273,
261,
7229,
13,
2023,
31,
203,
7734,
679,
9904,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
2003,
16283,
18,
542,
1638,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
1220,
707,
2212,
3128,
1548,
3113,
16177,
3113,
2206,
18,
4898,
471,
2206,
838,
4898,
18,
203,
377,
380,
203,
377,
380,
632,
891,
2003,
7969,
3699,
358,
506,
5640,
203,
377,
380,
203,
377,
380,
632,
2463,
411,
710,
34,
5743,
1757,
710,
34,
309,
2212,
6894,
333,
3699,
4102,
2583,
8554,
203,
377,
380,
540,
5721,
326,
1365,
16,
578,
309,
326,
3699,
1914,
279,
446,
1160,
16,
3541,
203,
377,
380,
540,
411,
710,
34,
3767,
1757,
710,
34,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
735fcdb4ece341621ebe018055531d2c32c0f288 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/CoyoteAdapter.java | [
"MIT"
] | Java | checkNormalize | null | public static boolean checkNormalize(MessageBytes uriMB) {
CharChunk uriCC = uriMB.getCharChunk();
char[] c = uriCC.getChars();
int start = uriCC.getStart();
int end = uriCC.getEnd();
int pos = 0;
// Check for '\' and 0
for (pos = start; pos < end; pos++) {
if (c[pos] == '\\') {
return false;
}
if (c[pos] == 0) {
return false;
}
}
// Check for "//"
for (pos = start; pos < (end - 1); pos++) {
if (c[pos] == '/') {
if (c[pos + 1] == '/') {
return false;
}
}
}
// Check for ending with "/." or "/.."
if (((end - start) >= 2) && (c[end - 1] == '.')) {
if ((c[end - 2] == '/')
|| ((c[end - 2] == '.')
&& (c[end - 3] == '/'))) {
return false;
}
}
// Check for "/./"
if (uriCC.indexOf("/./", 0, 3, 0) >= 0) {
return false;
}
// Check for "/../"
if (uriCC.indexOf("/../", 0, 4, 0) >= 0) {
return false;
}
return true;
} | /**
* Check that the URI is normalized following character decoding. This
* method checks for "\", 0, "//", "/./" and "/../".
*
* @param uriMB URI to be checked (should be chars)
*
* @return <code>false</code> if sequences that are supposed to be
* normalized are still present in the URI, otherwise
* <code>true</code>
*/ | Check that the URI is normalized following character decoding.
@param uriMB URI to be checked (should be chars)
@return false if sequences that are supposed to be
normalized are still present in the URI, otherwise
true | [
"Check",
"that",
"the",
"URI",
"is",
"normalized",
"following",
"character",
"decoding",
".",
"@param",
"uriMB",
"URI",
"to",
"be",
"checked",
"(",
"should",
"be",
"chars",
")",
"@return",
"false",
"if",
"sequences",
"that",
"are",
"supposed",
"to",
"be",
"normalized",
"are",
"still",
"present",
"in",
"the",
"URI",
"otherwise",
"true"
] | public static boolean checkNormalize(MessageBytes uriMB) {
CharChunk uriCC = uriMB.getCharChunk();
char[] c = uriCC.getChars();
int start = uriCC.getStart();
int end = uriCC.getEnd();
int pos = 0;
for (pos = start; pos < end; pos++) {
if (c[pos] == '\\') {
return false;
}
if (c[pos] == 0) {
return false;
}
}
for (pos = start; pos < (end - 1); pos++) {
if (c[pos] == '/') {
if (c[pos + 1] == '/') {
return false;
}
}
}
if (((end - start) >= 2) && (c[end - 1] == '.')) {
if ((c[end - 2] == '/')
|| ((c[end - 2] == '.')
&& (c[end - 3] == '/'))) {
return false;
}
}
if (uriCC.indexOf("/./", 0, 3, 0) >= 0) {
return false;
}
if (uriCC.indexOf("/../", 0, 4, 0) >= 0) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"checkNormalize",
"(",
"MessageBytes",
"uriMB",
")",
"{",
"CharChunk",
"uriCC",
"=",
"uriMB",
".",
"getCharChunk",
"(",
")",
";",
"char",
"[",
"]",
"c",
"=",
"uriCC",
".",
"getChars",
"(",
")",
";",
"int",
"start",
"=",
"uriCC",
".",
"getStart",
"(",
")",
";",
"int",
"end",
"=",
"uriCC",
".",
"getEnd",
"(",
")",
";",
"int",
"pos",
"=",
"0",
";",
"for",
"(",
"pos",
"=",
"start",
";",
"pos",
"<",
"end",
";",
"pos",
"++",
")",
"{",
"if",
"(",
"c",
"[",
"pos",
"]",
"==",
"'\\\\'",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"c",
"[",
"pos",
"]",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"for",
"(",
"pos",
"=",
"start",
";",
"pos",
"<",
"(",
"end",
"-",
"1",
")",
";",
"pos",
"++",
")",
"{",
"if",
"(",
"c",
"[",
"pos",
"]",
"==",
"'/'",
")",
"{",
"if",
"(",
"c",
"[",
"pos",
"+",
"1",
"]",
"==",
"'/'",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"if",
"(",
"(",
"(",
"end",
"-",
"start",
")",
">=",
"2",
")",
"&&",
"(",
"c",
"[",
"end",
"-",
"1",
"]",
"==",
"'.'",
")",
")",
"{",
"if",
"(",
"(",
"c",
"[",
"end",
"-",
"2",
"]",
"==",
"'/'",
")",
"||",
"(",
"(",
"c",
"[",
"end",
"-",
"2",
"]",
"==",
"'.'",
")",
"&&",
"(",
"c",
"[",
"end",
"-",
"3",
"]",
"==",
"'/'",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"uriCC",
".",
"indexOf",
"(",
"\"/./\"",
",",
"0",
",",
"3",
",",
"0",
")",
">=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"uriCC",
".",
"indexOf",
"(",
"\"/../\"",
",",
"0",
",",
"4",
",",
"0",
")",
">=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Check that the URI is normalized following character decoding. | [
"Check",
"that",
"the",
"URI",
"is",
"normalized",
"following",
"character",
"decoding",
"."
] | [
"// Check for '\\' and 0",
"// Check for \"//\"",
"// Check for ending with \"/.\" or \"/..\"",
"// Check for \"/./\"",
"// Check for \"/../\""
] | [
{
"param": "uriMB",
"type": "MessageBytes"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "uriMB",
"type": "MessageBytes",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
866,
14380,
12,
1079,
2160,
2003,
7969,
13,
288,
203,
203,
3639,
3703,
5579,
2003,
6743,
273,
2003,
7969,
18,
588,
2156,
5579,
5621,
203,
3639,
1149,
8526,
276,
273,
2003,
6743,
18,
588,
7803,
5621,
203,
3639,
509,
787,
273,
2003,
6743,
18,
588,
1685,
5621,
203,
3639,
509,
679,
273,
2003,
6743,
18,
588,
1638,
5621,
203,
203,
3639,
509,
949,
273,
374,
31,
203,
203,
3639,
368,
2073,
364,
14118,
471,
374,
203,
3639,
364,
261,
917,
273,
787,
31,
949,
411,
679,
31,
949,
27245,
288,
203,
5411,
309,
261,
71,
63,
917,
65,
422,
5282,
13,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
5411,
309,
261,
71,
63,
917,
65,
422,
374,
13,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
368,
2073,
364,
31828,
203,
3639,
364,
261,
917,
273,
787,
31,
949,
411,
261,
409,
300,
404,
1769,
949,
27245,
288,
203,
5411,
309,
261,
71,
63,
917,
65,
422,
2023,
13,
288,
203,
7734,
309,
261,
71,
63,
917,
397,
404,
65,
422,
2023,
13,
288,
203,
10792,
327,
629,
31,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
368,
2073,
364,
11463,
598,
2206,
1199,
578,
2206,
18460,
203,
3639,
309,
261,
12443,
409,
300,
787,
13,
1545,
576,
13,
597,
261,
71,
63,
409,
300,
404,
65,
422,
2611,
3719,
288,
203,
5411,
309,
14015,
71,
63,
409,
300,
576,
65,
422,
2023,
13,
203,
10792,
747,
14015,
71,
63,
409,
300,
576,
65,
422,
2611,
13,
203,
10792,
597,
261,
71,
63,
409,
300,
890,
65,
422,
2023,
20349,
288,
203,
7734,
327,
629,
31,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
368,
2073,
364,
2206,
18,
4898,
203,
3639,
309,
261,
1650,
6743,
18,
31806,
2932,
15865,
19,
3113,
374,
16,
890,
16,
374,
13,
1545,
374,
13,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
203,
3639,
368,
2073,
364,
2206,
838,
4898,
203,
3639,
309,
261,
1650,
6743,
18,
31806,
2932,
19,
6216,
3113,
374,
16,
1059,
16,
374,
13,
1545,
374,
13,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
203,
3639,
327,
638,
31,
203,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2073,
716,
326,
3699,
353,
5640,
3751,
3351,
13547,
18,
1220,
203,
377,
380,
707,
4271,
364,
1548,
3113,
374,
16,
16177,
3113,
2206,
18,
4898,
471,
2206,
838,
4898,
18,
203,
377,
380,
203,
377,
380,
632,
891,
2003,
7969,
3699,
358,
506,
5950,
261,
13139,
506,
5230,
13,
203,
377,
380,
203,
377,
380,
632,
2463,
411,
710,
34,
5743,
1757,
710,
34,
309,
8463,
716,
854,
18405,
358,
506,
203,
377,
380,
540,
5640,
854,
4859,
3430,
316,
326,
3699,
16,
3541,
203,
377,
380,
540,
411,
710,
34,
3767,
1757,
710,
34,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7400d116ebed27021bb13e9f5b9b92d1828d67e7 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/NioEndpoint.java | [
"MIT"
] | Java | unbind | null | @Override
public void unbind() throws Exception {
if (log.isDebugEnabled()) {
log.debug("Destroy initiated for "+new InetSocketAddress(getAddress(),getPort()));
}
if (running) {
stop();
}
doCloseServerSocket();
destroySsl();
super.unbind();
if (getHandler() != null ) {
getHandler().recycle();
}
selectorPool.close();
if (log.isDebugEnabled()) {
log.debug("Destroy completed for "+new InetSocketAddress(getAddress(),getPort()));
}
} | /**
* Deallocate NIO memory pools, and close server socket.
*/ | Deallocate NIO memory pools, and close server socket. | [
"Deallocate",
"NIO",
"memory",
"pools",
"and",
"close",
"server",
"socket",
"."
] | @Override
public void unbind() throws Exception {
if (log.isDebugEnabled()) {
log.debug("Destroy initiated for "+new InetSocketAddress(getAddress(),getPort()));
}
if (running) {
stop();
}
doCloseServerSocket();
destroySsl();
super.unbind();
if (getHandler() != null ) {
getHandler().recycle();
}
selectorPool.close();
if (log.isDebugEnabled()) {
log.debug("Destroy completed for "+new InetSocketAddress(getAddress(),getPort()));
}
} | [
"@",
"Override",
"public",
"void",
"unbind",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Destroy initiated for \"",
"+",
"new",
"InetSocketAddress",
"(",
"getAddress",
"(",
")",
",",
"getPort",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"running",
")",
"{",
"stop",
"(",
")",
";",
"}",
"doCloseServerSocket",
"(",
")",
";",
"destroySsl",
"(",
")",
";",
"super",
".",
"unbind",
"(",
")",
";",
"if",
"(",
"getHandler",
"(",
")",
"!=",
"null",
")",
"{",
"getHandler",
"(",
")",
".",
"recycle",
"(",
")",
";",
"}",
"selectorPool",
".",
"close",
"(",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Destroy completed for \"",
"+",
"new",
"InetSocketAddress",
"(",
"getAddress",
"(",
")",
",",
"getPort",
"(",
")",
")",
")",
";",
"}",
"}"
] | Deallocate NIO memory pools, and close server socket. | [
"Deallocate",
"NIO",
"memory",
"pools",
"and",
"close",
"server",
"socket",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
17449,
1435,
1216,
1185,
288,
203,
3639,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
5411,
613,
18,
4148,
2932,
10740,
27183,
364,
13773,
2704,
17943,
12,
588,
1887,
9334,
588,
2617,
1435,
10019,
203,
3639,
289,
203,
3639,
309,
261,
8704,
13,
288,
203,
5411,
2132,
5621,
203,
3639,
289,
203,
3639,
741,
4605,
2081,
4534,
5621,
203,
3639,
5546,
15840,
5621,
203,
3639,
2240,
18,
318,
4376,
5621,
203,
3639,
309,
261,
588,
1503,
1435,
480,
446,
262,
288,
203,
5411,
18945,
7675,
266,
13946,
5621,
203,
3639,
289,
203,
3639,
3451,
2864,
18,
4412,
5621,
203,
3639,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
5411,
613,
18,
4148,
2932,
10740,
5951,
364,
13773,
2704,
17943,
12,
588,
1887,
9334,
588,
2617,
1435,
10019,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1505,
16247,
423,
4294,
3778,
16000,
16,
471,
1746,
1438,
2987,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
a45e41253a710053a18da281b7d7f7429258f5bc | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/AbstractProtocol.java | [
"MIT"
] | Java | release | null | private void release(Processor processor) {
if (processor != null) {
processor.recycle();
// After recycling, only instances of UpgradeProcessorBase will
// return true for isUpgrade().
// Instances of UpgradeProcessorBase should not be added to
// recycledProcessors since that pool is only for AJP or HTTP
// processors
if (!processor.isUpgrade()) {
recycledProcessors.push(processor);
if (getLog().isDebugEnabled()) {
getLog().debug("Pushed Processor [" + processor + "]");
}
}
}
} | /**
* Expected to be used by the handler once the processor is no longer
* required.
*
* @param processor Processor being released (that was associated with
* the socket)
*/ | Expected to be used by the handler once the processor is no longer
required.
@param processor Processor being released (that was associated with
the socket) | [
"Expected",
"to",
"be",
"used",
"by",
"the",
"handler",
"once",
"the",
"processor",
"is",
"no",
"longer",
"required",
".",
"@param",
"processor",
"Processor",
"being",
"released",
"(",
"that",
"was",
"associated",
"with",
"the",
"socket",
")"
] | private void release(Processor processor) {
if (processor != null) {
processor.recycle();
if (!processor.isUpgrade()) {
recycledProcessors.push(processor);
if (getLog().isDebugEnabled()) {
getLog().debug("Pushed Processor [" + processor + "]");
}
}
}
} | [
"private",
"void",
"release",
"(",
"Processor",
"processor",
")",
"{",
"if",
"(",
"processor",
"!=",
"null",
")",
"{",
"processor",
".",
"recycle",
"(",
")",
";",
"if",
"(",
"!",
"processor",
".",
"isUpgrade",
"(",
")",
")",
"{",
"recycledProcessors",
".",
"push",
"(",
"processor",
")",
";",
"if",
"(",
"getLog",
"(",
")",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Pushed Processor [\"",
"+",
"processor",
"+",
"\"]\"",
")",
";",
"}",
"}",
"}",
"}"
] | Expected to be used by the handler once the processor is no longer
required. | [
"Expected",
"to",
"be",
"used",
"by",
"the",
"handler",
"once",
"the",
"processor",
"is",
"no",
"longer",
"required",
"."
] | [
"// After recycling, only instances of UpgradeProcessorBase will",
"// return true for isUpgrade().",
"// Instances of UpgradeProcessorBase should not be added to",
"// recycledProcessors since that pool is only for AJP or HTTP",
"// processors"
] | [
{
"param": "processor",
"type": "Processor"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "processor",
"type": "Processor",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
3992,
12,
5164,
6659,
13,
288,
203,
5411,
309,
261,
8700,
480,
446,
13,
288,
203,
7734,
6659,
18,
266,
13946,
5621,
203,
7734,
368,
7360,
25745,
830,
310,
16,
1338,
3884,
434,
17699,
5164,
2171,
903,
203,
7734,
368,
327,
638,
364,
353,
10784,
7675,
203,
7734,
368,
18357,
434,
17699,
5164,
2171,
1410,
486,
506,
3096,
358,
203,
7734,
368,
25745,
71,
1259,
18155,
3241,
716,
2845,
353,
1338,
364,
432,
29532,
578,
2239,
203,
7734,
368,
13399,
203,
7734,
309,
16051,
8700,
18,
291,
10784,
10756,
288,
203,
10792,
25745,
71,
1259,
18155,
18,
6206,
12,
8700,
1769,
203,
10792,
309,
261,
588,
1343,
7675,
291,
2829,
1526,
10756,
288,
203,
13491,
9189,
7675,
4148,
2932,
7621,
329,
15476,
8247,
397,
6659,
397,
9870,
1769,
203,
10792,
289,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
353,
1158,
7144,
203,
540,
380,
1931,
18,
203,
540,
380,
203,
540,
380,
632,
891,
6659,
15476,
3832,
15976,
261,
19056,
1703,
3627,
598,
203,
540,
380,
5375,
326,
2987,
13,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
a45e41253a710053a18da281b7d7f7429258f5bc | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/AbstractProtocol.java | [
"MIT"
] | Java | release | null | @Override
public void release(SocketWrapperBase<S> socketWrapper) {
S socket = socketWrapper.getSocket();
Processor processor = connections.remove(socket);
release(processor);
} | /**
* Expected to be used by the Endpoint to release resources on socket
* close, errors etc.
*/ | Expected to be used by the Endpoint to release resources on socket
close, errors etc. | [
"Expected",
"to",
"be",
"used",
"by",
"the",
"Endpoint",
"to",
"release",
"resources",
"on",
"socket",
"close",
"errors",
"etc",
"."
] | @Override
public void release(SocketWrapperBase<S> socketWrapper) {
S socket = socketWrapper.getSocket();
Processor processor = connections.remove(socket);
release(processor);
} | [
"@",
"Override",
"public",
"void",
"release",
"(",
"SocketWrapperBase",
"<",
"S",
">",
"socketWrapper",
")",
"{",
"S",
"socket",
"=",
"socketWrapper",
".",
"getSocket",
"(",
")",
";",
"Processor",
"processor",
"=",
"connections",
".",
"remove",
"(",
"socket",
")",
";",
"release",
"(",
"processor",
")",
";",
"}"
] | Expected to be used by the Endpoint to release resources on socket
close, errors etc. | [
"Expected",
"to",
"be",
"used",
"by",
"the",
"Endpoint",
"to",
"release",
"resources",
"on",
"socket",
"close",
"errors",
"etc",
"."
] | [] | [
{
"param": "socketWrapper",
"type": "SocketWrapperBase<S>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "socketWrapper",
"type": "SocketWrapperBase<S>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
3639,
1071,
918,
3992,
12,
4534,
3611,
2171,
32,
55,
34,
2987,
3611,
13,
288,
203,
5411,
348,
2987,
273,
2987,
3611,
18,
588,
4534,
5621,
203,
5411,
15476,
6659,
273,
5921,
18,
4479,
12,
7814,
1769,
203,
5411,
3992,
12,
8700,
1769,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
13219,
358,
506,
1399,
635,
326,
6961,
358,
3992,
2703,
603,
2987,
203,
540,
380,
1746,
16,
1334,
5527,
18,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
a45e41253a710053a18da281b7d7f7429258f5bc | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/AbstractProtocol.java | [
"MIT"
] | Java | run | null | @Override
public void run() {
// Loop until we receive a shutdown command
while (asyncTimeoutRunning) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
long now = System.currentTimeMillis();
for (Processor processor : waitingProcessors) {
processor.timeoutAsync(now);
}
// Loop if endpoint is paused
while (endpoint.isPaused() && asyncTimeoutRunning) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
}
} | /**
* The background thread that checks async requests and fires the
* timeout if there has been no activity.
*/ | The background thread that checks async requests and fires the
timeout if there has been no activity. | [
"The",
"background",
"thread",
"that",
"checks",
"async",
"requests",
"and",
"fires",
"the",
"timeout",
"if",
"there",
"has",
"been",
"no",
"activity",
"."
] | @Override
public void run() {
while (asyncTimeoutRunning) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
long now = System.currentTimeMillis();
for (Processor processor : waitingProcessors) {
processor.timeoutAsync(now);
}
while (endpoint.isPaused() && asyncTimeoutRunning) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"while",
"(",
"asyncTimeoutRunning",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"for",
"(",
"Processor",
"processor",
":",
"waitingProcessors",
")",
"{",
"processor",
".",
"timeoutAsync",
"(",
"now",
")",
";",
"}",
"while",
"(",
"endpoint",
".",
"isPaused",
"(",
")",
"&&",
"asyncTimeoutRunning",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}",
"}",
"}"
] | The background thread that checks async requests and fires the
timeout if there has been no activity. | [
"The",
"background",
"thread",
"that",
"checks",
"async",
"requests",
"and",
"fires",
"the",
"timeout",
"if",
"there",
"has",
"been",
"no",
"activity",
"."
] | [
"// Loop until we receive a shutdown command",
"// Ignore",
"// Loop if endpoint is paused",
"// Ignore"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
3639,
1071,
918,
1086,
1435,
288,
203,
203,
5411,
368,
9720,
3180,
732,
6798,
279,
5731,
1296,
203,
5411,
1323,
261,
3810,
2694,
7051,
13,
288,
203,
7734,
775,
288,
203,
10792,
4884,
18,
19607,
12,
18088,
1769,
203,
7734,
289,
1044,
261,
24485,
503,
425,
13,
288,
203,
10792,
368,
8049,
203,
7734,
289,
203,
7734,
1525,
2037,
273,
2332,
18,
2972,
28512,
5621,
203,
7734,
364,
261,
5164,
6659,
294,
7336,
18155,
13,
288,
203,
10402,
6659,
18,
4538,
2771,
12,
3338,
1769,
203,
7734,
289,
203,
203,
7734,
368,
9720,
309,
2494,
353,
17781,
203,
7734,
1323,
261,
8003,
18,
291,
28590,
1435,
597,
4326,
2694,
7051,
13,
288,
203,
10792,
775,
288,
203,
13491,
4884,
18,
19607,
12,
18088,
1769,
203,
10792,
289,
1044,
261,
24485,
503,
425,
13,
288,
203,
13491,
368,
8049,
203,
10792,
289,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
1021,
5412,
2650,
716,
4271,
4326,
3285,
471,
29564,
326,
203,
540,
380,
2021,
309,
1915,
711,
2118,
1158,
5728,
18,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testRequestBodySwallowing | null | @Test
public void testRequestBodySwallowing() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
Context ctx = tomcat.addContext("", null);
DispatchingServlet servlet = new DispatchingServlet();
Wrapper w = Tomcat.addServlet(ctx, "Test", servlet);
w.setAsyncSupported(true);
ctx.addServletMappingDecoded("/test", "Test");
tomcat.start();
// Hand-craft the client so we have complete control over the timing
SocketAddress addr = new InetSocketAddress("localhost", getPort());
Socket socket = new Socket();
socket.setSoTimeout(300000);
socket.connect(addr,300000);
OutputStream os = socket.getOutputStream();
Writer writer = new OutputStreamWriter(os, "ISO-8859-1");
InputStream is = socket.getInputStream();
Reader r = new InputStreamReader(is, "ISO-8859-1");
BufferedReader reader = new BufferedReader(r);
// Write the headers
writer.write("POST /test HTTP/1.1\r\n");
writer.write("Host: localhost:8080\r\n");
writer.write("Transfer-Encoding: chunked\r\n");
writer.write("\r\n");
writer.flush();
validateResponse(reader);
// Write the request body
writer.write("2\r\n");
writer.write("AB\r\n");
writer.write("0\r\n");
writer.write("\r\n");
writer.flush();
// Write the 2nd request
writer.write("POST /test HTTP/1.1\r\n");
writer.write("Host: localhost:8080\r\n");
writer.write("Transfer-Encoding: chunked\r\n");
writer.write("\r\n");
writer.flush();
// Read the 2nd response
validateResponse(reader);
// Write the 2nd request body
writer.write("2\r\n");
writer.write("AB\r\n");
writer.write("0\r\n");
writer.write("\r\n");
writer.flush();
// Done
socket.close();
} | /*
* Tests what happens if a request is completed during a dispatch but the
* request body has not been fully read.
*/ | Tests what happens if a request is completed during a dispatch but the
request body has not been fully read. | [
"Tests",
"what",
"happens",
"if",
"a",
"request",
"is",
"completed",
"during",
"a",
"dispatch",
"but",
"the",
"request",
"body",
"has",
"not",
"been",
"fully",
"read",
"."
] | @Test
public void testRequestBodySwallowing() throws Exception {
Tomcat tomcat = getTomcatInstance();
Context ctx = tomcat.addContext("", null);
DispatchingServlet servlet = new DispatchingServlet();
Wrapper w = Tomcat.addServlet(ctx, "Test", servlet);
w.setAsyncSupported(true);
ctx.addServletMappingDecoded("/test", "Test");
tomcat.start();
SocketAddress addr = new InetSocketAddress("localhost", getPort());
Socket socket = new Socket();
socket.setSoTimeout(300000);
socket.connect(addr,300000);
OutputStream os = socket.getOutputStream();
Writer writer = new OutputStreamWriter(os, "ISO-8859-1");
InputStream is = socket.getInputStream();
Reader r = new InputStreamReader(is, "ISO-8859-1");
BufferedReader reader = new BufferedReader(r);
writer.write("POST /test HTTP/1.1\r\n");
writer.write("Host: localhost:8080\r\n");
writer.write("Transfer-Encoding: chunked\r\n");
writer.write("\r\n");
writer.flush();
validateResponse(reader);
writer.write("2\r\n");
writer.write("AB\r\n");
writer.write("0\r\n");
writer.write("\r\n");
writer.flush();
writer.write("POST /test HTTP/1.1\r\n");
writer.write("Host: localhost:8080\r\n");
writer.write("Transfer-Encoding: chunked\r\n");
writer.write("\r\n");
writer.flush();
validateResponse(reader);
body
writer.write("2\r\n");
writer.write("AB\r\n");
writer.write("0\r\n");
writer.write("\r\n");
writer.flush();
socket.close();
} | [
"@",
"Test",
"public",
"void",
"testRequestBodySwallowing",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"DispatchingServlet",
"servlet",
"=",
"new",
"DispatchingServlet",
"(",
")",
";",
"Wrapper",
"w",
"=",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"Test\"",
",",
"servlet",
")",
";",
"w",
".",
"setAsyncSupported",
"(",
"true",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/test\"",
",",
"\"Test\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"SocketAddress",
"addr",
"=",
"new",
"InetSocketAddress",
"(",
"\"localhost\"",
",",
"getPort",
"(",
")",
")",
";",
"Socket",
"socket",
"=",
"new",
"Socket",
"(",
")",
";",
"socket",
".",
"setSoTimeout",
"(",
"300000",
")",
";",
"socket",
".",
"connect",
"(",
"addr",
",",
"300000",
")",
";",
"OutputStream",
"os",
"=",
"socket",
".",
"getOutputStream",
"(",
")",
";",
"Writer",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"os",
",",
"\"ISO-8859-1\"",
")",
";",
"InputStream",
"is",
"=",
"socket",
".",
"getInputStream",
"(",
")",
";",
"Reader",
"r",
"=",
"new",
"InputStreamReader",
"(",
"is",
",",
"\"ISO-8859-1\"",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"r",
")",
";",
"writer",
".",
"write",
"(",
"\"POST /test HTTP/1.1\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"Host: localhost:8080\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"Transfer-Encoding: chunked\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"\\r\\n\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"validateResponse",
"(",
"reader",
")",
";",
"writer",
".",
"write",
"(",
"\"2\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"AB\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"0\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"\\r\\n\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"write",
"(",
"\"POST /test HTTP/1.1\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"Host: localhost:8080\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"Transfer-Encoding: chunked\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"\\r\\n\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"validateResponse",
"(",
"reader",
")",
";",
"writer",
".",
"write",
"(",
"\"2\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"AB\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"0\\r\\n\"",
")",
";",
"writer",
".",
"write",
"(",
"\"\\r\\n\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"socket",
".",
"close",
"(",
")",
";",
"}"
] | Tests what happens if a request is completed during a dispatch but the
request body has not been fully read. | [
"Tests",
"what",
"happens",
"if",
"a",
"request",
"is",
"completed",
"during",
"a",
"dispatch",
"but",
"the",
"request",
"body",
"has",
"not",
"been",
"fully",
"read",
"."
] | [
"// No file system docBase required",
"// Hand-craft the client so we have complete control over the timing",
"// Write the headers",
"// Write the request body",
"// Write the 2nd request",
"// Read the 2nd response",
"// Write the 2nd request body",
"// Done"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
28843,
6050,
5965,
310,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
11552,
310,
4745,
8100,
273,
394,
11552,
310,
4745,
5621,
203,
3639,
18735,
341,
273,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
4709,
3113,
8100,
1769,
203,
3639,
341,
18,
542,
2771,
7223,
12,
3767,
1769,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
3813,
3113,
315,
4709,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
368,
2841,
17,
71,
5015,
326,
1004,
1427,
732,
1240,
3912,
3325,
1879,
326,
15538,
203,
3639,
8758,
1887,
3091,
273,
394,
17943,
2932,
13014,
3113,
11036,
10663,
203,
3639,
8758,
2987,
273,
394,
8758,
5621,
203,
3639,
2987,
18,
542,
10225,
2694,
12,
23,
11706,
1769,
203,
3639,
2987,
18,
3612,
12,
4793,
16,
23,
11706,
1769,
203,
3639,
8962,
1140,
273,
2987,
18,
588,
4632,
5621,
203,
3639,
5497,
2633,
273,
394,
24248,
12,
538,
16,
315,
12609,
17,
17258,
17,
21,
8863,
203,
3639,
5037,
353,
273,
2987,
18,
588,
4348,
5621,
203,
3639,
5393,
436,
273,
394,
15322,
12,
291,
16,
315,
12609,
17,
17258,
17,
21,
8863,
203,
3639,
10633,
2949,
273,
394,
10633,
12,
86,
1769,
203,
203,
3639,
368,
2598,
326,
1607,
203,
3639,
2633,
18,
2626,
2932,
3798,
342,
3813,
2239,
19,
21,
18,
21,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
2932,
2594,
30,
17365,
30,
3672,
3672,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
2932,
5912,
17,
4705,
30,
19949,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
31458,
86,
64,
82,
8863,
203,
3639,
2633,
18,
11330,
5621,
203,
203,
3639,
1954,
1064,
12,
10530,
1769,
203,
203,
3639,
368,
2598,
326,
590,
1417,
203,
3639,
2633,
18,
2626,
2932,
22,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
2932,
2090,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
2932,
20,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
31458,
86,
64,
82,
8863,
203,
3639,
2633,
18,
11330,
5621,
203,
203,
3639,
368,
2598,
326,
576,
4880,
590,
203,
3639,
2633,
18,
2626,
2932,
3798,
342,
3813,
2239,
19,
21,
18,
21,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
2932,
2594,
30,
17365,
30,
3672,
3672,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
2932,
5912,
17,
4705,
30,
19949,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
31458,
86,
64,
82,
8863,
203,
3639,
2633,
18,
11330,
5621,
203,
203,
3639,
368,
2720,
326,
576,
4880,
766,
203,
3639,
1954,
1064,
12,
10530,
1769,
203,
203,
3639,
368,
2598,
326,
576,
4880,
590,
1417,
203,
3639,
2633,
18,
2626,
2932,
22,
64,
86,
64,
82,
8863,
203,
3639,
2633,
18,
2626,
2932,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
20308,
203,
377,
380,
7766,
87,
4121,
10555,
309,
279,
590,
353,
5951,
4982,
279,
3435,
1496,
326,
203,
377,
380,
590,
1417,
711,
486,
2118,
7418,
855,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testMultipleHostHeader02 | null | @Test
public void testMultipleHostHeader02() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 400 response.
Assert.assertTrue(client.isResponse400());
} | /*
* Multiple instances of the same Host header
*/ | Multiple instances of the same Host header | [
"Multiple",
"instances",
"of",
"the",
"same",
"Host",
"header"
] | @Test
public void testMultipleHostHeader02() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse400());
} | [
"@",
"Test",
"public",
"void",
"testMultipleHostHeader02",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"TesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET /foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: a\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: a\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse400",
"(",
")",
")",
";",
"}"
] | Multiple instances of the same Host header | [
"Multiple",
"instances",
"of",
"the",
"same",
"Host",
"header"
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 400 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
8438,
2594,
1864,
3103,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
399,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
342,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
279,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
279,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
7409,
766,
18,
203,
3639,
5452,
18,
11231,
5510,
12,
2625,
18,
291,
1064,
16010,
10663,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
13531,
3884,
434,
326,
1967,
4893,
1446,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testInconsistentHostHeader04 | null | @Test
public void testInconsistentHostHeader04() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
tomcat.getConnector().setAttribute("allowHostHeaderMismatch", "false");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 400 response.
Assert.assertTrue(client.isResponse400());
} | /*
* Hostname (no port) is included in the request line, but Host header
* is empty.
* Added for bug 62739.
*/ | Hostname (no port) is included in the request line, but Host header
is empty. | [
"Hostname",
"(",
"no",
"port",
")",
"is",
"included",
"in",
"the",
"request",
"line",
"but",
"Host",
"header",
"is",
"empty",
"."
] | @Test
public void testInconsistentHostHeader04() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
tomcat.getConnector().setAttribute("allowHostHeaderMismatch", "false");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse400());
} | [
"@",
"Test",
"public",
"void",
"testInconsistentHostHeader04",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"allowHostHeaderMismatch\"",
",",
"\"false\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"TesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET http://a/foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: \"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse400",
"(",
")",
")",
";",
"}"
] | Hostname (no port) is included in the request line, but Host header
is empty. | [
"Hostname",
"(",
"no",
"port",
")",
"is",
"included",
"in",
"the",
"request",
"line",
"but",
"Host",
"header",
"is",
"empty",
"."
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 400 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
382,
16952,
2594,
1864,
3028,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
5965,
2594,
1864,
16901,
3113,
315,
5743,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
399,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
1062,
2207,
69,
19,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
315,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
17423,
261,
2135,
1756,
13,
353,
5849,
316,
326,
590,
980,
16,
1496,
4893,
1446,
203,
377,
380,
353,
1008,
18,
203,
377,
380,
25808,
364,
7934,
1666,
5324,
5520,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testInconsistentHostHeader05 | null | @Test
public void testInconsistentHostHeader05() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
tomcat.getConnector().setAttribute("allowHostHeaderMismatch", "false");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 400 response.
Assert.assertTrue(client.isResponse400());
} | /*
* Hostname (with port) is included in the request line, but Host header
* is empty.
* Added for bug 62739.
*/ | Hostname (with port) is included in the request line, but Host header
is empty. | [
"Hostname",
"(",
"with",
"port",
")",
"is",
"included",
"in",
"the",
"request",
"line",
"but",
"Host",
"header",
"is",
"empty",
"."
] | @Test
public void testInconsistentHostHeader05() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
tomcat.getConnector().setAttribute("allowHostHeaderMismatch", "false");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse400());
} | [
"@",
"Test",
"public",
"void",
"testInconsistentHostHeader05",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"allowHostHeaderMismatch\"",
",",
"\"false\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"TesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET http://a:8080/foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: \"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse400",
"(",
")",
")",
";",
"}"
] | Hostname (with port) is included in the request line, but Host header
is empty. | [
"Hostname",
"(",
"with",
"port",
")",
"is",
"included",
"in",
"the",
"request",
"line",
"but",
"Host",
"header",
"is",
"empty",
"."
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 400 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
382,
16952,
2594,
1864,
6260,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
5965,
2594,
1864,
16901,
3113,
315,
5743,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
399,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
1062,
2207,
69,
30,
3672,
3672,
19,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
315,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
7409,
766,
18,
203,
3639,
5452,
18,
11231,
5510,
12,
2625,
18,
291,
1064,
16010,
10663,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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,
16,
1496,
4893,
1446,
203,
377,
380,
353,
1008,
18,
203,
377,
380,
25808,
364,
7934,
1666,
5324,
5520,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testInconsistentHostHeader06 | null | @Test
public void testInconsistentHostHeader06() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
tomcat.getConnector().setAttribute("allowHostHeaderMismatch", "false");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 400 response.
Assert.assertTrue(client.isResponse400());
} | /*
* Hostname (with port and user) is included in the request line, but Host
* header is empty.
* Added for bug 62739.
*/ | Hostname (with port and user) is included in the request line, but Host
header is empty. | [
"Hostname",
"(",
"with",
"port",
"and",
"user",
")",
"is",
"included",
"in",
"the",
"request",
"line",
"but",
"Host",
"header",
"is",
"empty",
"."
] | @Test
public void testInconsistentHostHeader06() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
tomcat.getConnector().setAttribute("allowHostHeaderMismatch", "false");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse400());
} | [
"@",
"Test",
"public",
"void",
"testInconsistentHostHeader06",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"allowHostHeaderMismatch\"",
",",
"\"false\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"TesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET http://user:pwd@a/foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: \"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse400",
"(",
")",
")",
";",
"}"
] | Hostname (with port and user) is included in the request line, but Host
header is empty. | [
"Hostname",
"(",
"with",
"port",
"and",
"user",
")",
"is",
"included",
"in",
"the",
"request",
"line",
"but",
"Host",
"header",
"is",
"empty",
"."
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 400 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
382,
16952,
2594,
1864,
7677,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
5965,
2594,
1864,
16901,
3113,
315,
5743,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
399,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
1062,
2207,
1355,
30,
27487,
36,
69,
19,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
315,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
7409,
766,
18,
203,
3639,
5452,
18,
11231,
5510,
12,
2625,
18,
291,
1064,
16010,
10663,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
17423,
261,
1918,
1756,
471,
729,
13,
353,
5849,
316,
326,
590,
980,
16,
1496,
4893,
203,
377,
380,
1446,
353,
1008,
18,
203,
377,
380,
25808,
364,
7934,
1666,
5324,
5520,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testConsistentHostHeader01 | null | @Test
public void testConsistentHostHeader01() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 200 response.
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80", client.getResponseBody());
} | /*
* Request line host is an exact match for Host header (no port)
*/ | Request line host is an exact match for Host header (no port) | [
"Request",
"line",
"host",
"is",
"an",
"exact",
"match",
"for",
"Host",
"header",
"(",
"no",
"port",
")"
] | @Test
public void testConsistentHostHeader01() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80", client.getResponseBody());
} | [
"@",
"Test",
"public",
"void",
"testConsistentHostHeader01",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"ServerNameTesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET http://a/foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: a\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse200",
"(",
")",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"request.getServerName() is [a] and request.getServerPort() is 80\"",
",",
"client",
".",
"getResponseBody",
"(",
")",
")",
";",
"}"
] | Request line host is an exact match for Host header (no port) | [
"Request",
"line",
"host",
"is",
"an",
"exact",
"match",
"for",
"Host",
"header",
"(",
"no",
"port",
")"
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 200 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
17579,
319,
2594,
1864,
1611,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
3224,
461,
56,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
1062,
2207,
69,
19,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
279,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
4044,
766,
18,
203,
3639,
5452,
18,
11231,
5510,
12,
2625,
18,
291,
1064,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
1567,
980,
1479,
353,
392,
5565,
845,
364,
4893,
1446,
261,
2135,
1756,
13,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testConsistentHostHeader02 | null | @Test
public void testConsistentHostHeader02() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a:8080" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 200 response.
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 8080", client.getResponseBody());
} | /*
* Request line host is an exact match for Host header (with port)
*/ | Request line host is an exact match for Host header (with port) | [
"Request",
"line",
"host",
"is",
"an",
"exact",
"match",
"for",
"Host",
"header",
"(",
"with",
"port",
")"
] | @Test
public void testConsistentHostHeader02() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://a:8080/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a:8080" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 8080", client.getResponseBody());
} | [
"@",
"Test",
"public",
"void",
"testConsistentHostHeader02",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"ServerNameTesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET http://a:8080/foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: a:8080\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse200",
"(",
")",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"request.getServerName() is [a] and request.getServerPort() is 8080\"",
",",
"client",
".",
"getResponseBody",
"(",
")",
")",
";",
"}"
] | Request line host is an exact match for Host header (with port) | [
"Request",
"line",
"host",
"is",
"an",
"exact",
"match",
"for",
"Host",
"header",
"(",
"with",
"port",
")"
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 200 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
17579,
319,
2594,
1864,
3103,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
3224,
461,
56,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
1062,
2207,
69,
30,
3672,
3672,
19,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
279,
30,
3672,
3672,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
4044,
766,
18,
203,
3639,
5452,
18,
11231,
5510,
12,
2625,
18,
291,
1064,
6976,
10663,
203,
3639,
5452,
18,
11231,
8867,
2932,
2293,
18,
588,
28434,
1435,
353,
306,
69,
65,
471,
590,
18,
588,
2081,
2617,
1435,
353,
8958,
3672,
3113,
1004,
18,
588,
23269,
10663,
203,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testConsistentHostHeader03 | null | @Test
public void testConsistentHostHeader03() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 200 response.
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80", client.getResponseBody());
} | /*
* Request line host is an exact match for Host header
* (no port, with user info)
*/ | Request line host is an exact match for Host header
(no port, with user info) | [
"Request",
"line",
"host",
"is",
"an",
"exact",
"match",
"for",
"Host",
"header",
"(",
"no",
"port",
"with",
"user",
"info",
")"
] | @Test
public void testConsistentHostHeader03() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET http://user:pwd@a/foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: a" + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [a] and request.getServerPort() is 80", client.getResponseBody());
} | [
"@",
"Test",
"public",
"void",
"testConsistentHostHeader03",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"ServerNameTesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET http://user:pwd@a/foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: a\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse200",
"(",
")",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"request.getServerName() is [a] and request.getServerPort() is 80\"",
",",
"client",
".",
"getResponseBody",
"(",
")",
")",
";",
"}"
] | Request line host is an exact match for Host header
(no port, with user info) | [
"Request",
"line",
"host",
"is",
"an",
"exact",
"match",
"for",
"Host",
"header",
"(",
"no",
"port",
"with",
"user",
"info",
")"
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 200 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
17579,
319,
2594,
1864,
4630,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
3224,
461,
56,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
1062,
2207,
1355,
30,
27487,
36,
69,
19,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
279,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
4044,
766,
18,
203,
3639,
5452,
18,
11231,
5510,
12,
2625,
18,
291,
1064,
6976,
10663,
203,
3639,
5452,
18,
11231,
8867,
2932,
2293,
18,
588,
28434,
1435,
353,
306,
69,
65,
471,
590,
18,
588,
2081,
2617,
1435,
353,
8958,
3113,
1004,
18,
588,
23269,
10663,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
1567,
980,
1479,
353,
392,
5565,
845,
364,
4893,
1446,
203,
377,
380,
261,
2135,
1756,
16,
598,
729,
1123,
13,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testBlankHostHeader01 | null | @Test
public void testBlankHostHeader01() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 200 response.
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(), client.getResponseBody());
} | /*
* Host header exists but its value is an empty string. This is valid if
* the request line does not include a hostname/port.
* Added for bug 62739.
*/ | Host header exists but its value is an empty string. This is valid if
the request line does not include a hostname/port. | [
"Host",
"header",
"exists",
"but",
"its",
"value",
"is",
"an",
"empty",
"string",
".",
"This",
"is",
"valid",
"if",
"the",
"request",
"line",
"does",
"not",
"include",
"a",
"hostname",
"/",
"port",
"."
] | @Test
public void testBlankHostHeader01() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(), client.getResponseBody());
} | [
"@",
"Test",
"public",
"void",
"testBlankHostHeader01",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"ServerNameTesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET /foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: \"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse200",
"(",
")",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"request.getServerName() is [] and request.getServerPort() is \"",
"+",
"getPort",
"(",
")",
",",
"client",
".",
"getResponseBody",
"(",
")",
")",
";",
"}"
] | Host header exists but its value is an empty string. | [
"Host",
"header",
"exists",
"but",
"its",
"value",
"is",
"an",
"empty",
"string",
"."
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 200 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
7796,
2594,
1864,
1611,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
3224,
461,
56,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
342,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
315,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
4044,
766,
18,
203,
3639,
5452,
18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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
4893,
1446,
1704,
1496,
2097,
460,
353,
392,
1008,
533,
18,
225,
1220,
353,
923,
309,
203,
377,
380,
326,
590,
980,
1552,
486,
2341,
279,
5199,
19,
655,
18,
203,
377,
380,
25808,
364,
7934,
1666,
5324,
5520,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c0c26b3a089ba5f9cf1814ad4f1f6202d0d2e01a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/test/org/apache/coyote/http11/TestHttp11Processor.java | [
"MIT"
] | Java | testBlankHostHeader02 | null | @Test
public void testBlankHostHeader02() throws Exception {
Tomcat tomcat = getTomcatInstance();
// This setting means the connection will be closed at the end of the
// request
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
// No file system docBase required
Context ctx = tomcat.addContext("", null);
// Add servlet
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
// Expected response is a 200 response.
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(), client.getResponseBody());
} | /*
* Host header exists but has its value is empty (and there are multiple
* spaces after the ':'. This is valid if the request line does not
* include a hostname/port.
* Added for bug 62739.
*/ | Host header exists but has its value is empty (and there are multiple
spaces after the ':'. This is valid if the request line does not
include a hostname/port. | [
"Host",
"header",
"exists",
"but",
"has",
"its",
"value",
"is",
"empty",
"(",
"and",
"there",
"are",
"multiple",
"spaces",
"after",
"the",
"'",
":",
"'",
".",
"This",
"is",
"valid",
"if",
"the",
"request",
"line",
"does",
"not",
"include",
"a",
"hostname",
"/",
"port",
"."
] | @Test
public void testBlankHostHeader02() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
Context ctx = tomcat.addContext("", null);
Tomcat.addServlet(ctx, "TesterServlet", new ServerNameTesterServlet());
ctx.addServletMappingDecoded("/foo", "TesterServlet");
tomcat.start();
String request =
"GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: " + SimpleHttpClient.CRLF +
SimpleHttpClient.CRLF;
Client client = new Client(tomcat.getConnector().getLocalPort());
client.setRequest(new String[] {request});
client.connect();
client.processRequest();
Assert.assertTrue(client.isResponse200());
Assert.assertEquals("request.getServerName() is [] and request.getServerPort() is " + getPort(), client.getResponseBody());
} | [
"@",
"Test",
"public",
"void",
"testBlankHostHeader02",
"(",
")",
"throws",
"Exception",
"{",
"Tomcat",
"tomcat",
"=",
"getTomcatInstance",
"(",
")",
";",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"setAttribute",
"(",
"\"maxKeepAliveRequests\"",
",",
"\"1\"",
")",
";",
"Context",
"ctx",
"=",
"tomcat",
".",
"addContext",
"(",
"\"\"",
",",
"null",
")",
";",
"Tomcat",
".",
"addServlet",
"(",
"ctx",
",",
"\"TesterServlet\"",
",",
"new",
"ServerNameTesterServlet",
"(",
")",
")",
";",
"ctx",
".",
"addServletMappingDecoded",
"(",
"\"/foo\"",
",",
"\"TesterServlet\"",
")",
";",
"tomcat",
".",
"start",
"(",
")",
";",
"String",
"request",
"=",
"\"GET /foo HTTP/1.1\"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"\"Host: \"",
"+",
"SimpleHttpClient",
".",
"CRLF",
"+",
"SimpleHttpClient",
".",
"CRLF",
";",
"Client",
"client",
"=",
"new",
"Client",
"(",
"tomcat",
".",
"getConnector",
"(",
")",
".",
"getLocalPort",
"(",
")",
")",
";",
"client",
".",
"setRequest",
"(",
"new",
"String",
"[",
"]",
"{",
"request",
"}",
")",
";",
"client",
".",
"connect",
"(",
")",
";",
"client",
".",
"processRequest",
"(",
")",
";",
"Assert",
".",
"assertTrue",
"(",
"client",
".",
"isResponse200",
"(",
")",
")",
";",
"Assert",
".",
"assertEquals",
"(",
"\"request.getServerName() is [] and request.getServerPort() is \"",
"+",
"getPort",
"(",
")",
",",
"client",
".",
"getResponseBody",
"(",
")",
")",
";",
"}"
] | Host header exists but has its value is empty (and there are multiple
spaces after the ':'. | [
"Host",
"header",
"exists",
"but",
"has",
"its",
"value",
"is",
"empty",
"(",
"and",
"there",
"are",
"multiple",
"spaces",
"after",
"the",
"'",
":",
"'",
"."
] | [
"// This setting means the connection will be closed at the end of the",
"// request",
"// No file system docBase required",
"// Add servlet",
"// Expected response is a 200 response."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
1842,
7796,
2594,
1864,
3103,
1435,
1216,
1185,
288,
203,
3639,
399,
362,
2574,
29998,
2574,
273,
3181,
362,
2574,
1442,
5621,
203,
203,
3639,
368,
1220,
3637,
4696,
326,
1459,
903,
506,
4375,
622,
326,
679,
434,
326,
203,
3639,
368,
590,
203,
3639,
29998,
2574,
18,
588,
7487,
7675,
542,
1499,
2932,
1896,
24456,
6421,
3113,
315,
21,
8863,
203,
203,
3639,
368,
2631,
585,
2619,
997,
2171,
1931,
203,
3639,
1772,
1103,
273,
29998,
2574,
18,
1289,
1042,
2932,
3113,
446,
1769,
203,
203,
3639,
368,
1436,
8100,
203,
3639,
399,
362,
2574,
18,
1289,
4745,
12,
5900,
16,
315,
56,
7654,
4745,
3113,
394,
3224,
461,
56,
7654,
4745,
10663,
203,
3639,
1103,
18,
1289,
4745,
3233,
24888,
2932,
19,
11351,
3113,
315,
56,
7654,
4745,
8863,
203,
203,
3639,
29998,
2574,
18,
1937,
5621,
203,
203,
3639,
514,
590,
273,
203,
7734,
315,
3264,
342,
11351,
2239,
19,
21,
18,
21,
6,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
7734,
315,
2594,
30,
1377,
315,
397,
4477,
11895,
18,
5093,
9105,
397,
203,
1171,
4477,
11895,
18,
5093,
9105,
31,
203,
203,
3639,
2445,
1004,
273,
394,
2445,
12,
3599,
2574,
18,
588,
7487,
7675,
588,
2042,
2617,
10663,
203,
3639,
1004,
18,
542,
691,
12,
2704,
514,
8526,
288,
2293,
22938,
203,
203,
3639,
1004,
18,
3612,
5621,
203,
3639,
1004,
18,
2567,
691,
5621,
203,
203,
3639,
368,
13219,
766,
353,
279,
4044,
766,
18,
203,
3639,
5452,
18,
11231,
5510,
12,
2625,
18,
291,
1064,
6976,
10663,
203,
3639,
5452,
18,
11231,
8867,
2932,
2293,
18,
588,
28434,
1435,
353,
5378,
471,
590,
18,
588,
2081,
2617,
1435,
353,
315,
397,
11036,
9334,
1004,
18,
588,
23269,
10663,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
4893,
1446,
1704,
1496,
711,
2097,
460,
353,
1008,
261,
464,
1915,
854,
3229,
203,
377,
380,
7292,
1839,
326,
3921,
18,
225,
1220,
353,
923,
309,
326,
590,
980,
1552,
486,
203,
377,
380,
2341,
279,
5199,
19,
655,
18,
203,
377,
380,
25808,
364,
7934,
1666,
5324,
5520,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
030236e16bf002ebefc191d5109a191ffcd13e9b | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java | [
"MIT"
] | Java | startInternal | null | @Override
public void startInternal() throws Exception {
if (!running) {
allClosed = false;
running = true;
paused = false;
processorCache = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
socketProperties.getProcessorCache());
nioChannels = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
socketProperties.getBufferPool());
// Create worker collection
if ( getExecutor() == null ) {
createExecutor();
}
initializeConnectionLatch();
startAcceptorThreads();
}
} | /**
* Start the NIO2 endpoint, creating acceptor.
*/ | Start the NIO2 endpoint, creating acceptor. | [
"Start",
"the",
"NIO2",
"endpoint",
"creating",
"acceptor",
"."
] | @Override
public void startInternal() throws Exception {
if (!running) {
allClosed = false;
running = true;
paused = false;
processorCache = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
socketProperties.getProcessorCache());
nioChannels = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
socketProperties.getBufferPool());
if ( getExecutor() == null ) {
createExecutor();
}
initializeConnectionLatch();
startAcceptorThreads();
}
} | [
"@",
"Override",
"public",
"void",
"startInternal",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"running",
")",
"{",
"allClosed",
"=",
"false",
";",
"running",
"=",
"true",
";",
"paused",
"=",
"false",
";",
"processorCache",
"=",
"new",
"SynchronizedStack",
"<",
">",
"(",
"SynchronizedStack",
".",
"DEFAULT_SIZE",
",",
"socketProperties",
".",
"getProcessorCache",
"(",
")",
")",
";",
"nioChannels",
"=",
"new",
"SynchronizedStack",
"<",
">",
"(",
"SynchronizedStack",
".",
"DEFAULT_SIZE",
",",
"socketProperties",
".",
"getBufferPool",
"(",
")",
")",
";",
"if",
"(",
"getExecutor",
"(",
")",
"==",
"null",
")",
"{",
"createExecutor",
"(",
")",
";",
"}",
"initializeConnectionLatch",
"(",
")",
";",
"startAcceptorThreads",
"(",
")",
";",
"}",
"}"
] | Start the NIO2 endpoint, creating acceptor. | [
"Start",
"the",
"NIO2",
"endpoint",
"creating",
"acceptor",
"."
] | [
"// Create worker collection"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
787,
3061,
1435,
1216,
1185,
288,
203,
203,
3639,
309,
16051,
8704,
13,
288,
203,
5411,
777,
7395,
273,
629,
31,
203,
5411,
3549,
273,
638,
31,
203,
5411,
17781,
273,
629,
31,
203,
203,
5411,
6659,
1649,
273,
394,
348,
15666,
2624,
29667,
12,
55,
15666,
2624,
18,
5280,
67,
4574,
16,
203,
10792,
2987,
2297,
18,
588,
5164,
1649,
10663,
203,
5411,
22171,
10585,
273,
394,
348,
15666,
2624,
29667,
12,
55,
15666,
2624,
18,
5280,
67,
4574,
16,
203,
10792,
2987,
2297,
18,
588,
1892,
2864,
10663,
203,
203,
5411,
368,
1788,
4322,
1849,
203,
5411,
309,
261,
336,
6325,
1435,
422,
446,
262,
288,
203,
7734,
752,
6325,
5621,
203,
5411,
289,
203,
203,
5411,
4046,
1952,
23463,
5621,
203,
5411,
787,
5933,
280,
13233,
5621,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3603,
326,
423,
4294,
22,
2494,
16,
4979,
2791,
280,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
030236e16bf002ebefc191d5109a191ffcd13e9b | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java | [
"MIT"
] | Java | stopInternal | null | @Override
public void stopInternal() {
releaseConnectionLatch();
if (!paused) {
pause();
}
if (running) {
running = false;
unlockAccept();
// Use the executor to avoid binding the main thread if something bad
// occurs and unbind will also wait for a bit for it to complete
getExecutor().execute(new Runnable() {
@Override
public void run() {
// Then close all active connections if any remain
try {
for (Nio2Channel channel : getHandler().getOpenSockets()) {
channel.getSocket().close();
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
} finally {
allClosed = true;
}
}
});
nioChannels.clear();
processorCache.clear();
}
} | /**
* Stop the endpoint. This will cause all processing threads to stop.
*/ | Stop the endpoint. This will cause all processing threads to stop. | [
"Stop",
"the",
"endpoint",
".",
"This",
"will",
"cause",
"all",
"processing",
"threads",
"to",
"stop",
"."
] | @Override
public void stopInternal() {
releaseConnectionLatch();
if (!paused) {
pause();
}
if (running) {
running = false;
unlockAccept();
getExecutor().execute(new Runnable() {
@Override
public void run() {
try {
for (Nio2Channel channel : getHandler().getOpenSockets()) {
channel.getSocket().close();
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
} finally {
allClosed = true;
}
}
});
nioChannels.clear();
processorCache.clear();
}
} | [
"@",
"Override",
"public",
"void",
"stopInternal",
"(",
")",
"{",
"releaseConnectionLatch",
"(",
")",
";",
"if",
"(",
"!",
"paused",
")",
"{",
"pause",
"(",
")",
";",
"}",
"if",
"(",
"running",
")",
"{",
"running",
"=",
"false",
";",
"unlockAccept",
"(",
")",
";",
"getExecutor",
"(",
")",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"for",
"(",
"Nio2Channel",
"channel",
":",
"getHandler",
"(",
")",
".",
"getOpenSockets",
"(",
")",
")",
"{",
"channel",
".",
"getSocket",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"}",
"finally",
"{",
"allClosed",
"=",
"true",
";",
"}",
"}",
"}",
")",
";",
"nioChannels",
".",
"clear",
"(",
")",
";",
"processorCache",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | Stop the endpoint. | [
"Stop",
"the",
"endpoint",
"."
] | [
"// Use the executor to avoid binding the main thread if something bad",
"// occurs and unbind will also wait for a bit for it to complete",
"// Then close all active connections if any remain"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
2132,
3061,
1435,
288,
203,
3639,
3992,
1952,
23463,
5621,
203,
3639,
309,
16051,
8774,
3668,
13,
288,
203,
5411,
11722,
5621,
203,
3639,
289,
203,
3639,
309,
261,
8704,
13,
288,
203,
5411,
3549,
273,
629,
31,
203,
5411,
7186,
5933,
5621,
203,
5411,
368,
2672,
326,
6601,
358,
4543,
5085,
326,
2774,
2650,
309,
5943,
5570,
203,
5411,
368,
9938,
471,
17449,
903,
2546,
2529,
364,
279,
2831,
364,
518,
358,
3912,
203,
5411,
336,
6325,
7675,
8837,
12,
2704,
10254,
1435,
288,
203,
7734,
632,
6618,
203,
7734,
1071,
918,
1086,
1435,
288,
203,
10792,
368,
9697,
1746,
777,
2695,
5921,
309,
1281,
7232,
203,
10792,
775,
288,
203,
13491,
364,
261,
50,
1594,
22,
2909,
1904,
294,
18945,
7675,
588,
3678,
4534,
87,
10756,
288,
203,
18701,
1904,
18,
588,
4534,
7675,
4412,
5621,
203,
13491,
289,
203,
10792,
289,
1044,
261,
15155,
268,
13,
288,
203,
13491,
1185,
1989,
18,
4110,
15155,
12,
88,
1769,
203,
10792,
289,
3095,
288,
203,
13491,
777,
7395,
273,
638,
31,
203,
10792,
289,
203,
7734,
289,
203,
5411,
15549,
203,
5411,
22171,
10585,
18,
8507,
5621,
203,
5411,
6659,
1649,
18,
8507,
5621,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5131,
326,
2494,
18,
1220,
903,
4620,
777,
4929,
7403,
358,
2132,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
030236e16bf002ebefc191d5109a191ffcd13e9b | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java | [
"MIT"
] | Java | unbind | null | @Override
public void unbind() throws Exception {
if (running) {
stop();
}
doCloseServerSocket();
destroySsl();
super.unbind();
// Unlike other connectors, the thread pool is tied to the server socket
shutdownExecutor();
if (getHandler() != null) {
getHandler().recycle();
}
} | /**
* Deallocate NIO memory pools, and close server socket.
*/ | Deallocate NIO memory pools, and close server socket. | [
"Deallocate",
"NIO",
"memory",
"pools",
"and",
"close",
"server",
"socket",
"."
] | @Override
public void unbind() throws Exception {
if (running) {
stop();
}
doCloseServerSocket();
destroySsl();
super.unbind();
shutdownExecutor();
if (getHandler() != null) {
getHandler().recycle();
}
} | [
"@",
"Override",
"public",
"void",
"unbind",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"running",
")",
"{",
"stop",
"(",
")",
";",
"}",
"doCloseServerSocket",
"(",
")",
";",
"destroySsl",
"(",
")",
";",
"super",
".",
"unbind",
"(",
")",
";",
"shutdownExecutor",
"(",
")",
";",
"if",
"(",
"getHandler",
"(",
")",
"!=",
"null",
")",
"{",
"getHandler",
"(",
")",
".",
"recycle",
"(",
")",
";",
"}",
"}"
] | Deallocate NIO memory pools, and close server socket. | [
"Deallocate",
"NIO",
"memory",
"pools",
"and",
"close",
"server",
"socket",
"."
] | [
"// Unlike other connectors, the thread pool is tied to the server socket"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
17449,
1435,
1216,
1185,
288,
203,
3639,
309,
261,
8704,
13,
288,
203,
5411,
2132,
5621,
203,
3639,
289,
203,
3639,
741,
4605,
2081,
4534,
5621,
203,
3639,
5546,
15840,
5621,
203,
3639,
2240,
18,
318,
4376,
5621,
203,
3639,
368,
25448,
1308,
28473,
16,
326,
2650,
2845,
353,
268,
2092,
358,
326,
1438,
2987,
203,
3639,
5731,
6325,
5621,
203,
3639,
309,
261,
588,
1503,
1435,
480,
446,
13,
288,
203,
5411,
18945,
7675,
266,
13946,
5621,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1505,
16247,
423,
4294,
3778,
16000,
16,
471,
1746,
1438,
2987,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
030236e16bf002ebefc191d5109a191ffcd13e9b | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java | [
"MIT"
] | Java | writeNonBlocking | null | @Override
protected void writeNonBlocking(byte[] buf, int off, int len) throws IOException {
// Note: Possible alternate behavior:
// If there's non blocking abuse (like a test writing 1MB in a single
// "non blocking" write), then block until the previous write is
// done rather than continue buffering
// Also allows doing autoblocking
// Could be "smart" with coordination with the main CoyoteOutputStream to
// indicate the end of a write
// Uses: if (writePending.tryAcquire(socketWrapper.getTimeout(), TimeUnit.MILLISECONDS))
synchronized (writeCompletionHandler) {
checkError();
if (writeNotify || writePending.tryAcquire()) {
// No pending completion handler, so writing to the main buffer
// is possible
socketBufferHandler.configureWriteBufferForWrite();
int thisTime = transfer(buf, off, len, socketBufferHandler.getWriteBuffer());
len = len - thisTime;
off = off + thisTime;
if (len > 0) {
// Remaining data must be buffered
nonBlockingWriteBuffer.add(buf, off, len);
}
flushNonBlockingInternal(true);
} else {
nonBlockingWriteBuffer.add(buf, off, len);
}
}
} | /**
* {@inheritDoc}
* <p>
* Overridden for NIO2 to enable a gathering write to be used to write
* all of the remaining data in a single additional write should a
* non-blocking write leave data in the buffer.
*/ |
Overridden for NIO2 to enable a gathering write to be used to write
all of the remaining data in a single additional write should a
non-blocking write leave data in the buffer. | [
"Overridden",
"for",
"NIO2",
"to",
"enable",
"a",
"gathering",
"write",
"to",
"be",
"used",
"to",
"write",
"all",
"of",
"the",
"remaining",
"data",
"in",
"a",
"single",
"additional",
"write",
"should",
"a",
"non",
"-",
"blocking",
"write",
"leave",
"data",
"in",
"the",
"buffer",
"."
] | @Override
protected void writeNonBlocking(byte[] buf, int off, int len) throws IOException {
synchronized (writeCompletionHandler) {
checkError();
if (writeNotify || writePending.tryAcquire()) {
socketBufferHandler.configureWriteBufferForWrite();
int thisTime = transfer(buf, off, len, socketBufferHandler.getWriteBuffer());
len = len - thisTime;
off = off + thisTime;
if (len > 0) {
nonBlockingWriteBuffer.add(buf, off, len);
}
flushNonBlockingInternal(true);
} else {
nonBlockingWriteBuffer.add(buf, off, len);
}
}
} | [
"@",
"Override",
"protected",
"void",
"writeNonBlocking",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"writeCompletionHandler",
")",
"{",
"checkError",
"(",
")",
";",
"if",
"(",
"writeNotify",
"||",
"writePending",
".",
"tryAcquire",
"(",
")",
")",
"{",
"socketBufferHandler",
".",
"configureWriteBufferForWrite",
"(",
")",
";",
"int",
"thisTime",
"=",
"transfer",
"(",
"buf",
",",
"off",
",",
"len",
",",
"socketBufferHandler",
".",
"getWriteBuffer",
"(",
")",
")",
";",
"len",
"=",
"len",
"-",
"thisTime",
";",
"off",
"=",
"off",
"+",
"thisTime",
";",
"if",
"(",
"len",
">",
"0",
")",
"{",
"nonBlockingWriteBuffer",
".",
"add",
"(",
"buf",
",",
"off",
",",
"len",
")",
";",
"}",
"flushNonBlockingInternal",
"(",
"true",
")",
";",
"}",
"else",
"{",
"nonBlockingWriteBuffer",
".",
"add",
"(",
"buf",
",",
"off",
",",
"len",
")",
";",
"}",
"}",
"}"
] | {@inheritDoc}
<p>
Overridden for NIO2 to enable a gathering write to be used to write
all of the remaining data in a single additional write should a
non-blocking write leave data in the buffer. | [
"{",
"@inheritDoc",
"}",
"<p",
">",
"Overridden",
"for",
"NIO2",
"to",
"enable",
"a",
"gathering",
"write",
"to",
"be",
"used",
"to",
"write",
"all",
"of",
"the",
"remaining",
"data",
"in",
"a",
"single",
"additional",
"write",
"should",
"a",
"non",
"-",
"blocking",
"write",
"leave",
"data",
"in",
"the",
"buffer",
"."
] | [
"// Note: Possible alternate behavior:",
"// If there's non blocking abuse (like a test writing 1MB in a single",
"// \"non blocking\" write), then block until the previous write is",
"// done rather than continue buffering",
"// Also allows doing autoblocking",
"// Could be \"smart\" with coordination with the main CoyoteOutputStream to",
"// indicate the end of a write",
"// Uses: if (writePending.tryAcquire(socketWrapper.getTimeout(), TimeUnit.MILLISECONDS))",
"// No pending completion handler, so writing to the main buffer",
"// is possible",
"// Remaining data must be buffered"
] | [
{
"param": "buf",
"type": "byte[]"
},
{
"param": "off",
"type": "int"
},
{
"param": "len",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buf",
"type": "byte[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "len",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
3639,
4750,
918,
1045,
3989,
8728,
12,
7229,
8526,
1681,
16,
509,
3397,
16,
509,
562,
13,
1216,
1860,
288,
203,
5411,
368,
3609,
30,
25433,
12184,
6885,
30,
203,
5411,
368,
971,
1915,
1807,
1661,
9445,
1223,
1202,
261,
5625,
279,
1842,
7410,
404,
7969,
316,
279,
2202,
203,
5411,
368,
315,
5836,
9445,
6,
1045,
3631,
1508,
1203,
3180,
326,
2416,
1045,
353,
203,
5411,
368,
2731,
9178,
2353,
1324,
25056,
203,
5411,
368,
8080,
5360,
9957,
2059,
947,
739,
310,
203,
5411,
368,
14312,
506,
315,
26416,
6,
598,
2745,
1735,
598,
326,
2774,
7695,
93,
1168,
4632,
358,
203,
5411,
368,
10768,
326,
679,
434,
279,
1045,
203,
5411,
368,
14854,
30,
309,
261,
2626,
8579,
18,
698,
27761,
12,
7814,
3611,
18,
588,
2694,
9334,
9206,
18,
25437,
11609,
3719,
203,
5411,
3852,
261,
2626,
11238,
1503,
13,
288,
203,
7734,
866,
668,
5621,
203,
7734,
309,
261,
2626,
9168,
747,
1045,
8579,
18,
698,
27761,
10756,
288,
203,
10792,
368,
2631,
4634,
8364,
1838,
16,
1427,
7410,
358,
326,
2774,
1613,
203,
10792,
368,
353,
3323,
203,
10792,
2987,
1892,
1503,
18,
14895,
3067,
1892,
1290,
3067,
5621,
203,
10792,
509,
333,
950,
273,
7412,
12,
4385,
16,
3397,
16,
562,
16,
2987,
1892,
1503,
18,
588,
3067,
1892,
10663,
203,
10792,
562,
273,
562,
300,
333,
950,
31,
203,
10792,
3397,
273,
3397,
397,
333,
950,
31,
203,
10792,
309,
261,
1897,
405,
374,
13,
288,
203,
13491,
368,
2663,
3280,
501,
1297,
506,
11445,
203,
13491,
1661,
8728,
3067,
1892,
18,
1289,
12,
4385,
16,
3397,
16,
562,
1769,
203,
10792,
289,
203,
10792,
3663,
3989,
8728,
3061,
12,
3767,
1769,
203,
7734,
289,
469,
288,
203,
10792,
1661,
8728,
3067,
1892,
18,
1289,
12,
4385,
16,
3397,
16,
562,
1769,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
8901,
10990,
97,
203,
540,
380,
411,
84,
34,
203,
540,
380,
531,
1107,
2794,
364,
423,
4294,
22,
358,
4237,
279,
11090,
310,
1045,
358,
506,
1399,
358,
1045,
203,
540,
380,
777,
434,
326,
4463,
501,
316,
279,
2202,
3312,
1045,
1410,
279,
203,
540,
380,
1661,
17,
18926,
1045,
8851,
501,
316,
326,
1613,
18,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
030236e16bf002ebefc191d5109a191ffcd13e9b | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java | [
"MIT"
] | Java | writeNonBlockingInternal | null | @Override
protected void writeNonBlockingInternal(ByteBuffer from) throws IOException {
// Note: Possible alternate behavior:
// If there's non blocking abuse (like a test writing 1MB in a single
// "non blocking" write), then block until the previous write is
// done rather than continue buffering
// Also allows doing autoblocking
// Could be "smart" with coordination with the main CoyoteOutputStream to
// indicate the end of a write
// Uses: if (writePending.tryAcquire(socketWrapper.getTimeout(), TimeUnit.MILLISECONDS))
synchronized (writeCompletionHandler) {
checkError();
if (writeNotify || writePending.tryAcquire()) {
// No pending completion handler, so writing to the main buffer
// is possible
socketBufferHandler.configureWriteBufferForWrite();
transfer(from, socketBufferHandler.getWriteBuffer());
if (from.remaining() > 0) {
// Remaining data must be buffered
nonBlockingWriteBuffer.add(from);
}
flushNonBlockingInternal(true);
} else {
nonBlockingWriteBuffer.add(from);
}
}
} | /**
* {@inheritDoc}
* <p>
* Overridden for NIO2 to enable a gathering write to be used to write
* all of the remaining data in a single additional write should a
* non-blocking write leave data in the buffer.
*/ |
Overridden for NIO2 to enable a gathering write to be used to write
all of the remaining data in a single additional write should a
non-blocking write leave data in the buffer. | [
"Overridden",
"for",
"NIO2",
"to",
"enable",
"a",
"gathering",
"write",
"to",
"be",
"used",
"to",
"write",
"all",
"of",
"the",
"remaining",
"data",
"in",
"a",
"single",
"additional",
"write",
"should",
"a",
"non",
"-",
"blocking",
"write",
"leave",
"data",
"in",
"the",
"buffer",
"."
] | @Override
protected void writeNonBlockingInternal(ByteBuffer from) throws IOException {
synchronized (writeCompletionHandler) {
checkError();
if (writeNotify || writePending.tryAcquire()) {
socketBufferHandler.configureWriteBufferForWrite();
transfer(from, socketBufferHandler.getWriteBuffer());
if (from.remaining() > 0) {
nonBlockingWriteBuffer.add(from);
}
flushNonBlockingInternal(true);
} else {
nonBlockingWriteBuffer.add(from);
}
}
} | [
"@",
"Override",
"protected",
"void",
"writeNonBlockingInternal",
"(",
"ByteBuffer",
"from",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"writeCompletionHandler",
")",
"{",
"checkError",
"(",
")",
";",
"if",
"(",
"writeNotify",
"||",
"writePending",
".",
"tryAcquire",
"(",
")",
")",
"{",
"socketBufferHandler",
".",
"configureWriteBufferForWrite",
"(",
")",
";",
"transfer",
"(",
"from",
",",
"socketBufferHandler",
".",
"getWriteBuffer",
"(",
")",
")",
";",
"if",
"(",
"from",
".",
"remaining",
"(",
")",
">",
"0",
")",
"{",
"nonBlockingWriteBuffer",
".",
"add",
"(",
"from",
")",
";",
"}",
"flushNonBlockingInternal",
"(",
"true",
")",
";",
"}",
"else",
"{",
"nonBlockingWriteBuffer",
".",
"add",
"(",
"from",
")",
";",
"}",
"}",
"}"
] | {@inheritDoc}
<p>
Overridden for NIO2 to enable a gathering write to be used to write
all of the remaining data in a single additional write should a
non-blocking write leave data in the buffer. | [
"{",
"@inheritDoc",
"}",
"<p",
">",
"Overridden",
"for",
"NIO2",
"to",
"enable",
"a",
"gathering",
"write",
"to",
"be",
"used",
"to",
"write",
"all",
"of",
"the",
"remaining",
"data",
"in",
"a",
"single",
"additional",
"write",
"should",
"a",
"non",
"-",
"blocking",
"write",
"leave",
"data",
"in",
"the",
"buffer",
"."
] | [
"// Note: Possible alternate behavior:",
"// If there's non blocking abuse (like a test writing 1MB in a single",
"// \"non blocking\" write), then block until the previous write is",
"// done rather than continue buffering",
"// Also allows doing autoblocking",
"// Could be \"smart\" with coordination with the main CoyoteOutputStream to",
"// indicate the end of a write",
"// Uses: if (writePending.tryAcquire(socketWrapper.getTimeout(), TimeUnit.MILLISECONDS))",
"// No pending completion handler, so writing to the main buffer",
"// is possible",
"// Remaining data must be buffered"
] | [
{
"param": "from",
"type": "ByteBuffer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "from",
"type": "ByteBuffer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
3639,
4750,
918,
1045,
3989,
8728,
3061,
12,
12242,
628,
13,
1216,
1860,
288,
203,
5411,
368,
3609,
30,
25433,
12184,
6885,
30,
203,
5411,
368,
971,
1915,
1807,
1661,
9445,
1223,
1202,
261,
5625,
279,
1842,
7410,
404,
7969,
316,
279,
2202,
203,
5411,
368,
315,
5836,
9445,
6,
1045,
3631,
1508,
1203,
3180,
326,
2416,
1045,
353,
203,
5411,
368,
2731,
9178,
2353,
1324,
25056,
203,
5411,
368,
8080,
5360,
9957,
2059,
947,
739,
310,
203,
5411,
368,
14312,
506,
315,
26416,
6,
598,
2745,
1735,
598,
326,
2774,
7695,
93,
1168,
4632,
358,
203,
5411,
368,
10768,
326,
679,
434,
279,
1045,
203,
5411,
368,
14854,
30,
309,
261,
2626,
8579,
18,
698,
27761,
12,
7814,
3611,
18,
588,
2694,
9334,
9206,
18,
25437,
11609,
3719,
203,
5411,
3852,
261,
2626,
11238,
1503,
13,
288,
203,
7734,
866,
668,
5621,
203,
7734,
309,
261,
2626,
9168,
747,
1045,
8579,
18,
698,
27761,
10756,
288,
203,
10792,
368,
2631,
4634,
8364,
1838,
16,
1427,
7410,
358,
326,
2774,
1613,
203,
10792,
368,
353,
3323,
203,
10792,
2987,
1892,
1503,
18,
14895,
3067,
1892,
1290,
3067,
5621,
203,
10792,
7412,
12,
2080,
16,
2987,
1892,
1503,
18,
588,
3067,
1892,
10663,
203,
10792,
309,
261,
2080,
18,
17956,
1435,
405,
374,
13,
288,
203,
13491,
368,
2663,
3280,
501,
1297,
506,
11445,
203,
13491,
1661,
8728,
3067,
1892,
18,
1289,
12,
2080,
1769,
203,
10792,
289,
203,
10792,
3663,
3989,
8728,
3061,
12,
3767,
1769,
203,
7734,
289,
469,
288,
203,
10792,
1661,
8728,
3067,
1892,
18,
1289,
12,
2080,
1769,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
8901,
10990,
97,
203,
540,
380,
411,
84,
34,
203,
540,
380,
531,
1107,
2794,
364,
423,
4294,
22,
358,
4237,
279,
11090,
310,
1045,
358,
506,
1399,
358,
1045,
203,
540,
380,
777,
434,
326,
4463,
501,
316,
279,
2202,
3312,
1045,
1410,
279,
203,
540,
380,
1661,
17,
18926,
1045,
8851,
501,
316,
326,
1613,
18,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
030236e16bf002ebefc191d5109a191ffcd13e9b | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java | [
"MIT"
] | Java | doWrite | null | @Override
protected void doWrite(boolean block, ByteBuffer from) throws IOException {
Future<Integer> integer = null;
try {
do {
integer = getSocket().write(from);
long timeout = getWriteTimeout();
if (timeout > 0) {
if (integer.get(timeout, TimeUnit.MILLISECONDS).intValue() < 0) {
throw new EOFException(sm.getString("iob.failedwrite"));
}
} else {
if (integer.get().intValue() < 0) {
throw new EOFException(sm.getString("iob.failedwrite"));
}
}
} while (from.hasRemaining());
} catch (ExecutionException e) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
} else {
throw new IOException(e);
}
} catch (InterruptedException e) {
throw new IOException(e);
} catch (TimeoutException e) {
integer.cancel(true);
throw new SocketTimeoutException();
}
} | /**
* @param block Ignored since this method is only called in the
* blocking case
*/ | @param block Ignored since this method is only called in the
blocking case | [
"@param",
"block",
"Ignored",
"since",
"this",
"method",
"is",
"only",
"called",
"in",
"the",
"blocking",
"case"
] | @Override
protected void doWrite(boolean block, ByteBuffer from) throws IOException {
Future<Integer> integer = null;
try {
do {
integer = getSocket().write(from);
long timeout = getWriteTimeout();
if (timeout > 0) {
if (integer.get(timeout, TimeUnit.MILLISECONDS).intValue() < 0) {
throw new EOFException(sm.getString("iob.failedwrite"));
}
} else {
if (integer.get().intValue() < 0) {
throw new EOFException(sm.getString("iob.failedwrite"));
}
}
} while (from.hasRemaining());
} catch (ExecutionException e) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
} else {
throw new IOException(e);
}
} catch (InterruptedException e) {
throw new IOException(e);
} catch (TimeoutException e) {
integer.cancel(true);
throw new SocketTimeoutException();
}
} | [
"@",
"Override",
"protected",
"void",
"doWrite",
"(",
"boolean",
"block",
",",
"ByteBuffer",
"from",
")",
"throws",
"IOException",
"{",
"Future",
"<",
"Integer",
">",
"integer",
"=",
"null",
";",
"try",
"{",
"do",
"{",
"integer",
"=",
"getSocket",
"(",
")",
".",
"write",
"(",
"from",
")",
";",
"long",
"timeout",
"=",
"getWriteTimeout",
"(",
")",
";",
"if",
"(",
"timeout",
">",
"0",
")",
"{",
"if",
"(",
"integer",
".",
"get",
"(",
"timeout",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
".",
"intValue",
"(",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"EOFException",
"(",
"sm",
".",
"getString",
"(",
"\"iob.failedwrite\"",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"integer",
".",
"get",
"(",
")",
".",
"intValue",
"(",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"EOFException",
"(",
"sm",
".",
"getString",
"(",
"\"iob.failedwrite\"",
")",
")",
";",
"}",
"}",
"}",
"while",
"(",
"from",
".",
"hasRemaining",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ExecutionException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"instanceof",
"IOException",
")",
"{",
"throw",
"(",
"IOException",
")",
"e",
".",
"getCause",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"TimeoutException",
"e",
")",
"{",
"integer",
".",
"cancel",
"(",
"true",
")",
";",
"throw",
"new",
"SocketTimeoutException",
"(",
")",
";",
"}",
"}"
] | @param block Ignored since this method is only called in the
blocking case | [
"@param",
"block",
"Ignored",
"since",
"this",
"method",
"is",
"only",
"called",
"in",
"the",
"blocking",
"case"
] | [] | [
{
"param": "block",
"type": "boolean"
},
{
"param": "from",
"type": "ByteBuffer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "block",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "from",
"type": "ByteBuffer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
3639,
4750,
918,
741,
3067,
12,
6494,
1203,
16,
7400,
628,
13,
1216,
1860,
288,
203,
5411,
9108,
32,
4522,
34,
3571,
273,
446,
31,
203,
5411,
775,
288,
203,
7734,
741,
288,
203,
10792,
3571,
273,
28673,
7675,
2626,
12,
2080,
1769,
203,
10792,
1525,
2021,
273,
24929,
2694,
5621,
203,
10792,
309,
261,
4538,
405,
374,
13,
288,
203,
13491,
309,
261,
7745,
18,
588,
12,
4538,
16,
9206,
18,
25437,
11609,
2934,
474,
620,
1435,
411,
374,
13,
288,
203,
18701,
604,
394,
30051,
12,
4808,
18,
588,
780,
2932,
77,
947,
18,
7307,
2626,
7923,
1769,
203,
13491,
289,
203,
10792,
289,
469,
288,
203,
13491,
309,
261,
7745,
18,
588,
7675,
474,
620,
1435,
411,
374,
13,
288,
203,
18701,
604,
394,
30051,
12,
4808,
18,
588,
780,
2932,
77,
947,
18,
7307,
2626,
7923,
1769,
203,
13491,
289,
203,
10792,
289,
203,
7734,
289,
1323,
261,
2080,
18,
5332,
11429,
10663,
203,
5411,
289,
1044,
261,
14576,
425,
13,
288,
203,
7734,
309,
261,
73,
18,
588,
10683,
1435,
1276,
1860,
13,
288,
203,
10792,
604,
261,
14106,
13,
425,
18,
588,
10683,
5621,
203,
7734,
289,
469,
288,
203,
10792,
604,
394,
1860,
12,
73,
1769,
203,
7734,
289,
203,
5411,
289,
1044,
261,
24485,
503,
425,
13,
288,
203,
7734,
604,
394,
1860,
12,
73,
1769,
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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
632,
891,
1203,
8049,
72,
3241,
333,
707,
353,
1338,
2566,
316,
326,
203,
540,
380,
2868,
9445,
648,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
84c0a12f7ecc9e3845d4b967730bfb93dd80c489 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AbstractEndpoint.java | [
"MIT"
] | Java | addSslHostConfig | null | public void addSslHostConfig(SSLHostConfig sslHostConfig, boolean replace) throws IllegalArgumentException {
String key = sslHostConfig.getHostName();
if (key == null || key.length() == 0) {
throw new IllegalArgumentException(sm.getString("endpoint.noSslHostName"));
}
if (bindState != BindState.UNBOUND && bindState != BindState.SOCKET_CLOSED_ON_STOP &&
isSSLEnabled()) {
try {
createSSLContext(sslHostConfig);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
if (replace) {
SSLHostConfig previous = sslHostConfigs.put(key, sslHostConfig);
if (previous != null) {
unregisterJmx(sslHostConfig);
}
registerJmx(sslHostConfig);
// Do not release any SSLContexts associated with a replaced
// SSLHostConfig. They may still be in used by existing connections
// and releasing them would break the connection at best. Let GC
// handle the clean up.
} else {
SSLHostConfig duplicate = sslHostConfigs.putIfAbsent(key, sslHostConfig);
if (duplicate != null) {
releaseSSLContext(sslHostConfig);
throw new IllegalArgumentException(sm.getString("endpoint.duplicateSslHostName", key));
}
registerJmx(sslHostConfig);
}
} | /**
* Add the given SSL Host configuration, optionally replacing the existing
* configuration for the given host.
*
* @param sslHostConfig The configuration to add
* @param replace If {@code true} replacement of an existing
* configuration is permitted, otherwise any such
* attempted replacement will trigger an exception
*
* @throws IllegalArgumentException If the host name is not valid or if a
* configuration has already been provided
* for that host and replacement is not
* allowed
*/ | Add the given SSL Host configuration, optionally replacing the existing
configuration for the given host.
@param sslHostConfig The configuration to add
@param replace If true replacement of an existing
configuration is permitted, otherwise any such
attempted replacement will trigger an exception
@throws IllegalArgumentException If the host name is not valid or if a
configuration has already been provided
for that host and replacement is not
allowed | [
"Add",
"the",
"given",
"SSL",
"Host",
"configuration",
"optionally",
"replacing",
"the",
"existing",
"configuration",
"for",
"the",
"given",
"host",
".",
"@param",
"sslHostConfig",
"The",
"configuration",
"to",
"add",
"@param",
"replace",
"If",
"true",
"replacement",
"of",
"an",
"existing",
"configuration",
"is",
"permitted",
"otherwise",
"any",
"such",
"attempted",
"replacement",
"will",
"trigger",
"an",
"exception",
"@throws",
"IllegalArgumentException",
"If",
"the",
"host",
"name",
"is",
"not",
"valid",
"or",
"if",
"a",
"configuration",
"has",
"already",
"been",
"provided",
"for",
"that",
"host",
"and",
"replacement",
"is",
"not",
"allowed"
] | public void addSslHostConfig(SSLHostConfig sslHostConfig, boolean replace) throws IllegalArgumentException {
String key = sslHostConfig.getHostName();
if (key == null || key.length() == 0) {
throw new IllegalArgumentException(sm.getString("endpoint.noSslHostName"));
}
if (bindState != BindState.UNBOUND && bindState != BindState.SOCKET_CLOSED_ON_STOP &&
isSSLEnabled()) {
try {
createSSLContext(sslHostConfig);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
if (replace) {
SSLHostConfig previous = sslHostConfigs.put(key, sslHostConfig);
if (previous != null) {
unregisterJmx(sslHostConfig);
}
registerJmx(sslHostConfig);
} else {
SSLHostConfig duplicate = sslHostConfigs.putIfAbsent(key, sslHostConfig);
if (duplicate != null) {
releaseSSLContext(sslHostConfig);
throw new IllegalArgumentException(sm.getString("endpoint.duplicateSslHostName", key));
}
registerJmx(sslHostConfig);
}
} | [
"public",
"void",
"addSslHostConfig",
"(",
"SSLHostConfig",
"sslHostConfig",
",",
"boolean",
"replace",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"key",
"=",
"sslHostConfig",
".",
"getHostName",
"(",
")",
";",
"if",
"(",
"key",
"==",
"null",
"||",
"key",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.noSslHostName\"",
")",
")",
";",
"}",
"if",
"(",
"bindState",
"!=",
"BindState",
".",
"UNBOUND",
"&&",
"bindState",
"!=",
"BindState",
".",
"SOCKET_CLOSED_ON_STOP",
"&&",
"isSSLEnabled",
"(",
")",
")",
"{",
"try",
"{",
"createSSLContext",
"(",
"sslHostConfig",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
")",
";",
"}",
"}",
"if",
"(",
"replace",
")",
"{",
"SSLHostConfig",
"previous",
"=",
"sslHostConfigs",
".",
"put",
"(",
"key",
",",
"sslHostConfig",
")",
";",
"if",
"(",
"previous",
"!=",
"null",
")",
"{",
"unregisterJmx",
"(",
"sslHostConfig",
")",
";",
"}",
"registerJmx",
"(",
"sslHostConfig",
")",
";",
"}",
"else",
"{",
"SSLHostConfig",
"duplicate",
"=",
"sslHostConfigs",
".",
"putIfAbsent",
"(",
"key",
",",
"sslHostConfig",
")",
";",
"if",
"(",
"duplicate",
"!=",
"null",
")",
"{",
"releaseSSLContext",
"(",
"sslHostConfig",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.duplicateSslHostName\"",
",",
"key",
")",
")",
";",
"}",
"registerJmx",
"(",
"sslHostConfig",
")",
";",
"}",
"}"
] | Add the given SSL Host configuration, optionally replacing the existing
configuration for the given host. | [
"Add",
"the",
"given",
"SSL",
"Host",
"configuration",
"optionally",
"replacing",
"the",
"existing",
"configuration",
"for",
"the",
"given",
"host",
"."
] | [
"// Do not release any SSLContexts associated with a replaced",
"// SSLHostConfig. They may still be in used by existing connections",
"// and releasing them would break the connection at best. Let GC",
"// handle the clean up."
] | [
{
"param": "sslHostConfig",
"type": "SSLHostConfig"
},
{
"param": "replace",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sslHostConfig",
"type": "SSLHostConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "replace",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
527,
15840,
2594,
809,
12,
6745,
2594,
809,
5832,
2594,
809,
16,
1250,
1453,
13,
1216,
2754,
288,
203,
3639,
514,
498,
273,
5832,
2594,
809,
18,
588,
20946,
5621,
203,
3639,
309,
261,
856,
422,
446,
747,
498,
18,
2469,
1435,
422,
374,
13,
288,
203,
5411,
604,
394,
2754,
12,
4808,
18,
588,
780,
2932,
8003,
18,
2135,
15840,
20946,
7923,
1769,
203,
3639,
289,
203,
3639,
309,
261,
4376,
1119,
480,
6936,
1119,
18,
2124,
19318,
597,
1993,
1119,
480,
6936,
1119,
18,
25699,
67,
28475,
67,
673,
67,
17513,
597,
203,
7734,
353,
6745,
1526,
10756,
288,
203,
5411,
775,
288,
203,
7734,
752,
6745,
1042,
12,
8157,
2594,
809,
1769,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
604,
394,
2754,
12,
73,
1769,
203,
5411,
289,
203,
3639,
289,
203,
3639,
309,
261,
2079,
13,
288,
203,
5411,
7419,
2594,
809,
2416,
273,
5832,
2594,
8062,
18,
458,
12,
856,
16,
5832,
2594,
809,
1769,
203,
5411,
309,
261,
11515,
480,
446,
13,
288,
203,
7734,
10232,
46,
11023,
12,
8157,
2594,
809,
1769,
203,
5411,
289,
203,
5411,
1744,
46,
11023,
12,
8157,
2594,
809,
1769,
203,
203,
5411,
368,
2256,
486,
3992,
1281,
7419,
15518,
3627,
598,
279,
8089,
203,
5411,
368,
7419,
2594,
809,
18,
16448,
2026,
4859,
506,
316,
1399,
635,
2062,
5921,
203,
5411,
368,
471,
6707,
11730,
2182,
4102,
898,
326,
1459,
622,
3796,
18,
10559,
15085,
203,
5411,
368,
1640,
326,
2721,
731,
18,
203,
3639,
289,
469,
288,
203,
5411,
7419,
2594,
809,
6751,
273,
5832,
2594,
8062,
18,
458,
14711,
12,
856,
16,
5832,
2594,
809,
1769,
203,
5411,
309,
261,
17342,
480,
446,
13,
288,
203,
7734,
3992,
6745,
1042,
12,
8157,
2594,
809,
1769,
203,
7734,
604,
394,
2754,
12,
4808,
18,
588,
780,
2932,
8003,
18,
17342,
15840,
20946,
3113,
498,
10019,
203,
5411,
289,
203,
5411,
1744,
46,
11023,
12,
8157,
2594,
809,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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
377,
380,
1664,
364,
326,
864,
1479,
18,
203,
377,
380,
203,
377,
380,
632,
891,
5832,
2594,
809,
1021,
1664,
358,
527,
203,
377,
380,
632,
891,
1453,
4202,
971,
8901,
710,
638,
97,
6060,
434,
392,
2062,
203,
377,
380,
8227,
1664,
353,
15498,
16,
3541,
1281,
4123,
203,
377,
380,
8227,
18121,
6060,
903,
3080,
392,
1520,
203,
377,
380,
203,
377,
380,
632,
15069,
2754,
971,
326,
1479,
508,
353,
486,
923,
578,
309,
279,
203,
377,
380,
21394,
1664,
711,
1818,
2118,
2112,
203,
377,
380,
21394,
364,
716,
1479,
471,
6060,
353,
486,
203,
377,
380,
21394,
2935,
203,
377,
1195,
2,
-100,
-100,
-100
] |
84c0a12f7ecc9e3845d4b967730bfb93dd80c489 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AbstractEndpoint.java | [
"MIT"
] | Java | removeSslHostConfig | SSLHostConfig | public SSLHostConfig removeSslHostConfig(String hostName) {
if (hostName == null) {
return null;
}
// Host names are case insensitive
if (hostName.equalsIgnoreCase(getDefaultSSLHostConfigName())) {
throw new IllegalArgumentException(
sm.getString("endpoint.removeDefaultSslHostConfig", hostName));
}
SSLHostConfig sslHostConfig = sslHostConfigs.remove(hostName);
unregisterJmx(sslHostConfig);
return sslHostConfig;
} | /**
* Removes the SSL host configuration for the given host name, if such a
* configuration exists.
*
* @param hostName The host name associated with the SSL host configuration
* to remove
*
* @return The SSL host configuration that was removed, if any
*/ | Removes the SSL host configuration for the given host name, if such a
configuration exists.
@param hostName The host name associated with the SSL host configuration
to remove
@return The SSL host configuration that was removed, if any | [
"Removes",
"the",
"SSL",
"host",
"configuration",
"for",
"the",
"given",
"host",
"name",
"if",
"such",
"a",
"configuration",
"exists",
".",
"@param",
"hostName",
"The",
"host",
"name",
"associated",
"with",
"the",
"SSL",
"host",
"configuration",
"to",
"remove",
"@return",
"The",
"SSL",
"host",
"configuration",
"that",
"was",
"removed",
"if",
"any"
] | public SSLHostConfig removeSslHostConfig(String hostName) {
if (hostName == null) {
return null;
}
if (hostName.equalsIgnoreCase(getDefaultSSLHostConfigName())) {
throw new IllegalArgumentException(
sm.getString("endpoint.removeDefaultSslHostConfig", hostName));
}
SSLHostConfig sslHostConfig = sslHostConfigs.remove(hostName);
unregisterJmx(sslHostConfig);
return sslHostConfig;
} | [
"public",
"SSLHostConfig",
"removeSslHostConfig",
"(",
"String",
"hostName",
")",
"{",
"if",
"(",
"hostName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"hostName",
".",
"equalsIgnoreCase",
"(",
"getDefaultSSLHostConfigName",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.removeDefaultSslHostConfig\"",
",",
"hostName",
")",
")",
";",
"}",
"SSLHostConfig",
"sslHostConfig",
"=",
"sslHostConfigs",
".",
"remove",
"(",
"hostName",
")",
";",
"unregisterJmx",
"(",
"sslHostConfig",
")",
";",
"return",
"sslHostConfig",
";",
"}"
] | Removes the SSL host configuration for the given host name, if such a
configuration exists. | [
"Removes",
"the",
"SSL",
"host",
"configuration",
"for",
"the",
"given",
"host",
"name",
"if",
"such",
"a",
"configuration",
"exists",
"."
] | [
"// Host names are case insensitive"
] | [
{
"param": "hostName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hostName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
7419,
2594,
809,
1206,
15840,
2594,
809,
12,
780,
19266,
13,
288,
203,
3639,
309,
261,
2564,
461,
422,
446,
13,
288,
203,
5411,
327,
446,
31,
203,
3639,
289,
203,
3639,
368,
4893,
1257,
854,
648,
17904,
203,
3639,
309,
261,
2564,
461,
18,
14963,
5556,
12,
588,
1868,
6745,
2594,
809,
461,
1435,
3719,
288,
203,
5411,
604,
394,
2754,
12,
203,
10792,
3029,
18,
588,
780,
2932,
8003,
18,
4479,
1868,
15840,
2594,
809,
3113,
19266,
10019,
203,
3639,
289,
203,
3639,
7419,
2594,
809,
5832,
2594,
809,
273,
5832,
2594,
8062,
18,
4479,
12,
2564,
461,
1769,
203,
3639,
10232,
46,
11023,
12,
8157,
2594,
809,
1769,
203,
3639,
327,
5832,
2594,
809,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
5375,
358,
1206,
203,
377,
380,
203,
377,
380,
632,
2463,
225,
1021,
7419,
1479,
1664,
716,
1703,
3723,
16,
309,
1281,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
84c0a12f7ecc9e3845d4b967730bfb93dd80c489 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AbstractEndpoint.java | [
"MIT"
] | Java | reloadSslHostConfig | null | public void reloadSslHostConfig(String hostName) {
SSLHostConfig sslHostConfig = sslHostConfigs.get(hostName);
if (sslHostConfig == null) {
throw new IllegalArgumentException(
sm.getString("endpoint.unknownSslHostName", hostName));
}
addSslHostConfig(sslHostConfig, true);
} | /**
* Re-read the configuration files for the SSL host and replace the existing
* SSL configuration with the updated settings. Note this replacement will
* happen even if the settings remain unchanged.
*
* @param hostName The SSL host for which the configuration should be
* reloaded. This must match a current SSL host
*/ | Re-read the configuration files for the SSL host and replace the existing
SSL configuration with the updated settings. Note this replacement will
happen even if the settings remain unchanged.
@param hostName The SSL host for which the configuration should be
reloaded. This must match a current SSL host | [
"Re",
"-",
"read",
"the",
"configuration",
"files",
"for",
"the",
"SSL",
"host",
"and",
"replace",
"the",
"existing",
"SSL",
"configuration",
"with",
"the",
"updated",
"settings",
".",
"Note",
"this",
"replacement",
"will",
"happen",
"even",
"if",
"the",
"settings",
"remain",
"unchanged",
".",
"@param",
"hostName",
"The",
"SSL",
"host",
"for",
"which",
"the",
"configuration",
"should",
"be",
"reloaded",
".",
"This",
"must",
"match",
"a",
"current",
"SSL",
"host"
] | public void reloadSslHostConfig(String hostName) {
SSLHostConfig sslHostConfig = sslHostConfigs.get(hostName);
if (sslHostConfig == null) {
throw new IllegalArgumentException(
sm.getString("endpoint.unknownSslHostName", hostName));
}
addSslHostConfig(sslHostConfig, true);
} | [
"public",
"void",
"reloadSslHostConfig",
"(",
"String",
"hostName",
")",
"{",
"SSLHostConfig",
"sslHostConfig",
"=",
"sslHostConfigs",
".",
"get",
"(",
"hostName",
")",
";",
"if",
"(",
"sslHostConfig",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.unknownSslHostName\"",
",",
"hostName",
")",
")",
";",
"}",
"addSslHostConfig",
"(",
"sslHostConfig",
",",
"true",
")",
";",
"}"
] | Re-read the configuration files for the SSL host and replace the existing
SSL configuration with the updated settings. | [
"Re",
"-",
"read",
"the",
"configuration",
"files",
"for",
"the",
"SSL",
"host",
"and",
"replace",
"the",
"existing",
"SSL",
"configuration",
"with",
"the",
"updated",
"settings",
"."
] | [] | [
{
"param": "hostName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hostName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
7749,
15840,
2594,
809,
12,
780,
19266,
13,
288,
203,
3639,
7419,
2594,
809,
5832,
2594,
809,
273,
5832,
2594,
8062,
18,
588,
12,
2564,
461,
1769,
203,
3639,
309,
261,
8157,
2594,
809,
422,
446,
13,
288,
203,
5411,
604,
394,
2754,
12,
203,
10792,
3029,
18,
588,
780,
2932,
8003,
18,
8172,
15840,
20946,
3113,
19266,
10019,
203,
3639,
289,
203,
3639,
527,
15840,
2594,
809,
12,
8157,
2594,
809,
16,
638,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
868,
17,
896,
326,
1664,
1390,
364,
326,
7419,
1479,
471,
1453,
326,
2062,
203,
377,
380,
7419,
1664,
598,
326,
3526,
1947,
18,
3609,
333,
6060,
903,
203,
377,
380,
5865,
5456,
309,
326,
1947,
7232,
14827,
18,
203,
377,
380,
203,
377,
380,
632,
891,
19266,
1021,
7419,
1479,
364,
1492,
326,
1664,
1410,
506,
203,
377,
380,
1171,
283,
4230,
18,
1220,
1297,
845,
279,
783,
7419,
1479,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
84c0a12f7ecc9e3845d4b967730bfb93dd80c489 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AbstractEndpoint.java | [
"MIT"
] | Java | reloadSslHostConfigs | null | public void reloadSslHostConfigs() {
for (String hostName : sslHostConfigs.keySet()) {
reloadSslHostConfig(hostName);
}
} | /**
* Re-read the configuration files for all SSL hosts and replace the
* existing SSL configuration with the updated settings. Note this
* replacement will happen even if the settings remain unchanged.
*/ | Re-read the configuration files for all SSL hosts and replace the
existing SSL configuration with the updated settings. Note this
replacement will happen even if the settings remain unchanged. | [
"Re",
"-",
"read",
"the",
"configuration",
"files",
"for",
"all",
"SSL",
"hosts",
"and",
"replace",
"the",
"existing",
"SSL",
"configuration",
"with",
"the",
"updated",
"settings",
".",
"Note",
"this",
"replacement",
"will",
"happen",
"even",
"if",
"the",
"settings",
"remain",
"unchanged",
"."
] | public void reloadSslHostConfigs() {
for (String hostName : sslHostConfigs.keySet()) {
reloadSslHostConfig(hostName);
}
} | [
"public",
"void",
"reloadSslHostConfigs",
"(",
")",
"{",
"for",
"(",
"String",
"hostName",
":",
"sslHostConfigs",
".",
"keySet",
"(",
")",
")",
"{",
"reloadSslHostConfig",
"(",
"hostName",
")",
";",
"}",
"}"
] | Re-read the configuration files for all SSL hosts and replace the
existing SSL configuration with the updated settings. | [
"Re",
"-",
"read",
"the",
"configuration",
"files",
"for",
"all",
"SSL",
"hosts",
"and",
"replace",
"the",
"existing",
"SSL",
"configuration",
"with",
"the",
"updated",
"settings",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
7749,
15840,
2594,
8062,
1435,
288,
203,
3639,
364,
261,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1390,
364,
777,
7419,
7206,
471,
1453,
326,
203,
377,
380,
2062,
7419,
1664,
598,
326,
3526,
1947,
18,
3609,
333,
203,
377,
380,
6060,
903,
5865,
5456,
309,
326,
1947,
7232,
14827,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
84c0a12f7ecc9e3845d4b967730bfb93dd80c489 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AbstractEndpoint.java | [
"MIT"
] | Java | releaseSSLContext | null | protected void releaseSSLContext(SSLHostConfig sslHostConfig) {
for (SSLHostConfigCertificate certificate : sslHostConfig.getCertificates(true)) {
if (certificate.getSslContext() != null) {
SSLContext sslContext = certificate.getSslContext();
if (sslContext != null) {
sslContext.destroy();
}
}
}
} | /**
* Release the SSLContext, if any, associated with the SSLHostConfig.
*
* @param sslHostConfig The SSLHostConfig for which the SSLContext should be
* released
*/ | Release the SSLContext, if any, associated with the SSLHostConfig.
@param sslHostConfig The SSLHostConfig for which the SSLContext should be
released | [
"Release",
"the",
"SSLContext",
"if",
"any",
"associated",
"with",
"the",
"SSLHostConfig",
".",
"@param",
"sslHostConfig",
"The",
"SSLHostConfig",
"for",
"which",
"the",
"SSLContext",
"should",
"be",
"released"
] | protected void releaseSSLContext(SSLHostConfig sslHostConfig) {
for (SSLHostConfigCertificate certificate : sslHostConfig.getCertificates(true)) {
if (certificate.getSslContext() != null) {
SSLContext sslContext = certificate.getSslContext();
if (sslContext != null) {
sslContext.destroy();
}
}
}
} | [
"protected",
"void",
"releaseSSLContext",
"(",
"SSLHostConfig",
"sslHostConfig",
")",
"{",
"for",
"(",
"SSLHostConfigCertificate",
"certificate",
":",
"sslHostConfig",
".",
"getCertificates",
"(",
"true",
")",
")",
"{",
"if",
"(",
"certificate",
".",
"getSslContext",
"(",
")",
"!=",
"null",
")",
"{",
"SSLContext",
"sslContext",
"=",
"certificate",
".",
"getSslContext",
"(",
")",
";",
"if",
"(",
"sslContext",
"!=",
"null",
")",
"{",
"sslContext",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Release the SSLContext, if any, associated with the SSLHostConfig. | [
"Release",
"the",
"SSLContext",
"if",
"any",
"associated",
"with",
"the",
"SSLHostConfig",
"."
] | [] | [
{
"param": "sslHostConfig",
"type": "SSLHostConfig"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sslHostConfig",
"type": "SSLHostConfig",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
3992,
6745,
1042,
12,
6745,
2594,
809,
5832,
2594,
809,
13,
288,
203,
3639,
364,
261,
6745,
2594,
809,
4719,
4944,
294,
5832,
2594,
809,
18,
588,
14133,
12,
3767,
3719,
288,
203,
5411,
309,
261,
14108,
18,
588,
15840,
1042,
1435,
480,
446,
13,
288,
203,
7734,
26886,
26041,
273,
4944,
18,
588,
15840,
1042,
5621,
203,
7734,
309,
261,
8157,
1042,
480,
446,
13,
288,
203,
10792,
26041,
18,
11662,
5621,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
10819,
326,
26886,
16,
309,
1281,
16,
3627,
598,
326,
7419,
2594,
809,
18,
203,
377,
380,
203,
377,
380,
632,
891,
5832,
2594,
809,
1021,
7419,
2594,
809,
364,
1492,
326,
26886,
1410,
506,
203,
377,
380,
8227,
15976,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
64917a80098e9fcb83d5f33af50d8da2fd3c8cff | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11Processor.java | [
"MIT"
] | Java | statusDropsConnection | null | private static boolean statusDropsConnection(int status) {
return status == 400 /* SC_BAD_REQUEST */ ||
status == 408 /* SC_REQUEST_TIMEOUT */ ||
status == 411 /* SC_LENGTH_REQUIRED */ ||
status == 413 /* SC_REQUEST_ENTITY_TOO_LARGE */ ||
status == 414 /* SC_REQUEST_URI_TOO_LONG */ ||
status == 500 /* SC_INTERNAL_SERVER_ERROR */ ||
status == 503 /* SC_SERVICE_UNAVAILABLE */ ||
status == 501 /* SC_NOT_IMPLEMENTED */;
} | /**
* Determine if we must drop the connection because of the HTTP status
* code. Use the same list of codes as Apache/httpd.
*/ | Determine if we must drop the connection because of the HTTP status
code. Use the same list of codes as Apache/httpd. | [
"Determine",
"if",
"we",
"must",
"drop",
"the",
"connection",
"because",
"of",
"the",
"HTTP",
"status",
"code",
".",
"Use",
"the",
"same",
"list",
"of",
"codes",
"as",
"Apache",
"/",
"httpd",
"."
] | private static boolean statusDropsConnection(int status) {
return status == 400 /* SC_BAD_REQUEST */ ||
status == 408 /* SC_REQUEST_TIMEOUT */ ||
status == 411 /* SC_LENGTH_REQUIRED */ ||
status == 413 /* SC_REQUEST_ENTITY_TOO_LARGE */ ||
status == 414 /* SC_REQUEST_URI_TOO_LONG */ ||
status == 500 /* SC_INTERNAL_SERVER_ERROR */ ||
status == 503 /* SC_SERVICE_UNAVAILABLE */ ||
status == 501 /* SC_NOT_IMPLEMENTED */;
} | [
"private",
"static",
"boolean",
"statusDropsConnection",
"(",
"int",
"status",
")",
"{",
"return",
"status",
"==",
"400",
"/* SC_BAD_REQUEST */",
"||",
"status",
"==",
"408",
"/* SC_REQUEST_TIMEOUT */",
"||",
"status",
"==",
"411",
"/* SC_LENGTH_REQUIRED */",
"||",
"status",
"==",
"413",
"/* SC_REQUEST_ENTITY_TOO_LARGE */",
"||",
"status",
"==",
"414",
"/* SC_REQUEST_URI_TOO_LONG */",
"||",
"status",
"==",
"500",
"/* SC_INTERNAL_SERVER_ERROR */",
"||",
"status",
"==",
"503",
"/* SC_SERVICE_UNAVAILABLE */",
"||",
"status",
"==",
"501",
"/* SC_NOT_IMPLEMENTED */",
";",
"}"
] | Determine if we must drop the connection because of the HTTP status
code. | [
"Determine",
"if",
"we",
"must",
"drop",
"the",
"connection",
"because",
"of",
"the",
"HTTP",
"status",
"code",
"."
] | [] | [
{
"param": "status",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "status",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
1250,
1267,
40,
16703,
1952,
12,
474,
1267,
13,
288,
203,
3639,
327,
1267,
422,
7409,
1748,
8795,
67,
16234,
67,
5519,
1195,
747,
203,
9079,
1267,
422,
1059,
6840,
1748,
8795,
67,
5519,
67,
9503,
1195,
747,
203,
9079,
1267,
422,
1059,
2499,
1748,
8795,
67,
7096,
67,
14977,
1195,
747,
203,
9079,
1267,
422,
1059,
3437,
1748,
8795,
67,
5519,
67,
11101,
67,
4296,
51,
67,
48,
28847,
1195,
747,
203,
9079,
1267,
422,
1059,
3461,
1748,
8795,
67,
5519,
67,
3098,
67,
4296,
51,
67,
14639,
1195,
747,
203,
9079,
1267,
422,
6604,
1748,
8795,
67,
14005,
67,
4370,
67,
3589,
1195,
747,
203,
9079,
1267,
422,
26819,
1748,
8795,
67,
12426,
67,
2124,
23222,
1195,
747,
203,
9079,
1267,
422,
1381,
1611,
1748,
8795,
67,
4400,
67,
9883,
28485,
6404,
1195,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
10229,
309,
732,
1297,
3640,
326,
1459,
2724,
434,
326,
2239,
1267,
203,
377,
380,
981,
18,
225,
2672,
326,
1967,
666,
434,
6198,
487,
24840,
19,
2505,
72,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
64917a80098e9fcb83d5f33af50d8da2fd3c8cff | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11Processor.java | [
"MIT"
] | Java | addInputFilter | null | private void addInputFilter(InputFilter[] inputFilters, String encodingName) {
// Parsing trims and converts to lower case.
if (encodingName.equals("identity")) {
// Skip
} else if (encodingName.equals("chunked")) {
inputBuffer.addActiveFilter
(inputFilters[Constants.CHUNKED_FILTER]);
contentDelimitation = true;
} else {
for (int i = pluggableFilterIndex; i < inputFilters.length; i++) {
if (inputFilters[i].getEncodingName().toString().equals(encodingName)) {
inputBuffer.addActiveFilter(inputFilters[i]);
return;
}
}
// Unsupported transfer encoding
// 501 - Unimplemented
response.setStatus(501);
setErrorState(ErrorState.CLOSE_CLEAN, null);
if (log.isDebugEnabled()) {
log.debug(sm.getString("http11processor.request.prepare") +
" Unsupported transfer encoding [" + encodingName + "]");
}
}
} | /**
* Add an input filter to the current request. If the encoding is not
* supported, a 501 response will be returned to the client.
*/ | Add an input filter to the current request. If the encoding is not
supported, a 501 response will be returned to the client. | [
"Add",
"an",
"input",
"filter",
"to",
"the",
"current",
"request",
".",
"If",
"the",
"encoding",
"is",
"not",
"supported",
"a",
"501",
"response",
"will",
"be",
"returned",
"to",
"the",
"client",
"."
] | private void addInputFilter(InputFilter[] inputFilters, String encodingName) {
if (encodingName.equals("identity")) {
} else if (encodingName.equals("chunked")) {
inputBuffer.addActiveFilter
(inputFilters[Constants.CHUNKED_FILTER]);
contentDelimitation = true;
} else {
for (int i = pluggableFilterIndex; i < inputFilters.length; i++) {
if (inputFilters[i].getEncodingName().toString().equals(encodingName)) {
inputBuffer.addActiveFilter(inputFilters[i]);
return;
}
}
response.setStatus(501);
setErrorState(ErrorState.CLOSE_CLEAN, null);
if (log.isDebugEnabled()) {
log.debug(sm.getString("http11processor.request.prepare") +
" Unsupported transfer encoding [" + encodingName + "]");
}
}
} | [
"private",
"void",
"addInputFilter",
"(",
"InputFilter",
"[",
"]",
"inputFilters",
",",
"String",
"encodingName",
")",
"{",
"if",
"(",
"encodingName",
".",
"equals",
"(",
"\"identity\"",
")",
")",
"{",
"}",
"else",
"if",
"(",
"encodingName",
".",
"equals",
"(",
"\"chunked\"",
")",
")",
"{",
"inputBuffer",
".",
"addActiveFilter",
"(",
"inputFilters",
"[",
"Constants",
".",
"CHUNKED_FILTER",
"]",
")",
";",
"contentDelimitation",
"=",
"true",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"pluggableFilterIndex",
";",
"i",
"<",
"inputFilters",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"inputFilters",
"[",
"i",
"]",
".",
"getEncodingName",
"(",
")",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"encodingName",
")",
")",
"{",
"inputBuffer",
".",
"addActiveFilter",
"(",
"inputFilters",
"[",
"i",
"]",
")",
";",
"return",
";",
"}",
"}",
"response",
".",
"setStatus",
"(",
"501",
")",
";",
"setErrorState",
"(",
"ErrorState",
".",
"CLOSE_CLEAN",
",",
"null",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"http11processor.request.prepare\"",
")",
"+",
"\" Unsupported transfer encoding [\"",
"+",
"encodingName",
"+",
"\"]\"",
")",
";",
"}",
"}",
"}"
] | Add an input filter to the current request. | [
"Add",
"an",
"input",
"filter",
"to",
"the",
"current",
"request",
"."
] | [
"// Parsing trims and converts to lower case.",
"// Skip",
"// Unsupported transfer encoding",
"// 501 - Unimplemented"
] | [
{
"param": "inputFilters",
"type": "InputFilter[]"
},
{
"param": "encodingName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inputFilters",
"type": "InputFilter[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "encodingName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
527,
1210,
1586,
12,
1210,
1586,
8526,
810,
5422,
16,
514,
2688,
461,
13,
288,
203,
203,
3639,
368,
19761,
2209,
87,
471,
7759,
358,
2612,
648,
18,
203,
203,
3639,
309,
261,
5999,
461,
18,
14963,
2932,
10781,
6,
3719,
288,
203,
5411,
368,
6611,
203,
3639,
289,
469,
309,
261,
5999,
461,
18,
14963,
2932,
6551,
329,
6,
3719,
288,
203,
5411,
810,
1892,
18,
1289,
3896,
1586,
203,
7734,
261,
2630,
5422,
63,
2918,
18,
26464,
2056,
67,
11126,
19226,
203,
5411,
913,
23531,
367,
273,
638,
31,
203,
3639,
289,
469,
288,
203,
5411,
364,
261,
474,
277,
273,
886,
30382,
1586,
1016,
31,
277,
411,
810,
5422,
18,
2469,
31,
277,
27245,
288,
203,
7734,
309,
261,
2630,
5422,
63,
77,
8009,
588,
4705,
461,
7675,
10492,
7675,
14963,
12,
5999,
461,
3719,
288,
203,
10792,
810,
1892,
18,
1289,
3896,
1586,
12,
2630,
5422,
63,
77,
19226,
203,
10792,
327,
31,
203,
7734,
289,
203,
5411,
289,
203,
5411,
368,
7221,
7412,
2688,
203,
5411,
368,
1381,
1611,
300,
1351,
21099,
203,
5411,
766,
18,
542,
1482,
12,
9172,
1769,
203,
5411,
9967,
1119,
12,
668,
1119,
18,
13384,
67,
39,
10439,
16,
446,
1769,
203,
5411,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
7734,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
2505,
2499,
8700,
18,
2293,
18,
9366,
7923,
397,
203,
12900,
315,
7221,
7412,
2688,
8247,
397,
2688,
461,
397,
9870,
1769,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1436,
392,
810,
1034,
358,
326,
783,
590,
18,
971,
326,
2688,
353,
486,
203,
377,
380,
3260,
16,
279,
1381,
1611,
766,
903,
506,
2106,
358,
326,
1004,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
64917a80098e9fcb83d5f33af50d8da2fd3c8cff | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11Processor.java | [
"MIT"
] | Java | prepareResponse | null | @Override
protected final void prepareResponse() throws IOException {
boolean entityBody = true;
contentDelimitation = false;
OutputFilter[] outputFilters = outputBuffer.getFilters();
if (http09 == true) {
// HTTP/0.9
outputBuffer.addActiveFilter(outputFilters[Constants.IDENTITY_FILTER]);
outputBuffer.commit();
return;
}
int statusCode = response.getStatus();
if (statusCode < 200 || statusCode == 204 || statusCode == 205 ||
statusCode == 304) {
// No entity body
outputBuffer.addActiveFilter
(outputFilters[Constants.VOID_FILTER]);
entityBody = false;
contentDelimitation = true;
if (statusCode == 205) {
// RFC 7231 requires the server to explicitly signal an empty
// response in this case
response.setContentLength(0);
} else {
response.setContentLength(-1);
}
}
MessageBytes methodMB = request.method();
if (methodMB.equals("HEAD")) {
// No entity body
outputBuffer.addActiveFilter
(outputFilters[Constants.VOID_FILTER]);
contentDelimitation = true;
}
// Sendfile support
if (endpoint.getUseSendfile()) {
prepareSendfile(outputFilters);
}
// Check for compression
boolean useCompression = false;
if (entityBody && sendfileData == null) {
useCompression = protocol.useCompression(request, response);
}
MimeHeaders headers = response.getMimeHeaders();
// A SC_NO_CONTENT response may include entity headers
if (entityBody || statusCode == HttpServletResponse.SC_NO_CONTENT) {
String contentType = response.getContentType();
if (contentType != null) {
headers.setValue("Content-Type").setString(contentType);
}
String contentLanguage = response.getContentLanguage();
if (contentLanguage != null) {
headers.setValue("Content-Language")
.setString(contentLanguage);
}
}
long contentLength = response.getContentLengthLong();
boolean connectionClosePresent = isConnectionToken(headers, Constants.CLOSE);
if (contentLength != -1) {
headers.setValue("Content-Length").setLong(contentLength);
outputBuffer.addActiveFilter(outputFilters[Constants.IDENTITY_FILTER]);
contentDelimitation = true;
} else {
// If the response code supports an entity body and we're on
// HTTP 1.1 then we chunk unless we have a Connection: close header
if (http11 && entityBody && !connectionClosePresent) {
outputBuffer.addActiveFilter(outputFilters[Constants.CHUNKED_FILTER]);
contentDelimitation = true;
headers.addValue(Constants.TRANSFERENCODING).setString(Constants.CHUNKED);
} else {
outputBuffer.addActiveFilter(outputFilters[Constants.IDENTITY_FILTER]);
}
}
if (useCompression) {
outputBuffer.addActiveFilter(outputFilters[Constants.GZIP_FILTER]);
}
// Add date header unless application has already set one (e.g. in a
// Caching Filter)
if (headers.getValue("Date") == null) {
headers.addValue("Date").setString(
FastHttpDateFormat.getCurrentDate());
}
// FIXME: Add transfer encoding header
if ((entityBody) && (!contentDelimitation)) {
// Mark as close the connection after the request, and add the
// connection: close header
keepAlive = false;
}
// This may disabled keep-alive to check before working out the
// Connection header.
checkExpectationAndResponseStatus();
// If we know that the request is bad this early, add the
// Connection: close header.
if (keepAlive && statusDropsConnection(statusCode)) {
keepAlive = false;
}
if (!keepAlive) {
// Avoid adding the close header twice
if (!connectionClosePresent) {
headers.addValue(Constants.CONNECTION).setString(
Constants.CLOSE);
}
} else if (!getErrorState().isError()) {
if (!http11) {
headers.addValue(Constants.CONNECTION).setString(Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
}
if (protocol.getUseKeepAliveResponseHeader()) {
boolean connectionKeepAlivePresent =
isConnectionToken(request.getMimeHeaders(), Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
if (connectionKeepAlivePresent) {
int keepAliveTimeout = protocol.getKeepAliveTimeout();
if (keepAliveTimeout > 0) {
String value = "timeout=" + keepAliveTimeout / 1000L;
headers.setValue(Constants.KEEP_ALIVE_HEADER_NAME).setString(value);
if (http11) {
// Append if there is already a Connection header,
// else create the header
MessageBytes connectionHeaderValue = headers.getValue(Constants.CONNECTION);
if (connectionHeaderValue == null) {
headers.addValue(Constants.CONNECTION).setString(Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
} else {
connectionHeaderValue.setString(
connectionHeaderValue.getString() + ", " + Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
}
}
}
}
}
}
// Add server header
String server = protocol.getServer();
if (server == null) {
if (protocol.getServerRemoveAppProvidedValues()) {
headers.removeHeader("server");
}
} else {
// server always overrides anything the app might set
headers.setValue("Server").setString(server);
}
// Build the response header
try {
outputBuffer.sendStatus();
int size = headers.size();
for (int i = 0; i < size; i++) {
outputBuffer.sendHeader(headers.getName(i), headers.getValue(i));
}
outputBuffer.endHeaders();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
// If something goes wrong, reset the header buffer so the error
// response can be written instead.
outputBuffer.resetHeaderBuffer();
throw t;
}
outputBuffer.commit();
} | /**
* When committing the response, we have to validate the set of headers, as
* well as setup the response filters.
*/ | When committing the response, we have to validate the set of headers, as
well as setup the response filters. | [
"When",
"committing",
"the",
"response",
"we",
"have",
"to",
"validate",
"the",
"set",
"of",
"headers",
"as",
"well",
"as",
"setup",
"the",
"response",
"filters",
"."
] | @Override
protected final void prepareResponse() throws IOException {
boolean entityBody = true;
contentDelimitation = false;
OutputFilter[] outputFilters = outputBuffer.getFilters();
if (http09 == true) {
outputBuffer.addActiveFilter(outputFilters[Constants.IDENTITY_FILTER]);
outputBuffer.commit();
return;
}
int statusCode = response.getStatus();
if (statusCode < 200 || statusCode == 204 || statusCode == 205 ||
statusCode == 304) {
outputBuffer.addActiveFilter
(outputFilters[Constants.VOID_FILTER]);
entityBody = false;
contentDelimitation = true;
if (statusCode == 205) {
response.setContentLength(0);
} else {
response.setContentLength(-1);
}
}
MessageBytes methodMB = request.method();
if (methodMB.equals("HEAD")) {
outputBuffer.addActiveFilter
(outputFilters[Constants.VOID_FILTER]);
contentDelimitation = true;
}
if (endpoint.getUseSendfile()) {
prepareSendfile(outputFilters);
}
boolean useCompression = false;
if (entityBody && sendfileData == null) {
useCompression = protocol.useCompression(request, response);
}
MimeHeaders headers = response.getMimeHeaders();
if (entityBody || statusCode == HttpServletResponse.SC_NO_CONTENT) {
String contentType = response.getContentType();
if (contentType != null) {
headers.setValue("Content-Type").setString(contentType);
}
String contentLanguage = response.getContentLanguage();
if (contentLanguage != null) {
headers.setValue("Content-Language")
.setString(contentLanguage);
}
}
long contentLength = response.getContentLengthLong();
boolean connectionClosePresent = isConnectionToken(headers, Constants.CLOSE);
if (contentLength != -1) {
headers.setValue("Content-Length").setLong(contentLength);
outputBuffer.addActiveFilter(outputFilters[Constants.IDENTITY_FILTER]);
contentDelimitation = true;
} else {
if (http11 && entityBody && !connectionClosePresent) {
outputBuffer.addActiveFilter(outputFilters[Constants.CHUNKED_FILTER]);
contentDelimitation = true;
headers.addValue(Constants.TRANSFERENCODING).setString(Constants.CHUNKED);
} else {
outputBuffer.addActiveFilter(outputFilters[Constants.IDENTITY_FILTER]);
}
}
if (useCompression) {
outputBuffer.addActiveFilter(outputFilters[Constants.GZIP_FILTER]);
}
if (headers.getValue("Date") == null) {
headers.addValue("Date").setString(
FastHttpDateFormat.getCurrentDate());
}
if ((entityBody) && (!contentDelimitation)) {
keepAlive = false;
}
checkExpectationAndResponseStatus();
if (keepAlive && statusDropsConnection(statusCode)) {
keepAlive = false;
}
if (!keepAlive) {
if (!connectionClosePresent) {
headers.addValue(Constants.CONNECTION).setString(
Constants.CLOSE);
}
} else if (!getErrorState().isError()) {
if (!http11) {
headers.addValue(Constants.CONNECTION).setString(Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
}
if (protocol.getUseKeepAliveResponseHeader()) {
boolean connectionKeepAlivePresent =
isConnectionToken(request.getMimeHeaders(), Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
if (connectionKeepAlivePresent) {
int keepAliveTimeout = protocol.getKeepAliveTimeout();
if (keepAliveTimeout > 0) {
String value = "timeout=" + keepAliveTimeout / 1000L;
headers.setValue(Constants.KEEP_ALIVE_HEADER_NAME).setString(value);
if (http11) {
MessageBytes connectionHeaderValue = headers.getValue(Constants.CONNECTION);
if (connectionHeaderValue == null) {
headers.addValue(Constants.CONNECTION).setString(Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
} else {
connectionHeaderValue.setString(
connectionHeaderValue.getString() + ", " + Constants.KEEP_ALIVE_HEADER_VALUE_TOKEN);
}
}
}
}
}
}
String server = protocol.getServer();
if (server == null) {
if (protocol.getServerRemoveAppProvidedValues()) {
headers.removeHeader("server");
}
} else {
headers.setValue("Server").setString(server);
}
try {
outputBuffer.sendStatus();
int size = headers.size();
for (int i = 0; i < size; i++) {
outputBuffer.sendHeader(headers.getName(i), headers.getValue(i));
}
outputBuffer.endHeaders();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
outputBuffer.resetHeaderBuffer();
throw t;
}
outputBuffer.commit();
} | [
"@",
"Override",
"protected",
"final",
"void",
"prepareResponse",
"(",
")",
"throws",
"IOException",
"{",
"boolean",
"entityBody",
"=",
"true",
";",
"contentDelimitation",
"=",
"false",
";",
"OutputFilter",
"[",
"]",
"outputFilters",
"=",
"outputBuffer",
".",
"getFilters",
"(",
")",
";",
"if",
"(",
"http09",
"==",
"true",
")",
"{",
"outputBuffer",
".",
"addActiveFilter",
"(",
"outputFilters",
"[",
"Constants",
".",
"IDENTITY_FILTER",
"]",
")",
";",
"outputBuffer",
".",
"commit",
"(",
")",
";",
"return",
";",
"}",
"int",
"statusCode",
"=",
"response",
".",
"getStatus",
"(",
")",
";",
"if",
"(",
"statusCode",
"<",
"200",
"||",
"statusCode",
"==",
"204",
"||",
"statusCode",
"==",
"205",
"||",
"statusCode",
"==",
"304",
")",
"{",
"outputBuffer",
".",
"addActiveFilter",
"(",
"outputFilters",
"[",
"Constants",
".",
"VOID_FILTER",
"]",
")",
";",
"entityBody",
"=",
"false",
";",
"contentDelimitation",
"=",
"true",
";",
"if",
"(",
"statusCode",
"==",
"205",
")",
"{",
"response",
".",
"setContentLength",
"(",
"0",
")",
";",
"}",
"else",
"{",
"response",
".",
"setContentLength",
"(",
"-",
"1",
")",
";",
"}",
"}",
"MessageBytes",
"methodMB",
"=",
"request",
".",
"method",
"(",
")",
";",
"if",
"(",
"methodMB",
".",
"equals",
"(",
"\"HEAD\"",
")",
")",
"{",
"outputBuffer",
".",
"addActiveFilter",
"(",
"outputFilters",
"[",
"Constants",
".",
"VOID_FILTER",
"]",
")",
";",
"contentDelimitation",
"=",
"true",
";",
"}",
"if",
"(",
"endpoint",
".",
"getUseSendfile",
"(",
")",
")",
"{",
"prepareSendfile",
"(",
"outputFilters",
")",
";",
"}",
"boolean",
"useCompression",
"=",
"false",
";",
"if",
"(",
"entityBody",
"&&",
"sendfileData",
"==",
"null",
")",
"{",
"useCompression",
"=",
"protocol",
".",
"useCompression",
"(",
"request",
",",
"response",
")",
";",
"}",
"MimeHeaders",
"headers",
"=",
"response",
".",
"getMimeHeaders",
"(",
")",
";",
"if",
"(",
"entityBody",
"||",
"statusCode",
"==",
"HttpServletResponse",
".",
"SC_NO_CONTENT",
")",
"{",
"String",
"contentType",
"=",
"response",
".",
"getContentType",
"(",
")",
";",
"if",
"(",
"contentType",
"!=",
"null",
")",
"{",
"headers",
".",
"setValue",
"(",
"\"Content-Type\"",
")",
".",
"setString",
"(",
"contentType",
")",
";",
"}",
"String",
"contentLanguage",
"=",
"response",
".",
"getContentLanguage",
"(",
")",
";",
"if",
"(",
"contentLanguage",
"!=",
"null",
")",
"{",
"headers",
".",
"setValue",
"(",
"\"Content-Language\"",
")",
".",
"setString",
"(",
"contentLanguage",
")",
";",
"}",
"}",
"long",
"contentLength",
"=",
"response",
".",
"getContentLengthLong",
"(",
")",
";",
"boolean",
"connectionClosePresent",
"=",
"isConnectionToken",
"(",
"headers",
",",
"Constants",
".",
"CLOSE",
")",
";",
"if",
"(",
"contentLength",
"!=",
"-",
"1",
")",
"{",
"headers",
".",
"setValue",
"(",
"\"Content-Length\"",
")",
".",
"setLong",
"(",
"contentLength",
")",
";",
"outputBuffer",
".",
"addActiveFilter",
"(",
"outputFilters",
"[",
"Constants",
".",
"IDENTITY_FILTER",
"]",
")",
";",
"contentDelimitation",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"http11",
"&&",
"entityBody",
"&&",
"!",
"connectionClosePresent",
")",
"{",
"outputBuffer",
".",
"addActiveFilter",
"(",
"outputFilters",
"[",
"Constants",
".",
"CHUNKED_FILTER",
"]",
")",
";",
"contentDelimitation",
"=",
"true",
";",
"headers",
".",
"addValue",
"(",
"Constants",
".",
"TRANSFERENCODING",
")",
".",
"setString",
"(",
"Constants",
".",
"CHUNKED",
")",
";",
"}",
"else",
"{",
"outputBuffer",
".",
"addActiveFilter",
"(",
"outputFilters",
"[",
"Constants",
".",
"IDENTITY_FILTER",
"]",
")",
";",
"}",
"}",
"if",
"(",
"useCompression",
")",
"{",
"outputBuffer",
".",
"addActiveFilter",
"(",
"outputFilters",
"[",
"Constants",
".",
"GZIP_FILTER",
"]",
")",
";",
"}",
"if",
"(",
"headers",
".",
"getValue",
"(",
"\"Date\"",
")",
"==",
"null",
")",
"{",
"headers",
".",
"addValue",
"(",
"\"Date\"",
")",
".",
"setString",
"(",
"FastHttpDateFormat",
".",
"getCurrentDate",
"(",
")",
")",
";",
"}",
"if",
"(",
"(",
"entityBody",
")",
"&&",
"(",
"!",
"contentDelimitation",
")",
")",
"{",
"keepAlive",
"=",
"false",
";",
"}",
"checkExpectationAndResponseStatus",
"(",
")",
";",
"if",
"(",
"keepAlive",
"&&",
"statusDropsConnection",
"(",
"statusCode",
")",
")",
"{",
"keepAlive",
"=",
"false",
";",
"}",
"if",
"(",
"!",
"keepAlive",
")",
"{",
"if",
"(",
"!",
"connectionClosePresent",
")",
"{",
"headers",
".",
"addValue",
"(",
"Constants",
".",
"CONNECTION",
")",
".",
"setString",
"(",
"Constants",
".",
"CLOSE",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"getErrorState",
"(",
")",
".",
"isError",
"(",
")",
")",
"{",
"if",
"(",
"!",
"http11",
")",
"{",
"headers",
".",
"addValue",
"(",
"Constants",
".",
"CONNECTION",
")",
".",
"setString",
"(",
"Constants",
".",
"KEEP_ALIVE_HEADER_VALUE_TOKEN",
")",
";",
"}",
"if",
"(",
"protocol",
".",
"getUseKeepAliveResponseHeader",
"(",
")",
")",
"{",
"boolean",
"connectionKeepAlivePresent",
"=",
"isConnectionToken",
"(",
"request",
".",
"getMimeHeaders",
"(",
")",
",",
"Constants",
".",
"KEEP_ALIVE_HEADER_VALUE_TOKEN",
")",
";",
"if",
"(",
"connectionKeepAlivePresent",
")",
"{",
"int",
"keepAliveTimeout",
"=",
"protocol",
".",
"getKeepAliveTimeout",
"(",
")",
";",
"if",
"(",
"keepAliveTimeout",
">",
"0",
")",
"{",
"String",
"value",
"=",
"\"timeout=\"",
"+",
"keepAliveTimeout",
"/",
"1000L",
";",
"headers",
".",
"setValue",
"(",
"Constants",
".",
"KEEP_ALIVE_HEADER_NAME",
")",
".",
"setString",
"(",
"value",
")",
";",
"if",
"(",
"http11",
")",
"{",
"MessageBytes",
"connectionHeaderValue",
"=",
"headers",
".",
"getValue",
"(",
"Constants",
".",
"CONNECTION",
")",
";",
"if",
"(",
"connectionHeaderValue",
"==",
"null",
")",
"{",
"headers",
".",
"addValue",
"(",
"Constants",
".",
"CONNECTION",
")",
".",
"setString",
"(",
"Constants",
".",
"KEEP_ALIVE_HEADER_VALUE_TOKEN",
")",
";",
"}",
"else",
"{",
"connectionHeaderValue",
".",
"setString",
"(",
"connectionHeaderValue",
".",
"getString",
"(",
")",
"+",
"\", \"",
"+",
"Constants",
".",
"KEEP_ALIVE_HEADER_VALUE_TOKEN",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"String",
"server",
"=",
"protocol",
".",
"getServer",
"(",
")",
";",
"if",
"(",
"server",
"==",
"null",
")",
"{",
"if",
"(",
"protocol",
".",
"getServerRemoveAppProvidedValues",
"(",
")",
")",
"{",
"headers",
".",
"removeHeader",
"(",
"\"server\"",
")",
";",
"}",
"}",
"else",
"{",
"headers",
".",
"setValue",
"(",
"\"Server\"",
")",
".",
"setString",
"(",
"server",
")",
";",
"}",
"try",
"{",
"outputBuffer",
".",
"sendStatus",
"(",
")",
";",
"int",
"size",
"=",
"headers",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"outputBuffer",
".",
"sendHeader",
"(",
"headers",
".",
"getName",
"(",
"i",
")",
",",
"headers",
".",
"getValue",
"(",
"i",
")",
")",
";",
"}",
"outputBuffer",
".",
"endHeaders",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"outputBuffer",
".",
"resetHeaderBuffer",
"(",
")",
";",
"throw",
"t",
";",
"}",
"outputBuffer",
".",
"commit",
"(",
")",
";",
"}"
] | When committing the response, we have to validate the set of headers, as
well as setup the response filters. | [
"When",
"committing",
"the",
"response",
"we",
"have",
"to",
"validate",
"the",
"set",
"of",
"headers",
"as",
"well",
"as",
"setup",
"the",
"response",
"filters",
"."
] | [
"// HTTP/0.9",
"// No entity body",
"// RFC 7231 requires the server to explicitly signal an empty",
"// response in this case",
"// No entity body",
"// Sendfile support",
"// Check for compression",
"// A SC_NO_CONTENT response may include entity headers",
"// If the response code supports an entity body and we're on",
"// HTTP 1.1 then we chunk unless we have a Connection: close header",
"// Add date header unless application has already set one (e.g. in a",
"// Caching Filter)",
"// FIXME: Add transfer encoding header",
"// Mark as close the connection after the request, and add the",
"// connection: close header",
"// This may disabled keep-alive to check before working out the",
"// Connection header.",
"// If we know that the request is bad this early, add the",
"// Connection: close header.",
"// Avoid adding the close header twice",
"// Append if there is already a Connection header,",
"// else create the header",
"// Add server header",
"// server always overrides anything the app might set",
"// Build the response header",
"// If something goes wrong, reset the header buffer so the error",
"// response can be written instead."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
4750,
727,
918,
2911,
1064,
1435,
1216,
1860,
288,
203,
203,
3639,
1250,
1522,
2250,
273,
638,
31,
203,
3639,
913,
23531,
367,
273,
629,
31,
203,
203,
3639,
3633,
1586,
8526,
876,
5422,
273,
876,
1892,
18,
588,
5422,
5621,
203,
203,
3639,
309,
261,
2505,
5908,
422,
638,
13,
288,
203,
5411,
368,
2239,
19,
20,
18,
29,
203,
5411,
876,
1892,
18,
1289,
3896,
1586,
12,
2844,
5422,
63,
2918,
18,
29413,
67,
11126,
19226,
203,
5411,
876,
1892,
18,
7371,
5621,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
509,
6593,
273,
766,
18,
588,
1482,
5621,
203,
3639,
309,
261,
30120,
411,
4044,
747,
6593,
422,
11492,
747,
6593,
422,
4200,
25,
747,
203,
7734,
6593,
422,
27499,
13,
288,
203,
5411,
368,
2631,
1522,
1417,
203,
5411,
876,
1892,
18,
1289,
3896,
1586,
203,
7734,
261,
2844,
5422,
63,
2918,
18,
58,
12945,
67,
11126,
19226,
203,
5411,
1522,
2250,
273,
629,
31,
203,
5411,
913,
23531,
367,
273,
638,
31,
203,
5411,
309,
261,
30120,
422,
4200,
25,
13,
288,
203,
7734,
368,
8372,
2371,
4366,
21,
4991,
326,
1438,
358,
8122,
4277,
392,
1008,
203,
7734,
368,
766,
316,
333,
648,
203,
7734,
766,
18,
542,
1350,
1782,
12,
20,
1769,
203,
5411,
289,
469,
288,
203,
7734,
766,
18,
542,
1350,
1782,
19236,
21,
1769,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
2350,
2160,
707,
7969,
273,
590,
18,
2039,
5621,
203,
3639,
309,
261,
2039,
7969,
18,
14963,
2932,
12458,
6,
3719,
288,
203,
5411,
368,
2631,
1522,
1417,
203,
5411,
876,
1892,
18,
1289,
3896,
1586,
203,
7734,
261,
2844,
5422,
63,
2918,
18,
58,
12945,
67,
11126,
19226,
203,
5411,
913,
23531,
367,
273,
638,
31,
203,
3639,
289,
203,
203,
3639,
368,
2479,
768,
2865,
203,
3639,
309,
261,
8003,
18,
588,
3727,
3826,
768,
10756,
288,
203,
5411,
2911,
3826,
768,
12,
2844,
5422,
1769,
203,
3639,
289,
203,
203,
3639,
368,
2073,
364,
9154,
203,
3639,
1250,
999,
15270,
273,
629,
31,
203,
3639,
309,
261,
1096,
2250,
597,
1366,
768,
751,
422,
446,
13,
288,
203,
5411,
999,
15270,
273,
1771,
18,
1202,
15270,
12,
2293,
16,
766,
1769,
203,
3639,
289,
203,
203,
3639,
22059,
3121,
1607,
273,
766,
18,
588,
13320,
3121,
5621,
203,
3639,
368,
432,
8795,
67,
3417,
67,
9689,
766,
2026,
2341,
1522,
1607,
203,
3639,
309,
261,
1096,
2250,
747,
6593,
422,
12446,
18,
2312,
67,
3417,
67,
9689,
13,
288,
203,
5411,
514,
5064,
273,
766,
18,
588,
8046,
5621,
203,
5411,
309,
261,
22194,
480,
446,
13,
288,
203,
7734,
1607,
18,
542,
620,
2932,
1350,
17,
559,
20387,
542,
780,
12,
22194,
1769,
203,
5411,
289,
203,
5411,
514,
913,
3779,
273,
766,
18,
588,
1350,
3779,
5621,
203,
5411,
309,
261,
1745,
3779,
480,
446,
13,
288,
203,
7734,
1607,
18,
542,
620,
2932,
1350,
17,
3779,
7923,
203,
10792,
263,
542,
780,
12,
1745,
3779,
1769,
203,
5411,
289,
203,
3639,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
5203,
3294,
1787,
326,
766,
16,
732,
1240,
358,
1954,
326,
444,
434,
1607,
16,
487,
203,
377,
380,
5492,
487,
3875,
326,
766,
3415,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
64917a80098e9fcb83d5f33af50d8da2fd3c8cff | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11Processor.java | [
"MIT"
] | Java | endRequest | null | private void endRequest() {
if (getErrorState().isError()) {
// If we know we are closing the connection, don't drain
// input. This way uploading a 100GB file doesn't tie up the
// thread if the servlet has rejected it.
inputBuffer.setSwallowInput(false);
} else {
// Need to check this again here in case the response was
// committed before the error that requires the connection
// to be closed occurred.
checkExpectationAndResponseStatus();
}
// Finish the handling of the request
if (getErrorState().isIoAllowed()) {
try {
inputBuffer.endRequest();
} catch (IOException e) {
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
// 500 - Internal Server Error
// Can't add a 500 to the access log since that has already been
// written in the Adapter.service method.
response.setStatus(500);
setErrorState(ErrorState.CLOSE_NOW, t);
log.error(sm.getString("http11processor.request.finish"), t);
}
}
if (getErrorState().isIoAllowed()) {
try {
action(ActionCode.COMMIT, null);
outputBuffer.end();
} catch (IOException e) {
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
setErrorState(ErrorState.CLOSE_NOW, t);
log.error(sm.getString("http11processor.response.finish"), t);
}
}
} | /*
* No more input will be passed to the application. Remaining input will be
* swallowed or the connection dropped depending on the error and
* expectation status.
*/ | No more input will be passed to the application. Remaining input will be
swallowed or the connection dropped depending on the error and
expectation status. | [
"No",
"more",
"input",
"will",
"be",
"passed",
"to",
"the",
"application",
".",
"Remaining",
"input",
"will",
"be",
"swallowed",
"or",
"the",
"connection",
"dropped",
"depending",
"on",
"the",
"error",
"and",
"expectation",
"status",
"."
] | private void endRequest() {
if (getErrorState().isError()) {
inputBuffer.setSwallowInput(false);
} else {
checkExpectationAndResponseStatus();
}
if (getErrorState().isIoAllowed()) {
try {
inputBuffer.endRequest();
} catch (IOException e) {
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
response.setStatus(500);
setErrorState(ErrorState.CLOSE_NOW, t);
log.error(sm.getString("http11processor.request.finish"), t);
}
}
if (getErrorState().isIoAllowed()) {
try {
action(ActionCode.COMMIT, null);
outputBuffer.end();
} catch (IOException e) {
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
setErrorState(ErrorState.CLOSE_NOW, t);
log.error(sm.getString("http11processor.response.finish"), t);
}
}
} | [
"private",
"void",
"endRequest",
"(",
")",
"{",
"if",
"(",
"getErrorState",
"(",
")",
".",
"isError",
"(",
")",
")",
"{",
"inputBuffer",
".",
"setSwallowInput",
"(",
"false",
")",
";",
"}",
"else",
"{",
"checkExpectationAndResponseStatus",
"(",
")",
";",
"}",
"if",
"(",
"getErrorState",
"(",
")",
".",
"isIoAllowed",
"(",
")",
")",
"{",
"try",
"{",
"inputBuffer",
".",
"endRequest",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"setErrorState",
"(",
"ErrorState",
".",
"CLOSE_CONNECTION_NOW",
",",
"e",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"response",
".",
"setStatus",
"(",
"500",
")",
";",
"setErrorState",
"(",
"ErrorState",
".",
"CLOSE_NOW",
",",
"t",
")",
";",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"http11processor.request.finish\"",
")",
",",
"t",
")",
";",
"}",
"}",
"if",
"(",
"getErrorState",
"(",
")",
".",
"isIoAllowed",
"(",
")",
")",
"{",
"try",
"{",
"action",
"(",
"ActionCode",
".",
"COMMIT",
",",
"null",
")",
";",
"outputBuffer",
".",
"end",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"setErrorState",
"(",
"ErrorState",
".",
"CLOSE_CONNECTION_NOW",
",",
"e",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"setErrorState",
"(",
"ErrorState",
".",
"CLOSE_NOW",
",",
"t",
")",
";",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"http11processor.response.finish\"",
")",
",",
"t",
")",
";",
"}",
"}",
"}"
] | No more input will be passed to the application. | [
"No",
"more",
"input",
"will",
"be",
"passed",
"to",
"the",
"application",
"."
] | [
"// If we know we are closing the connection, don't drain",
"// input. This way uploading a 100GB file doesn't tie up the",
"// thread if the servlet has rejected it.",
"// Need to check this again here in case the response was",
"// committed before the error that requires the connection",
"// to be closed occurred.",
"// Finish the handling of the request",
"// 500 - Internal Server Error",
"// Can't add a 500 to the access log since that has already been",
"// written in the Adapter.service method."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
679,
691,
1435,
288,
203,
3639,
309,
261,
588,
668,
1119,
7675,
291,
668,
10756,
288,
203,
5411,
368,
971,
732,
5055,
732,
854,
7647,
326,
1459,
16,
2727,
1404,
15427,
203,
5411,
368,
810,
18,
1220,
4031,
25306,
279,
2130,
5887,
585,
3302,
1404,
25318,
731,
326,
203,
5411,
368,
2650,
309,
326,
8100,
711,
11876,
518,
18,
203,
5411,
810,
1892,
18,
542,
6050,
5965,
1210,
12,
5743,
1769,
203,
3639,
289,
469,
288,
203,
5411,
368,
12324,
358,
866,
333,
3382,
2674,
316,
648,
326,
766,
1703,
203,
5411,
368,
16015,
1865,
326,
555,
716,
4991,
326,
1459,
203,
5411,
368,
358,
506,
4375,
7841,
18,
203,
5411,
866,
11988,
367,
1876,
1064,
1482,
5621,
203,
3639,
289,
203,
203,
3639,
368,
18560,
326,
5057,
434,
326,
590,
203,
3639,
309,
261,
588,
668,
1119,
7675,
291,
15963,
5042,
10756,
288,
203,
5411,
775,
288,
203,
7734,
810,
1892,
18,
409,
691,
5621,
203,
5411,
289,
1044,
261,
14106,
425,
13,
288,
203,
7734,
9967,
1119,
12,
668,
1119,
18,
13384,
67,
15461,
67,
27091,
16,
425,
1769,
203,
5411,
289,
1044,
261,
15155,
268,
13,
288,
203,
7734,
1185,
1989,
18,
4110,
15155,
12,
88,
1769,
203,
7734,
368,
6604,
300,
3186,
3224,
1068,
203,
7734,
368,
4480,
1404,
527,
279,
6604,
358,
326,
2006,
613,
3241,
716,
711,
1818,
2118,
203,
7734,
368,
5941,
316,
326,
14238,
18,
3278,
707,
18,
203,
7734,
766,
18,
542,
1482,
12,
12483,
1769,
203,
7734,
9967,
1119,
12,
668,
1119,
18,
13384,
67,
27091,
16,
268,
1769,
203,
7734,
613,
18,
1636,
12,
4808,
18,
588,
780,
2932,
2505,
2499,
8700,
18,
2293,
18,
13749,
6,
3631,
268,
1769,
203,
5411,
289,
203,
3639,
289,
203,
3639,
309,
261,
588,
668,
1119,
7675,
291,
15963,
5042,
10756,
288,
203,
5411,
775,
288,
203,
7734,
1301,
12,
1803,
1085,
18,
18658,
16,
446,
1769,
203,
7734,
876,
1892,
18,
409,
5621,
203,
5411,
289,
1044,
261,
14106,
425,
13,
288,
203,
7734,
9967,
1119,
12,
668,
1119,
18,
13384,
67,
15461,
67,
27091,
16,
425,
1769,
203,
5411,
289,
1044,
261,
15155,
268,
13,
288,
203,
7734,
1185,
1989,
18,
4110,
15155,
12,
88,
1769,
203,
7734,
9967,
1119,
12,
668,
1119,
18,
13384,
67,
27091,
16,
268,
1769,
203,
7734,
613,
18,
1636,
12,
4808,
18,
588,
780,
2932,
2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100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
64917a80098e9fcb83d5f33af50d8da2fd3c8cff | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11Processor.java | [
"MIT"
] | Java | processSendfile | SendfileState | private SendfileState processSendfile(SocketWrapperBase<?> socketWrapper) {
openSocket = keepAlive;
// Done is equivalent to sendfile not being used
SendfileState result = SendfileState.DONE;
// Do sendfile as needed: add socket to sendfile and end
if (sendfileData != null && !getErrorState().isError()) {
if (keepAlive) {
if (available(false) == 0) {
sendfileData.keepAliveState = SendfileKeepAliveState.OPEN;
} else {
sendfileData.keepAliveState = SendfileKeepAliveState.PIPELINED;
}
} else {
sendfileData.keepAliveState = SendfileKeepAliveState.NONE;
}
result = socketWrapper.processSendfile(sendfileData);
switch (result) {
case ERROR:
// Write failed
if (log.isDebugEnabled()) {
log.debug(sm.getString("http11processor.sendfile.error"));
}
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, null);
//$FALL-THROUGH$
default:
sendfileData = null;
}
}
return result;
} | /**
* Trigger sendfile processing if required.
*
* @return The state of send file processing
*/ | Trigger sendfile processing if required.
@return The state of send file processing | [
"Trigger",
"sendfile",
"processing",
"if",
"required",
".",
"@return",
"The",
"state",
"of",
"send",
"file",
"processing"
] | private SendfileState processSendfile(SocketWrapperBase<?> socketWrapper) {
openSocket = keepAlive;
SendfileState result = SendfileState.DONE;
if (sendfileData != null && !getErrorState().isError()) {
if (keepAlive) {
if (available(false) == 0) {
sendfileData.keepAliveState = SendfileKeepAliveState.OPEN;
} else {
sendfileData.keepAliveState = SendfileKeepAliveState.PIPELINED;
}
} else {
sendfileData.keepAliveState = SendfileKeepAliveState.NONE;
}
result = socketWrapper.processSendfile(sendfileData);
switch (result) {
case ERROR:
if (log.isDebugEnabled()) {
log.debug(sm.getString("http11processor.sendfile.error"));
}
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, null);
default:
sendfileData = null;
}
}
return result;
} | [
"private",
"SendfileState",
"processSendfile",
"(",
"SocketWrapperBase",
"<",
"?",
">",
"socketWrapper",
")",
"{",
"openSocket",
"=",
"keepAlive",
";",
"SendfileState",
"result",
"=",
"SendfileState",
".",
"DONE",
";",
"if",
"(",
"sendfileData",
"!=",
"null",
"&&",
"!",
"getErrorState",
"(",
")",
".",
"isError",
"(",
")",
")",
"{",
"if",
"(",
"keepAlive",
")",
"{",
"if",
"(",
"available",
"(",
"false",
")",
"==",
"0",
")",
"{",
"sendfileData",
".",
"keepAliveState",
"=",
"SendfileKeepAliveState",
".",
"OPEN",
";",
"}",
"else",
"{",
"sendfileData",
".",
"keepAliveState",
"=",
"SendfileKeepAliveState",
".",
"PIPELINED",
";",
"}",
"}",
"else",
"{",
"sendfileData",
".",
"keepAliveState",
"=",
"SendfileKeepAliveState",
".",
"NONE",
";",
"}",
"result",
"=",
"socketWrapper",
".",
"processSendfile",
"(",
"sendfileData",
")",
";",
"switch",
"(",
"result",
")",
"{",
"case",
"ERROR",
":",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"http11processor.sendfile.error\"",
")",
")",
";",
"}",
"setErrorState",
"(",
"ErrorState",
".",
"CLOSE_CONNECTION_NOW",
",",
"null",
")",
";",
"default",
":",
"sendfileData",
"=",
"null",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Trigger sendfile processing if required. | [
"Trigger",
"sendfile",
"processing",
"if",
"required",
"."
] | [
"// Done is equivalent to sendfile not being used",
"// Do sendfile as needed: add socket to sendfile and end",
"// Write failed",
"//$FALL-THROUGH$"
] | [
{
"param": "socketWrapper",
"type": "SocketWrapperBase<?>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "socketWrapper",
"type": "SocketWrapperBase<?>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
2479,
768,
1119,
1207,
3826,
768,
12,
4534,
3611,
2171,
12880,
34,
2987,
3611,
13,
288,
203,
3639,
1696,
4534,
273,
24115,
31,
203,
3639,
368,
8677,
353,
7680,
358,
1366,
768,
486,
3832,
1399,
203,
3639,
2479,
768,
1119,
563,
273,
2479,
768,
1119,
18,
26875,
31,
203,
3639,
368,
2256,
1366,
768,
487,
3577,
30,
527,
2987,
358,
1366,
768,
471,
679,
203,
3639,
309,
261,
4661,
768,
751,
480,
446,
597,
401,
588,
668,
1119,
7675,
291,
668,
10756,
288,
203,
5411,
309,
261,
10102,
10608,
13,
288,
203,
7734,
309,
261,
5699,
12,
5743,
13,
422,
374,
13,
288,
203,
10792,
1366,
768,
751,
18,
10102,
10608,
1119,
273,
2479,
768,
24456,
1119,
18,
11437,
31,
203,
7734,
289,
469,
288,
203,
10792,
1366,
768,
751,
18,
10102,
10608,
1119,
273,
2479,
768,
24456,
1119,
18,
27602,
20663,
2056,
31,
203,
7734,
289,
203,
5411,
289,
469,
288,
203,
7734,
1366,
768,
751,
18,
10102,
10608,
1119,
273,
2479,
768,
24456,
1119,
18,
9826,
31,
203,
5411,
289,
203,
5411,
563,
273,
2987,
3611,
18,
2567,
3826,
768,
12,
4661,
768,
751,
1769,
203,
5411,
1620,
261,
2088,
13,
288,
203,
5411,
648,
5475,
30,
203,
7734,
368,
2598,
2535,
203,
7734,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
10792,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
2505,
2499,
8700,
18,
4661,
768,
18,
1636,
7923,
1769,
203,
7734,
289,
203,
7734,
9967,
1119,
12,
668,
1119,
18,
13384,
67,
15461,
67,
27091,
16,
446,
1769,
203,
7734,
4329,
42,
4685,
17,
2455,
1457,
57,
16715,
8,
203,
5411,
805,
30,
203,
7734,
1366,
768,
751,
273,
446,
31,
203,
5411,
289,
203,
3639,
289,
203,
3639,
327,
563,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
11321,
1366,
768,
4929,
309,
1931,
18,
203,
377,
380,
203,
377,
380,
632,
2463,
1021,
919,
434,
1366,
585,
4929,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
0cd6d7c85917340c671a977ed90905f2f11d4651 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/javax/servlet/http/HttpServlet.java | [
"MIT"
] | Java | doGet | null | protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
String protocol = req.getProtocol();
System.out.println("当前协议:current protocol is ===>" + protocol);
String msg = lStrings.getString("http.method_get_not_supported");
if (protocol.endsWith("1.1")) {
resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg);
} else {
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
}
} | /**
* Called by the server (via the <code>service</code> method) to
* allow a servlet to handle a GET request.
*
* <p>Overriding this method to support a GET request also
* automatically supports an HTTP HEAD request. A HEAD
* request is a GET request that returns no body in the
* response, only the request header fields.
*
* <p>When overriding this method, read the request data,
* write the response headers, get the response's writer or
* output stream object, and finally, write the response data.
* It's best to include content type and encoding. When using
* a <code>PrintWriter</code> object to return the response,
* set the content type before accessing the
* <code>PrintWriter</code> object.
*
* <p>The servlet container must write the headers before
* committing the response, because in HTTP the headers must be sent
* before the response body.
*
* <p>Where possible, set the Content-Length header (with the
* {@link javax.servlet.ServletResponse#setContentLength} method),
* to allow the servlet container to use a persistent connection
* to return its response to the client, improving performance.
* The content length is automatically set if the entire response fits
* inside the response buffer.
*
* <p>When using HTTP 1.1 chunked encoding (which means that the response
* has a Transfer-Encoding header), do not set the Content-Length header.
*
* <p>The GET method should be safe, that is, without
* any side effects for which users are held responsible.
* For example, most form queries have no side effects.
* If a client request is intended to change stored data,
* the request should use some other HTTP method.
*
* <p>The GET method should also be idempotent, meaning
* that it can be safely repeated. Sometimes making a
* method safe also makes it idempotent. For example,
* repeating queries is both safe and idempotent, but
* buying a product online or modifying data is neither
* safe nor idempotent.
*
* <p>If the request is incorrectly formatted, <code>doGet</code>
* returns an HTTP "Bad Request" message.
*
* @param req an {@link HttpServletRequest} object that
* contains the request the client has made
* of the servlet
*
* @param resp an {@link HttpServletResponse} object that
* contains the response the servlet sends
* to the client
*
* @exception IOException if an input or output error is
* detected when the servlet handles
* the GET request
*
* @exception ServletException if the request for the GET
* could not be handled
*
* @see javax.servlet.ServletResponse#setContentType
*/ | Called by the server (via the service method) to
allow a servlet to handle a GET request.
Overriding this method to support a GET request also
automatically supports an HTTP HEAD request. A HEAD
request is a GET request that returns no body in the
response, only the request header fields.
When overriding this method, read the request data,
write the response headers, get the response's writer or
output stream object, and finally, write the response data.
It's best to include content type and encoding. When using
a PrintWriter object to return the response,
set the content type before accessing the
PrintWriter object.
The servlet container must write the headers before
committing the response, because in HTTP the headers must be sent
before the response body.
When using HTTP 1.1 chunked encoding (which means that the response
has a Transfer-Encoding header), do not set the Content-Length header.
The GET method should be safe, that is, without
any side effects for which users are held responsible.
For example, most form queries have no side effects.
If a client request is intended to change stored data,
the request should use some other HTTP method.
The GET method should also be idempotent, meaning
that it can be safely repeated. Sometimes making a
method safe also makes it idempotent. For example,
repeating queries is both safe and idempotent, but
buying a product online or modifying data is neither
safe nor idempotent.
If the request is incorrectly formatted, doGet
returns an HTTP "Bad Request" message.
@param req an HttpServletRequest object that
contains the request the client has made
of the servlet
@param resp an HttpServletResponse object that
contains the response the servlet sends
to the client
@exception IOException if an input or output error is
detected when the servlet handles
the GET request
@exception ServletException if the request for the GET
could not be handled
| [
"Called",
"by",
"the",
"server",
"(",
"via",
"the",
"service",
"method",
")",
"to",
"allow",
"a",
"servlet",
"to",
"handle",
"a",
"GET",
"request",
".",
"Overriding",
"this",
"method",
"to",
"support",
"a",
"GET",
"request",
"also",
"automatically",
"supports",
"an",
"HTTP",
"HEAD",
"request",
".",
"A",
"HEAD",
"request",
"is",
"a",
"GET",
"request",
"that",
"returns",
"no",
"body",
"in",
"the",
"response",
"only",
"the",
"request",
"header",
"fields",
".",
"When",
"overriding",
"this",
"method",
"read",
"the",
"request",
"data",
"write",
"the",
"response",
"headers",
"get",
"the",
"response",
"'",
"s",
"writer",
"or",
"output",
"stream",
"object",
"and",
"finally",
"write",
"the",
"response",
"data",
".",
"It",
"'",
"s",
"best",
"to",
"include",
"content",
"type",
"and",
"encoding",
".",
"When",
"using",
"a",
"PrintWriter",
"object",
"to",
"return",
"the",
"response",
"set",
"the",
"content",
"type",
"before",
"accessing",
"the",
"PrintWriter",
"object",
".",
"The",
"servlet",
"container",
"must",
"write",
"the",
"headers",
"before",
"committing",
"the",
"response",
"because",
"in",
"HTTP",
"the",
"headers",
"must",
"be",
"sent",
"before",
"the",
"response",
"body",
".",
"When",
"using",
"HTTP",
"1",
".",
"1",
"chunked",
"encoding",
"(",
"which",
"means",
"that",
"the",
"response",
"has",
"a",
"Transfer",
"-",
"Encoding",
"header",
")",
"do",
"not",
"set",
"the",
"Content",
"-",
"Length",
"header",
".",
"The",
"GET",
"method",
"should",
"be",
"safe",
"that",
"is",
"without",
"any",
"side",
"effects",
"for",
"which",
"users",
"are",
"held",
"responsible",
".",
"For",
"example",
"most",
"form",
"queries",
"have",
"no",
"side",
"effects",
".",
"If",
"a",
"client",
"request",
"is",
"intended",
"to",
"change",
"stored",
"data",
"the",
"request",
"should",
"use",
"some",
"other",
"HTTP",
"method",
".",
"The",
"GET",
"method",
"should",
"also",
"be",
"idempotent",
"meaning",
"that",
"it",
"can",
"be",
"safely",
"repeated",
".",
"Sometimes",
"making",
"a",
"method",
"safe",
"also",
"makes",
"it",
"idempotent",
".",
"For",
"example",
"repeating",
"queries",
"is",
"both",
"safe",
"and",
"idempotent",
"but",
"buying",
"a",
"product",
"online",
"or",
"modifying",
"data",
"is",
"neither",
"safe",
"nor",
"idempotent",
".",
"If",
"the",
"request",
"is",
"incorrectly",
"formatted",
"doGet",
"returns",
"an",
"HTTP",
"\"",
"Bad",
"Request",
"\"",
"message",
".",
"@param",
"req",
"an",
"HttpServletRequest",
"object",
"that",
"contains",
"the",
"request",
"the",
"client",
"has",
"made",
"of",
"the",
"servlet",
"@param",
"resp",
"an",
"HttpServletResponse",
"object",
"that",
"contains",
"the",
"response",
"the",
"servlet",
"sends",
"to",
"the",
"client",
"@exception",
"IOException",
"if",
"an",
"input",
"or",
"output",
"error",
"is",
"detected",
"when",
"the",
"servlet",
"handles",
"the",
"GET",
"request",
"@exception",
"ServletException",
"if",
"the",
"request",
"for",
"the",
"GET",
"could",
"not",
"be",
"handled"
] | protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
String protocol = req.getProtocol();
System.out.println("当前协议:current protocol is ===>" + protocol);
String msg = lStrings.getString("http.method_get_not_supported");
if (protocol.endsWith("1.1")) {
resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg);
} else {
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
}
} | [
"protected",
"void",
"doGet",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"String",
"protocol",
"=",
"req",
".",
"getProtocol",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"当前协议:current protocol is ===>\" + protoco",
")",
"",
"",
"",
"String",
"msg",
"=",
"lStrings",
".",
"getString",
"(",
"\"http.method_get_not_supported\"",
")",
";",
"if",
"(",
"protocol",
".",
"endsWith",
"(",
"\"1.1\"",
")",
")",
"{",
"resp",
".",
"sendError",
"(",
"HttpServletResponse",
".",
"SC_METHOD_NOT_ALLOWED",
",",
"msg",
")",
";",
"}",
"else",
"{",
"resp",
".",
"sendError",
"(",
"HttpServletResponse",
".",
"SC_BAD_REQUEST",
",",
"msg",
")",
";",
"}",
"}"
] | Called by the server (via the <code>service</code> method) to
allow a servlet to handle a GET request. | [
"Called",
"by",
"the",
"server",
"(",
"via",
"the",
"<code",
">",
"service<",
"/",
"code",
">",
"method",
")",
"to",
"allow",
"a",
"servlet",
"to",
"handle",
"a",
"GET",
"request",
"."
] | [] | [
{
"param": "req",
"type": "HttpServletRequest"
},
{
"param": "resp",
"type": "HttpServletResponse"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "req",
"type": "HttpServletRequest",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "resp",
"type": "HttpServletResponse",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
23611,
12,
2940,
18572,
1111,
16,
12446,
1718,
13,
203,
3639,
1216,
16517,
16,
1860,
203,
565,
288,
203,
3639,
514,
1771,
273,
1111,
18,
588,
5752,
5621,
203,
3639,
2332,
18,
659,
18,
8222,
2932,
166,
126,
246,
166,
236,
240,
166,
240,
242,
169,
111,
111,
176,
125,
253,
2972,
1771,
353,
757,
2984,
397,
1771,
1769,
203,
3639,
514,
1234,
273,
328,
7957,
18,
588,
780,
2932,
2505,
18,
2039,
67,
588,
67,
902,
67,
4127,
8863,
203,
3639,
309,
261,
8373,
18,
5839,
1190,
2932,
21,
18,
21,
6,
3719,
288,
203,
5411,
1718,
18,
4661,
668,
12,
2940,
29910,
18,
2312,
67,
5327,
67,
4400,
67,
16852,
16,
1234,
1769,
203,
3639,
289,
469,
288,
203,
5411,
1718,
18,
4661,
668,
12,
2940,
29910,
18,
2312,
67,
16234,
67,
5519,
16,
1234,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
11782,
635,
326,
1438,
261,
21985,
326,
411,
710,
34,
3278,
1757,
710,
34,
707,
13,
358,
203,
377,
380,
1699,
279,
8100,
358,
1640,
279,
4978,
590,
18,
203,
377,
380,
203,
377,
380,
411,
84,
34,
22042,
10415,
333,
707,
358,
2865,
279,
4978,
590,
2546,
203,
377,
380,
6635,
6146,
392,
2239,
14792,
590,
18,
432,
14792,
203,
377,
380,
590,
353,
279,
4978,
590,
716,
1135,
1158,
1417,
316,
326,
203,
377,
380,
766,
16,
1338,
326,
590,
1446,
1466,
18,
203,
377,
380,
203,
377,
380,
411,
84,
34,
9434,
19488,
333,
707,
16,
855,
326,
590,
501,
16,
203,
377,
380,
1045,
326,
766,
1607,
16,
336,
326,
766,
1807,
2633,
578,
203,
377,
380,
876,
2
] |
0cd6d7c85917340c671a977ed90905f2f11d4651 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/javax/servlet/http/HttpServlet.java | [
"MIT"
] | Java | doTrace | null | protected void doTrace(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
int responseLength;
String CRLF = "\r\n";
StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI())
.append(" ").append(req.getProtocol());
Enumeration<String> reqHeaderEnum = req.getHeaderNames();
while( reqHeaderEnum.hasMoreElements() ) {
String headerName = reqHeaderEnum.nextElement();
buffer.append(CRLF).append(headerName).append(": ")
.append(req.getHeader(headerName));
}
buffer.append(CRLF);
responseLength = buffer.length();
resp.setContentType("message/http");
resp.setContentLength(responseLength);
ServletOutputStream out = resp.getOutputStream();
out.print(buffer.toString());
out.close();
} | /**
* Called by the server (via the <code>service</code> method)
* to allow a servlet to handle a TRACE request.
*
* A TRACE returns the headers sent with the TRACE
* request to the client, so that they can be used in
* debugging. There's no need to override this method.
*
* @param req the {@link HttpServletRequest} object that
* contains the request the client made of
* the servlet
*
* @param resp the {@link HttpServletResponse} object that
* contains the response the servlet returns
* to the client
*
* @exception IOException if an input or output error occurs
* while the servlet is handling the
* TRACE request
*
* @exception ServletException if the request for the
* TRACE cannot be handled
*/ | Called by the server (via the service method)
to allow a servlet to handle a TRACE request.
A TRACE returns the headers sent with the TRACE
request to the client, so that they can be used in
debugging. There's no need to override this method.
@param req the HttpServletRequest object that
contains the request the client made of
the servlet
@param resp the HttpServletResponse object that
contains the response the servlet returns
to the client
@exception IOException if an input or output error occurs
while the servlet is handling the
TRACE request
@exception ServletException if the request for the
TRACE cannot be handled | [
"Called",
"by",
"the",
"server",
"(",
"via",
"the",
"service",
"method",
")",
"to",
"allow",
"a",
"servlet",
"to",
"handle",
"a",
"TRACE",
"request",
".",
"A",
"TRACE",
"returns",
"the",
"headers",
"sent",
"with",
"the",
"TRACE",
"request",
"to",
"the",
"client",
"so",
"that",
"they",
"can",
"be",
"used",
"in",
"debugging",
".",
"There",
"'",
"s",
"no",
"need",
"to",
"override",
"this",
"method",
".",
"@param",
"req",
"the",
"HttpServletRequest",
"object",
"that",
"contains",
"the",
"request",
"the",
"client",
"made",
"of",
"the",
"servlet",
"@param",
"resp",
"the",
"HttpServletResponse",
"object",
"that",
"contains",
"the",
"response",
"the",
"servlet",
"returns",
"to",
"the",
"client",
"@exception",
"IOException",
"if",
"an",
"input",
"or",
"output",
"error",
"occurs",
"while",
"the",
"servlet",
"is",
"handling",
"the",
"TRACE",
"request",
"@exception",
"ServletException",
"if",
"the",
"request",
"for",
"the",
"TRACE",
"cannot",
"be",
"handled"
] | protected void doTrace(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
int responseLength;
String CRLF = "\r\n";
StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI())
.append(" ").append(req.getProtocol());
Enumeration<String> reqHeaderEnum = req.getHeaderNames();
while( reqHeaderEnum.hasMoreElements() ) {
String headerName = reqHeaderEnum.nextElement();
buffer.append(CRLF).append(headerName).append(": ")
.append(req.getHeader(headerName));
}
buffer.append(CRLF);
responseLength = buffer.length();
resp.setContentType("message/http");
resp.setContentLength(responseLength);
ServletOutputStream out = resp.getOutputStream();
out.print(buffer.toString());
out.close();
} | [
"protected",
"void",
"doTrace",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"int",
"responseLength",
";",
"String",
"CRLF",
"=",
"\"\\r\\n\"",
";",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"\"TRACE \"",
")",
".",
"append",
"(",
"req",
".",
"getRequestURI",
"(",
")",
")",
".",
"append",
"(",
"\" \"",
")",
".",
"append",
"(",
"req",
".",
"getProtocol",
"(",
")",
")",
";",
"Enumeration",
"<",
"String",
">",
"reqHeaderEnum",
"=",
"req",
".",
"getHeaderNames",
"(",
")",
";",
"while",
"(",
"reqHeaderEnum",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"headerName",
"=",
"reqHeaderEnum",
".",
"nextElement",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"CRLF",
")",
".",
"append",
"(",
"headerName",
")",
".",
"append",
"(",
"\": \"",
")",
".",
"append",
"(",
"req",
".",
"getHeader",
"(",
"headerName",
")",
")",
";",
"}",
"buffer",
".",
"append",
"(",
"CRLF",
")",
";",
"responseLength",
"=",
"buffer",
".",
"length",
"(",
")",
";",
"resp",
".",
"setContentType",
"(",
"\"message/http\"",
")",
";",
"resp",
".",
"setContentLength",
"(",
"responseLength",
")",
";",
"ServletOutputStream",
"out",
"=",
"resp",
".",
"getOutputStream",
"(",
")",
";",
"out",
".",
"print",
"(",
"buffer",
".",
"toString",
"(",
")",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}"
] | Called by the server (via the <code>service</code> method)
to allow a servlet to handle a TRACE request. | [
"Called",
"by",
"the",
"server",
"(",
"via",
"the",
"<code",
">",
"service<",
"/",
"code",
">",
"method",
")",
"to",
"allow",
"a",
"servlet",
"to",
"handle",
"a",
"TRACE",
"request",
"."
] | [] | [
{
"param": "req",
"type": "HttpServletRequest"
},
{
"param": "resp",
"type": "HttpServletResponse"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "req",
"type": "HttpServletRequest",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "resp",
"type": "HttpServletResponse",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
741,
3448,
12,
2940,
18572,
1111,
16,
12446,
1718,
13,
203,
3639,
1216,
16517,
16,
1860,
203,
565,
288,
203,
203,
3639,
509,
766,
1782,
31,
203,
203,
3639,
514,
21791,
273,
1548,
86,
64,
82,
14432,
203,
3639,
3225,
1613,
273,
394,
3225,
2932,
23827,
315,
2934,
6923,
12,
3658,
18,
588,
691,
3098,
10756,
203,
5411,
263,
6923,
2932,
315,
2934,
6923,
12,
3658,
18,
588,
5752,
10663,
203,
203,
3639,
13864,
32,
780,
34,
1111,
1864,
3572,
273,
1111,
18,
588,
1864,
1557,
5621,
203,
203,
3639,
1323,
12,
1111,
1864,
3572,
18,
5332,
7417,
3471,
1435,
262,
288,
203,
5411,
514,
19430,
273,
1111,
1864,
3572,
18,
4285,
1046,
5621,
203,
5411,
1613,
18,
6923,
12,
5093,
9105,
2934,
6923,
12,
3374,
461,
2934,
6923,
2932,
30,
9369,
203,
7734,
263,
6923,
12,
3658,
18,
588,
1864,
12,
3374,
461,
10019,
203,
3639,
289,
203,
203,
3639,
1613,
18,
6923,
12,
5093,
9105,
1769,
203,
203,
3639,
766,
1782,
273,
1613,
18,
2469,
5621,
203,
203,
3639,
1718,
18,
542,
8046,
2932,
2150,
19,
2505,
8863,
203,
3639,
1718,
18,
542,
1350,
1782,
12,
2740,
1782,
1769,
203,
3639,
7971,
4632,
596,
273,
1718,
18,
588,
4632,
5621,
203,
3639,
596,
18,
1188,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
11782,
635,
326,
1438,
261,
21985,
326,
411,
710,
34,
3278,
1757,
710,
34,
707,
13,
203,
377,
380,
358,
1699,
279,
8100,
358,
1640,
279,
12734,
590,
18,
203,
377,
380,
203,
377,
380,
432,
12734,
1135,
326,
1607,
3271,
598,
326,
12734,
203,
377,
380,
590,
358,
326,
1004,
16,
1427,
716,
2898,
848,
506,
1399,
316,
203,
377,
380,
10450,
18,
6149,
1807,
1158,
1608,
358,
3849,
333,
707,
18,
203,
377,
380,
203,
377,
380,
632,
891,
1111,
282,
326,
8901,
1232,
9984,
97,
733,
716,
203,
377,
380,
5375,
1914,
326,
590,
326,
1004,
7165,
434,
203,
377,
380,
5375,
326,
8100,
203,
377,
380,
203,
377,
380,
632,
891,
1718,
225,
326,
8901,
1232,
12446,
97,
2
] |
d7e3b988655df09d727ea10266cefbe17b94fe07 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/loader/WebappLoader.java | [
"MIT"
] | Java | startInternal | null | @Override
protected void startInternal() throws LifecycleException {
if (log.isDebugEnabled())
log.debug(sm.getString("webappLoader.starting"));
if (context.getResources() == null) {
log.info("No resources for " + context);
setState(LifecycleState.STARTING);
return;
}
// Construct a class loader based on our current repositories list
try {
classLoader = createClassLoader();
classLoader.setResources(context.getResources());
classLoader.setDelegate(this.delegate);
// Configure our repositories
setClassPath();
setPermissions();
((Lifecycle) classLoader).start();
String contextName = context.getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName cloname = new ObjectName(context.getDomain() + ":type=" +
classLoader.getClass().getSimpleName() + ",host=" +
context.getParent().getName() + ",context=" + contextName);
Registry.getRegistry(null, null)
.registerComponent(classLoader, cloname, null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
log.error( "LifecycleException ", t );
throw new LifecycleException("start: ", t);
}
setState(LifecycleState.STARTING);
} | /**
* Start associated {@link ClassLoader} and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/ | Start associated ClassLoader and implement the requirements
of org.apache.catalina.util.LifecycleBase#startInternal().
@exception LifecycleException if this component detects a fatal error
that prevents this component from being used | [
"Start",
"associated",
"ClassLoader",
"and",
"implement",
"the",
"requirements",
"of",
"org",
".",
"apache",
".",
"catalina",
".",
"util",
".",
"LifecycleBase#startInternal",
"()",
".",
"@exception",
"LifecycleException",
"if",
"this",
"component",
"detects",
"a",
"fatal",
"error",
"that",
"prevents",
"this",
"component",
"from",
"being",
"used"
] | @Override
protected void startInternal() throws LifecycleException {
if (log.isDebugEnabled())
log.debug(sm.getString("webappLoader.starting"));
if (context.getResources() == null) {
log.info("No resources for " + context);
setState(LifecycleState.STARTING);
return;
}
try {
classLoader = createClassLoader();
classLoader.setResources(context.getResources());
classLoader.setDelegate(this.delegate);
setClassPath();
setPermissions();
((Lifecycle) classLoader).start();
String contextName = context.getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName cloname = new ObjectName(context.getDomain() + ":type=" +
classLoader.getClass().getSimpleName() + ",host=" +
context.getParent().getName() + ",context=" + contextName);
Registry.getRegistry(null, null)
.registerComponent(classLoader, cloname, null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
log.error( "LifecycleException ", t );
throw new LifecycleException("start: ", t);
}
setState(LifecycleState.STARTING);
} | [
"@",
"Override",
"protected",
"void",
"startInternal",
"(",
")",
"throws",
"LifecycleException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"webappLoader.starting\"",
")",
")",
";",
"if",
"(",
"context",
".",
"getResources",
"(",
")",
"==",
"null",
")",
"{",
"log",
".",
"info",
"(",
"\"No resources for \"",
"+",
"context",
")",
";",
"setState",
"(",
"LifecycleState",
".",
"STARTING",
")",
";",
"return",
";",
"}",
"try",
"{",
"classLoader",
"=",
"createClassLoader",
"(",
")",
";",
"classLoader",
".",
"setResources",
"(",
"context",
".",
"getResources",
"(",
")",
")",
";",
"classLoader",
".",
"setDelegate",
"(",
"this",
".",
"delegate",
")",
";",
"setClassPath",
"(",
")",
";",
"setPermissions",
"(",
")",
";",
"(",
"(",
"Lifecycle",
")",
"classLoader",
")",
".",
"start",
"(",
")",
";",
"String",
"contextName",
"=",
"context",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"contextName",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"contextName",
"=",
"\"/\"",
"+",
"contextName",
";",
"}",
"ObjectName",
"cloname",
"=",
"new",
"ObjectName",
"(",
"context",
".",
"getDomain",
"(",
")",
"+",
"\":type=\"",
"+",
"classLoader",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\",host=\"",
"+",
"context",
".",
"getParent",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\",context=\"",
"+",
"contextName",
")",
";",
"Registry",
".",
"getRegistry",
"(",
"null",
",",
"null",
")",
".",
"registerComponent",
"(",
"classLoader",
",",
"cloname",
",",
"null",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"t",
"=",
"ExceptionUtils",
".",
"unwrapInvocationTargetException",
"(",
"t",
")",
";",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"log",
".",
"error",
"(",
"\"LifecycleException \"",
",",
"t",
")",
";",
"throw",
"new",
"LifecycleException",
"(",
"\"start: \"",
",",
"t",
")",
";",
"}",
"setState",
"(",
"LifecycleState",
".",
"STARTING",
")",
";",
"}"
] | Start associated {@link ClassLoader} and implement the requirements
of {@link org.apache.catalina.util.LifecycleBase#startInternal()}. | [
"Start",
"associated",
"{",
"@link",
"ClassLoader",
"}",
"and",
"implement",
"the",
"requirements",
"of",
"{",
"@link",
"org",
".",
"apache",
".",
"catalina",
".",
"util",
".",
"LifecycleBase#startInternal",
"()",
"}",
"."
] | [
"// Construct a class loader based on our current repositories list",
"// Configure our repositories"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
4750,
918,
787,
3061,
1435,
1216,
14283,
503,
288,
203,
203,
3639,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
203,
5411,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
4875,
2910,
2886,
18,
18526,
7923,
1769,
203,
203,
3639,
309,
261,
2472,
18,
588,
3805,
1435,
422,
446,
13,
288,
203,
5411,
613,
18,
1376,
2932,
2279,
2703,
364,
315,
397,
819,
1769,
203,
5411,
12947,
12,
9977,
1119,
18,
7570,
1360,
1769,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
368,
14291,
279,
667,
4088,
2511,
603,
3134,
783,
14531,
666,
203,
3639,
775,
288,
203,
203,
5411,
11138,
273,
752,
7805,
5621,
203,
5411,
11138,
18,
542,
3805,
12,
2472,
18,
588,
3805,
10663,
203,
5411,
11138,
18,
542,
9586,
12,
2211,
18,
22216,
1769,
203,
203,
5411,
368,
11758,
3134,
14531,
203,
5411,
444,
22158,
5621,
203,
203,
5411,
444,
6521,
5621,
203,
203,
5411,
14015,
9977,
13,
11138,
2934,
1937,
5621,
203,
203,
5411,
514,
819,
461,
273,
819,
18,
17994,
5621,
203,
5411,
309,
16051,
2472,
461,
18,
17514,
1190,
2932,
4898,
3719,
288,
203,
7734,
819,
461,
273,
4016,
397,
819,
461,
31,
203,
5411,
289,
203,
5411,
21013,
927,
265,
339,
273,
394,
21013,
12,
2472,
18,
588,
3748,
1435,
397,
6398,
723,
1546,
397,
203,
10792,
11138,
18,
588,
797,
7675,
588,
5784,
461,
1435,
397,
3104,
2564,
1546,
397,
203,
10792,
819,
18,
588,
3054,
7675,
17994,
1435,
397,
3104,
2472,
1546,
397,
819,
461,
1769,
203,
5411,
5438,
18,
588,
4243,
12,
2011,
16,
446,
13,
203,
7734,
263,
4861,
1841,
12,
1106,
2886,
16,
927,
265,
339,
16,
446,
1769,
203,
203,
3639,
289,
1044,
261,
15155,
268,
13,
288,
203,
5411,
268,
273,
1185,
1989,
18,
318,
4113,
9267,
14950,
12,
88,
1769,
203,
5411,
1185,
1989,
18,
4110,
15155,
12,
88,
1769,
203,
5411,
613,
18,
1636,
12,
315,
9977,
503,
3104,
268,
11272,
203,
5411,
604,
394,
14283,
503,
2932,
1937,
30,
3104,
268,
1769,
203,
3639,
289,
203,
203,
3639,
12947,
12,
9977,
1119,
18,
7570,
1360,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3603,
3627,
8901,
1232,
9403,
97,
471,
2348,
326,
8433,
203,
377,
380,
434,
8901,
1232,
2358,
18,
19211,
18,
2574,
287,
15314,
18,
1367,
18,
9977,
2171,
7,
1937,
3061,
1435,
5496,
203,
377,
380,
203,
377,
380,
632,
4064,
14283,
503,
309,
333,
1794,
5966,
87,
279,
10081,
555,
203,
377,
380,
225,
716,
17793,
333,
1794,
628,
3832,
1399,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d7e3b988655df09d727ea10266cefbe17b94fe07 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/loader/WebappLoader.java | [
"MIT"
] | Java | stopInternal | null | @Override
protected void stopInternal() throws LifecycleException {
if (log.isDebugEnabled())
log.debug(sm.getString("webappLoader.stopping"));
setState(LifecycleState.STOPPING);
// Remove context attributes as appropriate
ServletContext servletContext = context.getServletContext();
servletContext.removeAttribute(Globals.CLASS_PATH_ATTR);
// Throw away our current class loader if any
if (classLoader != null) {
try {
classLoader.stop();
} finally {
classLoader.destroy();
}
// classLoader must be non-null to have been registered
try {
String contextName = context.getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName cloname = new ObjectName(context.getDomain() + ":type=" +
classLoader.getClass().getSimpleName() + ",host=" +
context.getParent().getName() + ",context=" + contextName);
Registry.getRegistry(null, null).unregisterComponent(cloname);
} catch (Exception e) {
log.warn("LifecycleException ", e);
}
}
classLoader = null;
} | /**
* Stop associated {@link ClassLoader} and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/ | Stop associated ClassLoader and implement the requirements
of org.apache.catalina.util.LifecycleBase#stopInternal().
@exception LifecycleException if this component detects a fatal error
that prevents this component from being used | [
"Stop",
"associated",
"ClassLoader",
"and",
"implement",
"the",
"requirements",
"of",
"org",
".",
"apache",
".",
"catalina",
".",
"util",
".",
"LifecycleBase#stopInternal",
"()",
".",
"@exception",
"LifecycleException",
"if",
"this",
"component",
"detects",
"a",
"fatal",
"error",
"that",
"prevents",
"this",
"component",
"from",
"being",
"used"
] | @Override
protected void stopInternal() throws LifecycleException {
if (log.isDebugEnabled())
log.debug(sm.getString("webappLoader.stopping"));
setState(LifecycleState.STOPPING);
ServletContext servletContext = context.getServletContext();
servletContext.removeAttribute(Globals.CLASS_PATH_ATTR);
if (classLoader != null) {
try {
classLoader.stop();
} finally {
classLoader.destroy();
}
try {
String contextName = context.getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName cloname = new ObjectName(context.getDomain() + ":type=" +
classLoader.getClass().getSimpleName() + ",host=" +
context.getParent().getName() + ",context=" + contextName);
Registry.getRegistry(null, null).unregisterComponent(cloname);
} catch (Exception e) {
log.warn("LifecycleException ", e);
}
}
classLoader = null;
} | [
"@",
"Override",
"protected",
"void",
"stopInternal",
"(",
")",
"throws",
"LifecycleException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"webappLoader.stopping\"",
")",
")",
";",
"setState",
"(",
"LifecycleState",
".",
"STOPPING",
")",
";",
"ServletContext",
"servletContext",
"=",
"context",
".",
"getServletContext",
"(",
")",
";",
"servletContext",
".",
"removeAttribute",
"(",
"Globals",
".",
"CLASS_PATH_ATTR",
")",
";",
"if",
"(",
"classLoader",
"!=",
"null",
")",
"{",
"try",
"{",
"classLoader",
".",
"stop",
"(",
")",
";",
"}",
"finally",
"{",
"classLoader",
".",
"destroy",
"(",
")",
";",
"}",
"try",
"{",
"String",
"contextName",
"=",
"context",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"contextName",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"contextName",
"=",
"\"/\"",
"+",
"contextName",
";",
"}",
"ObjectName",
"cloname",
"=",
"new",
"ObjectName",
"(",
"context",
".",
"getDomain",
"(",
")",
"+",
"\":type=\"",
"+",
"classLoader",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\",host=\"",
"+",
"context",
".",
"getParent",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\",context=\"",
"+",
"contextName",
")",
";",
"Registry",
".",
"getRegistry",
"(",
"null",
",",
"null",
")",
".",
"unregisterComponent",
"(",
"cloname",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"LifecycleException \"",
",",
"e",
")",
";",
"}",
"}",
"classLoader",
"=",
"null",
";",
"}"
] | Stop associated {@link ClassLoader} and implement the requirements
of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. | [
"Stop",
"associated",
"{",
"@link",
"ClassLoader",
"}",
"and",
"implement",
"the",
"requirements",
"of",
"{",
"@link",
"org",
".",
"apache",
".",
"catalina",
".",
"util",
".",
"LifecycleBase#stopInternal",
"()",
"}",
"."
] | [
"// Remove context attributes as appropriate",
"// Throw away our current class loader if any",
"// classLoader must be non-null to have been registered"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
4750,
918,
2132,
3061,
1435,
1216,
14283,
503,
288,
203,
203,
3639,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
203,
5411,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
4875,
2910,
2886,
18,
5681,
1382,
7923,
1769,
203,
203,
3639,
12947,
12,
9977,
1119,
18,
17513,
20002,
1769,
203,
203,
3639,
368,
3581,
819,
1677,
487,
5505,
203,
3639,
22717,
20474,
273,
819,
18,
588,
4745,
1042,
5621,
203,
3639,
20474,
18,
4479,
1499,
12,
19834,
18,
5237,
67,
4211,
67,
12043,
1769,
203,
203,
3639,
368,
3743,
10804,
3134,
783,
667,
4088,
309,
1281,
203,
3639,
309,
261,
1106,
2886,
480,
446,
13,
288,
203,
5411,
775,
288,
203,
7734,
11138,
18,
5681,
5621,
203,
5411,
289,
3095,
288,
203,
7734,
11138,
18,
11662,
5621,
203,
5411,
289,
203,
203,
5411,
368,
11138,
1297,
506,
1661,
17,
2011,
358,
1240,
2118,
4104,
203,
5411,
775,
288,
203,
7734,
514,
819,
461,
273,
819,
18,
17994,
5621,
203,
7734,
309,
16051,
2472,
461,
18,
17514,
1190,
2932,
4898,
3719,
288,
203,
10792,
819,
461,
273,
4016,
397,
819,
461,
31,
203,
7734,
289,
203,
7734,
21013,
927,
265,
339,
273,
394,
21013,
12,
2472,
18,
588,
3748,
1435,
397,
6398,
723,
1546,
397,
203,
13491,
11138,
18,
588,
797,
7675,
588,
5784,
461,
1435,
397,
3104,
2564,
1546,
397,
203,
13491,
819,
18,
588,
3054,
7675,
17994,
1435,
397,
3104,
2472,
1546,
397,
819,
461,
1769,
203,
7734,
5438,
18,
588,
4243,
12,
2011,
16,
446,
2934,
318,
4861,
1841,
12,
830,
265,
339,
1769,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
8935,
2932,
9977,
503,
3104,
425,
1769,
203,
5411,
289,
203,
3639,
289,
203,
203,
203,
3639,
11138,
273,
446,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5131,
3627,
8901,
1232,
9403,
97,
471,
2348,
326,
8433,
203,
377,
380,
434,
8901,
1232,
2358,
18,
19211,
18,
2574,
287,
15314,
18,
1367,
18,
9977,
2171,
7,
5681,
3061,
1435,
5496,
203,
377,
380,
203,
377,
380,
632,
4064,
14283,
503,
309,
333,
1794,
5966,
87,
279,
10081,
555,
203,
377,
380,
225,
716,
17793,
333,
1794,
628,
3832,
1399,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5b719baa9b222e395272af4614120027ccb13284 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/valves/rewrite/RewriteValve.java | [
"MIT"
] | Java | parseCondFlag | null | protected static void parseCondFlag(String line, RewriteCond condition, String flag) {
if (flag.equals("NC") || flag.equals("nocase")) {
condition.setNocase(true);
} else if (flag.equals("OR") || flag.equals("ornext")) {
condition.setOrnext(true);
} else {
throw new IllegalArgumentException(sm.getString("rewriteValve.invalidFlags", line, flag));
}
} | /**
* Parser for RewriteCond flags.
* @param line The configuration line being parsed
* @param condition The current condition
* @param flag The flag
*/ | Parser for RewriteCond flags.
@param line The configuration line being parsed
@param condition The current condition
@param flag The flag | [
"Parser",
"for",
"RewriteCond",
"flags",
".",
"@param",
"line",
"The",
"configuration",
"line",
"being",
"parsed",
"@param",
"condition",
"The",
"current",
"condition",
"@param",
"flag",
"The",
"flag"
] | protected static void parseCondFlag(String line, RewriteCond condition, String flag) {
if (flag.equals("NC") || flag.equals("nocase")) {
condition.setNocase(true);
} else if (flag.equals("OR") || flag.equals("ornext")) {
condition.setOrnext(true);
} else {
throw new IllegalArgumentException(sm.getString("rewriteValve.invalidFlags", line, flag));
}
} | [
"protected",
"static",
"void",
"parseCondFlag",
"(",
"String",
"line",
",",
"RewriteCond",
"condition",
",",
"String",
"flag",
")",
"{",
"if",
"(",
"flag",
".",
"equals",
"(",
"\"NC\"",
")",
"||",
"flag",
".",
"equals",
"(",
"\"nocase\"",
")",
")",
"{",
"condition",
".",
"setNocase",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"flag",
".",
"equals",
"(",
"\"OR\"",
")",
"||",
"flag",
".",
"equals",
"(",
"\"ornext\"",
")",
")",
"{",
"condition",
".",
"setOrnext",
"(",
"true",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"sm",
".",
"getString",
"(",
"\"rewriteValve.invalidFlags\"",
",",
"line",
",",
"flag",
")",
")",
";",
"}",
"}"
] | Parser for RewriteCond flags. | [
"Parser",
"for",
"RewriteCond",
"flags",
"."
] | [] | [
{
"param": "line",
"type": "String"
},
{
"param": "condition",
"type": "RewriteCond"
},
{
"param": "flag",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "line",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "condition",
"type": "RewriteCond",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flag",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
760,
918,
1109,
12441,
4678,
12,
780,
980,
16,
17851,
12441,
2269,
16,
514,
2982,
13,
288,
203,
3639,
309,
261,
6420,
18,
14963,
2932,
10346,
7923,
747,
2982,
18,
14963,
2932,
31470,
448,
6,
3719,
288,
203,
5411,
2269,
18,
542,
50,
504,
448,
12,
3767,
1769,
203,
3639,
289,
469,
309,
261,
6420,
18,
14963,
2932,
916,
7923,
747,
2982,
18,
14963,
2932,
280,
4285,
6,
3719,
288,
203,
5411,
2269,
18,
542,
1162,
4285,
12,
3767,
1769,
203,
3639,
289,
469,
288,
203,
5411,
604,
394,
2754,
12,
4808,
18,
588,
780,
2932,
21489,
3053,
537,
18,
5387,
5094,
3113,
980,
16,
2982,
10019,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
6783,
364,
17851,
12441,
2943,
18,
203,
377,
380,
632,
891,
980,
1021,
1664,
980,
3832,
2707,
203,
377,
380,
632,
891,
2269,
1021,
783,
2269,
203,
377,
380,
632,
891,
2982,
1021,
2982,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | heartbeat | null | @Override
public void heartbeat() {
super.heartbeat();
for (MembershipListener listener : membershipListeners) {
if ( listener instanceof Heartbeat ) ((Heartbeat)listener).heartbeat();
}
for (ChannelListener listener : channelListeners) {
if ( listener instanceof Heartbeat ) ((Heartbeat)listener).heartbeat();
}
} | /**
* Sends a heartbeat through the interceptor stack.<br>
* Invoke this method from the application on a periodic basis if
* you have turned off internal heartbeats <code>channel.setHeartbeat(false)</code>
*/ | Sends a heartbeat through the interceptor stack.
Invoke this method from the application on a periodic basis if
you have turned off internal heartbeats channel.setHeartbeat(false) | [
"Sends",
"a",
"heartbeat",
"through",
"the",
"interceptor",
"stack",
".",
"Invoke",
"this",
"method",
"from",
"the",
"application",
"on",
"a",
"periodic",
"basis",
"if",
"you",
"have",
"turned",
"off",
"internal",
"heartbeats",
"channel",
".",
"setHeartbeat",
"(",
"false",
")"
] | @Override
public void heartbeat() {
super.heartbeat();
for (MembershipListener listener : membershipListeners) {
if ( listener instanceof Heartbeat ) ((Heartbeat)listener).heartbeat();
}
for (ChannelListener listener : channelListeners) {
if ( listener instanceof Heartbeat ) ((Heartbeat)listener).heartbeat();
}
} | [
"@",
"Override",
"public",
"void",
"heartbeat",
"(",
")",
"{",
"super",
".",
"heartbeat",
"(",
")",
";",
"for",
"(",
"MembershipListener",
"listener",
":",
"membershipListeners",
")",
"{",
"if",
"(",
"listener",
"instanceof",
"Heartbeat",
")",
"(",
"(",
"Heartbeat",
")",
"listener",
")",
".",
"heartbeat",
"(",
")",
";",
"}",
"for",
"(",
"ChannelListener",
"listener",
":",
"channelListeners",
")",
"{",
"if",
"(",
"listener",
"instanceof",
"Heartbeat",
")",
"(",
"(",
"Heartbeat",
")",
"listener",
")",
".",
"heartbeat",
"(",
")",
";",
"}",
"}"
] | Sends a heartbeat through the interceptor stack.<br>
Invoke this method from the application on a periodic basis if
you have turned off internal heartbeats <code>channel.setHeartbeat(false)</code> | [
"Sends",
"a",
"heartbeat",
"through",
"the",
"interceptor",
"stack",
".",
"<br",
">",
"Invoke",
"this",
"method",
"from",
"the",
"application",
"on",
"a",
"periodic",
"basis",
"if",
"you",
"have",
"turned",
"off",
"internal",
"heartbeats",
"<code",
">",
"channel",
".",
"setHeartbeat",
"(",
"false",
")",
"<",
"/",
"code",
">"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
12923,
1435,
288,
203,
3639,
2240,
18,
25445,
5621,
203,
203,
3639,
364,
261,
13447,
2223,
2991,
294,
12459,
5583,
13,
288,
203,
5411,
309,
261,
2991,
1276,
31687,
262,
14015,
15894,
13,
12757,
2934,
25445,
5621,
203,
3639,
289,
203,
203,
3639,
364,
261,
2909,
2223,
2991,
294,
1904,
5583,
13,
288,
203,
5411,
309,
261,
2991,
1276,
31687,
262,
14015,
15894,
13,
12757,
2934,
25445,
5621,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2479,
87,
279,
12923,
3059,
326,
13810,
2110,
22782,
2848,
34,
203,
377,
380,
14373,
333,
707,
628,
326,
2521,
603,
279,
17478,
10853,
309,
203,
377,
380,
1846,
1240,
21826,
3397,
2713,
3904,
7646,
2323,
411,
710,
34,
4327,
18,
542,
15894,
12,
5743,
13,
1757,
710,
34,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | send | UniqueId | @Override
public UniqueId send(Member[] destination, Serializable msg, int options, ErrorHandler handler)
throws ChannelException {
if ( msg == null ) throw new ChannelException(sm.getString("groupChannel.nullMessage"));
XByteBuffer buffer = null;
try {
if (destination == null || destination.length == 0) {
throw new ChannelException(sm.getString("groupChannel.noDestination"));
}
ChannelData data = new ChannelData(true);//generates a unique Id
data.setAddress(getLocalMember(false));
data.setTimestamp(System.currentTimeMillis());
byte[] b = null;
if ( msg instanceof ByteMessage ){
b = ((ByteMessage)msg).getMessage();
options = options | SEND_OPTIONS_BYTE_MESSAGE;
} else {
b = XByteBuffer.serialize(msg);
options = options & (~SEND_OPTIONS_BYTE_MESSAGE);
}
data.setOptions(options);
//XByteBuffer buffer = new XByteBuffer(b.length+128,false);
buffer = BufferPool.getBufferPool().getBuffer(b.length+128, false);
buffer.append(b,0,b.length);
data.setMessage(buffer);
InterceptorPayload payload = null;
if ( handler != null ) {
payload = new InterceptorPayload();
payload.setErrorHandler(handler);
}
getFirstInterceptor().sendMessage(destination, data, payload);
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel - Sent msg:" + new UniqueId(data.getUniqueId()) +
" at " + new java.sql.Timestamp(System.currentTimeMillis()) + " to " +
Arrays.toNameString(destination));
Logs.MESSAGES.trace("GroupChannel - Send Message:" +
new UniqueId(data.getUniqueId()) + " is " + msg);
}
return new UniqueId(data.getUniqueId());
} catch (RuntimeException | IOException e) {
throw new ChannelException(e);
} finally {
if ( buffer != null ) BufferPool.getBufferPool().returnBuffer(buffer);
}
} | /**
*
* @param destination Member[] - destination.length > 0
* @param msg Serializable - the message to send
* @param options sender options, options can trigger guarantee levels and different
* interceptors to react to the message see class documentation for the
* <code>Channel</code> object.<br>
* @param handler - callback object for error handling and completion notification,
* used when a message is sent asynchronously using the
* <code>Channel.SEND_OPTIONS_ASYNCHRONOUS</code> flag enabled.
* @return UniqueId - the unique Id that was assigned to this message
* @throws ChannelException - if an error occurs processing the message
* @see org.apache.catalina.tribes.Channel
*/ | @param destination Member[] - destination.length > 0
@param msg Serializable - the message to send
@param options sender options, options can trigger guarantee levels and different
interceptors to react to the message see class documentation for the
Channel object.
@param handler - callback object for error handling and completion notification,
used when a message is sent asynchronously using the
Channel.SEND_OPTIONS_ASYNCHRONOUS flag enabled.
@return UniqueId - the unique Id that was assigned to this message
@throws ChannelException - if an error occurs processing the message
@see org.apache.catalina.tribes.Channel | [
"@param",
"destination",
"Member",
"[]",
"-",
"destination",
".",
"length",
">",
"0",
"@param",
"msg",
"Serializable",
"-",
"the",
"message",
"to",
"send",
"@param",
"options",
"sender",
"options",
"options",
"can",
"trigger",
"guarantee",
"levels",
"and",
"different",
"interceptors",
"to",
"react",
"to",
"the",
"message",
"see",
"class",
"documentation",
"for",
"the",
"Channel",
"object",
".",
"@param",
"handler",
"-",
"callback",
"object",
"for",
"error",
"handling",
"and",
"completion",
"notification",
"used",
"when",
"a",
"message",
"is",
"sent",
"asynchronously",
"using",
"the",
"Channel",
".",
"SEND_OPTIONS_ASYNCHRONOUS",
"flag",
"enabled",
".",
"@return",
"UniqueId",
"-",
"the",
"unique",
"Id",
"that",
"was",
"assigned",
"to",
"this",
"message",
"@throws",
"ChannelException",
"-",
"if",
"an",
"error",
"occurs",
"processing",
"the",
"message",
"@see",
"org",
".",
"apache",
".",
"catalina",
".",
"tribes",
".",
"Channel"
] | @Override
public UniqueId send(Member[] destination, Serializable msg, int options, ErrorHandler handler)
throws ChannelException {
if ( msg == null ) throw new ChannelException(sm.getString("groupChannel.nullMessage"));
XByteBuffer buffer = null;
try {
if (destination == null || destination.length == 0) {
throw new ChannelException(sm.getString("groupChannel.noDestination"));
}
ChannelData data = new ChannelData(true);
data.setAddress(getLocalMember(false));
data.setTimestamp(System.currentTimeMillis());
byte[] b = null;
if ( msg instanceof ByteMessage ){
b = ((ByteMessage)msg).getMessage();
options = options | SEND_OPTIONS_BYTE_MESSAGE;
} else {
b = XByteBuffer.serialize(msg);
options = options & (~SEND_OPTIONS_BYTE_MESSAGE);
}
data.setOptions(options);
buffer = BufferPool.getBufferPool().getBuffer(b.length+128, false);
buffer.append(b,0,b.length);
data.setMessage(buffer);
InterceptorPayload payload = null;
if ( handler != null ) {
payload = new InterceptorPayload();
payload.setErrorHandler(handler);
}
getFirstInterceptor().sendMessage(destination, data, payload);
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel - Sent msg:" + new UniqueId(data.getUniqueId()) +
" at " + new java.sql.Timestamp(System.currentTimeMillis()) + " to " +
Arrays.toNameString(destination));
Logs.MESSAGES.trace("GroupChannel - Send Message:" +
new UniqueId(data.getUniqueId()) + " is " + msg);
}
return new UniqueId(data.getUniqueId());
} catch (RuntimeException | IOException e) {
throw new ChannelException(e);
} finally {
if ( buffer != null ) BufferPool.getBufferPool().returnBuffer(buffer);
}
} | [
"@",
"Override",
"public",
"UniqueId",
"send",
"(",
"Member",
"[",
"]",
"destination",
",",
"Serializable",
"msg",
",",
"int",
"options",
",",
"ErrorHandler",
"handler",
")",
"throws",
"ChannelException",
"{",
"if",
"(",
"msg",
"==",
"null",
")",
"throw",
"new",
"ChannelException",
"(",
"sm",
".",
"getString",
"(",
"\"groupChannel.nullMessage\"",
")",
")",
";",
"XByteBuffer",
"buffer",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"destination",
"==",
"null",
"||",
"destination",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"ChannelException",
"(",
"sm",
".",
"getString",
"(",
"\"groupChannel.noDestination\"",
")",
")",
";",
"}",
"ChannelData",
"data",
"=",
"new",
"ChannelData",
"(",
"true",
")",
";",
"data",
".",
"setAddress",
"(",
"getLocalMember",
"(",
"false",
")",
")",
";",
"data",
".",
"setTimestamp",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"byte",
"[",
"]",
"b",
"=",
"null",
";",
"if",
"(",
"msg",
"instanceof",
"ByteMessage",
")",
"{",
"b",
"=",
"(",
"(",
"ByteMessage",
")",
"msg",
")",
".",
"getMessage",
"(",
")",
";",
"options",
"=",
"options",
"|",
"SEND_OPTIONS_BYTE_MESSAGE",
";",
"}",
"else",
"{",
"b",
"=",
"XByteBuffer",
".",
"serialize",
"(",
"msg",
")",
";",
"options",
"=",
"options",
"&",
"(",
"~",
"SEND_OPTIONS_BYTE_MESSAGE",
")",
";",
"}",
"data",
".",
"setOptions",
"(",
"options",
")",
";",
"buffer",
"=",
"BufferPool",
".",
"getBufferPool",
"(",
")",
".",
"getBuffer",
"(",
"b",
".",
"length",
"+",
"128",
",",
"false",
")",
";",
"buffer",
".",
"append",
"(",
"b",
",",
"0",
",",
"b",
".",
"length",
")",
";",
"data",
".",
"setMessage",
"(",
"buffer",
")",
";",
"InterceptorPayload",
"payload",
"=",
"null",
";",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"payload",
"=",
"new",
"InterceptorPayload",
"(",
")",
";",
"payload",
".",
"setErrorHandler",
"(",
"handler",
")",
";",
"}",
"getFirstInterceptor",
"(",
")",
".",
"sendMessage",
"(",
"destination",
",",
"data",
",",
"payload",
")",
";",
"if",
"(",
"Logs",
".",
"MESSAGES",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"Logs",
".",
"MESSAGES",
".",
"trace",
"(",
"\"GroupChannel - Sent msg:\"",
"+",
"new",
"UniqueId",
"(",
"data",
".",
"getUniqueId",
"(",
")",
")",
"+",
"\" at \"",
"+",
"new",
"java",
".",
"sql",
".",
"Timestamp",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
"+",
"\" to \"",
"+",
"Arrays",
".",
"toNameString",
"(",
"destination",
")",
")",
";",
"Logs",
".",
"MESSAGES",
".",
"trace",
"(",
"\"GroupChannel - Send Message:\"",
"+",
"new",
"UniqueId",
"(",
"data",
".",
"getUniqueId",
"(",
")",
")",
"+",
"\" is \"",
"+",
"msg",
")",
";",
"}",
"return",
"new",
"UniqueId",
"(",
"data",
".",
"getUniqueId",
"(",
")",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"|",
"IOException",
"e",
")",
"{",
"throw",
"new",
"ChannelException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"buffer",
"!=",
"null",
")",
"BufferPool",
".",
"getBufferPool",
"(",
")",
".",
"returnBuffer",
"(",
"buffer",
")",
";",
"}",
"}"
] | @param destination Member[] - destination.length > 0
@param msg Serializable - the message to send
@param options sender options, options can trigger guarantee levels and different
interceptors to react to the message see class documentation for the
<code>Channel</code> object.<br>
@param handler - callback object for error handling and completion notification,
used when a message is sent asynchronously using the
<code>Channel.SEND_OPTIONS_ASYNCHRONOUS</code> flag enabled. | [
"@param",
"destination",
"Member",
"[]",
"-",
"destination",
".",
"length",
">",
";",
"0",
"@param",
"msg",
"Serializable",
"-",
"the",
"message",
"to",
"send",
"@param",
"options",
"sender",
"options",
"options",
"can",
"trigger",
"guarantee",
"levels",
"and",
"different",
"interceptors",
"to",
"react",
"to",
"the",
"message",
"see",
"class",
"documentation",
"for",
"the",
"<code",
">",
"Channel<",
"/",
"code",
">",
"object",
".",
"<br",
">",
"@param",
"handler",
"-",
"callback",
"object",
"for",
"error",
"handling",
"and",
"completion",
"notification",
"used",
"when",
"a",
"message",
"is",
"sent",
"asynchronously",
"using",
"the",
"<code",
">",
"Channel",
".",
"SEND_OPTIONS_ASYNCHRONOUS<",
"/",
"code",
">",
"flag",
"enabled",
"."
] | [
"//generates a unique Id",
"//XByteBuffer buffer = new XByteBuffer(b.length+128,false);"
] | [
{
"param": "destination",
"type": "Member[]"
},
{
"param": "msg",
"type": "Serializable"
},
{
"param": "options",
"type": "int"
},
{
"param": "handler",
"type": "ErrorHandler"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "destination",
"type": "Member[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msg",
"type": "Serializable",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "options",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "handler",
"type": "ErrorHandler",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
14584,
548,
1366,
12,
4419,
8526,
2929,
16,
13687,
1234,
16,
509,
702,
16,
26406,
1838,
13,
203,
5411,
1216,
5307,
503,
288,
203,
3639,
309,
261,
1234,
422,
446,
262,
604,
394,
5307,
503,
12,
4808,
18,
588,
780,
2932,
1655,
2909,
18,
2011,
1079,
7923,
1769,
203,
3639,
1139,
12242,
1613,
273,
446,
31,
203,
3639,
775,
288,
203,
5411,
309,
261,
10590,
422,
446,
747,
2929,
18,
2469,
422,
374,
13,
288,
203,
7734,
604,
394,
5307,
503,
12,
4808,
18,
588,
780,
2932,
1655,
2909,
18,
2135,
5683,
7923,
1769,
203,
5411,
289,
203,
5411,
5307,
751,
501,
273,
394,
5307,
751,
12,
3767,
1769,
759,
3441,
815,
279,
3089,
3124,
203,
5411,
501,
18,
542,
1887,
12,
588,
2042,
4419,
12,
5743,
10019,
203,
5411,
501,
18,
542,
4921,
12,
3163,
18,
2972,
28512,
10663,
203,
5411,
1160,
8526,
324,
273,
446,
31,
203,
5411,
309,
261,
1234,
1276,
3506,
1079,
262,
95,
203,
7734,
324,
273,
14015,
3216,
1079,
13,
3576,
2934,
24906,
5621,
203,
7734,
702,
273,
702,
571,
31434,
67,
12422,
67,
15377,
67,
8723,
31,
203,
5411,
289,
469,
288,
203,
7734,
324,
273,
1139,
12242,
18,
6288,
12,
3576,
1769,
203,
7734,
702,
273,
702,
473,
261,
98,
21675,
67,
12422,
67,
15377,
67,
8723,
1769,
203,
5411,
289,
203,
5411,
501,
18,
542,
1320,
12,
2116,
1769,
203,
5411,
368,
60,
12242,
1613,
273,
394,
1139,
12242,
12,
70,
18,
2469,
15,
10392,
16,
5743,
1769,
203,
5411,
1613,
273,
3525,
2864,
18,
588,
1892,
2864,
7675,
588,
1892,
12,
70,
18,
2469,
15,
10392,
16,
629,
1769,
203,
5411,
1613,
18,
6923,
12,
70,
16,
20,
16,
70,
18,
2469,
1769,
203,
5411,
501,
18,
542,
1079,
12,
4106,
1769,
203,
5411,
23499,
6110,
2385,
273,
446,
31,
203,
5411,
309,
261,
1838,
480,
446,
262,
288,
203,
7734,
2385,
273,
394,
23499,
6110,
5621,
203,
7734,
2385,
18,
542,
17729,
12,
4176,
1769,
203,
5411,
289,
203,
5411,
7521,
10281,
7675,
4661,
1079,
12,
10590,
16,
501,
16,
2385,
1769,
203,
5411,
309,
261,
20238,
18,
26195,
18,
291,
3448,
1526,
1435,
262,
288,
203,
7734,
20238,
18,
26195,
18,
5129,
2932,
1114,
2909,
300,
16695,
1234,
2773,
397,
394,
14584,
548,
12,
892,
18,
588,
24174,
10756,
397,
203,
13491,
315,
622,
315,
397,
394,
2252,
18,
4669,
18,
4921,
12,
3163,
18,
2972,
28512,
10756,
397,
315,
358,
315,
397,
203,
13491,
5647,
18,
869,
461,
780,
12,
10590,
10019,
203,
7734,
20238,
18,
26195,
18,
5129,
2932,
1114,
2909,
300,
2479,
2350,
2773,
397,
203,
13491,
394,
14584,
548,
12,
892,
18,
588,
24174,
10756,
397,
315,
353,
315,
397,
1234,
1769,
203,
5411,
289,
203,
203,
5411,
327,
394,
14584,
548,
12,
892,
18,
588,
24174,
10663,
203,
3639,
289,
1044,
261,
11949,
571,
1860,
425,
13,
288,
203,
5411,
604,
394,
5307,
503,
12,
73,
1769,
203,
3639,
289,
3095,
288,
203,
5411,
309,
261,
1613,
480,
446,
262,
3525,
2864,
18,
588,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
203,
377,
380,
632,
891,
2929,
8596,
8526,
300,
2929,
18,
2469,
473,
4521,
31,
374,
203,
377,
380,
632,
891,
1234,
13687,
300,
326,
883,
358,
1366,
203,
377,
380,
632,
891,
702,
5793,
702,
16,
702,
848,
3080,
18779,
7575,
471,
3775,
203,
377,
380,
7734,
18496,
358,
13417,
358,
326,
883,
2621,
667,
7323,
364,
326,
203,
377,
380,
7734,
411,
710,
34,
2909,
1757,
710,
34,
733,
22782,
2848,
34,
203,
377,
380,
632,
891,
1838,
300,
1348,
733,
364,
555,
5057,
471,
8364,
3851,
16,
203,
377,
380,
5375,
1399,
1347,
279,
883,
353,
3271,
14952,
1450,
326,
203,
377,
380,
5375,
411,
710,
34,
2909,
18,
21675,
67,
12422,
67,
3033,
17317,
1792,
19359,
21667,
1757,
2
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | messageReceived | null | @Override
public void messageReceived(ChannelMessage msg) {
if ( msg == null ) return;
try {
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel - Received msg:" +
new UniqueId(msg.getUniqueId()) + " at " +
new java.sql.Timestamp(System.currentTimeMillis()) + " from " +
msg.getAddress().getName());
}
Serializable fwd = null;
if ( (msg.getOptions() & SEND_OPTIONS_BYTE_MESSAGE) == SEND_OPTIONS_BYTE_MESSAGE ) {
fwd = new ByteMessage(msg.getMessage().getBytes());
} else {
try {
fwd = XByteBuffer.deserialize(msg.getMessage().getBytesDirect(), 0,
msg.getMessage().getLength());
}catch (Exception sx) {
log.error(sm.getString("groupChannel.unable.deserialize", msg),sx);
return;
}
}
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel - Receive Message:" +
new UniqueId(msg.getUniqueId()) + " is " + fwd);
}
//get the actual member with the correct alive time
Member source = msg.getAddress();
boolean rx = false;
boolean delivered = false;
for ( int i=0; i<channelListeners.size(); i++ ) {
ChannelListener channelListener = channelListeners.get(i);
if (channelListener != null && channelListener.accept(fwd, source)) {
channelListener.messageReceived(fwd, source);
delivered = true;
//if the message was accepted by an RPC channel, that channel
//is responsible for returning the reply, otherwise we send an absence reply
if ( channelListener instanceof RpcChannel ) rx = true;
}
}//for
if ((!rx) && (fwd instanceof RpcMessage)) {
//if we have a message that requires a response,
//but none was given, send back an immediate one
sendNoRpcChannelReply((RpcMessage)fwd,source);
}
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel delivered[" + delivered + "] id:" +
new UniqueId(msg.getUniqueId()));
}
} catch ( Exception x ) {
//this could be the channel listener throwing an exception, we should log it
//as a warning.
if ( log.isWarnEnabled() ) log.warn(sm.getString("groupChannel.receiving.error"),x);
throw new RemoteProcessException("Exception:"+x.getMessage(),x);
}
} | /**
* Callback from the interceptor stack. <br>
* When a message is received from a remote node, this method will be
* invoked by the previous interceptor.<br>
* This method can also be used to send a message to other components
* within the same application, but its an extreme case, and you're probably
* better off doing that logic between the applications itself.
* @param msg ChannelMessage
*/ | Callback from the interceptor stack.
When a message is received from a remote node, this method will be
invoked by the previous interceptor.
This method can also be used to send a message to other components
within the same application, but its an extreme case, and you're probably
better off doing that logic between the applications itself. | [
"Callback",
"from",
"the",
"interceptor",
"stack",
".",
"When",
"a",
"message",
"is",
"received",
"from",
"a",
"remote",
"node",
"this",
"method",
"will",
"be",
"invoked",
"by",
"the",
"previous",
"interceptor",
".",
"This",
"method",
"can",
"also",
"be",
"used",
"to",
"send",
"a",
"message",
"to",
"other",
"components",
"within",
"the",
"same",
"application",
"but",
"its",
"an",
"extreme",
"case",
"and",
"you",
"'",
"re",
"probably",
"better",
"off",
"doing",
"that",
"logic",
"between",
"the",
"applications",
"itself",
"."
] | @Override
public void messageReceived(ChannelMessage msg) {
if ( msg == null ) return;
try {
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel - Received msg:" +
new UniqueId(msg.getUniqueId()) + " at " +
new java.sql.Timestamp(System.currentTimeMillis()) + " from " +
msg.getAddress().getName());
}
Serializable fwd = null;
if ( (msg.getOptions() & SEND_OPTIONS_BYTE_MESSAGE) == SEND_OPTIONS_BYTE_MESSAGE ) {
fwd = new ByteMessage(msg.getMessage().getBytes());
} else {
try {
fwd = XByteBuffer.deserialize(msg.getMessage().getBytesDirect(), 0,
msg.getMessage().getLength());
}catch (Exception sx) {
log.error(sm.getString("groupChannel.unable.deserialize", msg),sx);
return;
}
}
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel - Receive Message:" +
new UniqueId(msg.getUniqueId()) + " is " + fwd);
}
Member source = msg.getAddress();
boolean rx = false;
boolean delivered = false;
for ( int i=0; i<channelListeners.size(); i++ ) {
ChannelListener channelListener = channelListeners.get(i);
if (channelListener != null && channelListener.accept(fwd, source)) {
channelListener.messageReceived(fwd, source);
delivered = true;
if ( channelListener instanceof RpcChannel ) rx = true;
}
}
if ((!rx) && (fwd instanceof RpcMessage)) {
sendNoRpcChannelReply((RpcMessage)fwd,source);
}
if ( Logs.MESSAGES.isTraceEnabled() ) {
Logs.MESSAGES.trace("GroupChannel delivered[" + delivered + "] id:" +
new UniqueId(msg.getUniqueId()));
}
} catch ( Exception x ) {
if ( log.isWarnEnabled() ) log.warn(sm.getString("groupChannel.receiving.error"),x);
throw new RemoteProcessException("Exception:"+x.getMessage(),x);
}
} | [
"@",
"Override",
"public",
"void",
"messageReceived",
"(",
"ChannelMessage",
"msg",
")",
"{",
"if",
"(",
"msg",
"==",
"null",
")",
"return",
";",
"try",
"{",
"if",
"(",
"Logs",
".",
"MESSAGES",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"Logs",
".",
"MESSAGES",
".",
"trace",
"(",
"\"GroupChannel - Received msg:\"",
"+",
"new",
"UniqueId",
"(",
"msg",
".",
"getUniqueId",
"(",
")",
")",
"+",
"\" at \"",
"+",
"new",
"java",
".",
"sql",
".",
"Timestamp",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
"+",
"\" from \"",
"+",
"msg",
".",
"getAddress",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"Serializable",
"fwd",
"=",
"null",
";",
"if",
"(",
"(",
"msg",
".",
"getOptions",
"(",
")",
"&",
"SEND_OPTIONS_BYTE_MESSAGE",
")",
"==",
"SEND_OPTIONS_BYTE_MESSAGE",
")",
"{",
"fwd",
"=",
"new",
"ByteMessage",
"(",
"msg",
".",
"getMessage",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"else",
"{",
"try",
"{",
"fwd",
"=",
"XByteBuffer",
".",
"deserialize",
"(",
"msg",
".",
"getMessage",
"(",
")",
".",
"getBytesDirect",
"(",
")",
",",
"0",
",",
"msg",
".",
"getMessage",
"(",
")",
".",
"getLength",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"sx",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"groupChannel.unable.deserialize\"",
",",
"msg",
")",
",",
"sx",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"Logs",
".",
"MESSAGES",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"Logs",
".",
"MESSAGES",
".",
"trace",
"(",
"\"GroupChannel - Receive Message:\"",
"+",
"new",
"UniqueId",
"(",
"msg",
".",
"getUniqueId",
"(",
")",
")",
"+",
"\" is \"",
"+",
"fwd",
")",
";",
"}",
"Member",
"source",
"=",
"msg",
".",
"getAddress",
"(",
")",
";",
"boolean",
"rx",
"=",
"false",
";",
"boolean",
"delivered",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"channelListeners",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ChannelListener",
"channelListener",
"=",
"channelListeners",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"channelListener",
"!=",
"null",
"&&",
"channelListener",
".",
"accept",
"(",
"fwd",
",",
"source",
")",
")",
"{",
"channelListener",
".",
"messageReceived",
"(",
"fwd",
",",
"source",
")",
";",
"delivered",
"=",
"true",
";",
"if",
"(",
"channelListener",
"instanceof",
"RpcChannel",
")",
"rx",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"(",
"!",
"rx",
")",
"&&",
"(",
"fwd",
"instanceof",
"RpcMessage",
")",
")",
"{",
"sendNoRpcChannelReply",
"(",
"(",
"RpcMessage",
")",
"fwd",
",",
"source",
")",
";",
"}",
"if",
"(",
"Logs",
".",
"MESSAGES",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"Logs",
".",
"MESSAGES",
".",
"trace",
"(",
"\"GroupChannel delivered[\"",
"+",
"delivered",
"+",
"\"] id:\"",
"+",
"new",
"UniqueId",
"(",
"msg",
".",
"getUniqueId",
"(",
")",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"x",
")",
"{",
"if",
"(",
"log",
".",
"isWarnEnabled",
"(",
")",
")",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"groupChannel.receiving.error\"",
")",
",",
"x",
")",
";",
"throw",
"new",
"RemoteProcessException",
"(",
"\"Exception:\"",
"+",
"x",
".",
"getMessage",
"(",
")",
",",
"x",
")",
";",
"}",
"}"
] | Callback from the interceptor stack. | [
"Callback",
"from",
"the",
"interceptor",
"stack",
"."
] | [
"//get the actual member with the correct alive time",
"//if the message was accepted by an RPC channel, that channel",
"//is responsible for returning the reply, otherwise we send an absence reply",
"//for",
"//if we have a message that requires a response,",
"//but none was given, send back an immediate one",
"//this could be the channel listener throwing an exception, we should log it",
"//as a warning."
] | [
{
"param": "msg",
"type": "ChannelMessage"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "msg",
"type": "ChannelMessage",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
883,
8872,
12,
2909,
1079,
1234,
13,
288,
203,
3639,
309,
261,
1234,
422,
446,
262,
327,
31,
203,
3639,
775,
288,
203,
5411,
309,
261,
20238,
18,
26195,
18,
291,
3448,
1526,
1435,
262,
288,
203,
7734,
20238,
18,
26195,
18,
5129,
2932,
1114,
2909,
300,
21066,
1234,
2773,
397,
203,
13491,
394,
14584,
548,
12,
3576,
18,
588,
24174,
10756,
397,
315,
622,
315,
397,
203,
13491,
394,
2252,
18,
4669,
18,
4921,
12,
3163,
18,
2972,
28512,
10756,
397,
315,
628,
315,
397,
203,
13491,
1234,
18,
588,
1887,
7675,
17994,
10663,
203,
5411,
289,
203,
203,
5411,
13687,
18943,
273,
446,
31,
203,
5411,
309,
261,
261,
3576,
18,
588,
1320,
1435,
473,
31434,
67,
12422,
67,
15377,
67,
8723,
13,
422,
31434,
67,
12422,
67,
15377,
67,
8723,
262,
288,
203,
7734,
18943,
273,
394,
3506,
1079,
12,
3576,
18,
24906,
7675,
588,
2160,
10663,
203,
5411,
289,
469,
288,
203,
7734,
775,
288,
203,
10792,
18943,
273,
1139,
12242,
18,
18109,
12,
3576,
18,
24906,
7675,
588,
2160,
5368,
9334,
374,
16,
203,
18701,
1234,
18,
24906,
7675,
588,
1782,
10663,
203,
7734,
289,
14683,
261,
503,
13280,
13,
288,
203,
10792,
613,
18,
1636,
12,
4808,
18,
588,
780,
2932,
1655,
2909,
18,
18828,
18,
18109,
3113,
1234,
3631,
30319,
1769,
203,
10792,
327,
31,
203,
7734,
289,
203,
5411,
289,
203,
5411,
309,
261,
20238,
18,
26195,
18,
291,
3448,
1526,
1435,
262,
288,
203,
7734,
20238,
18,
26195,
18,
5129,
2932,
1114,
2909,
300,
17046,
2350,
2773,
397,
203,
13491,
394,
14584,
548,
12,
3576,
18,
588,
24174,
10756,
397,
315,
353,
315,
397,
18943,
1769,
203,
5411,
289,
203,
203,
5411,
368,
588,
326,
3214,
3140,
598,
326,
3434,
13714,
813,
203,
5411,
8596,
1084,
273,
1234,
18,
588,
1887,
5621,
203,
5411,
1250,
8581,
273,
629,
31,
203,
5411,
1250,
22112,
273,
629,
31,
203,
5411,
364,
261,
509,
277,
33,
20,
31,
277,
32,
4327,
5583,
18,
1467,
5621,
277,
9904,
262,
288,
203,
7734,
5307,
2223,
1904,
2223,
273,
1904,
5583,
18,
588,
12,
77,
1769,
203,
7734,
309,
261,
4327,
2223,
480,
446,
597,
1904,
2223,
18,
9436,
12,
27131,
16,
1084,
3719,
288,
203,
10792,
1904,
2223,
18,
2150,
8872,
12,
27131,
16,
1084,
1769,
203,
10792,
22112,
273,
638,
31,
203,
10792,
368,
430,
326,
883,
1703,
8494,
635,
392,
8295,
1904,
16,
716,
1904,
203,
10792,
368,
291,
14549,
364,
5785,
326,
4332,
16,
3541,
732,
1366,
392,
2417,
802,
4332,
203,
10792,
309,
261,
1904,
2223,
1276,
18564,
2909,
262,
8581,
273,
638,
31,
203,
7734,
289,
203,
5411,
289,
759,
1884,
203,
5411,
309,
14015,
5,
20122,
13,
597,
261,
27131,
1276,
18564,
1079,
3719,
288,
203,
7734,
368,
430,
732,
1240,
279,
883,
716,
4991,
279,
766,
16,
203,
7734,
368,
12885,
6555,
1703,
864,
16,
1366,
1473,
392,
14483,
1245,
203,
7734,
1366,
2279,
11647,
2909,
7817,
12443,
11647,
1079,
13,
27131,
16,
3168,
1769,
203,
5411,
289,
203,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
8444,
628,
326,
13810,
2110,
18,
411,
2848,
34,
203,
377,
380,
5203,
279,
883,
353,
5079,
628,
279,
2632,
756,
16,
333,
707,
903,
506,
203,
377,
380,
8187,
635,
326,
2416,
13810,
22782,
2848,
34,
203,
377,
380,
1220,
707,
848,
2546,
506,
1399,
358,
1366,
279,
883,
358,
1308,
4085,
203,
377,
380,
3470,
326,
1967,
2521,
16,
1496,
2097,
392,
23755,
73,
648,
16,
471,
1846,
4565,
8656,
203,
377,
380,
7844,
3397,
9957,
716,
4058,
3086,
326,
12165,
6174,
18,
203,
377,
380,
632,
891,
1234,
5307,
1079,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | sendNoRpcChannelReply | null | protected void sendNoRpcChannelReply(RpcMessage msg, Member destination) {
try {
//avoid circular loop
if ( msg instanceof RpcMessage.NoRpcChannelReply) return;
RpcMessage.NoRpcChannelReply reply =
new RpcMessage.NoRpcChannelReply(msg.rpcId, msg.uuid);
send(new Member[]{destination},reply,Channel.SEND_OPTIONS_ASYNCHRONOUS);
} catch ( Exception x ) {
log.error(sm.getString("groupChannel.sendFail.noRpcChannelReply"),x);
}
} | /**
* Sends a <code>NoRpcChannelReply</code> message to a member<br>
* This method gets invoked by the channel if a RPC message comes in
* and no channel listener accepts the message. This avoids timeout
* @param msg RpcMessage
* @param destination Member - the destination for the reply
*/ | Sends a NoRpcChannelReply message to a member
This method gets invoked by the channel if a RPC message comes in
and no channel listener accepts the message. This avoids timeout
@param msg RpcMessage
@param destination Member - the destination for the reply | [
"Sends",
"a",
"NoRpcChannelReply",
"message",
"to",
"a",
"member",
"This",
"method",
"gets",
"invoked",
"by",
"the",
"channel",
"if",
"a",
"RPC",
"message",
"comes",
"in",
"and",
"no",
"channel",
"listener",
"accepts",
"the",
"message",
".",
"This",
"avoids",
"timeout",
"@param",
"msg",
"RpcMessage",
"@param",
"destination",
"Member",
"-",
"the",
"destination",
"for",
"the",
"reply"
] | protected void sendNoRpcChannelReply(RpcMessage msg, Member destination) {
try {
if ( msg instanceof RpcMessage.NoRpcChannelReply) return;
RpcMessage.NoRpcChannelReply reply =
new RpcMessage.NoRpcChannelReply(msg.rpcId, msg.uuid);
send(new Member[]{destination},reply,Channel.SEND_OPTIONS_ASYNCHRONOUS);
} catch ( Exception x ) {
log.error(sm.getString("groupChannel.sendFail.noRpcChannelReply"),x);
}
} | [
"protected",
"void",
"sendNoRpcChannelReply",
"(",
"RpcMessage",
"msg",
",",
"Member",
"destination",
")",
"{",
"try",
"{",
"if",
"(",
"msg",
"instanceof",
"RpcMessage",
".",
"NoRpcChannelReply",
")",
"return",
";",
"RpcMessage",
".",
"NoRpcChannelReply",
"reply",
"=",
"new",
"RpcMessage",
".",
"NoRpcChannelReply",
"(",
"msg",
".",
"rpcId",
",",
"msg",
".",
"uuid",
")",
";",
"send",
"(",
"new",
"Member",
"[",
"]",
"{",
"destination",
"}",
",",
"reply",
",",
"Channel",
".",
"SEND_OPTIONS_ASYNCHRONOUS",
")",
";",
"}",
"catch",
"(",
"Exception",
"x",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"groupChannel.sendFail.noRpcChannelReply\"",
")",
",",
"x",
")",
";",
"}",
"}"
] | Sends a <code>NoRpcChannelReply</code> message to a member<br>
This method gets invoked by the channel if a RPC message comes in
and no channel listener accepts the message. | [
"Sends",
"a",
"<code",
">",
"NoRpcChannelReply<",
"/",
"code",
">",
"message",
"to",
"a",
"member<br",
">",
"This",
"method",
"gets",
"invoked",
"by",
"the",
"channel",
"if",
"a",
"RPC",
"message",
"comes",
"in",
"and",
"no",
"channel",
"listener",
"accepts",
"the",
"message",
"."
] | [
"//avoid circular loop"
] | [
{
"param": "msg",
"type": "RpcMessage"
},
{
"param": "destination",
"type": "Member"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "msg",
"type": "RpcMessage",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "destination",
"type": "Member",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1366,
2279,
11647,
2909,
7817,
12,
11647,
1079,
1234,
16,
8596,
2929,
13,
288,
203,
3639,
775,
288,
203,
5411,
368,
842,
839,
15302,
2798,
203,
5411,
309,
261,
1234,
1276,
18564,
1079,
18,
2279,
11647,
2909,
7817,
13,
327,
31,
203,
5411,
18564,
1079,
18,
2279,
11647,
2909,
7817,
4332,
273,
203,
10792,
394,
18564,
1079,
18,
2279,
11647,
2909,
7817,
12,
3576,
18,
7452,
548,
16,
1234,
18,
7080,
1769,
203,
5411,
1366,
12,
2704,
8596,
63,
7073,
10590,
5779,
10629,
16,
2909,
18,
21675,
67,
12422,
67,
3033,
17317,
1792,
19359,
21667,
1769,
203,
3639,
289,
1044,
261,
1185,
619,
262,
288,
203,
5411,
613,
18,
1636,
12,
4808,
18,
588,
780,
2932,
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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2479,
87,
279,
411,
710,
34,
2279,
11647,
2909,
7817,
1757,
710,
34,
883,
358,
279,
3140,
32,
2848,
34,
203,
377,
380,
1220,
707,
5571,
8187,
635,
326,
1904,
309,
279,
8295,
883,
14535,
316,
203,
377,
380,
471,
1158,
1904,
2991,
8104,
326,
883,
18,
1220,
24192,
2021,
203,
377,
380,
632,
891,
1234,
18564,
1079,
203,
377,
380,
632,
891,
2929,
8596,
300,
326,
2929,
364,
326,
4332,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | memberAdded | null | @Override
public void memberAdded(Member member) {
//notify upwards
for (int i=0; i<membershipListeners.size(); i++ ) {
MembershipListener membershipListener = membershipListeners.get(i);
if (membershipListener != null) membershipListener.memberAdded(member);
}
} | /**
* memberAdded gets invoked by the interceptor below the channel
* and the channel will broadcast it to the membership listeners
* @param member Member - the new member
*/ | memberAdded gets invoked by the interceptor below the channel
and the channel will broadcast it to the membership listeners
@param member Member - the new member | [
"memberAdded",
"gets",
"invoked",
"by",
"the",
"interceptor",
"below",
"the",
"channel",
"and",
"the",
"channel",
"will",
"broadcast",
"it",
"to",
"the",
"membership",
"listeners",
"@param",
"member",
"Member",
"-",
"the",
"new",
"member"
] | @Override
public void memberAdded(Member member) {
for (int i=0; i<membershipListeners.size(); i++ ) {
MembershipListener membershipListener = membershipListeners.get(i);
if (membershipListener != null) membershipListener.memberAdded(member);
}
} | [
"@",
"Override",
"public",
"void",
"memberAdded",
"(",
"Member",
"member",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"membershipListeners",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"MembershipListener",
"membershipListener",
"=",
"membershipListeners",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"membershipListener",
"!=",
"null",
")",
"membershipListener",
".",
"memberAdded",
"(",
"member",
")",
";",
"}",
"}"
] | memberAdded gets invoked by the interceptor below the channel
and the channel will broadcast it to the membership listeners
@param member Member - the new member | [
"memberAdded",
"gets",
"invoked",
"by",
"the",
"interceptor",
"below",
"the",
"channel",
"and",
"the",
"channel",
"will",
"broadcast",
"it",
"to",
"the",
"membership",
"listeners",
"@param",
"member",
"Member",
"-",
"the",
"new",
"member"
] | [
"//notify upwards"
] | [
{
"param": "member",
"type": "Member"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "member",
"type": "Member",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
3140,
8602,
12,
4419,
3140,
13,
288,
203,
3639,
368,
12336,
731,
6397,
203,
3639,
364,
261,
474,
277,
33,
20,
31,
277,
32,
19679,
5583,
18,
1467,
5621,
277,
9904,
262,
288,
203,
5411,
28100,
2223,
12459,
2223,
273,
12459,
5583,
18,
588,
12,
77,
1769,
203,
5411,
309,
261,
19679,
2223,
480,
446,
13,
12459,
2223,
18,
5990,
8602,
12,
5990,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3140,
8602,
5571,
8187,
635,
326,
13810,
5712,
326,
1904,
203,
377,
380,
471,
326,
1904,
903,
8959,
518,
358,
326,
12459,
4679,
203,
377,
380,
632,
891,
3140,
8596,
300,
326,
394,
3140,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | memberDisappeared | null | @Override
public void memberDisappeared(Member member) {
//notify upwards
for (int i=0; i<membershipListeners.size(); i++ ) {
MembershipListener membershipListener = membershipListeners.get(i);
if (membershipListener != null) membershipListener.memberDisappeared(member);
}
} | /**
* memberDisappeared gets invoked by the interceptor below the channel
* and the channel will broadcast it to the membership listeners
* @param member Member - the member that left or crashed
*/ | memberDisappeared gets invoked by the interceptor below the channel
and the channel will broadcast it to the membership listeners
@param member Member - the member that left or crashed | [
"memberDisappeared",
"gets",
"invoked",
"by",
"the",
"interceptor",
"below",
"the",
"channel",
"and",
"the",
"channel",
"will",
"broadcast",
"it",
"to",
"the",
"membership",
"listeners",
"@param",
"member",
"Member",
"-",
"the",
"member",
"that",
"left",
"or",
"crashed"
] | @Override
public void memberDisappeared(Member member) {
for (int i=0; i<membershipListeners.size(); i++ ) {
MembershipListener membershipListener = membershipListeners.get(i);
if (membershipListener != null) membershipListener.memberDisappeared(member);
}
} | [
"@",
"Override",
"public",
"void",
"memberDisappeared",
"(",
"Member",
"member",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"membershipListeners",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"MembershipListener",
"membershipListener",
"=",
"membershipListeners",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"membershipListener",
"!=",
"null",
")",
"membershipListener",
".",
"memberDisappeared",
"(",
"member",
")",
";",
"}",
"}"
] | memberDisappeared gets invoked by the interceptor below the channel
and the channel will broadcast it to the membership listeners
@param member Member - the member that left or crashed | [
"memberDisappeared",
"gets",
"invoked",
"by",
"the",
"interceptor",
"below",
"the",
"channel",
"and",
"the",
"channel",
"will",
"broadcast",
"it",
"to",
"the",
"membership",
"listeners",
"@param",
"member",
"Member",
"-",
"the",
"member",
"that",
"left",
"or",
"crashed"
] | [
"//notify upwards"
] | [
{
"param": "member",
"type": "Member"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "member",
"type": "Member",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
3140,
1669,
438,
347,
2258,
12,
4419,
3140,
13,
288,
203,
3639,
368,
12336,
731,
6397,
203,
3639,
364,
261,
474,
277,
33,
20,
31,
277,
32,
19679,
5583,
18,
1467,
5621,
277,
9904,
262,
288,
203,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891,
3140,
8596,
300,
326,
3140,
716,
2002,
578,
4422,
13912,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | checkOptionFlags | null | protected void checkOptionFlags() throws ChannelException {
StringBuilder conflicts = new StringBuilder();
ChannelInterceptor first = interceptors;
while ( first != null ) {
int flag = first.getOptionFlag();
if ( flag != 0 ) {
ChannelInterceptor next = first.getNext();
while ( next != null ) {
int nflag = next.getOptionFlag();
if (nflag!=0 && (((flag & nflag) == flag ) || ((flag & nflag) == nflag)) ) {
conflicts.append("[");
conflicts.append(first.getClass().getName());
conflicts.append(":");
conflicts.append(flag);
conflicts.append(" == ");
conflicts.append(next.getClass().getName());
conflicts.append(":");
conflicts.append(nflag);
conflicts.append("] ");
}//end if
next = next.getNext();
}//while
}//end if
first = first.getNext();
}//while
if ( conflicts.length() > 0 ) throw new ChannelException(sm.getString("groupChannel.optionFlag.conflict",
conflicts.toString()));
} | /**
* Validates the option flags that each interceptor is using and reports
* an error if two interceptor share the same flag.
* @throws ChannelException Error with option flag
*/ | Validates the option flags that each interceptor is using and reports
an error if two interceptor share the same flag.
@throws ChannelException Error with option flag | [
"Validates",
"the",
"option",
"flags",
"that",
"each",
"interceptor",
"is",
"using",
"and",
"reports",
"an",
"error",
"if",
"two",
"interceptor",
"share",
"the",
"same",
"flag",
".",
"@throws",
"ChannelException",
"Error",
"with",
"option",
"flag"
] | protected void checkOptionFlags() throws ChannelException {
StringBuilder conflicts = new StringBuilder();
ChannelInterceptor first = interceptors;
while ( first != null ) {
int flag = first.getOptionFlag();
if ( flag != 0 ) {
ChannelInterceptor next = first.getNext();
while ( next != null ) {
int nflag = next.getOptionFlag();
if (nflag!=0 && (((flag & nflag) == flag ) || ((flag & nflag) == nflag)) ) {
conflicts.append("[");
conflicts.append(first.getClass().getName());
conflicts.append(":");
conflicts.append(flag);
conflicts.append(" == ");
conflicts.append(next.getClass().getName());
conflicts.append(":");
conflicts.append(nflag);
conflicts.append("] ");
}
next = next.getNext();
}
}
first = first.getNext();
}
if ( conflicts.length() > 0 ) throw new ChannelException(sm.getString("groupChannel.optionFlag.conflict",
conflicts.toString()));
} | [
"protected",
"void",
"checkOptionFlags",
"(",
")",
"throws",
"ChannelException",
"{",
"StringBuilder",
"conflicts",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"ChannelInterceptor",
"first",
"=",
"interceptors",
";",
"while",
"(",
"first",
"!=",
"null",
")",
"{",
"int",
"flag",
"=",
"first",
".",
"getOptionFlag",
"(",
")",
";",
"if",
"(",
"flag",
"!=",
"0",
")",
"{",
"ChannelInterceptor",
"next",
"=",
"first",
".",
"getNext",
"(",
")",
";",
"while",
"(",
"next",
"!=",
"null",
")",
"{",
"int",
"nflag",
"=",
"next",
".",
"getOptionFlag",
"(",
")",
";",
"if",
"(",
"nflag",
"!=",
"0",
"&&",
"(",
"(",
"(",
"flag",
"&",
"nflag",
")",
"==",
"flag",
")",
"||",
"(",
"(",
"flag",
"&",
"nflag",
")",
"==",
"nflag",
")",
")",
")",
"{",
"conflicts",
".",
"append",
"(",
"\"[\"",
")",
";",
"conflicts",
".",
"append",
"(",
"first",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"conflicts",
".",
"append",
"(",
"\":\"",
")",
";",
"conflicts",
".",
"append",
"(",
"flag",
")",
";",
"conflicts",
".",
"append",
"(",
"\" == \"",
")",
";",
"conflicts",
".",
"append",
"(",
"next",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"conflicts",
".",
"append",
"(",
"\":\"",
")",
";",
"conflicts",
".",
"append",
"(",
"nflag",
")",
";",
"conflicts",
".",
"append",
"(",
"\"] \"",
")",
";",
"}",
"next",
"=",
"next",
".",
"getNext",
"(",
")",
";",
"}",
"}",
"first",
"=",
"first",
".",
"getNext",
"(",
")",
";",
"}",
"if",
"(",
"conflicts",
".",
"length",
"(",
")",
">",
"0",
")",
"throw",
"new",
"ChannelException",
"(",
"sm",
".",
"getString",
"(",
"\"groupChannel.optionFlag.conflict\"",
",",
"conflicts",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Validates the option flags that each interceptor is using and reports
an error if two interceptor share the same flag. | [
"Validates",
"the",
"option",
"flags",
"that",
"each",
"interceptor",
"is",
"using",
"and",
"reports",
"an",
"error",
"if",
"two",
"interceptor",
"share",
"the",
"same",
"flag",
"."
] | [
"//end if",
"//while",
"//end if",
"//while"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
866,
1895,
5094,
1435,
1216,
5307,
503,
288,
203,
3639,
3225,
14450,
273,
394,
3225,
5621,
203,
3639,
5307,
10281,
1122,
273,
18496,
31,
203,
3639,
1323,
261,
1122,
480,
446,
262,
288,
203,
5411,
509,
2982,
273,
1122,
18,
588,
1895,
4678,
5621,
203,
5411,
309,
261,
2982,
480,
374,
262,
288,
203,
7734,
5307,
10281,
1024,
273,
1122,
18,
588,
2134,
5621,
203,
7734,
1323,
261,
1024,
480,
446,
262,
288,
203,
10792,
509,
290,
6420,
273,
1024,
18,
588,
1895,
4678,
5621,
203,
10792,
309,
261,
82,
6420,
5,
33,
20,
597,
261,
12443,
6420,
473,
290,
6420,
13,
422,
2982,
262,
747,
14015,
6420,
473,
290,
6420,
13,
422,
290,
6420,
3719,
262,
288,
203,
13491,
14450,
18,
6923,
2932,
63,
8863,
203,
13491,
14450,
18,
6923,
12,
3645,
18,
588,
797,
7675,
17994,
10663,
203,
13491,
14450,
18,
6923,
2932,
2773,
1769,
203,
13491,
14450,
18,
6923,
12,
6420,
1769,
203,
13491,
14450,
18,
6923,
2932,
422,
315,
1769,
203,
13491,
14450,
18,
6923,
12,
4285,
18,
588,
797,
7675,
17994,
10663,
203,
13491,
14450,
18,
6923,
2932,
2773,
1769,
203,
13491,
14450,
18,
6923,
12,
82,
6420,
1769,
203,
13491,
14450,
18,
6923,
2932,
65,
315,
1769,
203,
10792,
289,
759,
409,
309,
203,
10792,
1024,
273,
1024,
18,
588,
2134,
5621,
203,
7734,
289,
759,
17523,
203,
5411,
289,
759,
409,
309,
203,
5411,
1122,
273,
1122,
18,
588,
2134,
5621,
203,
3639,
289,
759,
17523,
203,
3639,
309,
261,
14450,
18,
2469,
1435,
405,
374,
262,
604,
394,
5307,
503,
12,
4808,
18,
588,
780,
2932,
1655,
2909,
18,
3482,
4678,
18,
20340,
3113,
203,
7734,
14450,
18,
10492,
1435,
10019,
203,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2364,
815,
326,
1456,
2943,
716,
1517,
13810,
353,
1450,
471,
10557,
203,
377,
380,
392,
555,
309,
2795,
13810,
7433,
326,
1967,
2982,
18,
203,
377,
380,
632,
15069,
5307,
503,
1068,
598,
1456,
2982,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7b72b434570af4bb1b467e5c91aa6e1f42630307 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/tribes/group/GroupChannel.java | [
"MIT"
] | Java | addMembershipListener | null | @Override
public void addMembershipListener(MembershipListener membershipListener) {
if (!this.membershipListeners.contains(membershipListener) )
this.membershipListeners.add(membershipListener);
} | /**
* Adds a membership listener to the channel.<br>
* Membership listeners are uniquely identified using the equals(Object) method
* @param membershipListener MembershipListener
*/ | Adds a membership listener to the channel.
Membership listeners are uniquely identified using the equals(Object) method
@param membershipListener MembershipListener | [
"Adds",
"a",
"membership",
"listener",
"to",
"the",
"channel",
".",
"Membership",
"listeners",
"are",
"uniquely",
"identified",
"using",
"the",
"equals",
"(",
"Object",
")",
"method",
"@param",
"membershipListener",
"MembershipListener"
] | @Override
public void addMembershipListener(MembershipListener membershipListener) {
if (!this.membershipListeners.contains(membershipListener) )
this.membershipListeners.add(membershipListener);
} | [
"@",
"Override",
"public",
"void",
"addMembershipListener",
"(",
"MembershipListener",
"membershipListener",
")",
"{",
"if",
"(",
"!",
"this",
".",
"membershipListeners",
".",
"contains",
"(",
"membershipListener",
")",
")",
"this",
".",
"membershipListeners",
".",
"add",
"(",
"membershipListener",
")",
";",
"}"
] | Adds a membership listener to the channel.<br>
Membership listeners are uniquely identified using the equals(Object) method
@param membershipListener MembershipListener | [
"Adds",
"a",
"membership",
"listener",
"to",
"the",
"channel",
".",
"<br",
">",
"Membership",
"listeners",
"are",
"uniquely",
"identified",
"using",
"the",
"equals",
"(",
"Object",
")",
"method",
"@param",
"membershipListener",
"MembershipListener"
] | [] | [
{
"param": "membershipListener",
"type": "MembershipListener"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "membershipListener",
"type": "MembershipListener",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
527,
13447,
2223,
12,
13447,
2223,
12459,
2223,
13,
288,
203,
3639,
309,
16051,
2211,
18,
19679,
5583,
18,
12298,
12,
19679,
2223,
13,
262,
203,
5411,
333,
18,
19679,
5583,
18,
1289,
12,
19679,
2223,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
15605,
279,
12459,
2991,
358,
326,
1904,
22782,
2848,
34,
203,
377,
380,
28100,
4679,
854,
30059,
9283,
1450,
326,
1606,
12,
921,
13,
707,
203,
377,
380,
632,
891,
12459,
2223,
28100,
2223,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | filterAppPaths | null | protected String[] filterAppPaths(String[] unfilteredAppPaths) {
Pattern filter = host.getDeployIgnorePattern();
if (filter == null || unfilteredAppPaths == null) {
return unfilteredAppPaths;
}
List<String> filteredList = new ArrayList<>();
Matcher matcher = null;
for (String appPath : unfilteredAppPaths) {
if (matcher == null) {
matcher = filter.matcher(appPath);
} else {
matcher.reset(appPath);
}
if (matcher.matches()) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("hostConfig.ignorePath", appPath));
}
} else {
filteredList.add(appPath);
}
}
return filteredList.toArray(new String[filteredList.size()]);
} | /**
* Filter the list of application file paths to remove those that match
* the regular expression defined by {@link Host#getDeployIgnore()}.
*
* @param unfilteredAppPaths The list of application paths to filter
*
* @return The filtered list of application paths
*/ | Filter the list of application file paths to remove those that match
the regular expression defined by Host#getDeployIgnore().
@param unfilteredAppPaths The list of application paths to filter
@return The filtered list of application paths | [
"Filter",
"the",
"list",
"of",
"application",
"file",
"paths",
"to",
"remove",
"those",
"that",
"match",
"the",
"regular",
"expression",
"defined",
"by",
"Host#getDeployIgnore",
"()",
".",
"@param",
"unfilteredAppPaths",
"The",
"list",
"of",
"application",
"paths",
"to",
"filter",
"@return",
"The",
"filtered",
"list",
"of",
"application",
"paths"
] | protected String[] filterAppPaths(String[] unfilteredAppPaths) {
Pattern filter = host.getDeployIgnorePattern();
if (filter == null || unfilteredAppPaths == null) {
return unfilteredAppPaths;
}
List<String> filteredList = new ArrayList<>();
Matcher matcher = null;
for (String appPath : unfilteredAppPaths) {
if (matcher == null) {
matcher = filter.matcher(appPath);
} else {
matcher.reset(appPath);
}
if (matcher.matches()) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("hostConfig.ignorePath", appPath));
}
} else {
filteredList.add(appPath);
}
}
return filteredList.toArray(new String[filteredList.size()]);
} | [
"protected",
"String",
"[",
"]",
"filterAppPaths",
"(",
"String",
"[",
"]",
"unfilteredAppPaths",
")",
"{",
"Pattern",
"filter",
"=",
"host",
".",
"getDeployIgnorePattern",
"(",
")",
";",
"if",
"(",
"filter",
"==",
"null",
"||",
"unfilteredAppPaths",
"==",
"null",
")",
"{",
"return",
"unfilteredAppPaths",
";",
"}",
"List",
"<",
"String",
">",
"filteredList",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"Matcher",
"matcher",
"=",
"null",
";",
"for",
"(",
"String",
"appPath",
":",
"unfilteredAppPaths",
")",
"{",
"if",
"(",
"matcher",
"==",
"null",
")",
"{",
"matcher",
"=",
"filter",
".",
"matcher",
"(",
"appPath",
")",
";",
"}",
"else",
"{",
"matcher",
".",
"reset",
"(",
"appPath",
")",
";",
"}",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.ignorePath\"",
",",
"appPath",
")",
")",
";",
"}",
"}",
"else",
"{",
"filteredList",
".",
"add",
"(",
"appPath",
")",
";",
"}",
"}",
"return",
"filteredList",
".",
"toArray",
"(",
"new",
"String",
"[",
"filteredList",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | Filter the list of application file paths to remove those that match
the regular expression defined by {@link Host#getDeployIgnore()}. | [
"Filter",
"the",
"list",
"of",
"application",
"file",
"paths",
"to",
"remove",
"those",
"that",
"match",
"the",
"regular",
"expression",
"defined",
"by",
"{",
"@link",
"Host#getDeployIgnore",
"()",
"}",
"."
] | [] | [
{
"param": "unfilteredAppPaths",
"type": "String[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "unfilteredAppPaths",
"type": "String[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
514,
8526,
1034,
3371,
4466,
12,
780,
8526,
640,
12071,
3371,
4466,
13,
288,
203,
3639,
6830,
1034,
273,
1479,
18,
588,
10015,
3777,
3234,
5621,
203,
3639,
309,
261,
2188,
422,
446,
747,
640,
12071,
3371,
4466,
422,
446,
13,
288,
203,
5411,
327,
640,
12071,
3371,
4466,
31,
203,
3639,
289,
203,
203,
3639,
987,
32,
780,
34,
5105,
682,
273,
394,
2407,
29667,
5621,
203,
3639,
9757,
4546,
273,
446,
31,
203,
3639,
364,
261,
780,
28563,
294,
640,
12071,
3371,
4466,
13,
288,
203,
5411,
309,
261,
22761,
422,
446,
13,
288,
203,
7734,
4546,
273,
1034,
18,
22761,
12,
2910,
743,
1769,
203,
5411,
289,
469,
288,
203,
7734,
4546,
18,
6208,
12,
2910,
743,
1769,
203,
5411,
289,
203,
5411,
309,
261,
22761,
18,
8436,
10756,
288,
203,
7734,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
10792,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
2564,
809,
18,
6185,
743,
3113,
28563,
10019,
203,
7734,
289,
203,
5411,
289,
469,
288,
203,
7734,
5105,
682,
18,
1289,
12,
2910,
743,
1769,
203,
5411,
289,
203,
3639,
289,
203,
3639,
327,
5105,
682,
18,
31447,
12,
2704,
514,
63,
12071,
682,
18,
1467,
1435,
19226,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
4008,
326,
666,
434,
2521,
585,
2953,
358,
1206,
5348,
716,
845,
203,
377,
380,
326,
6736,
2652,
2553,
635,
8901,
1232,
4893,
7,
588,
10015,
3777,
1435,
5496,
203,
377,
380,
203,
377,
380,
632,
891,
640,
12071,
3371,
4466,
565,
1021,
666,
434,
2521,
2953,
358,
1034,
203,
377,
380,
203,
377,
380,
632,
2463,
225,
1021,
5105,
666,
434,
2521,
2953,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | deployApps | null | protected void deployApps(String name) {
File appBase = host.getAppBaseFile();
File configBase = host.getConfigBaseFile();
ContextName cn = new ContextName(name, false);
String baseName = cn.getBaseName();
if (deploymentExists(cn.getName())) {
return;
}
// Deploy XML descriptor from configBase
File xml = new File(configBase, baseName + ".xml");
if (xml.exists()) {
deployDescriptor(cn, xml);
return;
}
// Deploy WAR
File war = new File(appBase, baseName + ".war");
if (war.exists()) {
deployWAR(cn, war);
return;
}
// Deploy expanded folder
File dir = new File(appBase, baseName);
if (dir.exists())
deployDirectory(cn, dir);
} | /**
* Deploy applications for any directories or WAR files that are found
* in our "application root" directory.
* @param name The context name which should be deployed
*/ | Deploy applications for any directories or WAR files that are found
in our "application root" directory.
@param name The context name which should be deployed | [
"Deploy",
"applications",
"for",
"any",
"directories",
"or",
"WAR",
"files",
"that",
"are",
"found",
"in",
"our",
"\"",
"application",
"root",
"\"",
"directory",
".",
"@param",
"name",
"The",
"context",
"name",
"which",
"should",
"be",
"deployed"
] | protected void deployApps(String name) {
File appBase = host.getAppBaseFile();
File configBase = host.getConfigBaseFile();
ContextName cn = new ContextName(name, false);
String baseName = cn.getBaseName();
if (deploymentExists(cn.getName())) {
return;
}
File xml = new File(configBase, baseName + ".xml");
if (xml.exists()) {
deployDescriptor(cn, xml);
return;
}
File war = new File(appBase, baseName + ".war");
if (war.exists()) {
deployWAR(cn, war);
return;
}
File dir = new File(appBase, baseName);
if (dir.exists())
deployDirectory(cn, dir);
} | [
"protected",
"void",
"deployApps",
"(",
"String",
"name",
")",
"{",
"File",
"appBase",
"=",
"host",
".",
"getAppBaseFile",
"(",
")",
";",
"File",
"configBase",
"=",
"host",
".",
"getConfigBaseFile",
"(",
")",
";",
"ContextName",
"cn",
"=",
"new",
"ContextName",
"(",
"name",
",",
"false",
")",
";",
"String",
"baseName",
"=",
"cn",
".",
"getBaseName",
"(",
")",
";",
"if",
"(",
"deploymentExists",
"(",
"cn",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"File",
"xml",
"=",
"new",
"File",
"(",
"configBase",
",",
"baseName",
"+",
"\".xml\"",
")",
";",
"if",
"(",
"xml",
".",
"exists",
"(",
")",
")",
"{",
"deployDescriptor",
"(",
"cn",
",",
"xml",
")",
";",
"return",
";",
"}",
"File",
"war",
"=",
"new",
"File",
"(",
"appBase",
",",
"baseName",
"+",
"\".war\"",
")",
";",
"if",
"(",
"war",
".",
"exists",
"(",
")",
")",
"{",
"deployWAR",
"(",
"cn",
",",
"war",
")",
";",
"return",
";",
"}",
"File",
"dir",
"=",
"new",
"File",
"(",
"appBase",
",",
"baseName",
")",
";",
"if",
"(",
"dir",
".",
"exists",
"(",
")",
")",
"deployDirectory",
"(",
"cn",
",",
"dir",
")",
";",
"}"
] | Deploy applications for any directories or WAR files that are found
in our "application root" directory. | [
"Deploy",
"applications",
"for",
"any",
"directories",
"or",
"WAR",
"files",
"that",
"are",
"found",
"in",
"our",
"\"",
"application",
"root",
"\"",
"directory",
"."
] | [
"// Deploy XML descriptor from configBase",
"// Deploy WAR",
"// Deploy expanded folder"
] | [
{
"param": "name",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
7286,
16339,
12,
780,
508,
13,
288,
203,
203,
3639,
1387,
595,
2171,
273,
1479,
18,
588,
3371,
2171,
812,
5621,
203,
3639,
1387,
642,
2171,
273,
1479,
18,
588,
809,
2171,
812,
5621,
203,
3639,
1772,
461,
6227,
273,
394,
1772,
461,
12,
529,
16,
629,
1769,
203,
3639,
514,
16162,
273,
6227,
18,
588,
29907,
5621,
203,
203,
3639,
309,
261,
21704,
4002,
12,
10305,
18,
17994,
1435,
3719,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
368,
7406,
3167,
4950,
628,
642,
2171,
203,
3639,
1387,
2025,
273,
394,
1387,
12,
1425,
2171,
16,
16162,
397,
3552,
2902,
8863,
203,
3639,
309,
261,
2902,
18,
1808,
10756,
288,
203,
5411,
7286,
3187,
12,
10305,
16,
2025,
1769,
203,
5411,
327,
31,
203,
3639,
289,
203,
3639,
368,
7406,
678,
985,
203,
3639,
1387,
21983,
273,
394,
1387,
12,
2910,
2171,
16,
16162,
397,
3552,
905,
8863,
203,
3639,
309,
261,
905,
18,
1808,
10756,
288,
203,
5411,
7286,
16777,
12,
10305,
16,
21983,
1769,
203,
5411,
327,
31,
203,
3639,
289,
203,
3639,
368,
7406,
8406,
3009,
203,
3639,
1387,
1577,
273,
394,
1387,
12,
2910,
2171,
16,
16162,
1769,
203,
3639,
309,
261,
1214,
18,
1808,
10756,
203,
5411,
7286,
2853,
12,
10305,
16,
1577,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7406,
12165,
364,
1281,
6402,
578,
678,
985,
1390,
716,
854,
1392,
203,
377,
380,
316,
3134,
315,
3685,
1365,
6,
1867,
18,
203,
377,
380,
632,
891,
508,
1021,
819,
508,
1492,
1410,
506,
19357,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | deployDescriptors | null | protected void deployDescriptors(File configBase, String[] files) {
if (files == null)
return;
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
File contextXml = new File(configBase, files[i]);
if (files[i].toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
ContextName cn = new ContextName(files[i], true);
if (isServiced(cn.getName()) || deploymentExists(cn.getName()))
continue;
results.add(
es.submit(new DeployDescriptor(this, cn, contextXml)));
}
}
for (Future<?> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployDescriptor.threaded.error"), e);
}
}
} | /**
* Deploy XML context descriptors.
* @param configBase The config base
* @param files The XML descriptors which should be deployed
*/ | Deploy XML context descriptors.
@param configBase The config base
@param files The XML descriptors which should be deployed | [
"Deploy",
"XML",
"context",
"descriptors",
".",
"@param",
"configBase",
"The",
"config",
"base",
"@param",
"files",
"The",
"XML",
"descriptors",
"which",
"should",
"be",
"deployed"
] | protected void deployDescriptors(File configBase, String[] files) {
if (files == null)
return;
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
File contextXml = new File(configBase, files[i]);
if (files[i].toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
ContextName cn = new ContextName(files[i], true);
if (isServiced(cn.getName()) || deploymentExists(cn.getName()))
continue;
results.add(
es.submit(new DeployDescriptor(this, cn, contextXml)));
}
}
for (Future<?> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployDescriptor.threaded.error"), e);
}
}
} | [
"protected",
"void",
"deployDescriptors",
"(",
"File",
"configBase",
",",
"String",
"[",
"]",
"files",
")",
"{",
"if",
"(",
"files",
"==",
"null",
")",
"return",
";",
"ExecutorService",
"es",
"=",
"host",
".",
"getStartStopExecutor",
"(",
")",
";",
"List",
"<",
"Future",
"<",
"?",
">",
">",
"results",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"File",
"contextXml",
"=",
"new",
"File",
"(",
"configBase",
",",
"files",
"[",
"i",
"]",
")",
";",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
".",
"endsWith",
"(",
"\".xml\"",
")",
")",
"{",
"ContextName",
"cn",
"=",
"new",
"ContextName",
"(",
"files",
"[",
"i",
"]",
",",
"true",
")",
";",
"if",
"(",
"isServiced",
"(",
"cn",
".",
"getName",
"(",
")",
")",
"||",
"deploymentExists",
"(",
"cn",
".",
"getName",
"(",
")",
")",
")",
"continue",
";",
"results",
".",
"add",
"(",
"es",
".",
"submit",
"(",
"new",
"DeployDescriptor",
"(",
"this",
",",
"cn",
",",
"contextXml",
")",
")",
")",
";",
"}",
"}",
"for",
"(",
"Future",
"<",
"?",
">",
"result",
":",
"results",
")",
"{",
"try",
"{",
"result",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployDescriptor.threaded.error\"",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Deploy XML context descriptors. | [
"Deploy",
"XML",
"context",
"descriptors",
"."
] | [] | [
{
"param": "configBase",
"type": "File"
},
{
"param": "files",
"type": "String[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "configBase",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": "String[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
7286,
12705,
12,
812,
642,
2171,
16,
514,
8526,
1390,
13,
288,
203,
203,
3639,
309,
261,
2354,
422,
446,
13,
203,
5411,
327,
31,
203,
203,
3639,
27299,
5001,
273,
1479,
18,
588,
1685,
4947,
6325,
5621,
203,
3639,
987,
32,
4118,
12880,
9778,
1686,
273,
394,
2407,
29667,
5621,
203,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
1390,
18,
2469,
31,
277,
27245,
288,
203,
5411,
1387,
819,
4432,
273,
394,
1387,
12,
1425,
2171,
16,
1390,
63,
77,
19226,
203,
203,
5411,
309,
261,
2354,
63,
77,
8009,
869,
5630,
12,
3916,
18,
16324,
13462,
2934,
5839,
1190,
2932,
18,
2902,
6,
3719,
288,
203,
7734,
1772,
461,
6227,
273,
394,
1772,
461,
12,
2354,
63,
77,
6487,
638,
1769,
203,
203,
7734,
309,
261,
291,
1179,
72,
12,
10305,
18,
17994,
10756,
747,
6314,
4002,
12,
10305,
18,
17994,
1435,
3719,
203,
10792,
1324,
31,
203,
203,
7734,
1686,
18,
1289,
12,
203,
13491,
5001,
18,
9297,
12,
2704,
7406,
3187,
12,
2211,
16,
6227,
16,
819,
4432,
3719,
1769,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
364,
261,
4118,
12880,
34,
563,
294,
1686,
13,
288,
203,
5411,
775,
288,
203,
7734,
563,
18,
588,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
1636,
12,
4808,
18,
588,
780,
12,
203,
13491,
315,
2564,
809,
18,
12411,
3187,
18,
451,
20528,
18,
1636,
6,
3631,
425,
1769,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7406,
3167,
819,
14215,
18,
203,
377,
380,
632,
891,
642,
2171,
1021,
642,
1026,
203,
377,
380,
632,
891,
1390,
1021,
3167,
14215,
1492,
1410,
506,
19357,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | deployDescriptor | null | @SuppressWarnings("null") // context is not null
protected void deployDescriptor(ContextName cn, File contextXml) {
DeployedApplication deployedApp =
new DeployedApplication(cn.getName(), true);
long startTime = 0;
// Assume this is a configuration descriptor and deploy it
if(log.isInfoEnabled()) {
startTime = System.currentTimeMillis();
log.info(sm.getString("hostConfig.deployDescriptor",
contextXml.getAbsolutePath()));
}
Context context = null;
boolean isExternalWar = false;
boolean isExternal = false;
File expandedDocBase = null;
try (FileInputStream fis = new FileInputStream(contextXml)) {
synchronized (digesterLock) {
try {
context = (Context) digester.parse(fis);
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployDescriptor.error",
contextXml.getAbsolutePath()), e);
} finally {
digester.reset();
if (context == null) {
context = new FailedContext();
}
}
}
Class<?> clazz = Class.forName(host.getConfigClass());
LifecycleListener listener = (LifecycleListener) clazz.getConstructor().newInstance();
context.addLifecycleListener(listener);
context.setConfigFile(contextXml.toURI().toURL());
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());
// Add the associated docBase to the redeployed list if it's a WAR
if (context.getDocBase() != null) {
File docBase = new File(context.getDocBase());
if (!docBase.isAbsolute()) {
docBase = new File(host.getAppBaseFile(), context.getDocBase());
}
// If external docBase, register .xml as redeploy first
if (!docBase.getCanonicalPath().startsWith(
host.getAppBaseFile().getAbsolutePath() + File.separator)) {
isExternal = true;
deployedApp.redeployResources.put(
contextXml.getAbsolutePath(),
Long.valueOf(contextXml.lastModified()));
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
Long.valueOf(docBase.lastModified()));
if (docBase.getAbsolutePath().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
isExternalWar = true;
}
} else {
log.warn(sm.getString("hostConfig.deployDescriptor.localDocBaseSpecified",
docBase));
// Ignore specified docBase
context.setDocBase(null);
}
}
host.addChild(context);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("hostConfig.deployDescriptor.error",
contextXml.getAbsolutePath()), t);
} finally {
// Get paths for WAR and expanded WAR in appBase
// default to appBase dir + name
expandedDocBase = new File(host.getAppBaseFile(), cn.getBaseName());
if (context.getDocBase() != null
&& !context.getDocBase().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
// first assume docBase is absolute
expandedDocBase = new File(context.getDocBase());
if (!expandedDocBase.isAbsolute()) {
// if docBase specified and relative, it must be relative to appBase
expandedDocBase = new File(host.getAppBaseFile(), context.getDocBase());
}
}
boolean unpackWAR = unpackWARs;
if (unpackWAR && context instanceof StandardContext) {
unpackWAR = ((StandardContext) context).getUnpackWAR();
}
// Add the eventual unpacked WAR and all the resources which will be
// watched inside it
if (isExternalWar) {
if (unpackWAR) {
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
Long.valueOf(expandedDocBase.lastModified()));
addWatchedResources(deployedApp, expandedDocBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
}
} else {
// Find an existing matching war and expanded folder
if (!isExternal) {
File warDocBase = new File(expandedDocBase.getAbsolutePath() + ".war");
if (warDocBase.exists()) {
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
Long.valueOf(warDocBase.lastModified()));
} else {
// Trigger a redeploy if a WAR is added
deployedApp.redeployResources.put(
warDocBase.getAbsolutePath(),
Long.valueOf(0));
}
}
if (unpackWAR) {
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
Long.valueOf(expandedDocBase.lastModified()));
addWatchedResources(deployedApp,
expandedDocBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
}
if (!isExternal) {
// For external docBases, the context.xml will have been
// added above.
deployedApp.redeployResources.put(
contextXml.getAbsolutePath(),
Long.valueOf(contextXml.lastModified()));
}
}
// Add the global redeploy resources (which are never deleted) at
// the end so they don't interfere with the deletion process
addGlobalRedeployResources(deployedApp);
}
if (host.findChild(context.getName()) != null) {
deployed.put(context.getName(), deployedApp);
}
if (log.isInfoEnabled()) {
log.info(sm.getString("hostConfig.deployDescriptor.finished",
contextXml.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
}
} | /**
* Deploy specified context descriptor.
* @param cn The context name
* @param contextXml The descriptor
*/ | Deploy specified context descriptor.
@param cn The context name
@param contextXml The descriptor | [
"Deploy",
"specified",
"context",
"descriptor",
".",
"@param",
"cn",
"The",
"context",
"name",
"@param",
"contextXml",
"The",
"descriptor"
] | @SuppressWarnings("null")
protected void deployDescriptor(ContextName cn, File contextXml) {
DeployedApplication deployedApp =
new DeployedApplication(cn.getName(), true);
long startTime = 0;
if(log.isInfoEnabled()) {
startTime = System.currentTimeMillis();
log.info(sm.getString("hostConfig.deployDescriptor",
contextXml.getAbsolutePath()));
}
Context context = null;
boolean isExternalWar = false;
boolean isExternal = false;
File expandedDocBase = null;
try (FileInputStream fis = new FileInputStream(contextXml)) {
synchronized (digesterLock) {
try {
context = (Context) digester.parse(fis);
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployDescriptor.error",
contextXml.getAbsolutePath()), e);
} finally {
digester.reset();
if (context == null) {
context = new FailedContext();
}
}
}
Class<?> clazz = Class.forName(host.getConfigClass());
LifecycleListener listener = (LifecycleListener) clazz.getConstructor().newInstance();
context.addLifecycleListener(listener);
context.setConfigFile(contextXml.toURI().toURL());
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());
if (context.getDocBase() != null) {
File docBase = new File(context.getDocBase());
if (!docBase.isAbsolute()) {
docBase = new File(host.getAppBaseFile(), context.getDocBase());
}
if (!docBase.getCanonicalPath().startsWith(
host.getAppBaseFile().getAbsolutePath() + File.separator)) {
isExternal = true;
deployedApp.redeployResources.put(
contextXml.getAbsolutePath(),
Long.valueOf(contextXml.lastModified()));
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
Long.valueOf(docBase.lastModified()));
if (docBase.getAbsolutePath().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
isExternalWar = true;
}
} else {
log.warn(sm.getString("hostConfig.deployDescriptor.localDocBaseSpecified",
docBase));
context.setDocBase(null);
}
}
host.addChild(context);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("hostConfig.deployDescriptor.error",
contextXml.getAbsolutePath()), t);
} finally {
expandedDocBase = new File(host.getAppBaseFile(), cn.getBaseName());
if (context.getDocBase() != null
&& !context.getDocBase().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
expandedDocBase = new File(context.getDocBase());
if (!expandedDocBase.isAbsolute()) {
expandedDocBase = new File(host.getAppBaseFile(), context.getDocBase());
}
}
boolean unpackWAR = unpackWARs;
if (unpackWAR && context instanceof StandardContext) {
unpackWAR = ((StandardContext) context).getUnpackWAR();
}
if (isExternalWar) {
if (unpackWAR) {
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
Long.valueOf(expandedDocBase.lastModified()));
addWatchedResources(deployedApp, expandedDocBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
}
} else {
if (!isExternal) {
File warDocBase = new File(expandedDocBase.getAbsolutePath() + ".war");
if (warDocBase.exists()) {
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
Long.valueOf(warDocBase.lastModified()));
} else {
deployedApp.redeployResources.put(
warDocBase.getAbsolutePath(),
Long.valueOf(0));
}
}
if (unpackWAR) {
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
Long.valueOf(expandedDocBase.lastModified()));
addWatchedResources(deployedApp,
expandedDocBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
}
if (!isExternal) {
deployedApp.redeployResources.put(
contextXml.getAbsolutePath(),
Long.valueOf(contextXml.lastModified()));
}
}
addGlobalRedeployResources(deployedApp);
}
if (host.findChild(context.getName()) != null) {
deployed.put(context.getName(), deployedApp);
}
if (log.isInfoEnabled()) {
log.info(sm.getString("hostConfig.deployDescriptor.finished",
contextXml.getAbsolutePath(), Long.valueOf(System.currentTimeMillis() - startTime)));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"null\"",
")",
"protected",
"void",
"deployDescriptor",
"(",
"ContextName",
"cn",
",",
"File",
"contextXml",
")",
"{",
"DeployedApplication",
"deployedApp",
"=",
"new",
"DeployedApplication",
"(",
"cn",
".",
"getName",
"(",
")",
",",
"true",
")",
";",
"long",
"startTime",
"=",
"0",
";",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"log",
".",
"info",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployDescriptor\"",
",",
"contextXml",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
"}",
"Context",
"context",
"=",
"null",
";",
"boolean",
"isExternalWar",
"=",
"false",
";",
"boolean",
"isExternal",
"=",
"false",
";",
"File",
"expandedDocBase",
"=",
"null",
";",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"contextXml",
")",
")",
"{",
"synchronized",
"(",
"digesterLock",
")",
"{",
"try",
"{",
"context",
"=",
"(",
"Context",
")",
"digester",
".",
"parse",
"(",
"fis",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployDescriptor.error\"",
",",
"contextXml",
".",
"getAbsolutePath",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"digester",
".",
"reset",
"(",
")",
";",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"context",
"=",
"new",
"FailedContext",
"(",
")",
";",
"}",
"}",
"}",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"host",
".",
"getConfigClass",
"(",
")",
")",
";",
"LifecycleListener",
"listener",
"=",
"(",
"LifecycleListener",
")",
"clazz",
".",
"getConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"context",
".",
"addLifecycleListener",
"(",
"listener",
")",
";",
"context",
".",
"setConfigFile",
"(",
"contextXml",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
")",
";",
"context",
".",
"setName",
"(",
"cn",
".",
"getName",
"(",
")",
")",
";",
"context",
".",
"setPath",
"(",
"cn",
".",
"getPath",
"(",
")",
")",
";",
"context",
".",
"setWebappVersion",
"(",
"cn",
".",
"getVersion",
"(",
")",
")",
";",
"if",
"(",
"context",
".",
"getDocBase",
"(",
")",
"!=",
"null",
")",
"{",
"File",
"docBase",
"=",
"new",
"File",
"(",
"context",
".",
"getDocBase",
"(",
")",
")",
";",
"if",
"(",
"!",
"docBase",
".",
"isAbsolute",
"(",
")",
")",
"{",
"docBase",
"=",
"new",
"File",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
",",
"context",
".",
"getDocBase",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"docBase",
".",
"getCanonicalPath",
"(",
")",
".",
"startsWith",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
"+",
"File",
".",
"separator",
")",
")",
"{",
"isExternal",
"=",
"true",
";",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"contextXml",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"contextXml",
".",
"lastModified",
"(",
")",
")",
")",
";",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"docBase",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"docBase",
".",
"lastModified",
"(",
")",
")",
")",
";",
"if",
"(",
"docBase",
".",
"getAbsolutePath",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
".",
"endsWith",
"(",
"\".war\"",
")",
")",
"{",
"isExternalWar",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployDescriptor.localDocBaseSpecified\"",
",",
"docBase",
")",
")",
";",
"context",
".",
"setDocBase",
"(",
"null",
")",
";",
"}",
"}",
"host",
".",
"addChild",
"(",
"context",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployDescriptor.error\"",
",",
"contextXml",
".",
"getAbsolutePath",
"(",
")",
")",
",",
"t",
")",
";",
"}",
"finally",
"{",
"expandedDocBase",
"=",
"new",
"File",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
",",
"cn",
".",
"getBaseName",
"(",
")",
")",
";",
"if",
"(",
"context",
".",
"getDocBase",
"(",
")",
"!=",
"null",
"&&",
"!",
"context",
".",
"getDocBase",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
".",
"endsWith",
"(",
"\".war\"",
")",
")",
"{",
"expandedDocBase",
"=",
"new",
"File",
"(",
"context",
".",
"getDocBase",
"(",
")",
")",
";",
"if",
"(",
"!",
"expandedDocBase",
".",
"isAbsolute",
"(",
")",
")",
"{",
"expandedDocBase",
"=",
"new",
"File",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
",",
"context",
".",
"getDocBase",
"(",
")",
")",
";",
"}",
"}",
"boolean",
"unpackWAR",
"=",
"unpackWARs",
";",
"if",
"(",
"unpackWAR",
"&&",
"context",
"instanceof",
"StandardContext",
")",
"{",
"unpackWAR",
"=",
"(",
"(",
"StandardContext",
")",
"context",
")",
".",
"getUnpackWAR",
"(",
")",
";",
"}",
"if",
"(",
"isExternalWar",
")",
"{",
"if",
"(",
"unpackWAR",
")",
"{",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"expandedDocBase",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"expandedDocBase",
".",
"lastModified",
"(",
")",
")",
")",
";",
"addWatchedResources",
"(",
"deployedApp",
",",
"expandedDocBase",
".",
"getAbsolutePath",
"(",
")",
",",
"context",
")",
";",
"}",
"else",
"{",
"addWatchedResources",
"(",
"deployedApp",
",",
"null",
",",
"context",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"isExternal",
")",
"{",
"File",
"warDocBase",
"=",
"new",
"File",
"(",
"expandedDocBase",
".",
"getAbsolutePath",
"(",
")",
"+",
"\".war\"",
")",
";",
"if",
"(",
"warDocBase",
".",
"exists",
"(",
")",
")",
"{",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"warDocBase",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"warDocBase",
".",
"lastModified",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"warDocBase",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"0",
")",
")",
";",
"}",
"}",
"if",
"(",
"unpackWAR",
")",
"{",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"expandedDocBase",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"expandedDocBase",
".",
"lastModified",
"(",
")",
")",
")",
";",
"addWatchedResources",
"(",
"deployedApp",
",",
"expandedDocBase",
".",
"getAbsolutePath",
"(",
")",
",",
"context",
")",
";",
"}",
"else",
"{",
"addWatchedResources",
"(",
"deployedApp",
",",
"null",
",",
"context",
")",
";",
"}",
"if",
"(",
"!",
"isExternal",
")",
"{",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"contextXml",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"contextXml",
".",
"lastModified",
"(",
")",
")",
")",
";",
"}",
"}",
"addGlobalRedeployResources",
"(",
"deployedApp",
")",
";",
"}",
"if",
"(",
"host",
".",
"findChild",
"(",
"context",
".",
"getName",
"(",
")",
")",
"!=",
"null",
")",
"{",
"deployed",
".",
"put",
"(",
"context",
".",
"getName",
"(",
")",
",",
"deployedApp",
")",
";",
"}",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployDescriptor.finished\"",
",",
"contextXml",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"startTime",
")",
")",
")",
";",
"}",
"}"
] | Deploy specified context descriptor. | [
"Deploy",
"specified",
"context",
"descriptor",
"."
] | [
"// context is not null",
"// Assume this is a configuration descriptor and deploy it",
"// Add the associated docBase to the redeployed list if it's a WAR",
"// If external docBase, register .xml as redeploy first",
"// Ignore specified docBase",
"// Get paths for WAR and expanded WAR in appBase",
"// default to appBase dir + name",
"// first assume docBase is absolute",
"// if docBase specified and relative, it must be relative to appBase",
"// Add the eventual unpacked WAR and all the resources which will be",
"// watched inside it",
"// Find an existing matching war and expanded folder",
"// Trigger a redeploy if a WAR is added",
"// For external docBases, the context.xml will have been",
"// added above.",
"// Add the global redeploy resources (which are never deleted) at",
"// the end so they don't interfere with the deletion process"
] | [
{
"param": "cn",
"type": "ContextName"
},
{
"param": "contextXml",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cn",
"type": "ContextName",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "contextXml",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
29282,
4312,
2932,
2011,
7923,
368,
819,
353,
486,
446,
203,
565,
4750,
918,
7286,
3187,
12,
1042,
461,
6227,
16,
1387,
819,
4432,
13,
288,
203,
203,
3639,
7406,
329,
3208,
19357,
3371,
273,
203,
7734,
394,
7406,
329,
3208,
12,
10305,
18,
17994,
9334,
638,
1769,
203,
203,
3639,
1525,
8657,
273,
374,
31,
203,
3639,
368,
15983,
333,
353,
279,
1664,
4950,
471,
7286,
518,
203,
3639,
309,
12,
1330,
18,
291,
966,
1526,
10756,
288,
203,
6647,
8657,
273,
2332,
18,
2972,
28512,
5621,
203,
6647,
613,
18,
1376,
12,
4808,
18,
588,
780,
2932,
2564,
809,
18,
12411,
3187,
3113,
203,
10792,
819,
4432,
18,
588,
10368,
743,
1435,
10019,
203,
3639,
289,
203,
203,
3639,
1772,
819,
273,
446,
31,
203,
3639,
1250,
353,
6841,
30634,
273,
629,
31,
203,
3639,
1250,
353,
6841,
273,
629,
31,
203,
3639,
1387,
8406,
1759,
2171,
273,
446,
31,
203,
203,
3639,
775,
261,
812,
4348,
15324,
273,
394,
11907,
12,
2472,
4432,
3719,
288,
203,
5411,
3852,
261,
5606,
7654,
2531,
13,
288,
203,
7734,
775,
288,
203,
10792,
819,
273,
261,
1042,
13,
23821,
18,
2670,
12,
74,
291,
1769,
203,
7734,
289,
1044,
261,
503,
425,
13,
288,
203,
10792,
613,
18,
1636,
12,
4808,
18,
588,
780,
12,
203,
18701,
315,
2564,
809,
18,
12411,
3187,
18,
1636,
3113,
203,
18701,
819,
4432,
18,
588,
10368,
743,
1435,
3631,
425,
1769,
203,
7734,
289,
3095,
288,
203,
10792,
23821,
18,
6208,
5621,
203,
10792,
309,
261,
2472,
422,
446,
13,
288,
203,
13491,
819,
273,
394,
11175,
1042,
5621,
203,
10792,
289,
203,
7734,
289,
203,
5411,
289,
203,
203,
5411,
1659,
12880,
34,
4003,
273,
1659,
18,
1884,
461,
12,
2564,
18,
588,
809,
797,
10663,
203,
5411,
14283,
2223,
2991,
273,
261,
9977,
2223,
13,
4003,
18,
588,
6293,
7675,
2704,
1442,
5621,
203,
5411,
819,
18,
1289,
9977,
2223,
12,
12757,
1769,
203,
203,
5411,
819,
18,
542,
13705,
12,
2472,
4432,
18,
869,
3098,
7675,
869,
1785,
10663,
203,
5411,
819,
18,
542,
461,
12,
10305,
18,
17994,
10663,
203,
5411,
819,
18,
542,
743,
12,
10305,
18,
588,
743,
10663,
203,
5411,
819,
18,
542,
4079,
2910,
1444,
12,
10305,
18,
588,
1444,
10663,
203,
5411,
368,
1436,
326,
3627,
997,
2171,
358,
326,
283,
12411,
329,
666,
309,
518,
1807,
279,
678,
985,
203,
5411,
309,
261,
2472,
18,
588,
1759,
2171,
1435,
480,
446,
13,
288,
203,
7734,
1387,
997,
2171,
273,
394,
1387,
12,
2472,
18,
588,
1759,
2171,
10663,
203,
7734,
309,
16051,
2434,
2171,
18,
291,
10368,
10756,
288,
203,
10792,
997,
2171,
273,
394,
1387,
12,
2564,
18,
588,
3371,
2171,
812,
9334,
819,
18,
588,
1759,
2171,
10663,
203,
7734,
289,
203,
7734,
368,
971,
3903,
997,
2171,
16,
1744,
263,
2902,
487,
283,
12411,
1122,
203,
7734,
309,
16051,
2434,
2171,
18,
588,
15512,
743,
7675,
17514,
1190,
12,
203,
13491,
1479,
18,
588,
3371,
2171,
812,
7675,
588,
10368,
743,
1435,
397,
1387,
18,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
7406,
1269,
819,
4950,
18,
203,
377,
380,
632,
891,
6227,
1021,
819,
508,
203,
377,
380,
632,
891,
819,
4432,
1021,
4950,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | deployWARs | null | protected void deployWARs(File appBase, String[] files) {
if (files == null)
return;
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
if (files[i].equalsIgnoreCase("META-INF"))
continue;
if (files[i].equalsIgnoreCase("WEB-INF"))
continue;
File war = new File(appBase, files[i]);
if (files[i].toLowerCase(Locale.ENGLISH).endsWith(".war") &&
war.isFile() && !invalidWars.contains(files[i]) ) {
ContextName cn = new ContextName(files[i], true);
if (isServiced(cn.getName())) {
continue;
}
if (deploymentExists(cn.getName())) {
DeployedApplication app = deployed.get(cn.getName());
boolean unpackWAR = unpackWARs;
if (unpackWAR && host.findChild(cn.getName()) instanceof StandardContext) {
unpackWAR = ((StandardContext) host.findChild(cn.getName())).getUnpackWAR();
}
if (!unpackWAR && app != null) {
// Need to check for a directory that should not be
// there
File dir = new File(appBase, cn.getBaseName());
if (dir.exists()) {
if (!app.loggedDirWarning) {
log.warn(sm.getString(
"hostConfig.deployWar.hiddenDir",
dir.getAbsoluteFile(),
war.getAbsoluteFile()));
app.loggedDirWarning = true;
}
} else {
app.loggedDirWarning = false;
}
}
continue;
}
// Check for WARs with /../ /./ or similar sequences in the name
if (!validateContextPath(appBase, cn.getBaseName())) {
log.error(sm.getString(
"hostConfig.illegalWarName", files[i]));
invalidWars.add(files[i]);
continue;
}
results.add(es.submit(new DeployWar(this, cn, war)));
}
}
for (Future<?> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployWar.threaded.error"), e);
}
}
} | /**
* Deploy WAR files.
* @param appBase The base path for applications
* @param files The WARs to deploy
*/ | Deploy WAR files.
@param appBase The base path for applications
@param files The WARs to deploy | [
"Deploy",
"WAR",
"files",
".",
"@param",
"appBase",
"The",
"base",
"path",
"for",
"applications",
"@param",
"files",
"The",
"WARs",
"to",
"deploy"
] | protected void deployWARs(File appBase, String[] files) {
if (files == null)
return;
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
if (files[i].equalsIgnoreCase("META-INF"))
continue;
if (files[i].equalsIgnoreCase("WEB-INF"))
continue;
File war = new File(appBase, files[i]);
if (files[i].toLowerCase(Locale.ENGLISH).endsWith(".war") &&
war.isFile() && !invalidWars.contains(files[i]) ) {
ContextName cn = new ContextName(files[i], true);
if (isServiced(cn.getName())) {
continue;
}
if (deploymentExists(cn.getName())) {
DeployedApplication app = deployed.get(cn.getName());
boolean unpackWAR = unpackWARs;
if (unpackWAR && host.findChild(cn.getName()) instanceof StandardContext) {
unpackWAR = ((StandardContext) host.findChild(cn.getName())).getUnpackWAR();
}
if (!unpackWAR && app != null) {
File dir = new File(appBase, cn.getBaseName());
if (dir.exists()) {
if (!app.loggedDirWarning) {
log.warn(sm.getString(
"hostConfig.deployWar.hiddenDir",
dir.getAbsoluteFile(),
war.getAbsoluteFile()));
app.loggedDirWarning = true;
}
} else {
app.loggedDirWarning = false;
}
}
continue;
}
if (!validateContextPath(appBase, cn.getBaseName())) {
log.error(sm.getString(
"hostConfig.illegalWarName", files[i]));
invalidWars.add(files[i]);
continue;
}
results.add(es.submit(new DeployWar(this, cn, war)));
}
}
for (Future<?> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployWar.threaded.error"), e);
}
}
} | [
"protected",
"void",
"deployWARs",
"(",
"File",
"appBase",
",",
"String",
"[",
"]",
"files",
")",
"{",
"if",
"(",
"files",
"==",
"null",
")",
"return",
";",
"ExecutorService",
"es",
"=",
"host",
".",
"getStartStopExecutor",
"(",
")",
";",
"List",
"<",
"Future",
"<",
"?",
">",
">",
"results",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"equalsIgnoreCase",
"(",
"\"META-INF\"",
")",
")",
"continue",
";",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"equalsIgnoreCase",
"(",
"\"WEB-INF\"",
")",
")",
"continue",
";",
"File",
"war",
"=",
"new",
"File",
"(",
"appBase",
",",
"files",
"[",
"i",
"]",
")",
";",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
".",
"endsWith",
"(",
"\".war\"",
")",
"&&",
"war",
".",
"isFile",
"(",
")",
"&&",
"!",
"invalidWars",
".",
"contains",
"(",
"files",
"[",
"i",
"]",
")",
")",
"{",
"ContextName",
"cn",
"=",
"new",
"ContextName",
"(",
"files",
"[",
"i",
"]",
",",
"true",
")",
";",
"if",
"(",
"isServiced",
"(",
"cn",
".",
"getName",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"deploymentExists",
"(",
"cn",
".",
"getName",
"(",
")",
")",
")",
"{",
"DeployedApplication",
"app",
"=",
"deployed",
".",
"get",
"(",
"cn",
".",
"getName",
"(",
")",
")",
";",
"boolean",
"unpackWAR",
"=",
"unpackWARs",
";",
"if",
"(",
"unpackWAR",
"&&",
"host",
".",
"findChild",
"(",
"cn",
".",
"getName",
"(",
")",
")",
"instanceof",
"StandardContext",
")",
"{",
"unpackWAR",
"=",
"(",
"(",
"StandardContext",
")",
"host",
".",
"findChild",
"(",
"cn",
".",
"getName",
"(",
")",
")",
")",
".",
"getUnpackWAR",
"(",
")",
";",
"}",
"if",
"(",
"!",
"unpackWAR",
"&&",
"app",
"!=",
"null",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"appBase",
",",
"cn",
".",
"getBaseName",
"(",
")",
")",
";",
"if",
"(",
"dir",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"app",
".",
"loggedDirWarning",
")",
"{",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployWar.hiddenDir\"",
",",
"dir",
".",
"getAbsoluteFile",
"(",
")",
",",
"war",
".",
"getAbsoluteFile",
"(",
")",
")",
")",
";",
"app",
".",
"loggedDirWarning",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"app",
".",
"loggedDirWarning",
"=",
"false",
";",
"}",
"}",
"continue",
";",
"}",
"if",
"(",
"!",
"validateContextPath",
"(",
"appBase",
",",
"cn",
".",
"getBaseName",
"(",
")",
")",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.illegalWarName\"",
",",
"files",
"[",
"i",
"]",
")",
")",
";",
"invalidWars",
".",
"add",
"(",
"files",
"[",
"i",
"]",
")",
";",
"continue",
";",
"}",
"results",
".",
"add",
"(",
"es",
".",
"submit",
"(",
"new",
"DeployWar",
"(",
"this",
",",
"cn",
",",
"war",
")",
")",
")",
";",
"}",
"}",
"for",
"(",
"Future",
"<",
"?",
">",
"result",
":",
"results",
")",
"{",
"try",
"{",
"result",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployWar.threaded.error\"",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Deploy WAR files. | [
"Deploy",
"WAR",
"files",
"."
] | [
"// Need to check for a directory that should not be",
"// there",
"// Check for WARs with /../ /./ or similar sequences in the name"
] | [
{
"param": "appBase",
"type": "File"
},
{
"param": "files",
"type": "String[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "appBase",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": "String[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
7286,
16777,
87,
12,
812,
595,
2171,
16,
514,
8526,
1390,
13,
288,
203,
203,
3639,
309,
261,
2354,
422,
446,
13,
203,
5411,
327,
31,
203,
203,
3639,
27299,
5001,
273,
1479,
18,
588,
1685,
4947,
6325,
5621,
203,
3639,
987,
32,
4118,
12880,
9778,
1686,
273,
394,
2407,
29667,
5621,
203,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
1390,
18,
2469,
31,
277,
27245,
288,
203,
203,
5411,
309,
261,
2354,
63,
77,
8009,
14963,
5556,
2932,
19294,
17,
19212,
6,
3719,
203,
7734,
1324,
31,
203,
5411,
309,
261,
2354,
63,
77,
8009,
14963,
5556,
2932,
14778,
17,
19212,
6,
3719,
203,
7734,
1324,
31,
203,
5411,
1387,
21983,
273,
394,
1387,
12,
2910,
2171,
16,
1390,
63,
77,
19226,
203,
5411,
309,
261,
2354,
63,
77,
8009,
869,
5630,
12,
3916,
18,
16324,
13462,
2934,
5839,
1190,
2932,
18,
905,
7923,
597,
203,
10792,
21983,
18,
291,
812,
1435,
597,
401,
5387,
59,
5913,
18,
12298,
12,
2354,
63,
77,
5717,
262,
288,
203,
203,
7734,
1772,
461,
6227,
273,
394,
1772,
461,
12,
2354,
63,
77,
6487,
638,
1769,
203,
203,
7734,
309,
261,
291,
1179,
72,
12,
10305,
18,
17994,
1435,
3719,
288,
203,
10792,
1324,
31,
203,
7734,
289,
203,
7734,
309,
261,
21704,
4002,
12,
10305,
18,
17994,
1435,
3719,
288,
203,
10792,
7406,
329,
3208,
595,
273,
19357,
18,
588,
12,
10305,
18,
17994,
10663,
203,
10792,
1250,
6167,
16777,
273,
6167,
16777,
87,
31,
203,
10792,
309,
261,
17309,
16777,
597,
1479,
18,
4720,
1763,
12,
10305,
18,
17994,
10756,
1276,
8263,
1042,
13,
288,
203,
13491,
6167,
16777,
273,
14015,
8336,
1042,
13,
1479,
18,
4720,
1763,
12,
10305,
18,
17994,
10756,
2934,
588,
23649,
16777,
5621,
203,
10792,
289,
203,
10792,
309,
16051,
17309,
16777,
597,
595,
480,
446,
13,
288,
203,
13491,
368,
12324,
358,
866,
364,
279,
1867,
716,
1410,
486,
506,
203,
13491,
368,
1915,
203,
13491,
1387,
1577,
273,
394,
1387,
12,
2910,
2171,
16,
6227,
18,
588,
29907,
10663,
203,
13491,
309,
261,
1214,
18,
1808,
10756,
288,
203,
18701,
309,
16051,
2910,
18,
19385,
1621,
6210,
13,
288,
203,
27573,
613,
18,
8935,
12,
4808,
18,
588,
780,
12,
203,
4766,
3639,
315,
2564,
809,
18,
12411,
30634,
18,
6345,
1621,
3113,
203,
4766,
3639,
1577,
18,
588,
10368,
812,
9334,
203,
4766,
3639,
21983,
18,
588,
10368,
812,
1435,
10019,
203,
27573,
595,
18,
19385,
1621,
6210,
273,
638,
31,
203,
18701,
289,
203,
13491,
289,
469,
288,
203,
18701,
595,
18,
19385,
1621,
6210,
273,
629,
31,
203,
13491,
289,
203,
10792,
289,
203,
10792,
1324,
31,
203,
7734,
289,
203,
203,
7734,
368,
2073,
364,
678,
985,
87,
598,
342,
6216,
342,
18,
19,
578,
7281,
8463,
316,
326,
508,
203,
7734,
309,
16051,
5662,
1042,
743,
12,
2910,
2171,
16,
6227,
18,
588,
29907,
1435,
3719,
288,
203,
10792,
613,
18,
1636,
12,
4808,
18,
588,
780,
12,
203,
18701,
315,
2564,
809,
18,
31751,
30634,
461,
3113,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
7406,
678,
985,
1390,
18,
203,
377,
380,
632,
891,
595,
2171,
1021,
1026,
589,
364,
12165,
203,
377,
380,
632,
891,
1390,
1021,
678,
985,
87,
358,
7286,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | deployDirectories | null | protected void deployDirectories(File appBase, String[] files) {
if (files == null)
return;
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
if (files[i].equalsIgnoreCase("META-INF"))
continue;
if (files[i].equalsIgnoreCase("WEB-INF"))
continue;
File dir = new File(appBase, files[i]);
if (dir.isDirectory()) {
ContextName cn = new ContextName(files[i], false);
if (isServiced(cn.getName()) || deploymentExists(cn.getName()))
continue;
results.add(es.submit(new DeployDirectory(this, cn, dir)));
}
}
for (Future<?> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployDir.threaded.error"), e);
}
}
} | /**
* Deploy exploded webapps.
* @param appBase The base path for applications
* @param files The exploded webapps that should be deployed
*/ | Deploy exploded webapps.
@param appBase The base path for applications
@param files The exploded webapps that should be deployed | [
"Deploy",
"exploded",
"webapps",
".",
"@param",
"appBase",
"The",
"base",
"path",
"for",
"applications",
"@param",
"files",
"The",
"exploded",
"webapps",
"that",
"should",
"be",
"deployed"
] | protected void deployDirectories(File appBase, String[] files) {
if (files == null)
return;
ExecutorService es = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
if (files[i].equalsIgnoreCase("META-INF"))
continue;
if (files[i].equalsIgnoreCase("WEB-INF"))
continue;
File dir = new File(appBase, files[i]);
if (dir.isDirectory()) {
ContextName cn = new ContextName(files[i], false);
if (isServiced(cn.getName()) || deploymentExists(cn.getName()))
continue;
results.add(es.submit(new DeployDirectory(this, cn, dir)));
}
}
for (Future<?> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString(
"hostConfig.deployDir.threaded.error"), e);
}
}
} | [
"protected",
"void",
"deployDirectories",
"(",
"File",
"appBase",
",",
"String",
"[",
"]",
"files",
")",
"{",
"if",
"(",
"files",
"==",
"null",
")",
"return",
";",
"ExecutorService",
"es",
"=",
"host",
".",
"getStartStopExecutor",
"(",
")",
";",
"List",
"<",
"Future",
"<",
"?",
">",
">",
"results",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"equalsIgnoreCase",
"(",
"\"META-INF\"",
")",
")",
"continue",
";",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"equalsIgnoreCase",
"(",
"\"WEB-INF\"",
")",
")",
"continue",
";",
"File",
"dir",
"=",
"new",
"File",
"(",
"appBase",
",",
"files",
"[",
"i",
"]",
")",
";",
"if",
"(",
"dir",
".",
"isDirectory",
"(",
")",
")",
"{",
"ContextName",
"cn",
"=",
"new",
"ContextName",
"(",
"files",
"[",
"i",
"]",
",",
"false",
")",
";",
"if",
"(",
"isServiced",
"(",
"cn",
".",
"getName",
"(",
")",
")",
"||",
"deploymentExists",
"(",
"cn",
".",
"getName",
"(",
")",
")",
")",
"continue",
";",
"results",
".",
"add",
"(",
"es",
".",
"submit",
"(",
"new",
"DeployDirectory",
"(",
"this",
",",
"cn",
",",
"dir",
")",
")",
")",
";",
"}",
"}",
"for",
"(",
"Future",
"<",
"?",
">",
"result",
":",
"results",
")",
"{",
"try",
"{",
"result",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.deployDir.threaded.error\"",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Deploy exploded webapps. | [
"Deploy",
"exploded",
"webapps",
"."
] | [] | [
{
"param": "appBase",
"type": "File"
},
{
"param": "files",
"type": "String[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "appBase",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": "String[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
7286,
13071,
12,
812,
595,
2171,
16,
514,
8526,
1390,
13,
288,
203,
203,
3639,
309,
261,
2354,
422,
446,
13,
203,
5411,
327,
31,
203,
203,
3639,
27299,
5001,
273,
1479,
18,
588,
1685,
4947,
6325,
5621,
203,
3639,
987,
32,
4118,
12880,
9778,
1686,
273,
394,
2407,
29667,
5621,
203,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
1390,
18,
2469,
31,
277,
27245,
288,
203,
203,
5411,
309,
261,
2354,
63,
77,
8009,
14963,
5556,
2932,
19294,
17,
19212,
6,
3719,
203,
7734,
1324,
31,
203,
5411,
309,
261,
2354,
63,
77,
8009,
14963,
5556,
2932,
14778,
17,
19212,
6,
3719,
203,
7734,
1324,
31,
203,
5411,
1387,
1577,
273,
394,
1387,
12,
2910,
2171,
16,
1390,
63,
77,
19226,
203,
5411,
309,
261,
1214,
18,
291,
2853,
10756,
288,
203,
7734,
1772,
461,
6227,
273,
394,
1772,
461,
12,
2354,
63,
77,
6487,
629,
1769,
203,
203,
7734,
309,
261,
291,
1179,
72,
12,
10305,
18,
17994,
10756,
747,
6314,
4002,
12,
10305,
18,
17994,
1435,
3719,
203,
10792,
1324,
31,
203,
203,
7734,
1686,
18,
1289,
12,
281,
18,
9297,
12,
2704,
7406,
2853,
12,
2211,
16,
6227,
16,
1577,
3719,
1769,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
364,
261,
4118,
12880,
34,
563,
294,
1686,
13,
288,
203,
5411,
775,
288,
203,
7734,
563,
18,
588,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
1636,
12,
4808,
18,
588,
780,
12,
203,
13491,
315,
2564,
809,
18,
12411,
1621,
18,
451,
20528,
18,
1636,
6,
3631,
425,
1769,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7406,
22676,
3311,
11411,
18,
203,
377,
380,
632,
891,
595,
2171,
1021,
1026,
589,
364,
12165,
203,
377,
380,
632,
891,
1390,
1021,
22676,
3311,
11411,
716,
1410,
506,
19357,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | addWatchedResources | null | protected void addWatchedResources(DeployedApplication app, String docBase,
Context context) {
// FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*,
// WEB-INF/*.xml), where we would only check if at least one
// resource is newer than app.timestamp
File docBaseFile = null;
if (docBase != null) {
docBaseFile = new File(docBase);
if (!docBaseFile.isAbsolute()) {
docBaseFile = new File(host.getAppBaseFile(), docBase);
}
}
String[] watchedResources = context.findWatchedResources();
for (int i = 0; i < watchedResources.length; i++) {
File resource = new File(watchedResources[i]);
if (!resource.isAbsolute()) {
if (docBase != null) {
resource = new File(docBaseFile, watchedResources[i]);
} else {
if(log.isDebugEnabled())
log.debug("Ignoring non-existent WatchedResource '" +
resource.getAbsolutePath() + "'");
continue;
}
}
if(log.isDebugEnabled())
log.debug("Watching WatchedResource '" +
resource.getAbsolutePath() + "'");
app.reloadResources.put(resource.getAbsolutePath(),
Long.valueOf(resource.lastModified()));
}
} | /**
* Add watched resources to the specified Context.
* @param app HostConfig deployed app
* @param docBase web app docBase
* @param context web application context
*/ | Add watched resources to the specified Context.
@param app HostConfig deployed app
@param docBase web app docBase
@param context web application context | [
"Add",
"watched",
"resources",
"to",
"the",
"specified",
"Context",
".",
"@param",
"app",
"HostConfig",
"deployed",
"app",
"@param",
"docBase",
"web",
"app",
"docBase",
"@param",
"context",
"web",
"application",
"context"
] | protected void addWatchedResources(DeployedApplication app, String docBase,
Context context) {
File docBaseFile = null;
if (docBase != null) {
docBaseFile = new File(docBase);
if (!docBaseFile.isAbsolute()) {
docBaseFile = new File(host.getAppBaseFile(), docBase);
}
}
String[] watchedResources = context.findWatchedResources();
for (int i = 0; i < watchedResources.length; i++) {
File resource = new File(watchedResources[i]);
if (!resource.isAbsolute()) {
if (docBase != null) {
resource = new File(docBaseFile, watchedResources[i]);
} else {
if(log.isDebugEnabled())
log.debug("Ignoring non-existent WatchedResource '" +
resource.getAbsolutePath() + "'");
continue;
}
}
if(log.isDebugEnabled())
log.debug("Watching WatchedResource '" +
resource.getAbsolutePath() + "'");
app.reloadResources.put(resource.getAbsolutePath(),
Long.valueOf(resource.lastModified()));
}
} | [
"protected",
"void",
"addWatchedResources",
"(",
"DeployedApplication",
"app",
",",
"String",
"docBase",
",",
"Context",
"context",
")",
"{",
"File",
"docBaseFile",
"=",
"null",
";",
"if",
"(",
"docBase",
"!=",
"null",
")",
"{",
"docBaseFile",
"=",
"new",
"File",
"(",
"docBase",
")",
";",
"if",
"(",
"!",
"docBaseFile",
".",
"isAbsolute",
"(",
")",
")",
"{",
"docBaseFile",
"=",
"new",
"File",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
",",
"docBase",
")",
";",
"}",
"}",
"String",
"[",
"]",
"watchedResources",
"=",
"context",
".",
"findWatchedResources",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"watchedResources",
".",
"length",
";",
"i",
"++",
")",
"{",
"File",
"resource",
"=",
"new",
"File",
"(",
"watchedResources",
"[",
"i",
"]",
")",
";",
"if",
"(",
"!",
"resource",
".",
"isAbsolute",
"(",
")",
")",
"{",
"if",
"(",
"docBase",
"!=",
"null",
")",
"{",
"resource",
"=",
"new",
"File",
"(",
"docBaseFile",
",",
"watchedResources",
"[",
"i",
"]",
")",
";",
"}",
"else",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"Ignoring non-existent WatchedResource '\"",
"+",
"resource",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"'\"",
")",
";",
"continue",
";",
"}",
"}",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"Watching WatchedResource '\"",
"+",
"resource",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"'\"",
")",
";",
"app",
".",
"reloadResources",
".",
"put",
"(",
"resource",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"resource",
".",
"lastModified",
"(",
")",
")",
")",
";",
"}",
"}"
] | Add watched resources to the specified Context. | [
"Add",
"watched",
"resources",
"to",
"the",
"specified",
"Context",
"."
] | [
"// FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*,",
"// WEB-INF/*.xml), where we would only check if at least one",
"// resource is newer than app.timestamp"
] | [
{
"param": "app",
"type": "DeployedApplication"
},
{
"param": "docBase",
"type": "String"
},
{
"param": "context",
"type": "Context"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "app",
"type": "DeployedApplication",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "docBase",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "context",
"type": "Context",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
527,
5234,
329,
3805,
12,
31954,
3208,
595,
16,
514,
997,
2171,
16,
203,
5411,
1772,
819,
13,
288,
203,
3639,
368,
9852,
30,
7881,
21463,
18,
1436,
2865,
364,
6884,
261,
338,
30,
19877,
17,
19212,
20308,
16,
203,
3639,
368,
3639,
19877,
17,
19212,
30987,
2902,
3631,
1625,
732,
4102,
1338,
866,
309,
622,
4520,
1245,
203,
3639,
368,
3639,
1058,
353,
16069,
2353,
595,
18,
5508,
203,
3639,
1387,
997,
2171,
812,
273,
446,
31,
203,
3639,
309,
261,
2434,
2171,
480,
446,
13,
288,
203,
5411,
997,
2171,
812,
273,
394,
1387,
12,
2434,
2171,
1769,
203,
5411,
309,
16051,
2434,
2171,
812,
18,
291,
10368,
10756,
288,
203,
7734,
997,
2171,
812,
273,
394,
1387,
12,
2564,
18,
588,
3371,
2171,
812,
9334,
997,
2171,
1769,
203,
5411,
289,
203,
3639,
289,
203,
3639,
514,
8526,
23135,
3805,
273,
819,
18,
4720,
5234,
329,
3805,
5621,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
23135,
3805,
18,
2469,
31,
277,
27245,
288,
203,
5411,
1387,
1058,
273,
394,
1387,
12,
7585,
329,
3805,
63,
77,
19226,
203,
5411,
309,
16051,
3146,
18,
291,
10368,
10756,
288,
203,
7734,
309,
261,
2434,
2171,
480,
446,
13,
288,
203,
10792,
1058,
273,
394,
1387,
12,
2434,
2171,
812,
16,
23135,
3805,
63,
77,
19226,
203,
7734,
289,
469,
288,
203,
10792,
309,
12,
1330,
18,
291,
2829,
1526,
10756,
203,
13491,
613,
18,
4148,
2932,
21702,
1661,
17,
19041,
9736,
329,
1420,
2119,
397,
203,
27573,
1058,
18,
588,
10368,
743,
1435,
397,
5862,
1769,
203,
10792,
1324,
31,
203,
7734,
289,
203,
5411,
289,
203,
5411,
309,
12,
1330,
18,
291,
2829,
1526,
10756,
203,
7734,
613,
18,
4148,
2932,
5234,
310,
9736,
329,
1420,
2119,
397,
203,
13491,
1058,
18,
588,
10368,
743,
1435,
397,
5862,
1769,
203,
5411,
595,
18,
17517,
3805,
18,
458,
12,
3146,
18,
588,
10368,
743,
9334,
203,
10792,
3407,
18,
1132,
951,
12,
3146,
18,
2722,
4575,
1435,
10019,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1436,
23135,
2703,
358,
326,
1269,
1772,
18,
203,
377,
380,
632,
891,
595,
4893,
809,
19357,
595,
203,
377,
380,
632,
891,
997,
2171,
3311,
595,
997,
2171,
203,
377,
380,
632,
891,
819,
3311,
2521,
819,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | checkResources | null | protected synchronized void checkResources(DeployedApplication app,
boolean skipFileModificationResolutionCheck) {
String[] resources =
app.redeployResources.keySet().toArray(new String[0]);
// Offset the current time by the resolution of File.lastModified()
long currentTimeWithResolutionOffset =
System.currentTimeMillis() - FILE_MODIFICATION_RESOLUTION_MS;
for (int i = 0; i < resources.length; i++) {
File resource = new File(resources[i]);
if (log.isDebugEnabled())
log.debug("Checking context[" + app.name +
"] redeploy resource " + resource);
long lastModified =
app.redeployResources.get(resources[i]).longValue();
if (resource.exists() || lastModified == 0) {
// File.lastModified() has a resolution of 1s (1000ms). The last
// modified time has to be more than 1000ms ago to ensure that
// modifications that take place in the same second are not
// missed. See Bug 57765.
if (resource.lastModified() != lastModified && (!host.getAutoDeploy() ||
resource.lastModified() < currentTimeWithResolutionOffset ||
skipFileModificationResolutionCheck)) {
if (resource.isDirectory()) {
// No action required for modified directory
app.redeployResources.put(resources[i],
Long.valueOf(resource.lastModified()));
} else if (app.hasDescriptor &&
resource.getName().toLowerCase(
Locale.ENGLISH).endsWith(".war")) {
// Modified WAR triggers a reload if there is an XML
// file present
// The only resource that should be deleted is the
// expanded WAR (if any)
Context context = (Context) host.findChild(app.name);
String docBase = context.getDocBase();
if (!docBase.toLowerCase(Locale.ENGLISH).endsWith(".war")) {
// This is an expanded directory
File docBaseFile = new File(docBase);
if (!docBaseFile.isAbsolute()) {
docBaseFile = new File(host.getAppBaseFile(),
docBase);
}
reload(app, docBaseFile, resource.getAbsolutePath());
} else {
reload(app, null, null);
}
// Update times
app.redeployResources.put(resources[i],
Long.valueOf(resource.lastModified()));
app.timestamp = System.currentTimeMillis();
boolean unpackWAR = unpackWARs;
if (unpackWAR && context instanceof StandardContext) {
unpackWAR = ((StandardContext) context).getUnpackWAR();
}
if (unpackWAR) {
addWatchedResources(app, context.getDocBase(), context);
} else {
addWatchedResources(app, null, context);
}
return;
} else {
// Everything else triggers a redeploy
// (just need to undeploy here, deploy will follow)
undeploy(app);
deleteRedeployResources(app, resources, i, false);
return;
}
}
} else {
// There is a chance the the resource was only missing
// temporarily eg renamed during a text editor save
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
// Ignore
}
// Recheck the resource to see if it was really deleted
if (resource.exists()) {
continue;
}
// Undeploy application
undeploy(app);
deleteRedeployResources(app, resources, i, true);
return;
}
}
resources = app.reloadResources.keySet().toArray(new String[0]);
boolean update = false;
for (int i = 0; i < resources.length; i++) {
File resource = new File(resources[i]);
if (log.isDebugEnabled()) {
log.debug("Checking context[" + app.name + "] reload resource " + resource);
}
long lastModified = app.reloadResources.get(resources[i]).longValue();
// File.lastModified() has a resolution of 1s (1000ms). The last
// modified time has to be more than 1000ms ago to ensure that
// modifications that take place in the same second are not
// missed. See Bug 57765.
if ((resource.lastModified() != lastModified &&
(!host.getAutoDeploy() ||
resource.lastModified() < currentTimeWithResolutionOffset ||
skipFileModificationResolutionCheck)) ||
update) {
if (!update) {
// Reload application
reload(app, null, null);
update = true;
}
// Update times. More than one file may have been updated. We
// don't want to trigger a series of reloads.
app.reloadResources.put(resources[i],
Long.valueOf(resource.lastModified()));
}
app.timestamp = System.currentTimeMillis();
}
} | /**
* Check resources for redeployment and reloading.
*
* @param app The web application to check
* @param skipFileModificationResolutionCheck
* When checking files for modification should the check that
* requires that any file modification must have occurred at
* least as long ago as the resolution of the file time stamp
* be skipped
*/ | Check resources for redeployment and reloading.
@param app The web application to check
@param skipFileModificationResolutionCheck
When checking files for modification should the check that
requires that any file modification must have occurred at
least as long ago as the resolution of the file time stamp
be skipped | [
"Check",
"resources",
"for",
"redeployment",
"and",
"reloading",
".",
"@param",
"app",
"The",
"web",
"application",
"to",
"check",
"@param",
"skipFileModificationResolutionCheck",
"When",
"checking",
"files",
"for",
"modification",
"should",
"the",
"check",
"that",
"requires",
"that",
"any",
"file",
"modification",
"must",
"have",
"occurred",
"at",
"least",
"as",
"long",
"ago",
"as",
"the",
"resolution",
"of",
"the",
"file",
"time",
"stamp",
"be",
"skipped"
] | protected synchronized void checkResources(DeployedApplication app,
boolean skipFileModificationResolutionCheck) {
String[] resources =
app.redeployResources.keySet().toArray(new String[0]);
long currentTimeWithResolutionOffset =
System.currentTimeMillis() - FILE_MODIFICATION_RESOLUTION_MS;
for (int i = 0; i < resources.length; i++) {
File resource = new File(resources[i]);
if (log.isDebugEnabled())
log.debug("Checking context[" + app.name +
"] redeploy resource " + resource);
long lastModified =
app.redeployResources.get(resources[i]).longValue();
if (resource.exists() || lastModified == 0) {
if (resource.lastModified() != lastModified && (!host.getAutoDeploy() ||
resource.lastModified() < currentTimeWithResolutionOffset ||
skipFileModificationResolutionCheck)) {
if (resource.isDirectory()) {
app.redeployResources.put(resources[i],
Long.valueOf(resource.lastModified()));
} else if (app.hasDescriptor &&
resource.getName().toLowerCase(
Locale.ENGLISH).endsWith(".war")) {
Context context = (Context) host.findChild(app.name);
String docBase = context.getDocBase();
if (!docBase.toLowerCase(Locale.ENGLISH).endsWith(".war")) {
File docBaseFile = new File(docBase);
if (!docBaseFile.isAbsolute()) {
docBaseFile = new File(host.getAppBaseFile(),
docBase);
}
reload(app, docBaseFile, resource.getAbsolutePath());
} else {
reload(app, null, null);
}
app.redeployResources.put(resources[i],
Long.valueOf(resource.lastModified()));
app.timestamp = System.currentTimeMillis();
boolean unpackWAR = unpackWARs;
if (unpackWAR && context instanceof StandardContext) {
unpackWAR = ((StandardContext) context).getUnpackWAR();
}
if (unpackWAR) {
addWatchedResources(app, context.getDocBase(), context);
} else {
addWatchedResources(app, null, context);
}
return;
} else {
undeploy(app);
deleteRedeployResources(app, resources, i, false);
return;
}
}
} else {
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
}
if (resource.exists()) {
continue;
}
undeploy(app);
deleteRedeployResources(app, resources, i, true);
return;
}
}
resources = app.reloadResources.keySet().toArray(new String[0]);
boolean update = false;
for (int i = 0; i < resources.length; i++) {
File resource = new File(resources[i]);
if (log.isDebugEnabled()) {
log.debug("Checking context[" + app.name + "] reload resource " + resource);
}
long lastModified = app.reloadResources.get(resources[i]).longValue();
if ((resource.lastModified() != lastModified &&
(!host.getAutoDeploy() ||
resource.lastModified() < currentTimeWithResolutionOffset ||
skipFileModificationResolutionCheck)) ||
update) {
if (!update) {
reload(app, null, null);
update = true;
}
. More than one file may have been updated. We
app.reloadResources.put(resources[i],
Long.valueOf(resource.lastModified()));
}
app.timestamp = System.currentTimeMillis();
}
} | [
"protected",
"synchronized",
"void",
"checkResources",
"(",
"DeployedApplication",
"app",
",",
"boolean",
"skipFileModificationResolutionCheck",
")",
"{",
"String",
"[",
"]",
"resources",
"=",
"app",
".",
"redeployResources",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"long",
"currentTimeWithResolutionOffset",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"FILE_MODIFICATION_RESOLUTION_MS",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"File",
"resource",
"=",
"new",
"File",
"(",
"resources",
"[",
"i",
"]",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"Checking context[\"",
"+",
"app",
".",
"name",
"+",
"\"] redeploy resource \"",
"+",
"resource",
")",
";",
"long",
"lastModified",
"=",
"app",
".",
"redeployResources",
".",
"get",
"(",
"resources",
"[",
"i",
"]",
")",
".",
"longValue",
"(",
")",
";",
"if",
"(",
"resource",
".",
"exists",
"(",
")",
"||",
"lastModified",
"==",
"0",
")",
"{",
"if",
"(",
"resource",
".",
"lastModified",
"(",
")",
"!=",
"lastModified",
"&&",
"(",
"!",
"host",
".",
"getAutoDeploy",
"(",
")",
"||",
"resource",
".",
"lastModified",
"(",
")",
"<",
"currentTimeWithResolutionOffset",
"||",
"skipFileModificationResolutionCheck",
")",
")",
"{",
"if",
"(",
"resource",
".",
"isDirectory",
"(",
")",
")",
"{",
"app",
".",
"redeployResources",
".",
"put",
"(",
"resources",
"[",
"i",
"]",
",",
"Long",
".",
"valueOf",
"(",
"resource",
".",
"lastModified",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"app",
".",
"hasDescriptor",
"&&",
"resource",
".",
"getName",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
".",
"endsWith",
"(",
"\".war\"",
")",
")",
"{",
"Context",
"context",
"=",
"(",
"Context",
")",
"host",
".",
"findChild",
"(",
"app",
".",
"name",
")",
";",
"String",
"docBase",
"=",
"context",
".",
"getDocBase",
"(",
")",
";",
"if",
"(",
"!",
"docBase",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
".",
"endsWith",
"(",
"\".war\"",
")",
")",
"{",
"File",
"docBaseFile",
"=",
"new",
"File",
"(",
"docBase",
")",
";",
"if",
"(",
"!",
"docBaseFile",
".",
"isAbsolute",
"(",
")",
")",
"{",
"docBaseFile",
"=",
"new",
"File",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
",",
"docBase",
")",
";",
"}",
"reload",
"(",
"app",
",",
"docBaseFile",
",",
"resource",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"else",
"{",
"reload",
"(",
"app",
",",
"null",
",",
"null",
")",
";",
"}",
"app",
".",
"redeployResources",
".",
"put",
"(",
"resources",
"[",
"i",
"]",
",",
"Long",
".",
"valueOf",
"(",
"resource",
".",
"lastModified",
"(",
")",
")",
")",
";",
"app",
".",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"unpackWAR",
"=",
"unpackWARs",
";",
"if",
"(",
"unpackWAR",
"&&",
"context",
"instanceof",
"StandardContext",
")",
"{",
"unpackWAR",
"=",
"(",
"(",
"StandardContext",
")",
"context",
")",
".",
"getUnpackWAR",
"(",
")",
";",
"}",
"if",
"(",
"unpackWAR",
")",
"{",
"addWatchedResources",
"(",
"app",
",",
"context",
".",
"getDocBase",
"(",
")",
",",
"context",
")",
";",
"}",
"else",
"{",
"addWatchedResources",
"(",
"app",
",",
"null",
",",
"context",
")",
";",
"}",
"return",
";",
"}",
"else",
"{",
"undeploy",
"(",
"app",
")",
";",
"deleteRedeployResources",
"(",
"app",
",",
"resources",
",",
"i",
",",
"false",
")",
";",
"return",
";",
"}",
"}",
"}",
"else",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"500",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e1",
")",
"{",
"}",
"if",
"(",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"continue",
";",
"}",
"undeploy",
"(",
"app",
")",
";",
"deleteRedeployResources",
"(",
"app",
",",
"resources",
",",
"i",
",",
"true",
")",
";",
"return",
";",
"}",
"}",
"resources",
"=",
"app",
".",
"reloadResources",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"boolean",
"update",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"File",
"resource",
"=",
"new",
"File",
"(",
"resources",
"[",
"i",
"]",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Checking context[\"",
"+",
"app",
".",
"name",
"+",
"\"] reload resource \"",
"+",
"resource",
")",
";",
"}",
"long",
"lastModified",
"=",
"app",
".",
"reloadResources",
".",
"get",
"(",
"resources",
"[",
"i",
"]",
")",
".",
"longValue",
"(",
")",
";",
"if",
"(",
"(",
"resource",
".",
"lastModified",
"(",
")",
"!=",
"lastModified",
"&&",
"(",
"!",
"host",
".",
"getAutoDeploy",
"(",
")",
"||",
"resource",
".",
"lastModified",
"(",
")",
"<",
"currentTimeWithResolutionOffset",
"||",
"skipFileModificationResolutionCheck",
")",
")",
"||",
"update",
")",
"{",
"if",
"(",
"!",
"update",
")",
"{",
"reload",
"(",
"app",
",",
"null",
",",
"null",
")",
";",
"update",
"=",
"true",
";",
"}",
"app",
".",
"reloadResources",
".",
"put",
"(",
"resources",
"[",
"i",
"]",
",",
"Long",
".",
"valueOf",
"(",
"resource",
".",
"lastModified",
"(",
")",
")",
")",
";",
"}",
"app",
".",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"}"
] | Check resources for redeployment and reloading. | [
"Check",
"resources",
"for",
"redeployment",
"and",
"reloading",
"."
] | [
"// Offset the current time by the resolution of File.lastModified()",
"// File.lastModified() has a resolution of 1s (1000ms). The last",
"// modified time has to be more than 1000ms ago to ensure that",
"// modifications that take place in the same second are not",
"// missed. See Bug 57765.",
"// No action required for modified directory",
"// Modified WAR triggers a reload if there is an XML",
"// file present",
"// The only resource that should be deleted is the",
"// expanded WAR (if any)",
"// This is an expanded directory",
"// Update times",
"// Everything else triggers a redeploy",
"// (just need to undeploy here, deploy will follow)",
"// There is a chance the the resource was only missing",
"// temporarily eg renamed during a text editor save",
"// Ignore",
"// Recheck the resource to see if it was really deleted",
"// Undeploy application",
"// File.lastModified() has a resolution of 1s (1000ms). The last",
"// modified time has to be more than 1000ms ago to ensure that",
"// modifications that take place in the same second are not",
"// missed. See Bug 57765.",
"// Reload application",
"// Update times. More than one file may have been updated. We",
"// don't want to trigger a series of reloads."
] | [
{
"param": "app",
"type": "DeployedApplication"
},
{
"param": "skipFileModificationResolutionCheck",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "app",
"type": "DeployedApplication",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "skipFileModificationResolutionCheck",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
3852,
918,
866,
3805,
12,
31954,
3208,
595,
16,
203,
5411,
1250,
2488,
812,
13467,
11098,
1564,
13,
288,
203,
3639,
514,
8526,
2703,
273,
203,
5411,
595,
18,
266,
12411,
3805,
18,
856,
694,
7675,
31447,
12,
2704,
514,
63,
20,
19226,
203,
3639,
368,
9874,
326,
783,
813,
635,
326,
7861,
434,
1387,
18,
2722,
4575,
1435,
203,
3639,
1525,
6680,
1190,
11098,
2335,
273,
203,
7734,
2332,
18,
2972,
28512,
1435,
300,
7527,
67,
6720,
14865,
67,
17978,
13269,
67,
3537,
31,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
2703,
18,
2469,
31,
277,
27245,
288,
203,
5411,
1387,
1058,
273,
394,
1387,
12,
4683,
63,
77,
19226,
203,
5411,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
203,
7734,
613,
18,
4148,
2932,
14294,
819,
9614,
397,
595,
18,
529,
397,
203,
13491,
9850,
283,
12411,
1058,
315,
397,
1058,
1769,
203,
5411,
1525,
12709,
273,
203,
10792,
595,
18,
266,
12411,
3805,
18,
588,
12,
4683,
63,
77,
65,
2934,
5748,
620,
5621,
203,
5411,
309,
261,
3146,
18,
1808,
1435,
747,
12709,
422,
374,
13,
288,
203,
7734,
368,
1387,
18,
2722,
4575,
1435,
711,
279,
7861,
434,
404,
87,
261,
18088,
959,
2934,
1021,
1142,
203,
7734,
368,
4358,
813,
711,
358,
506,
1898,
2353,
4336,
959,
20325,
358,
3387,
716,
203,
7734,
368,
17953,
716,
4862,
3166,
316,
326,
1967,
2205,
854,
486,
203,
7734,
368,
25143,
18,
2164,
16907,
1381,
4700,
9222,
18,
203,
7734,
309,
261,
3146,
18,
2722,
4575,
1435,
480,
12709,
597,
16051,
2564,
18,
588,
4965,
10015,
1435,
747,
203,
13491,
1058,
18,
2722,
4575,
1435,
411,
6680,
1190,
11098,
2335,
747,
203,
13491,
2488,
812,
13467,
11098,
1564,
3719,
288,
203,
10792,
309,
261,
3146,
18,
291,
2853,
10756,
288,
203,
13491,
368,
2631,
1301,
1931,
364,
4358,
1867,
203,
13491,
595,
18,
266,
12411,
3805,
18,
458,
12,
4683,
63,
77,
6487,
203,
27573,
3407,
18,
1132,
951,
12,
3146,
18,
2722,
4575,
1435,
10019,
203,
10792,
289,
469,
309,
261,
2910,
18,
5332,
3187,
597,
203,
18701,
1058,
18,
17994,
7675,
869,
5630,
12,
203,
4766,
565,
6458,
18,
16324,
13462,
2934,
5839,
1190,
2932,
18,
905,
6,
3719,
288,
203,
13491,
368,
21154,
678,
985,
11752,
279,
7749,
309,
1915,
353,
392,
3167,
203,
13491,
368,
585,
3430,
203,
13491,
368,
1021,
1338,
1058,
716,
1410,
506,
4282,
353,
326,
203,
13491,
368,
8406,
678,
985,
261,
430,
1281,
13,
203,
13491,
1772,
819,
273,
261,
1042,
13,
1479,
18,
4720,
1763,
12,
2910,
18,
529,
1769,
203,
13491,
514,
997,
2171,
273,
819,
18,
588,
1759,
2171,
5621,
203,
13491,
309,
16051,
2434,
2171,
18,
869,
5630,
12,
3916,
18,
16324,
13462,
2934,
5839,
1190,
2932,
18,
905,
6,
3719,
288,
203,
18701,
368,
1220,
353,
392,
8406,
1867,
203,
18701,
1387,
997,
2171,
812,
273,
394,
1387,
12,
2434,
2171,
1769,
203,
18701,
309,
16051,
2434,
2171,
812,
18,
291,
10368,
10756,
288,
203,
27573,
997,
2171,
812,
273,
394,
1387,
12,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
2073,
2703,
364,
283,
21704,
471,
7749,
310,
18,
203,
377,
380,
203,
377,
380,
632,
891,
595,
282,
1021,
3311,
2521,
358,
866,
203,
377,
380,
632,
891,
2488,
812,
13467,
11098,
1564,
203,
377,
380,
2868,
5203,
6728,
1390,
364,
11544,
1410,
326,
866,
716,
203,
377,
380,
2868,
4991,
716,
1281,
585,
11544,
1297,
1240,
7841,
622,
203,
377,
380,
2868,
4520,
487,
1525,
20325,
487,
326,
7861,
434,
326,
585,
813,
14429,
203,
377,
380,
2868,
506,
9700,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | reload | null | private void reload(DeployedApplication app, File fileToRemove, String newDocBase) {
if(log.isInfoEnabled())
log.info(sm.getString("hostConfig.reload", app.name));
Context context = (Context) host.findChild(app.name);
if (context.getState().isAvailable()) {
if (fileToRemove != null && newDocBase != null) {
context.addLifecycleListener(
new ExpandedDirectoryRemovalListener(fileToRemove, newDocBase));
}
// Reload catches and logs exceptions
context.reload();
} else {
// If the context was not started (for example an error
// in web.xml) we'll still get to try to start
if (fileToRemove != null && newDocBase != null) {
ExpandWar.delete(fileToRemove);
context.setDocBase(newDocBase);
}
try {
context.start();
} catch (Exception e) {
log.error(sm.getString("hostConfig.context.restart", app.name), e);
}
}
} | /*
* Note: If either of fileToRemove and newDocBase are null, both will be
* ignored.
*/ | If either of fileToRemove and newDocBase are null, both will be
ignored. | [
"If",
"either",
"of",
"fileToRemove",
"and",
"newDocBase",
"are",
"null",
"both",
"will",
"be",
"ignored",
"."
] | private void reload(DeployedApplication app, File fileToRemove, String newDocBase) {
if(log.isInfoEnabled())
log.info(sm.getString("hostConfig.reload", app.name));
Context context = (Context) host.findChild(app.name);
if (context.getState().isAvailable()) {
if (fileToRemove != null && newDocBase != null) {
context.addLifecycleListener(
new ExpandedDirectoryRemovalListener(fileToRemove, newDocBase));
}
context.reload();
} else {
if (fileToRemove != null && newDocBase != null) {
ExpandWar.delete(fileToRemove);
context.setDocBase(newDocBase);
}
try {
context.start();
} catch (Exception e) {
log.error(sm.getString("hostConfig.context.restart", app.name), e);
}
}
} | [
"private",
"void",
"reload",
"(",
"DeployedApplication",
"app",
",",
"File",
"fileToRemove",
",",
"String",
"newDocBase",
")",
"{",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"log",
".",
"info",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.reload\"",
",",
"app",
".",
"name",
")",
")",
";",
"Context",
"context",
"=",
"(",
"Context",
")",
"host",
".",
"findChild",
"(",
"app",
".",
"name",
")",
";",
"if",
"(",
"context",
".",
"getState",
"(",
")",
".",
"isAvailable",
"(",
")",
")",
"{",
"if",
"(",
"fileToRemove",
"!=",
"null",
"&&",
"newDocBase",
"!=",
"null",
")",
"{",
"context",
".",
"addLifecycleListener",
"(",
"new",
"ExpandedDirectoryRemovalListener",
"(",
"fileToRemove",
",",
"newDocBase",
")",
")",
";",
"}",
"context",
".",
"reload",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"fileToRemove",
"!=",
"null",
"&&",
"newDocBase",
"!=",
"null",
")",
"{",
"ExpandWar",
".",
"delete",
"(",
"fileToRemove",
")",
";",
"context",
".",
"setDocBase",
"(",
"newDocBase",
")",
";",
"}",
"try",
"{",
"context",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.context.restart\"",
",",
"app",
".",
"name",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Note: If either of fileToRemove and newDocBase are null, both will be
ignored. | [
"Note",
":",
"If",
"either",
"of",
"fileToRemove",
"and",
"newDocBase",
"are",
"null",
"both",
"will",
"be",
"ignored",
"."
] | [
"// Reload catches and logs exceptions",
"// If the context was not started (for example an error",
"// in web.xml) we'll still get to try to start"
] | [
{
"param": "app",
"type": "DeployedApplication"
},
{
"param": "fileToRemove",
"type": "File"
},
{
"param": "newDocBase",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "app",
"type": "DeployedApplication",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fileToRemove",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newDocBase",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
7749,
12,
31954,
3208,
595,
16,
1387,
585,
12765,
16,
514,
394,
1759,
2171,
13,
288,
203,
3639,
309,
12,
1330,
18,
291,
966,
1526,
10756,
203,
5411,
613,
18,
1376,
12,
4808,
18,
588,
780,
2932,
2564,
809,
18,
17517,
3113,
595,
18,
529,
10019,
203,
3639,
1772,
819,
273,
261,
1042,
13,
1479,
18,
4720,
1763,
12,
2910,
18,
529,
1769,
203,
3639,
309,
261,
2472,
18,
588,
1119,
7675,
291,
5268,
10756,
288,
203,
5411,
309,
261,
768,
12765,
480,
446,
597,
394,
1759,
2171,
480,
446,
13,
288,
203,
7734,
819,
18,
1289,
9977,
2223,
12,
203,
13491,
394,
7784,
5860,
2853,
24543,
2223,
12,
768,
12765,
16,
394,
1759,
2171,
10019,
203,
5411,
289,
203,
5411,
368,
23086,
1044,
281,
471,
5963,
4798,
203,
5411,
819,
18,
17517,
5621,
203,
3639,
289,
469,
288,
203,
5411,
368,
971,
326,
819,
1703,
486,
5746,
261,
1884,
3454,
392,
555,
203,
5411,
368,
316,
3311,
18,
2902,
13,
732,
5614,
4859,
336,
358,
775,
358,
787,
203,
5411,
309,
261,
768,
12765,
480,
446,
597,
394,
1759,
2171,
480,
446,
13,
288,
203,
7734,
16429,
30634,
18,
3733,
12,
768,
12765,
1769,
203,
7734,
819,
18,
542,
1759,
2171,
12,
2704,
1759,
2171,
1769,
203,
5411,
289,
203,
5411,
775,
288,
203,
7734,
819,
18,
1937,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
1636,
12,
4808,
18,
588,
780,
2932,
2564,
809,
18,
2472,
18,
19164,
3113,
595,
18,
529,
3631,
425,
1769,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | stop | null | public void stop() {
if (log.isDebugEnabled())
log.debug(sm.getString("hostConfig.stop"));
if (oname != null) {
try {
Registry.getRegistry(null, null).unregisterComponent(oname);
} catch (Exception e) {
log.warn(sm.getString("hostConfig.jmx.unregister", oname), e);
}
}
oname = null;
} | /**
* Process a "stop" event for this Host.
*/ | Process a "stop" event for this Host. | [
"Process",
"a",
"\"",
"stop",
"\"",
"event",
"for",
"this",
"Host",
"."
] | public void stop() {
if (log.isDebugEnabled())
log.debug(sm.getString("hostConfig.stop"));
if (oname != null) {
try {
Registry.getRegistry(null, null).unregisterComponent(oname);
} catch (Exception e) {
log.warn(sm.getString("hostConfig.jmx.unregister", oname), e);
}
}
oname = null;
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.stop\"",
")",
")",
";",
"if",
"(",
"oname",
"!=",
"null",
")",
"{",
"try",
"{",
"Registry",
".",
"getRegistry",
"(",
"null",
",",
"null",
")",
".",
"unregisterComponent",
"(",
"oname",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.jmx.unregister\"",
",",
"oname",
")",
",",
"e",
")",
";",
"}",
"}",
"oname",
"=",
"null",
";",
"}"
] | Process a "stop" event for this Host. | [
"Process",
"a",
"\"",
"stop",
"\"",
"event",
"for",
"this",
"Host",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
2132,
1435,
288,
203,
203,
3639,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
203,
5411,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
2564,
809,
18,
5681,
7923,
1769,
203,
203,
3639,
309,
261,
265,
339,
480,
446,
13,
288,
203,
5411,
775,
288,
203,
7734,
5438,
18,
588,
4243,
12,
2011,
16,
446,
2934,
318,
4861,
1841,
12,
265,
339,
1769,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
8935,
12,
4808,
18,
588,
780,
2932,
2564,
809,
18,
78,
11023,
18,
318,
4861,
3113,
603,
339,
3631,
425,
1769,
203,
5411,
289,
203,
3639,
289,
203,
3639,
603,
339,
273,
446,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
4389,
279,
315,
5681,
6,
871,
364,
333,
4893,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | check | null | protected void check() {
if (host.getAutoDeploy()) {
// Check for resources modification to trigger redeployment
DeployedApplication[] apps =
deployed.values().toArray(new DeployedApplication[0]);
for (int i = 0; i < apps.length; i++) {
if (!isServiced(apps[i].name))
checkResources(apps[i], false);
}
// Check for old versions of applications that can now be undeployed
if (host.getUndeployOldVersions()) {
checkUndeploy();
}
// Hotdeploy applications
deployApps();
}
} | /**
* Check status of all webapps.
*/ | Check status of all webapps. | [
"Check",
"status",
"of",
"all",
"webapps",
"."
] | protected void check() {
if (host.getAutoDeploy()) {
DeployedApplication[] apps =
deployed.values().toArray(new DeployedApplication[0]);
for (int i = 0; i < apps.length; i++) {
if (!isServiced(apps[i].name))
checkResources(apps[i], false);
}
if (host.getUndeployOldVersions()) {
checkUndeploy();
}
deployApps();
}
} | [
"protected",
"void",
"check",
"(",
")",
"{",
"if",
"(",
"host",
".",
"getAutoDeploy",
"(",
")",
")",
"{",
"DeployedApplication",
"[",
"]",
"apps",
"=",
"deployed",
".",
"values",
"(",
")",
".",
"toArray",
"(",
"new",
"DeployedApplication",
"[",
"0",
"]",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"apps",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"isServiced",
"(",
"apps",
"[",
"i",
"]",
".",
"name",
")",
")",
"checkResources",
"(",
"apps",
"[",
"i",
"]",
",",
"false",
")",
";",
"}",
"if",
"(",
"host",
".",
"getUndeployOldVersions",
"(",
")",
")",
"{",
"checkUndeploy",
"(",
")",
";",
"}",
"deployApps",
"(",
")",
";",
"}",
"}"
] | Check status of all webapps. | [
"Check",
"status",
"of",
"all",
"webapps",
"."
] | [
"// Check for resources modification to trigger redeployment",
"// Check for old versions of applications that can now be undeployed",
"// Hotdeploy applications"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
866,
1435,
288,
203,
203,
3639,
309,
261,
2564,
18,
588,
4965,
10015,
10756,
288,
203,
5411,
368,
2073,
364,
2703,
11544,
358,
3080,
283,
21704,
203,
5411,
7406,
329,
3208,
8526,
8279,
273,
203,
7734,
19357,
18,
2372,
7675,
31447,
12,
2704,
7406,
329,
3208,
63,
20,
19226,
203,
5411,
364,
261,
474,
277,
273,
374,
31,
277,
411,
8279,
18,
2469,
31,
277,
27245,
288,
203,
7734,
309,
16051,
291,
1179,
72,
12,
11411,
63,
77,
8009,
529,
3719,
203,
10792,
866,
3805,
12,
11411,
63,
77,
6487,
629,
1769,
203,
5411,
289,
203,
203,
5411,
368,
2073,
364,
1592,
5244,
434,
12165,
716,
848,
2037,
506,
640,
12411,
329,
203,
5411,
309,
261,
2564,
18,
588,
984,
12411,
7617,
5940,
10756,
288,
203,
7734,
866,
984,
12411,
5621,
203,
5411,
289,
203,
203,
5411,
368,
670,
352,
12411,
12165,
203,
5411,
7286,
16339,
5621,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | check | null | public void check(String name) {
DeployedApplication app = deployed.get(name);
if (app != null) {
checkResources(app, true);
}
deployApps(name);
} | /**
* Check status of a specific web application and reload, redeploy or deploy
* it as necessary. This method is for use with functionality such as
* management web applications that upload new/updated web applications and
* need to trigger the appropriate action to deploy them. This method
* assumes that the web application is currently marked as serviced and that
* any uploading/updating has been completed before this method is called.
* Any action taken as a result of the checks will complete before this
* method returns.
*
* @param name The name of the web application to check
*/ | Check status of a specific web application and reload, redeploy or deploy
it as necessary. This method is for use with functionality such as
management web applications that upload new/updated web applications and
need to trigger the appropriate action to deploy them. This method
assumes that the web application is currently marked as serviced and that
any uploading/updating has been completed before this method is called.
Any action taken as a result of the checks will complete before this
method returns.
@param name The name of the web application to check | [
"Check",
"status",
"of",
"a",
"specific",
"web",
"application",
"and",
"reload",
"redeploy",
"or",
"deploy",
"it",
"as",
"necessary",
".",
"This",
"method",
"is",
"for",
"use",
"with",
"functionality",
"such",
"as",
"management",
"web",
"applications",
"that",
"upload",
"new",
"/",
"updated",
"web",
"applications",
"and",
"need",
"to",
"trigger",
"the",
"appropriate",
"action",
"to",
"deploy",
"them",
".",
"This",
"method",
"assumes",
"that",
"the",
"web",
"application",
"is",
"currently",
"marked",
"as",
"serviced",
"and",
"that",
"any",
"uploading",
"/",
"updating",
"has",
"been",
"completed",
"before",
"this",
"method",
"is",
"called",
".",
"Any",
"action",
"taken",
"as",
"a",
"result",
"of",
"the",
"checks",
"will",
"complete",
"before",
"this",
"method",
"returns",
".",
"@param",
"name",
"The",
"name",
"of",
"the",
"web",
"application",
"to",
"check"
] | public void check(String name) {
DeployedApplication app = deployed.get(name);
if (app != null) {
checkResources(app, true);
}
deployApps(name);
} | [
"public",
"void",
"check",
"(",
"String",
"name",
")",
"{",
"DeployedApplication",
"app",
"=",
"deployed",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"app",
"!=",
"null",
")",
"{",
"checkResources",
"(",
"app",
",",
"true",
")",
";",
"}",
"deployApps",
"(",
"name",
")",
";",
"}"
] | Check status of a specific web application and reload, redeploy or deploy
it as necessary. | [
"Check",
"status",
"of",
"a",
"specific",
"web",
"application",
"and",
"reload",
"redeploy",
"or",
"deploy",
"it",
"as",
"necessary",
"."
] | [] | [
{
"param": "name",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
866,
12,
780,
508,
13,
288,
203,
3639,
7406,
329,
3208,
595,
273,
19357,
18,
588,
12,
529,
1769,
203,
3639,
309,
261,
2910,
480,
446,
13,
288,
203,
5411,
866,
3805,
12,
2910,
16,
638,
1769,
203,
3639,
289,
203,
3639,
7286,
16339,
12,
529,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2073,
1267,
434,
279,
2923,
3311,
2521,
471,
7749,
16,
283,
12411,
578,
7286,
203,
377,
380,
518,
487,
4573,
18,
1220,
707,
353,
364,
999,
598,
14176,
4123,
487,
203,
377,
380,
11803,
3311,
12165,
716,
3617,
394,
19,
7007,
3311,
12165,
471,
203,
377,
380,
1608,
358,
3080,
326,
5505,
1301,
358,
7286,
2182,
18,
1220,
707,
203,
377,
380,
13041,
716,
326,
3311,
2521,
353,
4551,
9350,
487,
1156,
72,
471,
716,
203,
377,
380,
1281,
25306,
19,
5533,
1776,
711,
2118,
5951,
1865,
333,
707,
353,
2566,
18,
203,
377,
380,
5502,
1301,
9830,
487,
279,
563,
434,
326,
4271,
903,
3912,
1865,
333,
203,
377,
380,
707,
1135,
18,
203,
377,
380,
203,
377,
380,
632,
891,
2
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | checkUndeploy | null | public synchronized void checkUndeploy() {
if (deployed.size() < 2) {
return;
}
// Need ordered set of names
SortedSet<String> sortedAppNames = new TreeSet<>();
sortedAppNames.addAll(deployed.keySet());
Iterator<String> iter = sortedAppNames.iterator();
ContextName previous = new ContextName(iter.next(), false);
do {
ContextName current = new ContextName(iter.next(), false);
if (current.getPath().equals(previous.getPath())) {
// Current and previous are same path - current will always
// be a later version
Context previousContext = (Context) host.findChild(previous.getName());
Context currentContext = (Context) host.findChild(current.getName());
if (previousContext != null && currentContext != null &&
currentContext.getState().isAvailable() &&
!isServiced(previous.getName())) {
Manager manager = previousContext.getManager();
if (manager != null) {
int sessionCount;
if (manager instanceof DistributedManager) {
sessionCount = ((DistributedManager) manager).getActiveSessionsFull();
} else {
sessionCount = manager.getActiveSessions();
}
if (sessionCount == 0) {
if (log.isInfoEnabled()) {
log.info(sm.getString(
"hostConfig.undeployVersion", previous.getName()));
}
DeployedApplication app = deployed.get(previous.getName());
String[] resources = app.redeployResources.keySet().toArray(new String[0]);
// Version is unused - undeploy it completely
// The -1 is a 'trick' to ensure all redeploy
// resources are removed
undeploy(app);
deleteRedeployResources(app, resources, -1, true);
}
}
}
}
previous = current;
} while (iter.hasNext());
} | /**
* Check for old versions of applications using parallel deployment that are
* now unused (have no active sessions) and undeploy any that are found.
*/ | Check for old versions of applications using parallel deployment that are
now unused (have no active sessions) and undeploy any that are found. | [
"Check",
"for",
"old",
"versions",
"of",
"applications",
"using",
"parallel",
"deployment",
"that",
"are",
"now",
"unused",
"(",
"have",
"no",
"active",
"sessions",
")",
"and",
"undeploy",
"any",
"that",
"are",
"found",
"."
] | public synchronized void checkUndeploy() {
if (deployed.size() < 2) {
return;
}
SortedSet<String> sortedAppNames = new TreeSet<>();
sortedAppNames.addAll(deployed.keySet());
Iterator<String> iter = sortedAppNames.iterator();
ContextName previous = new ContextName(iter.next(), false);
do {
ContextName current = new ContextName(iter.next(), false);
if (current.getPath().equals(previous.getPath())) {
Context previousContext = (Context) host.findChild(previous.getName());
Context currentContext = (Context) host.findChild(current.getName());
if (previousContext != null && currentContext != null &&
currentContext.getState().isAvailable() &&
!isServiced(previous.getName())) {
Manager manager = previousContext.getManager();
if (manager != null) {
int sessionCount;
if (manager instanceof DistributedManager) {
sessionCount = ((DistributedManager) manager).getActiveSessionsFull();
} else {
sessionCount = manager.getActiveSessions();
}
if (sessionCount == 0) {
if (log.isInfoEnabled()) {
log.info(sm.getString(
"hostConfig.undeployVersion", previous.getName()));
}
DeployedApplication app = deployed.get(previous.getName());
String[] resources = app.redeployResources.keySet().toArray(new String[0]);
undeploy(app);
deleteRedeployResources(app, resources, -1, true);
}
}
}
}
previous = current;
} while (iter.hasNext());
} | [
"public",
"synchronized",
"void",
"checkUndeploy",
"(",
")",
"{",
"if",
"(",
"deployed",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"return",
";",
"}",
"SortedSet",
"<",
"String",
">",
"sortedAppNames",
"=",
"new",
"TreeSet",
"<",
">",
"(",
")",
";",
"sortedAppNames",
".",
"addAll",
"(",
"deployed",
".",
"keySet",
"(",
")",
")",
";",
"Iterator",
"<",
"String",
">",
"iter",
"=",
"sortedAppNames",
".",
"iterator",
"(",
")",
";",
"ContextName",
"previous",
"=",
"new",
"ContextName",
"(",
"iter",
".",
"next",
"(",
")",
",",
"false",
")",
";",
"do",
"{",
"ContextName",
"current",
"=",
"new",
"ContextName",
"(",
"iter",
".",
"next",
"(",
")",
",",
"false",
")",
";",
"if",
"(",
"current",
".",
"getPath",
"(",
")",
".",
"equals",
"(",
"previous",
".",
"getPath",
"(",
")",
")",
")",
"{",
"Context",
"previousContext",
"=",
"(",
"Context",
")",
"host",
".",
"findChild",
"(",
"previous",
".",
"getName",
"(",
")",
")",
";",
"Context",
"currentContext",
"=",
"(",
"Context",
")",
"host",
".",
"findChild",
"(",
"current",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"previousContext",
"!=",
"null",
"&&",
"currentContext",
"!=",
"null",
"&&",
"currentContext",
".",
"getState",
"(",
")",
".",
"isAvailable",
"(",
")",
"&&",
"!",
"isServiced",
"(",
"previous",
".",
"getName",
"(",
")",
")",
")",
"{",
"Manager",
"manager",
"=",
"previousContext",
".",
"getManager",
"(",
")",
";",
"if",
"(",
"manager",
"!=",
"null",
")",
"{",
"int",
"sessionCount",
";",
"if",
"(",
"manager",
"instanceof",
"DistributedManager",
")",
"{",
"sessionCount",
"=",
"(",
"(",
"DistributedManager",
")",
"manager",
")",
".",
"getActiveSessionsFull",
"(",
")",
";",
"}",
"else",
"{",
"sessionCount",
"=",
"manager",
".",
"getActiveSessions",
"(",
")",
";",
"}",
"if",
"(",
"sessionCount",
"==",
"0",
")",
"{",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"sm",
".",
"getString",
"(",
"\"hostConfig.undeployVersion\"",
",",
"previous",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"DeployedApplication",
"app",
"=",
"deployed",
".",
"get",
"(",
"previous",
".",
"getName",
"(",
")",
")",
";",
"String",
"[",
"]",
"resources",
"=",
"app",
".",
"redeployResources",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"undeploy",
"(",
"app",
")",
";",
"deleteRedeployResources",
"(",
"app",
",",
"resources",
",",
"-",
"1",
",",
"true",
")",
";",
"}",
"}",
"}",
"}",
"previous",
"=",
"current",
";",
"}",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
";",
"}"
] | Check for old versions of applications using parallel deployment that are
now unused (have no active sessions) and undeploy any that are found. | [
"Check",
"for",
"old",
"versions",
"of",
"applications",
"using",
"parallel",
"deployment",
"that",
"are",
"now",
"unused",
"(",
"have",
"no",
"active",
"sessions",
")",
"and",
"undeploy",
"any",
"that",
"are",
"found",
"."
] | [
"// Need ordered set of names",
"// Current and previous are same path - current will always",
"// be a later version",
"// Version is unused - undeploy it completely",
"// The -1 is a 'trick' to ensure all redeploy",
"// resources are removed"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
3852,
918,
866,
984,
12411,
1435,
288,
203,
3639,
309,
261,
12411,
329,
18,
1467,
1435,
411,
576,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
368,
12324,
5901,
444,
434,
1257,
203,
3639,
22123,
32,
780,
34,
3115,
3371,
1557,
273,
394,
19461,
29667,
5621,
203,
3639,
3115,
3371,
1557,
18,
1289,
1595,
12,
12411,
329,
18,
856,
694,
10663,
203,
203,
3639,
4498,
32,
780,
34,
1400,
273,
3115,
3371,
1557,
18,
9838,
5621,
203,
203,
3639,
1772,
461,
2416,
273,
394,
1772,
461,
12,
2165,
18,
4285,
9334,
629,
1769,
203,
3639,
741,
288,
203,
5411,
1772,
461,
783,
273,
394,
1772,
461,
12,
2165,
18,
4285,
9334,
629,
1769,
203,
203,
5411,
309,
261,
2972,
18,
588,
743,
7675,
14963,
12,
11515,
18,
588,
743,
1435,
3719,
288,
203,
7734,
368,
6562,
471,
2416,
854,
1967,
589,
300,
783,
903,
3712,
203,
7734,
368,
506,
279,
5137,
1177,
203,
7734,
1772,
2416,
1042,
273,
261,
1042,
13,
1479,
18,
4720,
1763,
12,
11515,
18,
17994,
10663,
203,
7734,
1772,
31184,
273,
261,
1042,
13,
1479,
18,
4720,
1763,
12,
2972,
18,
17994,
10663,
203,
7734,
309,
261,
11515,
1042,
480,
446,
597,
31184,
480,
446,
597,
203,
13491,
31184,
18,
588,
1119,
7675,
291,
5268,
1435,
597,
203,
13491,
401,
291,
1179,
72,
12,
11515,
18,
17994,
1435,
3719,
288,
203,
10792,
8558,
3301,
273,
2416,
1042,
18,
588,
1318,
5621,
203,
10792,
309,
261,
4181,
480,
446,
13,
288,
203,
13491,
509,
1339,
1380,
31,
203,
13491,
309,
261,
4181,
1276,
27877,
1318,
13,
288,
203,
18701,
1339,
1380,
273,
14015,
1669,
11050,
1318,
13,
3301,
2934,
588,
3896,
13566,
5080,
5621,
203,
13491,
289,
469,
288,
203,
18701,
1339,
1380,
273,
3301,
18,
588,
3896,
13566,
5621,
203,
13491,
289,
203,
13491,
309,
261,
3184,
1380,
422,
374,
13,
288,
203,
18701,
309,
261,
1330,
18,
291,
966,
1526,
10756,
288,
203,
27573,
613,
18,
1376,
12,
4808,
18,
588,
780,
12,
203,
4766,
3639,
315,
2564,
809,
18,
318,
12411,
1444,
3113,
2416,
18,
17994,
1435,
10019,
203,
18701,
289,
203,
18701,
7406,
329,
3208,
595,
273,
19357,
18,
588,
12,
11515,
18,
17994,
10663,
203,
18701,
514,
8526,
2703,
273,
595,
18,
266,
12411,
3805,
18,
856,
694,
7675,
31447,
12,
2704,
514,
63,
20,
19226,
203,
18701,
368,
4049,
353,
10197,
300,
640,
12411,
518,
14416,
203,
18701,
368,
1021,
300,
21,
353,
279,
296,
313,
1200,
11,
358,
3387,
777,
283,
12411,
203,
18701,
368,
2703,
854,
3723,
203,
18701,
640,
12411,
12,
2910,
1769,
203,
18701,
1430,
426,
12411,
3805,
12,
2910,
16,
2703,
16,
300,
21,
16,
638,
1769,
203,
13491,
289,
203,
10792,
289,
203,
7734,
289,
203,
5411,
289,
203,
5411,
2416,
273,
783,
31,
203,
3639,
289,
1323,
261,
2165,
18,
5332,
2134,
10663,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2073,
364,
1592,
5244,
434,
12165,
1450,
7230,
6314,
716,
854,
203,
377,
380,
2037,
10197,
261,
21516,
1158,
2695,
8856,
13,
471,
640,
12411,
1281,
716,
854,
1392,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | manageApp | null | public void manageApp(Context context) {
String contextName = context.getName();
if (deployed.containsKey(contextName))
return;
DeployedApplication deployedApp =
new DeployedApplication(contextName, false);
// Add the associated docBase to the redeployed list if it's a WAR
boolean isWar = false;
if (context.getDocBase() != null) {
File docBase = new File(context.getDocBase());
if (!docBase.isAbsolute()) {
docBase = new File(host.getAppBaseFile(), context.getDocBase());
}
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
Long.valueOf(docBase.lastModified()));
if (docBase.getAbsolutePath().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
isWar = true;
}
}
host.addChild(context);
// Add the eventual unpacked WAR and all the resources which will be
// watched inside it
boolean unpackWAR = unpackWARs;
if (unpackWAR && context instanceof StandardContext) {
unpackWAR = ((StandardContext) context).getUnpackWAR();
}
if (isWar && unpackWAR) {
File docBase = new File(host.getAppBaseFile(), context.getBaseName());
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
Long.valueOf(docBase.lastModified()));
addWatchedResources(deployedApp, docBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
}
deployed.put(contextName, deployedApp);
} | /**
* Add a new Context to be managed by us.
* Entry point for the admin webapp, and other JMX Context controllers.
* @param context The context instance
*/ | Add a new Context to be managed by us.
Entry point for the admin webapp, and other JMX Context controllers.
@param context The context instance | [
"Add",
"a",
"new",
"Context",
"to",
"be",
"managed",
"by",
"us",
".",
"Entry",
"point",
"for",
"the",
"admin",
"webapp",
"and",
"other",
"JMX",
"Context",
"controllers",
".",
"@param",
"context",
"The",
"context",
"instance"
] | public void manageApp(Context context) {
String contextName = context.getName();
if (deployed.containsKey(contextName))
return;
DeployedApplication deployedApp =
new DeployedApplication(contextName, false);
boolean isWar = false;
if (context.getDocBase() != null) {
File docBase = new File(context.getDocBase());
if (!docBase.isAbsolute()) {
docBase = new File(host.getAppBaseFile(), context.getDocBase());
}
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
Long.valueOf(docBase.lastModified()));
if (docBase.getAbsolutePath().toLowerCase(Locale.ENGLISH).endsWith(".war")) {
isWar = true;
}
}
host.addChild(context);
boolean unpackWAR = unpackWARs;
if (unpackWAR && context instanceof StandardContext) {
unpackWAR = ((StandardContext) context).getUnpackWAR();
}
if (isWar && unpackWAR) {
File docBase = new File(host.getAppBaseFile(), context.getBaseName());
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
Long.valueOf(docBase.lastModified()));
addWatchedResources(deployedApp, docBase.getAbsolutePath(), context);
} else {
addWatchedResources(deployedApp, null, context);
}
deployed.put(contextName, deployedApp);
} | [
"public",
"void",
"manageApp",
"(",
"Context",
"context",
")",
"{",
"String",
"contextName",
"=",
"context",
".",
"getName",
"(",
")",
";",
"if",
"(",
"deployed",
".",
"containsKey",
"(",
"contextName",
")",
")",
"return",
";",
"DeployedApplication",
"deployedApp",
"=",
"new",
"DeployedApplication",
"(",
"contextName",
",",
"false",
")",
";",
"boolean",
"isWar",
"=",
"false",
";",
"if",
"(",
"context",
".",
"getDocBase",
"(",
")",
"!=",
"null",
")",
"{",
"File",
"docBase",
"=",
"new",
"File",
"(",
"context",
".",
"getDocBase",
"(",
")",
")",
";",
"if",
"(",
"!",
"docBase",
".",
"isAbsolute",
"(",
")",
")",
"{",
"docBase",
"=",
"new",
"File",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
",",
"context",
".",
"getDocBase",
"(",
")",
")",
";",
"}",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"docBase",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"docBase",
".",
"lastModified",
"(",
")",
")",
")",
";",
"if",
"(",
"docBase",
".",
"getAbsolutePath",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
".",
"endsWith",
"(",
"\".war\"",
")",
")",
"{",
"isWar",
"=",
"true",
";",
"}",
"}",
"host",
".",
"addChild",
"(",
"context",
")",
";",
"boolean",
"unpackWAR",
"=",
"unpackWARs",
";",
"if",
"(",
"unpackWAR",
"&&",
"context",
"instanceof",
"StandardContext",
")",
"{",
"unpackWAR",
"=",
"(",
"(",
"StandardContext",
")",
"context",
")",
".",
"getUnpackWAR",
"(",
")",
";",
"}",
"if",
"(",
"isWar",
"&&",
"unpackWAR",
")",
"{",
"File",
"docBase",
"=",
"new",
"File",
"(",
"host",
".",
"getAppBaseFile",
"(",
")",
",",
"context",
".",
"getBaseName",
"(",
")",
")",
";",
"deployedApp",
".",
"redeployResources",
".",
"put",
"(",
"docBase",
".",
"getAbsolutePath",
"(",
")",
",",
"Long",
".",
"valueOf",
"(",
"docBase",
".",
"lastModified",
"(",
")",
")",
")",
";",
"addWatchedResources",
"(",
"deployedApp",
",",
"docBase",
".",
"getAbsolutePath",
"(",
")",
",",
"context",
")",
";",
"}",
"else",
"{",
"addWatchedResources",
"(",
"deployedApp",
",",
"null",
",",
"context",
")",
";",
"}",
"deployed",
".",
"put",
"(",
"contextName",
",",
"deployedApp",
")",
";",
"}"
] | Add a new Context to be managed by us. | [
"Add",
"a",
"new",
"Context",
"to",
"be",
"managed",
"by",
"us",
"."
] | [
"// Add the associated docBase to the redeployed list if it's a WAR",
"// Add the eventual unpacked WAR and all the resources which will be",
"// watched inside it"
] | [
{
"param": "context",
"type": "Context"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "context",
"type": "Context",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
10680,
3371,
12,
1042,
819,
13,
225,
288,
203,
203,
3639,
514,
819,
461,
273,
819,
18,
17994,
5621,
203,
203,
3639,
309,
261,
12411,
329,
18,
12298,
653,
12,
2472,
461,
3719,
203,
5411,
327,
31,
203,
203,
3639,
7406,
329,
3208,
19357,
3371,
273,
203,
7734,
394,
7406,
329,
3208,
12,
2472,
461,
16,
629,
1769,
203,
203,
3639,
368,
1436,
326,
3627,
997,
2171,
358,
326,
283,
12411,
329,
666,
309,
518,
1807,
279,
678,
985,
203,
3639,
1250,
353,
30634,
273,
629,
31,
203,
3639,
309,
261,
2472,
18,
588,
1759,
2171,
1435,
480,
446,
13,
288,
203,
5411,
1387,
997,
2171,
273,
394,
1387,
12,
2472,
18,
588,
1759,
2171,
10663,
203,
5411,
309,
16051,
2434,
2171,
18,
291,
10368,
10756,
288,
203,
7734,
997,
2171,
273,
394,
1387,
12,
2564,
18,
588,
3371,
2171,
812,
9334,
819,
18,
588,
1759,
2171,
10663,
203,
5411,
289,
203,
5411,
19357,
3371,
18,
266,
12411,
3805,
18,
458,
12,
2434,
2171,
18,
588,
10368,
743,
9334,
203,
10792,
3407,
18,
1132,
951,
12,
2434,
2171,
18,
2722,
4575,
1435,
10019,
203,
5411,
309,
261,
2434,
2171,
18,
588,
10368,
743,
7675,
869,
5630,
12,
3916,
18,
16324,
13462,
2934,
5839,
1190,
2932,
18,
905,
6,
3719,
288,
203,
7734,
353,
30634,
273,
638,
31,
203,
5411,
289,
203,
3639,
289,
203,
3639,
1479,
18,
1289,
1763,
12,
2472,
1769,
203,
3639,
368,
1436,
326,
871,
1462,
24195,
678,
985,
471,
777,
326,
2703,
1492,
903,
506,
203,
3639,
368,
23135,
4832,
518,
203,
3639,
1250,
6167,
16777,
273,
6167,
16777,
87,
31,
203,
3639,
309,
261,
17309,
16777,
597,
819,
1276,
8263,
1042,
13,
288,
203,
5411,
6167,
16777,
273,
14015,
8336,
1042,
13,
819,
2934,
588,
23649,
16777,
5621,
203,
3639,
289,
203,
3639,
309,
261,
291,
30634,
597,
6167,
16777,
13,
288,
203,
5411,
1387,
997,
2171,
273,
394,
1387,
12,
2564,
18,
588,
3371,
2171,
812,
9334,
819,
18,
588,
29907,
10663,
203,
5411,
19357,
3371,
18,
266,
12411,
3805,
18,
458,
12,
2434,
2171,
18,
588,
10368,
743,
9334,
203,
13491,
3407,
18,
1132,
951,
12,
2434,
2171,
18,
2722,
4575,
1435,
10019,
203,
5411,
527,
5234,
329,
3805,
12,
12411,
329,
3371,
16,
997,
2171,
18,
588,
10368,
743,
9334,
819,
1769,
203,
3639,
289,
469,
288,
203,
5411,
527,
5234,
329,
3805,
12,
12411,
329,
3371,
16,
446,
16,
819,
1769,
203,
3639,
289,
203,
3639,
19357,
18,
458,
12,
2472,
461,
16,
19357,
3371,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1436,
279,
394,
1772,
358,
506,
7016,
635,
584,
18,
203,
377,
380,
3841,
1634,
364,
326,
3981,
28945,
16,
471,
1308,
28845,
1772,
12403,
18,
203,
377,
380,
632,
891,
819,
1021,
819,
791,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d6a175ec00fe7ccf7c9622144df0b7b3d2343bca | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/startup/HostConfig.java | [
"MIT"
] | Java | unmanageApp | null | public void unmanageApp(String contextName) {
if(isServiced(contextName)) {
deployed.remove(contextName);
host.removeChild(host.findChild(contextName));
}
} | /**
* Remove a webapp from our control.
* Entry point for the admin webapp, and other JMX Context controllers.
* @param contextName The context name
*/ | Remove a webapp from our control.
Entry point for the admin webapp, and other JMX Context controllers.
@param contextName The context name | [
"Remove",
"a",
"webapp",
"from",
"our",
"control",
".",
"Entry",
"point",
"for",
"the",
"admin",
"webapp",
"and",
"other",
"JMX",
"Context",
"controllers",
".",
"@param",
"contextName",
"The",
"context",
"name"
] | public void unmanageApp(String contextName) {
if(isServiced(contextName)) {
deployed.remove(contextName);
host.removeChild(host.findChild(contextName));
}
} | [
"public",
"void",
"unmanageApp",
"(",
"String",
"contextName",
")",
"{",
"if",
"(",
"isServiced",
"(",
"contextName",
")",
")",
"{",
"deployed",
".",
"remove",
"(",
"contextName",
")",
";",
"host",
".",
"removeChild",
"(",
"host",
".",
"findChild",
"(",
"contextName",
")",
")",
";",
"}",
"}"
] | Remove a webapp from our control. | [
"Remove",
"a",
"webapp",
"from",
"our",
"control",
"."
] | [] | [
{
"param": "contextName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "contextName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
640,
12633,
3371,
12,
780,
819,
461,
13,
288,
203,
3639,
309,
12,
291,
1179,
72,
12,
2472,
461,
3719,
288,
203,
5411,
19357,
18,
4479,
12,
2472,
461,
1769,
203,
5411,
1479,
18,
4479,
1763,
12,
2564,
18,
4720,
1763,
12,
2472,
461,
10019,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3581,
279,
28945,
628,
3134,
3325,
18,
203,
377,
380,
3841,
1634,
364,
326,
3981,
28945,
16,
471,
1308,
28845,
1772,
12403,
18,
203,
377,
380,
632,
891,
819,
461,
1021,
819,
508,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c2a1d7ce49d1850a0b5cf183098b27a0f3a7b843 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/Connector.java | [
"MIT"
] | Java | stopInternal | null | @Override
protected void stopInternal() throws LifecycleException {
setState(LifecycleState.STOPPING);
try {
protocolHandler.stop();
} catch (Exception e) {
throw new LifecycleException(
sm.getString("coyoteConnector.protocolHandlerStopFailed"), e);
}
} | /**
* Terminate processing requests via this Connector.
*
* @exception LifecycleException if a fatal shutdown error occurs
*/ | Terminate processing requests via this Connector.
@exception LifecycleException if a fatal shutdown error occurs | [
"Terminate",
"processing",
"requests",
"via",
"this",
"Connector",
".",
"@exception",
"LifecycleException",
"if",
"a",
"fatal",
"shutdown",
"error",
"occurs"
] | @Override
protected void stopInternal() throws LifecycleException {
setState(LifecycleState.STOPPING);
try {
protocolHandler.stop();
} catch (Exception e) {
throw new LifecycleException(
sm.getString("coyoteConnector.protocolHandlerStopFailed"), e);
}
} | [
"@",
"Override",
"protected",
"void",
"stopInternal",
"(",
")",
"throws",
"LifecycleException",
"{",
"setState",
"(",
"LifecycleState",
".",
"STOPPING",
")",
";",
"try",
"{",
"protocolHandler",
".",
"stop",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"LifecycleException",
"(",
"sm",
".",
"getString",
"(",
"\"coyoteConnector.protocolHandlerStopFailed\"",
")",
",",
"e",
")",
";",
"}",
"}"
] | Terminate processing requests via this Connector. | [
"Terminate",
"processing",
"requests",
"via",
"this",
"Connector",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
4750,
918,
2132,
3061,
1435,
1216,
14283,
503,
288,
203,
203,
3639,
12947,
12,
9977,
1119,
18,
17513,
20002,
1769,
203,
203,
3639,
775,
288,
203,
5411,
1771,
1503,
18,
5681,
5621,
203,
3639,
289,
1044,
261,
503,
425,
13,
288,
203,
5411,
604,
394,
14283,
503,
12,
203,
10792,
3029,
18,
588,
780,
2932,
2894,
93,
1168,
7487,
18,
8373,
1503,
4947,
2925,
6,
3631,
425,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
23945,
4929,
3285,
3970,
333,
15779,
18,
203,
377,
380,
203,
377,
380,
632,
4064,
14283,
503,
309,
279,
10081,
5731,
555,
9938,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c2aaea794bf33b872a4a4cb032b2a244c8efe6b8 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http2/StreamProcessor.java | [
"MIT"
] | Java | prepareHeaders | null | static void prepareHeaders(Request coyoteRequest, Response coyoteResponse,
Http2Protocol protocol, Stream stream) {
MimeHeaders headers = coyoteResponse.getMimeHeaders();
int statusCode = coyoteResponse.getStatus();
// Add the pseudo header for status
headers.addValue(":status").setString(Integer.toString(statusCode));
// Check to see if a response body is present
if (!(statusCode < 200 || statusCode == 204 || statusCode == 205 || statusCode == 304)) {
String contentType = coyoteResponse.getContentType();
if (contentType != null) {
headers.setValue("content-type").setString(contentType);
}
String contentLanguage = coyoteResponse.getContentLanguage();
if (contentLanguage != null) {
headers.setValue("content-language").setString(contentLanguage);
}
// Add a content-length header if a content length has been set unless
// the application has already added one
long contentLength = coyoteResponse.getContentLengthLong();
if (contentLength != -1 && headers.getValue("content-length") == null) {
headers.addValue("content-length").setLong(contentLength);
}
} else {
if (statusCode == 205) {
// RFC 7231 requires the server to explicitly signal an empty
// response in this case
coyoteResponse.setContentLength(0);
} else {
coyoteResponse.setContentLength(-1);
}
}
// Add date header unless it is an informational response or the
// application has already set one
if (statusCode >= 200 && headers.getValue("date") == null) {
headers.addValue("date").setString(FastHttpDateFormat.getCurrentDate());
}
if (protocol != null && protocol.useCompression(coyoteRequest, coyoteResponse)) {
// Enable compression. Headers will have been set. Need to configure
// output filter at this point.
stream.addOutputFilter(new GzipOutputFilter());
}
} | // an ACK. For that use case coyoteRequest, protocol and stream will be null. | an ACK. For that use case coyoteRequest, protocol and stream will be null. | [
"an",
"ACK",
".",
"For",
"that",
"use",
"case",
"coyoteRequest",
"protocol",
"and",
"stream",
"will",
"be",
"null",
"."
] | static void prepareHeaders(Request coyoteRequest, Response coyoteResponse,
Http2Protocol protocol, Stream stream) {
MimeHeaders headers = coyoteResponse.getMimeHeaders();
int statusCode = coyoteResponse.getStatus();
headers.addValue(":status").setString(Integer.toString(statusCode));
if (!(statusCode < 200 || statusCode == 204 || statusCode == 205 || statusCode == 304)) {
String contentType = coyoteResponse.getContentType();
if (contentType != null) {
headers.setValue("content-type").setString(contentType);
}
String contentLanguage = coyoteResponse.getContentLanguage();
if (contentLanguage != null) {
headers.setValue("content-language").setString(contentLanguage);
}
long contentLength = coyoteResponse.getContentLengthLong();
if (contentLength != -1 && headers.getValue("content-length") == null) {
headers.addValue("content-length").setLong(contentLength);
}
} else {
if (statusCode == 205) {
coyoteResponse.setContentLength(0);
} else {
coyoteResponse.setContentLength(-1);
}
}
if (statusCode >= 200 && headers.getValue("date") == null) {
headers.addValue("date").setString(FastHttpDateFormat.getCurrentDate());
}
if (protocol != null && protocol.useCompression(coyoteRequest, coyoteResponse)) {
stream.addOutputFilter(new GzipOutputFilter());
}
} | [
"static",
"void",
"prepareHeaders",
"(",
"Request",
"coyoteRequest",
",",
"Response",
"coyoteResponse",
",",
"Http2Protocol",
"protocol",
",",
"Stream",
"stream",
")",
"{",
"MimeHeaders",
"headers",
"=",
"coyoteResponse",
".",
"getMimeHeaders",
"(",
")",
";",
"int",
"statusCode",
"=",
"coyoteResponse",
".",
"getStatus",
"(",
")",
";",
"headers",
".",
"addValue",
"(",
"\":status\"",
")",
".",
"setString",
"(",
"Integer",
".",
"toString",
"(",
"statusCode",
")",
")",
";",
"if",
"(",
"!",
"(",
"statusCode",
"<",
"200",
"||",
"statusCode",
"==",
"204",
"||",
"statusCode",
"==",
"205",
"||",
"statusCode",
"==",
"304",
")",
")",
"{",
"String",
"contentType",
"=",
"coyoteResponse",
".",
"getContentType",
"(",
")",
";",
"if",
"(",
"contentType",
"!=",
"null",
")",
"{",
"headers",
".",
"setValue",
"(",
"\"content-type\"",
")",
".",
"setString",
"(",
"contentType",
")",
";",
"}",
"String",
"contentLanguage",
"=",
"coyoteResponse",
".",
"getContentLanguage",
"(",
")",
";",
"if",
"(",
"contentLanguage",
"!=",
"null",
")",
"{",
"headers",
".",
"setValue",
"(",
"\"content-language\"",
")",
".",
"setString",
"(",
"contentLanguage",
")",
";",
"}",
"long",
"contentLength",
"=",
"coyoteResponse",
".",
"getContentLengthLong",
"(",
")",
";",
"if",
"(",
"contentLength",
"!=",
"-",
"1",
"&&",
"headers",
".",
"getValue",
"(",
"\"content-length\"",
")",
"==",
"null",
")",
"{",
"headers",
".",
"addValue",
"(",
"\"content-length\"",
")",
".",
"setLong",
"(",
"contentLength",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"statusCode",
"==",
"205",
")",
"{",
"coyoteResponse",
".",
"setContentLength",
"(",
"0",
")",
";",
"}",
"else",
"{",
"coyoteResponse",
".",
"setContentLength",
"(",
"-",
"1",
")",
";",
"}",
"}",
"if",
"(",
"statusCode",
">=",
"200",
"&&",
"headers",
".",
"getValue",
"(",
"\"date\"",
")",
"==",
"null",
")",
"{",
"headers",
".",
"addValue",
"(",
"\"date\"",
")",
".",
"setString",
"(",
"FastHttpDateFormat",
".",
"getCurrentDate",
"(",
")",
")",
";",
"}",
"if",
"(",
"protocol",
"!=",
"null",
"&&",
"protocol",
".",
"useCompression",
"(",
"coyoteRequest",
",",
"coyoteResponse",
")",
")",
"{",
"stream",
".",
"addOutputFilter",
"(",
"new",
"GzipOutputFilter",
"(",
")",
")",
";",
"}",
"}"
] | an ACK. | [
"an",
"ACK",
"."
] | [
"// Add the pseudo header for status",
"// Check to see if a response body is present",
"// Add a content-length header if a content length has been set unless",
"// the application has already added one",
"// RFC 7231 requires the server to explicitly signal an empty",
"// response in this case",
"// Add date header unless it is an informational response or the",
"// application has already set one",
"// Enable compression. Headers will have been set. Need to configure",
"// output filter at this point."
] | [
{
"param": "coyoteRequest",
"type": "Request"
},
{
"param": "coyoteResponse",
"type": "Response"
},
{
"param": "protocol",
"type": "Http2Protocol"
},
{
"param": "stream",
"type": "Stream"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "coyoteRequest",
"type": "Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coyoteResponse",
"type": "Response",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "protocol",
"type": "Http2Protocol",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stream",
"type": "Stream",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
760,
918,
2911,
3121,
12,
691,
1825,
93,
1168,
691,
16,
2306,
1825,
93,
1168,
1064,
16,
203,
5411,
2541,
22,
5752,
1771,
16,
3961,
1407,
13,
288,
203,
3639,
22059,
3121,
1607,
273,
1825,
93,
1168,
1064,
18,
588,
13320,
3121,
5621,
203,
3639,
509,
6593,
273,
1825,
93,
1168,
1064,
18,
588,
1482,
5621,
203,
203,
3639,
368,
1436,
326,
12454,
1446,
364,
1267,
203,
3639,
1607,
18,
1289,
620,
2932,
30,
2327,
20387,
542,
780,
12,
4522,
18,
10492,
12,
30120,
10019,
203,
203,
3639,
368,
2073,
358,
2621,
309,
279,
766,
1417,
353,
3430,
203,
3639,
309,
16051,
12,
30120,
411,
4044,
747,
6593,
422,
11492,
747,
6593,
422,
4200,
25,
747,
6593,
422,
27499,
3719,
288,
203,
5411,
514,
5064,
273,
1825,
93,
1168,
1064,
18,
588,
8046,
5621,
203,
5411,
309,
261,
22194,
480,
446,
13,
288,
203,
7734,
1607,
18,
542,
620,
2932,
1745,
17,
723,
20387,
542,
780,
12,
22194,
1769,
203,
5411,
289,
203,
5411,
514,
913,
3779,
273,
1825,
93,
1168,
1064,
18,
588,
1350,
3779,
5621,
203,
5411,
309,
261,
1745,
3779,
480,
446,
13,
288,
203,
7734,
1607,
18,
542,
620,
2932,
1745,
17,
4923,
20387,
542,
780,
12,
1745,
3779,
1769,
203,
5411,
289,
203,
5411,
368,
1436,
279,
913,
17,
2469,
1446,
309,
279,
913,
769,
711,
2118,
444,
3308,
203,
5411,
368,
326,
2521,
711,
1818,
3096,
1245,
203,
5411,
1525,
17117,
273,
1825,
93,
1168,
1064,
18,
588,
1350,
1782,
3708,
5621,
203,
5411,
309,
261,
1745,
1782,
480,
300,
21,
597,
1607,
18,
24805,
2932,
1745,
17,
2469,
7923,
422,
446,
13,
288,
203,
7734,
1607,
18,
1289,
620,
2932,
1745,
17,
2469,
20387,
542,
3708,
12,
1745,
1782,
1769,
203,
5411,
289,
203,
3639,
289,
469,
288,
203,
5411,
309,
261,
30120,
422,
4200,
25,
13,
288,
203,
7734,
368,
8372,
2371,
4366,
21,
4991,
326,
1438,
358,
8122,
4277,
392,
1008,
203,
7734,
368,
766,
316,
333,
648,
203,
7734,
1825,
93,
1168,
1064,
18,
542,
1350,
1782,
12,
20,
1769,
203,
5411,
289,
469,
288,
203,
7734,
1825,
93,
1168,
1064,
18,
542,
1350,
1782,
19236,
21,
1769,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
368,
1436,
1509,
1446,
3308,
518,
353,
392,
1779,
287,
766,
578,
326,
203,
3639,
368,
2521,
711,
1818,
444,
1245,
203,
3639,
309,
261,
30120,
1545,
4044,
597,
1607,
18,
24805,
2932,
712,
7923,
422,
446,
13,
288,
203,
5411,
1607,
18,
1289,
620,
2932,
712,
20387,
542,
780,
12,
12305,
2940,
11878,
18,
588,
3935,
1626,
10663,
203,
3639,
289,
203,
203,
3639,
309,
261,
8373,
480,
446,
597,
1771,
18,
1202,
15270,
12,
2894,
93,
1168,
691,
16,
1825,
93,
1168,
1064,
3719,
288,
203,
5411,
368,
9677,
9154,
18,
12158,
903,
1240,
2118,
444,
18,
12324,
358,
5068,
203,
5411,
368,
876,
1034,
622,
333,
1634,
18,
203,
5411,
1407,
18,
1289,
1447,
1586,
12,
2704,
31712,
1447,
1586,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
392,
26069,
18,
2457,
716,
999,
648,
1825,
93,
1168,
691,
16,
1771,
471,
1407,
903,
506,
446,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5af9fe07be2aa9cbf4f22d2eced49cb09b253f71 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AprEndpoint.java | [
"MIT"
] | Java | startInternal | null | @Override
public void startInternal() throws Exception {
if (!running) {
running = true;
paused = false;
processorCache = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
socketProperties.getProcessorCache());
// Create worker collection
if (getExecutor() == null) {
createExecutor();
}
initializeConnectionLatch();
// Start poller thread
poller = new Poller();
poller.init();
Thread pollerThread = new Thread(poller, getName() + "-Poller");
pollerThread.setPriority(threadPriority);
pollerThread.setDaemon(true);
pollerThread.start();
// Start sendfile thread
if (getUseSendfile()) {
sendfile = new Sendfile();
sendfile.init();
Thread sendfileThread =
new Thread(sendfile, getName() + "-Sendfile");
sendfileThread.setPriority(threadPriority);
sendfileThread.setDaemon(true);
sendfileThread.start();
}
startAcceptorThreads();
}
} | /**
* Start the APR endpoint, creating acceptor, poller and sendfile threads.
*/ | Start the APR endpoint, creating acceptor, poller and sendfile threads. | [
"Start",
"the",
"APR",
"endpoint",
"creating",
"acceptor",
"poller",
"and",
"sendfile",
"threads",
"."
] | @Override
public void startInternal() throws Exception {
if (!running) {
running = true;
paused = false;
processorCache = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
socketProperties.getProcessorCache());
if (getExecutor() == null) {
createExecutor();
}
initializeConnectionLatch();
poller = new Poller();
poller.init();
Thread pollerThread = new Thread(poller, getName() + "-Poller");
pollerThread.setPriority(threadPriority);
pollerThread.setDaemon(true);
pollerThread.start();
if (getUseSendfile()) {
sendfile = new Sendfile();
sendfile.init();
Thread sendfileThread =
new Thread(sendfile, getName() + "-Sendfile");
sendfileThread.setPriority(threadPriority);
sendfileThread.setDaemon(true);
sendfileThread.start();
}
startAcceptorThreads();
}
} | [
"@",
"Override",
"public",
"void",
"startInternal",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"running",
")",
"{",
"running",
"=",
"true",
";",
"paused",
"=",
"false",
";",
"processorCache",
"=",
"new",
"SynchronizedStack",
"<",
">",
"(",
"SynchronizedStack",
".",
"DEFAULT_SIZE",
",",
"socketProperties",
".",
"getProcessorCache",
"(",
")",
")",
";",
"if",
"(",
"getExecutor",
"(",
")",
"==",
"null",
")",
"{",
"createExecutor",
"(",
")",
";",
"}",
"initializeConnectionLatch",
"(",
")",
";",
"poller",
"=",
"new",
"Poller",
"(",
")",
";",
"poller",
".",
"init",
"(",
")",
";",
"Thread",
"pollerThread",
"=",
"new",
"Thread",
"(",
"poller",
",",
"getName",
"(",
")",
"+",
"\"-Poller\"",
")",
";",
"pollerThread",
".",
"setPriority",
"(",
"threadPriority",
")",
";",
"pollerThread",
".",
"setDaemon",
"(",
"true",
")",
";",
"pollerThread",
".",
"start",
"(",
")",
";",
"if",
"(",
"getUseSendfile",
"(",
")",
")",
"{",
"sendfile",
"=",
"new",
"Sendfile",
"(",
")",
";",
"sendfile",
".",
"init",
"(",
")",
";",
"Thread",
"sendfileThread",
"=",
"new",
"Thread",
"(",
"sendfile",
",",
"getName",
"(",
")",
"+",
"\"-Sendfile\"",
")",
";",
"sendfileThread",
".",
"setPriority",
"(",
"threadPriority",
")",
";",
"sendfileThread",
".",
"setDaemon",
"(",
"true",
")",
";",
"sendfileThread",
".",
"start",
"(",
")",
";",
"}",
"startAcceptorThreads",
"(",
")",
";",
"}",
"}"
] | Start the APR endpoint, creating acceptor, poller and sendfile threads. | [
"Start",
"the",
"APR",
"endpoint",
"creating",
"acceptor",
"poller",
"and",
"sendfile",
"threads",
"."
] | [
"// Create worker collection",
"// Start poller thread",
"// Start sendfile thread"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
787,
3061,
1435,
1216,
1185,
288,
203,
203,
3639,
309,
16051,
8704,
13,
288,
203,
5411,
3549,
273,
638,
31,
203,
5411,
17781,
273,
629,
31,
203,
203,
5411,
6659,
1649,
273,
394,
348,
15666,
2624,
29667,
12,
55,
15666,
2624,
18,
5280,
67,
4574,
16,
203,
10792,
2987,
2297,
18,
588,
5164,
1649,
10663,
203,
203,
5411,
368,
1788,
4322,
1849,
203,
5411,
309,
261,
588,
6325,
1435,
422,
446,
13,
288,
203,
7734,
752,
6325,
5621,
203,
5411,
289,
203,
203,
5411,
4046,
1952,
23463,
5621,
203,
203,
5411,
368,
3603,
24525,
2650,
203,
5411,
24525,
273,
394,
6730,
749,
5621,
203,
5411,
24525,
18,
2738,
5621,
203,
5411,
4884,
24525,
3830,
273,
394,
4884,
12,
3915,
749,
16,
1723,
1435,
397,
3701,
5850,
749,
8863,
203,
5411,
24525,
3830,
18,
542,
8183,
12,
5930,
8183,
1769,
203,
5411,
24525,
3830,
18,
542,
12858,
12,
3767,
1769,
203,
5411,
24525,
3830,
18,
1937,
5621,
203,
203,
5411,
368,
3603,
1366,
768,
2650,
203,
5411,
309,
261,
588,
3727,
3826,
768,
10756,
288,
203,
7734,
1366,
768,
273,
394,
2479,
768,
5621,
203,
7734,
1366,
768,
18,
2738,
5621,
203,
7734,
4884,
1366,
768,
3830,
273,
203,
13491,
394,
4884,
12,
4661,
768,
16,
1723,
1435,
397,
3701,
3826,
768,
8863,
203,
7734,
1366,
768,
3830,
18,
542,
8183,
12,
5930,
8183,
1769,
203,
7734,
1366,
768,
3830,
18,
542,
12858,
12,
3767,
1769,
203,
7734,
1366,
768,
3830,
18,
1937,
5621,
203,
5411,
289,
203,
203,
5411,
787,
5933,
280,
13233,
5621,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3603,
326,
432,
8025,
2494,
16,
4979,
2791,
280,
16,
24525,
471,
1366,
768,
7403,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5af9fe07be2aa9cbf4f22d2eced49cb09b253f71 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AprEndpoint.java | [
"MIT"
] | Java | stopInternal | null | @Override
public void stopInternal() {
releaseConnectionLatch();
if (!paused) {
pause();
}
if (running) {
running = false;
poller.stop();
for (SocketWrapperBase<Long> socketWrapper : connections.values()) {
try {
socketWrapper.close();
} catch (IOException e) {
// Ignore
}
}
for (AbstractEndpoint.Acceptor acceptor : acceptors) {
long waitLeft = 10000;
while (waitLeft > 0 &&
acceptor.getState() != AcceptorState.ENDED &&
serverSock != 0) {
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// Ignore
}
waitLeft -= 50;
}
if (waitLeft == 0) {
log.warn(sm.getString("endpoint.warn.unlockAcceptorFailed",
acceptor.getThreadName()));
// If the Acceptor is still running force
// the hard socket close.
if (serverSock != 0) {
Socket.shutdown(serverSock, Socket.APR_SHUTDOWN_READ);
serverSock = 0;
}
}
}
// Close any sockets not in the poller performing blocking
// read/writes. Need to do this before destroying the poller since
// that will also destroy the root pool for these sockets.
for (Long s : connections.keySet()) {
Socket.shutdown(s.longValue(), Socket.APR_SHUTDOWN_READWRITE);
}
try {
poller.destroy();
} catch (Exception e) {
// Ignore
}
poller = null;
connections.clear();
if (getUseSendfile()) {
try {
sendfile.destroy();
} catch (Exception e) {
// Ignore
}
sendfile = null;
}
processorCache.clear();
}
shutdownExecutor();
} | /**
* Stop the endpoint. This will cause all processing threads to stop.
*/ | Stop the endpoint. This will cause all processing threads to stop. | [
"Stop",
"the",
"endpoint",
".",
"This",
"will",
"cause",
"all",
"processing",
"threads",
"to",
"stop",
"."
] | @Override
public void stopInternal() {
releaseConnectionLatch();
if (!paused) {
pause();
}
if (running) {
running = false;
poller.stop();
for (SocketWrapperBase<Long> socketWrapper : connections.values()) {
try {
socketWrapper.close();
} catch (IOException e) {
}
}
for (AbstractEndpoint.Acceptor acceptor : acceptors) {
long waitLeft = 10000;
while (waitLeft > 0 &&
acceptor.getState() != AcceptorState.ENDED &&
serverSock != 0) {
try {
Thread.sleep(50);
} catch (InterruptedException e) {
}
waitLeft -= 50;
}
if (waitLeft == 0) {
log.warn(sm.getString("endpoint.warn.unlockAcceptorFailed",
acceptor.getThreadName()));
if (serverSock != 0) {
Socket.shutdown(serverSock, Socket.APR_SHUTDOWN_READ);
serverSock = 0;
}
}
}
for (Long s : connections.keySet()) {
Socket.shutdown(s.longValue(), Socket.APR_SHUTDOWN_READWRITE);
}
try {
poller.destroy();
} catch (Exception e) {
}
poller = null;
connections.clear();
if (getUseSendfile()) {
try {
sendfile.destroy();
} catch (Exception e) {
}
sendfile = null;
}
processorCache.clear();
}
shutdownExecutor();
} | [
"@",
"Override",
"public",
"void",
"stopInternal",
"(",
")",
"{",
"releaseConnectionLatch",
"(",
")",
";",
"if",
"(",
"!",
"paused",
")",
"{",
"pause",
"(",
")",
";",
"}",
"if",
"(",
"running",
")",
"{",
"running",
"=",
"false",
";",
"poller",
".",
"stop",
"(",
")",
";",
"for",
"(",
"SocketWrapperBase",
"<",
"Long",
">",
"socketWrapper",
":",
"connections",
".",
"values",
"(",
")",
")",
"{",
"try",
"{",
"socketWrapper",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"for",
"(",
"AbstractEndpoint",
".",
"Acceptor",
"acceptor",
":",
"acceptors",
")",
"{",
"long",
"waitLeft",
"=",
"10000",
";",
"while",
"(",
"waitLeft",
">",
"0",
"&&",
"acceptor",
".",
"getState",
"(",
")",
"!=",
"AcceptorState",
".",
"ENDED",
"&&",
"serverSock",
"!=",
"0",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"50",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"waitLeft",
"-=",
"50",
";",
"}",
"if",
"(",
"waitLeft",
"==",
"0",
")",
"{",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.warn.unlockAcceptorFailed\"",
",",
"acceptor",
".",
"getThreadName",
"(",
")",
")",
")",
";",
"if",
"(",
"serverSock",
"!=",
"0",
")",
"{",
"Socket",
".",
"shutdown",
"(",
"serverSock",
",",
"Socket",
".",
"APR_SHUTDOWN_READ",
")",
";",
"serverSock",
"=",
"0",
";",
"}",
"}",
"}",
"for",
"(",
"Long",
"s",
":",
"connections",
".",
"keySet",
"(",
")",
")",
"{",
"Socket",
".",
"shutdown",
"(",
"s",
".",
"longValue",
"(",
")",
",",
"Socket",
".",
"APR_SHUTDOWN_READWRITE",
")",
";",
"}",
"try",
"{",
"poller",
".",
"destroy",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"poller",
"=",
"null",
";",
"connections",
".",
"clear",
"(",
")",
";",
"if",
"(",
"getUseSendfile",
"(",
")",
")",
"{",
"try",
"{",
"sendfile",
".",
"destroy",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"sendfile",
"=",
"null",
";",
"}",
"processorCache",
".",
"clear",
"(",
")",
";",
"}",
"shutdownExecutor",
"(",
")",
";",
"}"
] | Stop the endpoint. | [
"Stop",
"the",
"endpoint",
"."
] | [
"// Ignore",
"// Ignore",
"// If the Acceptor is still running force",
"// the hard socket close.",
"// Close any sockets not in the poller performing blocking",
"// read/writes. Need to do this before destroying the poller since",
"// that will also destroy the root pool for these sockets.",
"// Ignore",
"// Ignore"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
2132,
3061,
1435,
288,
203,
3639,
3992,
1952,
23463,
5621,
203,
3639,
309,
16051,
8774,
3668,
13,
288,
203,
5411,
11722,
5621,
203,
3639,
289,
203,
3639,
309,
261,
8704,
13,
288,
203,
5411,
3549,
273,
629,
31,
203,
5411,
24525,
18,
5681,
5621,
203,
5411,
364,
261,
4534,
3611,
2171,
32,
3708,
34,
2987,
3611,
294,
5921,
18,
2372,
10756,
288,
203,
7734,
775,
288,
203,
10792,
2987,
3611,
18,
4412,
5621,
203,
7734,
289,
1044,
261,
14106,
425,
13,
288,
203,
10792,
368,
8049,
203,
7734,
289,
203,
5411,
289,
203,
5411,
364,
261,
7469,
3293,
18,
5933,
280,
2791,
280,
294,
2791,
1383,
13,
288,
203,
7734,
1525,
2529,
3910,
273,
12619,
31,
203,
7734,
1323,
261,
7048,
3910,
405,
374,
597,
203,
13491,
2791,
280,
18,
588,
1119,
1435,
480,
8662,
280,
1119,
18,
22088,
597,
203,
13491,
1438,
55,
975,
480,
374,
13,
288,
203,
10792,
775,
288,
203,
13491,
4884,
18,
19607,
12,
3361,
1769,
203,
10792,
289,
1044,
261,
24485,
503,
425,
13,
288,
203,
13491,
368,
8049,
203,
10792,
289,
203,
10792,
2529,
3910,
3947,
6437,
31,
203,
7734,
289,
203,
7734,
309,
261,
7048,
3910,
422,
374,
13,
288,
203,
10792,
613,
18,
8935,
12,
4808,
18,
588,
780,
2932,
8003,
18,
8935,
18,
26226,
5933,
280,
2925,
3113,
203,
18701,
2791,
280,
18,
588,
3830,
461,
1435,
10019,
203,
10402,
368,
971,
326,
8662,
280,
353,
4859,
3549,
2944,
203,
10402,
368,
326,
7877,
2987,
1746,
18,
203,
10402,
309,
261,
3567,
55,
975,
480,
374,
13,
288,
203,
15604,
8758,
18,
15132,
12,
3567,
55,
975,
16,
8758,
18,
2203,
54,
67,
2664,
1693,
12711,
67,
6949,
1769,
203,
15604,
1438,
55,
975,
273,
374,
31,
203,
10402,
289,
203,
7734,
289,
203,
5411,
289,
203,
5411,
368,
3527,
1281,
16762,
486,
316,
326,
24525,
14928,
9445,
203,
5411,
368,
855,
19,
13284,
18,
12324,
358,
741,
333,
1865,
5546,
310,
326,
24525,
3241,
203,
5411,
368,
716,
903,
2546,
5546,
326,
1365,
2845,
364,
4259,
16762,
18,
203,
5411,
364,
261,
3708,
272,
294,
5921,
18,
856,
694,
10756,
288,
203,
7734,
8758,
18,
15132,
12,
87,
18,
5748,
620,
9334,
8758,
18,
2203,
54,
67,
2664,
1693,
12711,
67,
6949,
11677,
1769,
203,
5411,
289,
203,
5411,
775,
288,
203,
7734,
24525,
18,
11662,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
368,
8049,
203,
5411,
289,
203,
5411,
24525,
273,
446,
31,
203,
5411,
5921,
18,
8507,
5621,
203,
5411,
309,
261,
588,
3727,
3826,
768,
10756,
288,
203,
7734,
775,
288,
203,
10792,
1366,
768,
18,
11662,
5621,
203,
7734,
289,
1044,
261,
503,
425,
13,
288,
203,
10792,
368,
8049,
203,
7734,
289,
203,
7734,
1366,
768,
273,
446,
31,
203,
5411,
289,
203,
5411,
6659,
1649,
18,
8507,
5621,
203,
3639,
289,
203,
3639,
5731,
6325,
5621,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5131,
326,
2494,
18,
1220,
903,
4620,
777,
4929,
7403,
358,
2132,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5af9fe07be2aa9cbf4f22d2eced49cb09b253f71 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AprEndpoint.java | [
"MIT"
] | Java | processSocketWithOptions | null | protected boolean processSocketWithOptions(long socket) {
try {
// During shutdown, executor may be null - avoid NPE
if (running) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("endpoint.debug.socket",
Long.valueOf(socket)));
}
AprSocketWrapper wrapper = new AprSocketWrapper(Long.valueOf(socket), this);
wrapper.setKeepAliveLeft(getMaxKeepAliveRequests());
wrapper.setSecure(isSSLEnabled());
wrapper.setReadTimeout(getConnectionTimeout());
wrapper.setWriteTimeout(getConnectionTimeout());
connections.put(Long.valueOf(socket), wrapper);
getExecutor().execute(new SocketWithOptionsProcessor(wrapper));
}
} catch (RejectedExecutionException x) {
log.warn("Socket processing request was rejected for:"+socket,x);
return false;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
// This means we got an OOM or similar creating a thread, or that
// the pool and its queue are full
log.error(sm.getString("endpoint.process.fail"), t);
return false;
}
return true;
} | /**
* Process given socket. This is called when the socket has been
* accepted.
* @param socket The socket
* @return <code>true</code> if the socket was correctly configured
* and processing may continue, <code>false</code> if the socket needs to be
* close immediately
*/ | Process given socket. This is called when the socket has been
accepted.
@param socket The socket
@return true if the socket was correctly configured
and processing may continue, false if the socket needs to be
close immediately | [
"Process",
"given",
"socket",
".",
"This",
"is",
"called",
"when",
"the",
"socket",
"has",
"been",
"accepted",
".",
"@param",
"socket",
"The",
"socket",
"@return",
"true",
"if",
"the",
"socket",
"was",
"correctly",
"configured",
"and",
"processing",
"may",
"continue",
"false",
"if",
"the",
"socket",
"needs",
"to",
"be",
"close",
"immediately"
] | protected boolean processSocketWithOptions(long socket) {
try {
if (running) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("endpoint.debug.socket",
Long.valueOf(socket)));
}
AprSocketWrapper wrapper = new AprSocketWrapper(Long.valueOf(socket), this);
wrapper.setKeepAliveLeft(getMaxKeepAliveRequests());
wrapper.setSecure(isSSLEnabled());
wrapper.setReadTimeout(getConnectionTimeout());
wrapper.setWriteTimeout(getConnectionTimeout());
connections.put(Long.valueOf(socket), wrapper);
getExecutor().execute(new SocketWithOptionsProcessor(wrapper));
}
} catch (RejectedExecutionException x) {
log.warn("Socket processing request was rejected for:"+socket,x);
return false;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("endpoint.process.fail"), t);
return false;
}
return true;
} | [
"protected",
"boolean",
"processSocketWithOptions",
"(",
"long",
"socket",
")",
"{",
"try",
"{",
"if",
"(",
"running",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.debug.socket\"",
",",
"Long",
".",
"valueOf",
"(",
"socket",
")",
")",
")",
";",
"}",
"AprSocketWrapper",
"wrapper",
"=",
"new",
"AprSocketWrapper",
"(",
"Long",
".",
"valueOf",
"(",
"socket",
")",
",",
"this",
")",
";",
"wrapper",
".",
"setKeepAliveLeft",
"(",
"getMaxKeepAliveRequests",
"(",
")",
")",
";",
"wrapper",
".",
"setSecure",
"(",
"isSSLEnabled",
"(",
")",
")",
";",
"wrapper",
".",
"setReadTimeout",
"(",
"getConnectionTimeout",
"(",
")",
")",
";",
"wrapper",
".",
"setWriteTimeout",
"(",
"getConnectionTimeout",
"(",
")",
")",
";",
"connections",
".",
"put",
"(",
"Long",
".",
"valueOf",
"(",
"socket",
")",
",",
"wrapper",
")",
";",
"getExecutor",
"(",
")",
".",
"execute",
"(",
"new",
"SocketWithOptionsProcessor",
"(",
"wrapper",
")",
")",
";",
"}",
"}",
"catch",
"(",
"RejectedExecutionException",
"x",
")",
"{",
"log",
".",
"warn",
"(",
"\"Socket processing request was rejected for:\"",
"+",
"socket",
",",
"x",
")",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.process.fail\"",
")",
",",
"t",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Process given socket. | [
"Process",
"given",
"socket",
"."
] | [
"// During shutdown, executor may be null - avoid NPE",
"// This means we got an OOM or similar creating a thread, or that",
"// the pool and its queue are full"
] | [
{
"param": "socket",
"type": "long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "socket",
"type": "long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
1250,
1207,
4534,
27442,
12,
5748,
2987,
13,
288,
203,
3639,
775,
288,
203,
5411,
368,
463,
4017,
5731,
16,
6601,
2026,
506,
446,
300,
4543,
423,
1423,
203,
5411,
309,
261,
8704,
13,
288,
203,
7734,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
10792,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
8003,
18,
4148,
18,
7814,
3113,
203,
18701,
3407,
18,
1132,
951,
12,
7814,
3719,
1769,
203,
7734,
289,
203,
7734,
432,
683,
4534,
3611,
4053,
273,
394,
432,
683,
4534,
3611,
12,
3708,
18,
1132,
951,
12,
7814,
3631,
333,
1769,
203,
7734,
4053,
18,
542,
24456,
3910,
12,
588,
2747,
24456,
6421,
10663,
203,
7734,
4053,
18,
542,
12834,
12,
291,
6745,
1526,
10663,
203,
7734,
4053,
18,
542,
1994,
2694,
12,
588,
1952,
2694,
10663,
203,
7734,
4053,
18,
542,
3067,
2694,
12,
588,
1952,
2694,
10663,
203,
7734,
5921,
18,
458,
12,
3708,
18,
1132,
951,
12,
7814,
3631,
4053,
1769,
203,
7734,
336,
6325,
7675,
8837,
12,
2704,
8758,
27442,
5164,
12,
8376,
10019,
203,
5411,
289,
203,
3639,
289,
1044,
261,
19902,
14576,
619,
13,
288,
203,
5411,
613,
18,
8935,
2932,
4534,
4929,
590,
1703,
11876,
364,
2773,
15,
7814,
16,
92,
1769,
203,
5411,
327,
629,
31,
203,
3639,
289,
1044,
261,
15155,
268,
13,
288,
203,
5411,
1185,
1989,
18,
4110,
15155,
12,
88,
1769,
203,
5411,
368,
1220,
4696,
732,
2363,
392,
531,
1872,
578,
7281,
4979,
279,
2650,
16,
578,
716,
203,
5411,
368,
326,
2845,
471,
2097,
2389,
854,
1983,
203,
5411,
613,
18,
1636,
12,
4808,
18,
588,
780,
2932,
8003,
18,
2567,
18,
6870,
6,
3631,
268,
1769,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
3639,
327,
638,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
4389,
864,
2987,
18,
1220,
353,
2566,
1347,
326,
2987,
711,
2118,
203,
377,
380,
8494,
18,
203,
377,
380,
632,
891,
2987,
1021,
2987,
203,
377,
380,
632,
2463,
411,
710,
34,
3767,
1757,
710,
34,
309,
326,
2987,
1703,
8783,
4351,
203,
377,
380,
225,
471,
4929,
2026,
1324,
16,
411,
710,
34,
5743,
1757,
710,
34,
309,
326,
2987,
4260,
358,
506,
203,
377,
380,
225,
1746,
7636,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5af9fe07be2aa9cbf4f22d2eced49cb09b253f71 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AprEndpoint.java | [
"MIT"
] | Java | init | null | protected synchronized void init() {
pool = Pool.create(serverSockPool);
// Single poller by default
int defaultPollerSize = getMaxConnections();
if ((OS.IS_WIN32 || OS.IS_WIN64) && (defaultPollerSize > 1024)) {
// The maximum per poller to get reasonable performance is 1024
// Adjust poller size so that it won't reach the limit. This is
// a limitation of XP / Server 2003 that has been fixed in
// Vista / Server 2008 onwards.
actualPollerSize = 1024;
} else {
actualPollerSize = defaultPollerSize;
}
timeouts = new SocketTimeouts(defaultPollerSize);
// At the moment, setting the timeout is useless, but it could get
// used again as the normal poller could be faster using maintain.
// It might not be worth bothering though.
long pollset = allocatePoller(actualPollerSize, pool, -1);
if (pollset == 0 && actualPollerSize > 1024) {
actualPollerSize = 1024;
pollset = allocatePoller(actualPollerSize, pool, -1);
}
if (pollset == 0) {
actualPollerSize = 62;
pollset = allocatePoller(actualPollerSize, pool, -1);
}
pollerCount = defaultPollerSize / actualPollerSize;
pollerTime = pollTime / pollerCount;
nextPollerTime = pollerTime;
pollers = new long[pollerCount];
pollers[0] = pollset;
for (int i = 1; i < pollerCount; i++) {
pollers[i] = allocatePoller(actualPollerSize, pool, -1);
}
pollerSpace = new int[pollerCount];
for (int i = 0; i < pollerCount; i++) {
pollerSpace[i] = actualPollerSize;
}
/*
* x2 - One descriptor for the socket, one for the event(s).
* x2 - Some APR implementations return multiple events for the
* same socket as different entries. Each socket is registered
* for a maximum of two events (read and write) at any one
* time.
*
* Therefore size is actual poller size *4.
*/
desc = new long[actualPollerSize * 4];
connectionCount.set(0);
addList = new SocketList(defaultPollerSize);
closeList = new SocketList(defaultPollerSize);
} | /**
* Create the poller. With some versions of APR, the maximum poller size
* will be 62 (recompiling APR is necessary to remove this limitation).
*/ | Create the poller. With some versions of APR, the maximum poller size
will be 62 (recompiling APR is necessary to remove this limitation). | [
"Create",
"the",
"poller",
".",
"With",
"some",
"versions",
"of",
"APR",
"the",
"maximum",
"poller",
"size",
"will",
"be",
"62",
"(",
"recompiling",
"APR",
"is",
"necessary",
"to",
"remove",
"this",
"limitation",
")",
"."
] | protected synchronized void init() {
pool = Pool.create(serverSockPool);
int defaultPollerSize = getMaxConnections();
if ((OS.IS_WIN32 || OS.IS_WIN64) && (defaultPollerSize > 1024)) {
actualPollerSize = 1024;
} else {
actualPollerSize = defaultPollerSize;
}
timeouts = new SocketTimeouts(defaultPollerSize);
long pollset = allocatePoller(actualPollerSize, pool, -1);
if (pollset == 0 && actualPollerSize > 1024) {
actualPollerSize = 1024;
pollset = allocatePoller(actualPollerSize, pool, -1);
}
if (pollset == 0) {
actualPollerSize = 62;
pollset = allocatePoller(actualPollerSize, pool, -1);
}
pollerCount = defaultPollerSize / actualPollerSize;
pollerTime = pollTime / pollerCount;
nextPollerTime = pollerTime;
pollers = new long[pollerCount];
pollers[0] = pollset;
for (int i = 1; i < pollerCount; i++) {
pollers[i] = allocatePoller(actualPollerSize, pool, -1);
}
pollerSpace = new int[pollerCount];
for (int i = 0; i < pollerCount; i++) {
pollerSpace[i] = actualPollerSize;
}
/*
* x2 - One descriptor for the socket, one for the event(s).
* x2 - Some APR implementations return multiple events for the
* same socket as different entries. Each socket is registered
* for a maximum of two events (read and write) at any one
* time.
*
* Therefore size is actual poller size *4.
*/
desc = new long[actualPollerSize * 4];
connectionCount.set(0);
addList = new SocketList(defaultPollerSize);
closeList = new SocketList(defaultPollerSize);
} | [
"protected",
"synchronized",
"void",
"init",
"(",
")",
"{",
"pool",
"=",
"Pool",
".",
"create",
"(",
"serverSockPool",
")",
";",
"int",
"defaultPollerSize",
"=",
"getMaxConnections",
"(",
")",
";",
"if",
"(",
"(",
"OS",
".",
"IS_WIN32",
"||",
"OS",
".",
"IS_WIN64",
")",
"&&",
"(",
"defaultPollerSize",
">",
"1024",
")",
")",
"{",
"actualPollerSize",
"=",
"1024",
";",
"}",
"else",
"{",
"actualPollerSize",
"=",
"defaultPollerSize",
";",
"}",
"timeouts",
"=",
"new",
"SocketTimeouts",
"(",
"defaultPollerSize",
")",
";",
"long",
"pollset",
"=",
"allocatePoller",
"(",
"actualPollerSize",
",",
"pool",
",",
"-",
"1",
")",
";",
"if",
"(",
"pollset",
"==",
"0",
"&&",
"actualPollerSize",
">",
"1024",
")",
"{",
"actualPollerSize",
"=",
"1024",
";",
"pollset",
"=",
"allocatePoller",
"(",
"actualPollerSize",
",",
"pool",
",",
"-",
"1",
")",
";",
"}",
"if",
"(",
"pollset",
"==",
"0",
")",
"{",
"actualPollerSize",
"=",
"62",
";",
"pollset",
"=",
"allocatePoller",
"(",
"actualPollerSize",
",",
"pool",
",",
"-",
"1",
")",
";",
"}",
"pollerCount",
"=",
"defaultPollerSize",
"/",
"actualPollerSize",
";",
"pollerTime",
"=",
"pollTime",
"/",
"pollerCount",
";",
"nextPollerTime",
"=",
"pollerTime",
";",
"pollers",
"=",
"new",
"long",
"[",
"pollerCount",
"]",
";",
"pollers",
"[",
"0",
"]",
"=",
"pollset",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"pollerCount",
";",
"i",
"++",
")",
"{",
"pollers",
"[",
"i",
"]",
"=",
"allocatePoller",
"(",
"actualPollerSize",
",",
"pool",
",",
"-",
"1",
")",
";",
"}",
"pollerSpace",
"=",
"new",
"int",
"[",
"pollerCount",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pollerCount",
";",
"i",
"++",
")",
"{",
"pollerSpace",
"[",
"i",
"]",
"=",
"actualPollerSize",
";",
"}",
"/*\n * x2 - One descriptor for the socket, one for the event(s).\n * x2 - Some APR implementations return multiple events for the\n * same socket as different entries. Each socket is registered\n * for a maximum of two events (read and write) at any one\n * time.\n *\n * Therefore size is actual poller size *4.\n */",
"desc",
"=",
"new",
"long",
"[",
"actualPollerSize",
"*",
"4",
"]",
";",
"connectionCount",
".",
"set",
"(",
"0",
")",
";",
"addList",
"=",
"new",
"SocketList",
"(",
"defaultPollerSize",
")",
";",
"closeList",
"=",
"new",
"SocketList",
"(",
"defaultPollerSize",
")",
";",
"}"
] | Create the poller. | [
"Create",
"the",
"poller",
"."
] | [
"// Single poller by default",
"// The maximum per poller to get reasonable performance is 1024",
"// Adjust poller size so that it won't reach the limit. This is",
"// a limitation of XP / Server 2003 that has been fixed in",
"// Vista / Server 2008 onwards.",
"// At the moment, setting the timeout is useless, but it could get",
"// used again as the normal poller could be faster using maintain.",
"// It might not be worth bothering though."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
3852,
918,
1208,
1435,
288,
203,
203,
5411,
2845,
273,
8828,
18,
2640,
12,
3567,
55,
975,
2864,
1769,
203,
203,
5411,
368,
10326,
24525,
635,
805,
203,
5411,
509,
805,
5850,
749,
1225,
273,
7288,
9314,
5621,
203,
203,
5411,
309,
14015,
4618,
18,
5127,
67,
24572,
1578,
747,
5932,
18,
5127,
67,
24572,
1105,
13,
597,
261,
1886,
5850,
749,
1225,
405,
6250,
3719,
288,
203,
7734,
368,
1021,
4207,
1534,
24525,
358,
336,
23589,
9239,
353,
6250,
203,
7734,
368,
17720,
24525,
963,
1427,
716,
518,
8462,
1404,
9287,
326,
1800,
18,
1220,
353,
203,
7734,
368,
279,
17732,
434,
1139,
52,
342,
3224,
4044,
23,
716,
711,
2118,
5499,
316,
203,
7734,
368,
776,
376,
69,
342,
3224,
4044,
28,
603,
6397,
18,
203,
7734,
3214,
5850,
749,
1225,
273,
6250,
31,
203,
5411,
289,
469,
288,
203,
7734,
3214,
5850,
749,
1225,
273,
805,
5850,
749,
1225,
31,
203,
5411,
289,
203,
203,
5411,
20395,
273,
394,
8758,
2694,
87,
12,
1886,
5850,
749,
1225,
1769,
203,
203,
5411,
368,
2380,
326,
10382,
16,
3637,
326,
2021,
353,
26967,
16,
1496,
518,
3377,
336,
203,
5411,
368,
1399,
3382,
487,
326,
2212,
24525,
3377,
506,
12063,
1450,
17505,
18,
203,
5411,
368,
2597,
4825,
486,
506,
26247,
23440,
310,
11376,
18,
203,
5411,
1525,
7672,
542,
273,
10101,
5850,
749,
12,
18672,
5850,
749,
1225,
16,
2845,
16,
300,
21,
1769,
203,
5411,
309,
261,
13835,
542,
422,
374,
597,
3214,
5850,
749,
1225,
405,
6250,
13,
288,
203,
7734,
3214,
5850,
749,
1225,
273,
6250,
31,
203,
7734,
7672,
542,
273,
10101,
5850,
749,
12,
18672,
5850,
749,
1225,
16,
2845,
16,
300,
21,
1769,
203,
5411,
289,
203,
5411,
309,
261,
13835,
542,
422,
374,
13,
288,
203,
7734,
3214,
5850,
749,
1225,
273,
22684,
31,
203,
7734,
7672,
542,
273,
10101,
5850,
749,
12,
18672,
5850,
749,
1225,
16,
2845,
16,
300,
21,
1769,
203,
5411,
289,
203,
203,
5411,
24525,
1380,
273,
805,
5850,
749,
1225,
342,
3214,
5850,
749,
1225,
31,
203,
5411,
24525,
950,
273,
7672,
950,
342,
24525,
1380,
31,
203,
5411,
1024,
5850,
749,
950,
273,
24525,
950,
31,
203,
203,
5411,
2952,
3135,
273,
394,
1525,
63,
3915,
749,
1380,
15533,
203,
5411,
2952,
3135,
63,
20,
65,
273,
7672,
542,
31,
203,
5411,
364,
261,
474,
277,
273,
404,
31,
277,
411,
24525,
1380,
31,
277,
27245,
288,
203,
7734,
2952,
3135,
63,
77,
65,
273,
10101,
5850,
749,
12,
18672,
5850,
749,
1225,
16,
2845,
16,
300,
21,
1769,
203,
5411,
289,
203,
203,
5411,
24525,
3819,
273,
394,
509,
63,
3915,
749,
1380,
15533,
203,
5411,
364,
261,
474,
277,
273,
374,
31,
277,
411,
24525,
1380,
31,
277,
27245,
288,
203,
7734,
24525,
3819,
63,
77,
65,
273,
3214,
5850,
749,
1225,
31,
203,
5411,
289,
203,
203,
5411,
1748,
203,
2398,
380,
619,
22,
300,
6942,
4950,
364,
326,
2987,
16,
1245,
364,
326,
871,
12,
87,
2934,
203,
2398,
380,
619,
22,
300,
10548,
432,
2
] | [
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
540,
380,
1788,
326,
24525,
18,
3423,
2690,
5244,
434,
432,
8025,
16,
326,
4207,
24525,
963,
203,
540,
380,
903,
506,
22684,
261,
266,
2919,
4973,
432,
8025,
353,
4573,
358,
1206,
333,
17732,
2934,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5af9fe07be2aa9cbf4f22d2eced49cb09b253f71 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AprEndpoint.java | [
"MIT"
] | Java | removeFromPoller | null | private void removeFromPoller(long socket) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("endpoint.debug.pollerRemove",
Long.valueOf(socket)));
}
int rv = -1;
for (int i = 0; i < pollers.length; i++) {
if (pollerSpace[i] < actualPollerSize) {
rv = Poll.remove(pollers[i], socket);
if (rv != Status.APR_NOTFOUND) {
pollerSpace[i]++;
connectionCount.decrementAndGet();
if (log.isDebugEnabled()) {
log.debug(sm.getString("endpoint.debug.pollerRemoved",
Long.valueOf(socket)));
}
break;
}
}
}
timeouts.remove(socket);
} | /**
* Remove specified socket from the pollers. Must only be called from
* {@link Poller#run()}.
*/ | Remove specified socket from the pollers. Must only be called from
Poller#run(). | [
"Remove",
"specified",
"socket",
"from",
"the",
"pollers",
".",
"Must",
"only",
"be",
"called",
"from",
"Poller#run",
"()",
"."
] | private void removeFromPoller(long socket) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("endpoint.debug.pollerRemove",
Long.valueOf(socket)));
}
int rv = -1;
for (int i = 0; i < pollers.length; i++) {
if (pollerSpace[i] < actualPollerSize) {
rv = Poll.remove(pollers[i], socket);
if (rv != Status.APR_NOTFOUND) {
pollerSpace[i]++;
connectionCount.decrementAndGet();
if (log.isDebugEnabled()) {
log.debug(sm.getString("endpoint.debug.pollerRemoved",
Long.valueOf(socket)));
}
break;
}
}
}
timeouts.remove(socket);
} | [
"private",
"void",
"removeFromPoller",
"(",
"long",
"socket",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.debug.pollerRemove\"",
",",
"Long",
".",
"valueOf",
"(",
"socket",
")",
")",
")",
";",
"}",
"int",
"rv",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pollers",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"pollerSpace",
"[",
"i",
"]",
"<",
"actualPollerSize",
")",
"{",
"rv",
"=",
"Poll",
".",
"remove",
"(",
"pollers",
"[",
"i",
"]",
",",
"socket",
")",
";",
"if",
"(",
"rv",
"!=",
"Status",
".",
"APR_NOTFOUND",
")",
"{",
"pollerSpace",
"[",
"i",
"]",
"++",
";",
"connectionCount",
".",
"decrementAndGet",
"(",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.debug.pollerRemoved\"",
",",
"Long",
".",
"valueOf",
"(",
"socket",
")",
")",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"timeouts",
".",
"remove",
"(",
"socket",
")",
";",
"}"
] | Remove specified socket from the pollers. | [
"Remove",
"specified",
"socket",
"from",
"the",
"pollers",
"."
] | [] | [
{
"param": "socket",
"type": "long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "socket",
"type": "long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
22386,
5850,
749,
12,
5748,
2987,
13,
288,
203,
5411,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
7734,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
8003,
18,
4148,
18,
3915,
749,
3288,
3113,
203,
13491,
3407,
18,
1132,
951,
12,
7814,
3719,
1769,
203,
5411,
289,
203,
5411,
509,
5633,
273,
300,
21,
31,
203,
5411,
364,
261,
474,
277,
273,
374,
31,
277,
411,
2952,
3135,
18,
2469,
31,
277,
27245,
288,
203,
7734,
309,
261,
3915,
749,
3819,
63,
77,
65,
411,
3214,
5850,
749,
1225,
13,
288,
203,
10792,
5633,
273,
19160,
18,
4479,
12,
3915,
3135,
63,
77,
6487,
2987,
1769,
203,
10792,
309,
261,
4962,
480,
2685,
18,
2203,
54,
67,
4400,
9294,
13,
288,
203,
13491,
24525,
3819,
63,
77,
3737,
15,
31,
203,
13491,
1459,
1380,
18,
323,
3702,
14042,
5621,
203,
13491,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
18701,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
8003,
18,
4148,
18,
3915,
749,
10026,
3113,
203,
4766,
565,
3407,
18,
1132,
951,
12,
7814,
3719,
1769,
203,
13491,
289,
203,
13491,
898,
31,
203,
10792,
289,
203,
7734,
289,
203,
5411,
289,
203,
5411,
20395,
18,
4479,
12,
7814,
1769,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
3581,
1269,
2987,
628,
326,
2952,
3135,
18,
6753,
1338,
506,
2566,
628,
203,
540,
380,
8901,
1232,
6730,
749,
7,
2681,
1435,
5496,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5af9fe07be2aa9cbf4f22d2eced49cb09b253f71 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/tomcat/util/net/AprEndpoint.java | [
"MIT"
] | Java | run | null | @Override
public void run() {
long maintainTime = 0;
// Loop until we receive a shutdown command
while (sendfileRunning) {
// Loop if endpoint is paused
while (sendfileRunning && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore
}
}
// Loop if poller is empty
while (sendfileRunning && sendfileCount < 1 && addS.size() < 1) {
// Reset maintain time.
maintainTime = 0;
try {
synchronized (this) {
if (sendfileRunning && sendfileCount < 1 && addS.size() < 1) {
this.wait();
}
}
} catch (InterruptedException e) {
// Ignore
}
}
// Don't add or poll if the poller has been stopped
if (!sendfileRunning) {
break;
}
try {
// Add socket to the poller
if (addS.size() > 0) {
synchronized (this) {
for (int i = (addS.size() - 1); i >= 0; i--) {
SendfileData data = addS.get(i);
int rv = Poll.add(sendfilePollset, data.socket, Poll.APR_POLLOUT);
if (rv == Status.APR_SUCCESS) {
sendfileData.put(Long.valueOf(data.socket), data);
sendfileCount++;
} else {
getLog().warn(sm.getString(
"endpoint.sendfile.addfail",
Integer.valueOf(rv),
Error.strerror(rv)));
// Can't do anything: close the socket right away
closeSocket(data.socket);
}
}
addS.clear();
}
}
maintainTime += pollTime;
// Pool for the specified interval
int rv = Poll.poll(sendfilePollset, pollTime, desc, false);
if (rv > 0) {
for (int n = 0; n < rv; n++) {
// Get the sendfile state
SendfileData state =
sendfileData.get(Long.valueOf(desc[n*2+1]));
// Problem events
if (((desc[n*2] & Poll.APR_POLLHUP) == Poll.APR_POLLHUP)
|| ((desc[n*2] & Poll.APR_POLLERR) == Poll.APR_POLLERR)) {
// Close socket and clear pool
remove(state);
// Destroy file descriptor pool, which should close the file
// Close the socket, as the response would be incomplete
closeSocket(state.socket);
continue;
}
// Write some data using sendfile
long nw = Socket.sendfilen(state.socket, state.fd,
state.pos,
state.length, 0);
if (nw < 0) {
// Close socket and clear pool
remove(state);
// Close the socket, as the response would be incomplete
// This will close the file too.
closeSocket(state.socket);
continue;
}
state.pos += nw;
state.length -= nw;
if (state.length == 0) {
remove(state);
switch (state.keepAliveState) {
case NONE: {
// Close the socket since this is
// the end of the not keep-alive request.
closeSocket(state.socket);
break;
}
case PIPELINED: {
// Destroy file descriptor pool, which should close the file
Pool.destroy(state.fdpool);
Socket.timeoutSet(state.socket, getConnectionTimeout() * 1000);
// Process the pipelined request data
if (!processSocket(state.socket, SocketEvent.OPEN_READ)) {
closeSocket(state.socket);
}
break;
}
case OPEN: {
// Destroy file descriptor pool, which should close the file
Pool.destroy(state.fdpool);
Socket.timeoutSet(state.socket, getConnectionTimeout() * 1000);
// Put the socket back in the poller for
// processing of further requests
getPoller().add(state.socket, getKeepAliveTimeout(),
Poll.APR_POLLIN);
break;
}
}
}
}
} else if (rv < 0) {
int errn = -rv;
/* Any non timeup or interrupted error is critical */
if ((errn != Status.TIMEUP) && (errn != Status.EINTR)) {
if (errn > Status.APR_OS_START_USERERR) {
errn -= Status.APR_OS_START_USERERR;
}
getLog().error(sm.getString(
"endpoint.apr.pollError",
Integer.valueOf(errn),
Error.strerror(errn)));
// Handle poll critical failure
synchronized (this) {
destroy();
init();
}
continue;
}
}
// Call maintain for the sendfile poller
if (getConnectionTimeout() > 0 &&
maintainTime > 1000000L && sendfileRunning) {
rv = Poll.maintain(sendfilePollset, desc, false);
maintainTime = 0;
if (rv > 0) {
for (int n = 0; n < rv; n++) {
// Get the sendfile state
SendfileData state = sendfileData.get(Long.valueOf(desc[n]));
// Close socket and clear pool
remove(state);
// Destroy file descriptor pool, which should close the file
// Close the socket, as the response would be incomplete
closeSocket(state.socket);
}
}
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
getLog().error(sm.getString("endpoint.poll.error"), t);
}
}
synchronized (this) {
this.notifyAll();
}
} | /**
* The background thread that listens for incoming TCP/IP connections
* and hands them off to an appropriate processor.
*/ | The background thread that listens for incoming TCP/IP connections
and hands them off to an appropriate processor. | [
"The",
"background",
"thread",
"that",
"listens",
"for",
"incoming",
"TCP",
"/",
"IP",
"connections",
"and",
"hands",
"them",
"off",
"to",
"an",
"appropriate",
"processor",
"."
] | @Override
public void run() {
long maintainTime = 0;
while (sendfileRunning) {
while (sendfileRunning && paused) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
while (sendfileRunning && sendfileCount < 1 && addS.size() < 1) {
maintainTime = 0;
try {
synchronized (this) {
if (sendfileRunning && sendfileCount < 1 && addS.size() < 1) {
this.wait();
}
}
} catch (InterruptedException e) {
}
}
if (!sendfileRunning) {
break;
}
try {
if (addS.size() > 0) {
synchronized (this) {
for (int i = (addS.size() - 1); i >= 0; i--) {
SendfileData data = addS.get(i);
int rv = Poll.add(sendfilePollset, data.socket, Poll.APR_POLLOUT);
if (rv == Status.APR_SUCCESS) {
sendfileData.put(Long.valueOf(data.socket), data);
sendfileCount++;
} else {
getLog().warn(sm.getString(
"endpoint.sendfile.addfail",
Integer.valueOf(rv),
Error.strerror(rv)));
closeSocket(data.socket);
}
}
addS.clear();
}
}
maintainTime += pollTime;
int rv = Poll.poll(sendfilePollset, pollTime, desc, false);
if (rv > 0) {
for (int n = 0; n < rv; n++) {
SendfileData state =
sendfileData.get(Long.valueOf(desc[n*2+1]));
if (((desc[n*2] & Poll.APR_POLLHUP) == Poll.APR_POLLHUP)
|| ((desc[n*2] & Poll.APR_POLLERR) == Poll.APR_POLLERR)) {
remove(state);
closeSocket(state.socket);
continue;
}
long nw = Socket.sendfilen(state.socket, state.fd,
state.pos,
state.length, 0);
if (nw < 0) {
remove(state);
closeSocket(state.socket);
continue;
}
state.pos += nw;
state.length -= nw;
if (state.length == 0) {
remove(state);
switch (state.keepAliveState) {
case NONE: {
closeSocket(state.socket);
break;
}
case PIPELINED: {
Pool.destroy(state.fdpool);
Socket.timeoutSet(state.socket, getConnectionTimeout() * 1000);
if (!processSocket(state.socket, SocketEvent.OPEN_READ)) {
closeSocket(state.socket);
}
break;
}
case OPEN: {
Pool.destroy(state.fdpool);
Socket.timeoutSet(state.socket, getConnectionTimeout() * 1000);
getPoller().add(state.socket, getKeepAliveTimeout(),
Poll.APR_POLLIN);
break;
}
}
}
}
} else if (rv < 0) {
int errn = -rv;
/* Any non timeup or interrupted error is critical */
if ((errn != Status.TIMEUP) && (errn != Status.EINTR)) {
if (errn > Status.APR_OS_START_USERERR) {
errn -= Status.APR_OS_START_USERERR;
}
getLog().error(sm.getString(
"endpoint.apr.pollError",
Integer.valueOf(errn),
Error.strerror(errn)));
synchronized (this) {
destroy();
init();
}
continue;
}
}
if (getConnectionTimeout() > 0 &&
maintainTime > 1000000L && sendfileRunning) {
rv = Poll.maintain(sendfilePollset, desc, false);
maintainTime = 0;
if (rv > 0) {
for (int n = 0; n < rv; n++) {
SendfileData state = sendfileData.get(Long.valueOf(desc[n]));
remove(state);
closeSocket(state.socket);
}
}
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
getLog().error(sm.getString("endpoint.poll.error"), t);
}
}
synchronized (this) {
this.notifyAll();
}
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"long",
"maintainTime",
"=",
"0",
";",
"while",
"(",
"sendfileRunning",
")",
"{",
"while",
"(",
"sendfileRunning",
"&&",
"paused",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}",
"while",
"(",
"sendfileRunning",
"&&",
"sendfileCount",
"<",
"1",
"&&",
"addS",
".",
"size",
"(",
")",
"<",
"1",
")",
"{",
"maintainTime",
"=",
"0",
";",
"try",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"sendfileRunning",
"&&",
"sendfileCount",
"<",
"1",
"&&",
"addS",
".",
"size",
"(",
")",
"<",
"1",
")",
"{",
"this",
".",
"wait",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}",
"if",
"(",
"!",
"sendfileRunning",
")",
"{",
"break",
";",
"}",
"try",
"{",
"if",
"(",
"addS",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"(",
"addS",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"SendfileData",
"data",
"=",
"addS",
".",
"get",
"(",
"i",
")",
";",
"int",
"rv",
"=",
"Poll",
".",
"add",
"(",
"sendfilePollset",
",",
"data",
".",
"socket",
",",
"Poll",
".",
"APR_POLLOUT",
")",
";",
"if",
"(",
"rv",
"==",
"Status",
".",
"APR_SUCCESS",
")",
"{",
"sendfileData",
".",
"put",
"(",
"Long",
".",
"valueOf",
"(",
"data",
".",
"socket",
")",
",",
"data",
")",
";",
"sendfileCount",
"++",
";",
"}",
"else",
"{",
"getLog",
"(",
")",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.sendfile.addfail\"",
",",
"Integer",
".",
"valueOf",
"(",
"rv",
")",
",",
"Error",
".",
"strerror",
"(",
"rv",
")",
")",
")",
";",
"closeSocket",
"(",
"data",
".",
"socket",
")",
";",
"}",
"}",
"addS",
".",
"clear",
"(",
")",
";",
"}",
"}",
"maintainTime",
"+=",
"pollTime",
";",
"int",
"rv",
"=",
"Poll",
".",
"poll",
"(",
"sendfilePollset",
",",
"pollTime",
",",
"desc",
",",
"false",
")",
";",
"if",
"(",
"rv",
">",
"0",
")",
"{",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"rv",
";",
"n",
"++",
")",
"{",
"SendfileData",
"state",
"=",
"sendfileData",
".",
"get",
"(",
"Long",
".",
"valueOf",
"(",
"desc",
"[",
"n",
"*",
"2",
"+",
"1",
"]",
")",
")",
";",
"if",
"(",
"(",
"(",
"desc",
"[",
"n",
"*",
"2",
"]",
"&",
"Poll",
".",
"APR_POLLHUP",
")",
"==",
"Poll",
".",
"APR_POLLHUP",
")",
"||",
"(",
"(",
"desc",
"[",
"n",
"*",
"2",
"]",
"&",
"Poll",
".",
"APR_POLLERR",
")",
"==",
"Poll",
".",
"APR_POLLERR",
")",
")",
"{",
"remove",
"(",
"state",
")",
";",
"closeSocket",
"(",
"state",
".",
"socket",
")",
";",
"continue",
";",
"}",
"long",
"nw",
"=",
"Socket",
".",
"sendfilen",
"(",
"state",
".",
"socket",
",",
"state",
".",
"fd",
",",
"state",
".",
"pos",
",",
"state",
".",
"length",
",",
"0",
")",
";",
"if",
"(",
"nw",
"<",
"0",
")",
"{",
"remove",
"(",
"state",
")",
";",
"closeSocket",
"(",
"state",
".",
"socket",
")",
";",
"continue",
";",
"}",
"state",
".",
"pos",
"+=",
"nw",
";",
"state",
".",
"length",
"-=",
"nw",
";",
"if",
"(",
"state",
".",
"length",
"==",
"0",
")",
"{",
"remove",
"(",
"state",
")",
";",
"switch",
"(",
"state",
".",
"keepAliveState",
")",
"{",
"case",
"NONE",
":",
"{",
"closeSocket",
"(",
"state",
".",
"socket",
")",
";",
"break",
";",
"}",
"case",
"PIPELINED",
":",
"{",
"Pool",
".",
"destroy",
"(",
"state",
".",
"fdpool",
")",
";",
"Socket",
".",
"timeoutSet",
"(",
"state",
".",
"socket",
",",
"getConnectionTimeout",
"(",
")",
"*",
"1000",
")",
";",
"if",
"(",
"!",
"processSocket",
"(",
"state",
".",
"socket",
",",
"SocketEvent",
".",
"OPEN_READ",
")",
")",
"{",
"closeSocket",
"(",
"state",
".",
"socket",
")",
";",
"}",
"break",
";",
"}",
"case",
"OPEN",
":",
"{",
"Pool",
".",
"destroy",
"(",
"state",
".",
"fdpool",
")",
";",
"Socket",
".",
"timeoutSet",
"(",
"state",
".",
"socket",
",",
"getConnectionTimeout",
"(",
")",
"*",
"1000",
")",
";",
"getPoller",
"(",
")",
".",
"add",
"(",
"state",
".",
"socket",
",",
"getKeepAliveTimeout",
"(",
")",
",",
"Poll",
".",
"APR_POLLIN",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"rv",
"<",
"0",
")",
"{",
"int",
"errn",
"=",
"-",
"rv",
";",
"/* Any non timeup or interrupted error is critical */",
"if",
"(",
"(",
"errn",
"!=",
"Status",
".",
"TIMEUP",
")",
"&&",
"(",
"errn",
"!=",
"Status",
".",
"EINTR",
")",
")",
"{",
"if",
"(",
"errn",
">",
"Status",
".",
"APR_OS_START_USERERR",
")",
"{",
"errn",
"-=",
"Status",
".",
"APR_OS_START_USERERR",
";",
"}",
"getLog",
"(",
")",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.apr.pollError\"",
",",
"Integer",
".",
"valueOf",
"(",
"errn",
")",
",",
"Error",
".",
"strerror",
"(",
"errn",
")",
")",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"destroy",
"(",
")",
";",
"init",
"(",
")",
";",
"}",
"continue",
";",
"}",
"}",
"if",
"(",
"getConnectionTimeout",
"(",
")",
">",
"0",
"&&",
"maintainTime",
">",
"1000000L",
"&&",
"sendfileRunning",
")",
"{",
"rv",
"=",
"Poll",
".",
"maintain",
"(",
"sendfilePollset",
",",
"desc",
",",
"false",
")",
";",
"maintainTime",
"=",
"0",
";",
"if",
"(",
"rv",
">",
"0",
")",
"{",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"rv",
";",
"n",
"++",
")",
"{",
"SendfileData",
"state",
"=",
"sendfileData",
".",
"get",
"(",
"Long",
".",
"valueOf",
"(",
"desc",
"[",
"n",
"]",
")",
")",
";",
"remove",
"(",
"state",
")",
";",
"closeSocket",
"(",
"state",
".",
"socket",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtils",
".",
"handleThrowable",
"(",
"t",
")",
";",
"getLog",
"(",
")",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"endpoint.poll.error\"",
")",
",",
"t",
")",
";",
"}",
"}",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"notifyAll",
"(",
")",
";",
"}",
"}"
] | The background thread that listens for incoming TCP/IP connections
and hands them off to an appropriate processor. | [
"The",
"background",
"thread",
"that",
"listens",
"for",
"incoming",
"TCP",
"/",
"IP",
"connections",
"and",
"hands",
"them",
"off",
"to",
"an",
"appropriate",
"processor",
"."
] | [
"// Loop until we receive a shutdown command",
"// Loop if endpoint is paused",
"// Ignore",
"// Loop if poller is empty",
"// Reset maintain time.",
"// Ignore",
"// Don't add or poll if the poller has been stopped",
"// Add socket to the poller",
"// Can't do anything: close the socket right away",
"// Pool for the specified interval",
"// Get the sendfile state",
"// Problem events",
"// Close socket and clear pool",
"// Destroy file descriptor pool, which should close the file",
"// Close the socket, as the response would be incomplete",
"// Write some data using sendfile",
"// Close socket and clear pool",
"// Close the socket, as the response would be incomplete",
"// This will close the file too.",
"// Close the socket since this is",
"// the end of the not keep-alive request.",
"// Destroy file descriptor pool, which should close the file",
"// Process the pipelined request data",
"// Destroy file descriptor pool, which should close the file",
"// Put the socket back in the poller for",
"// processing of further requests",
"// Handle poll critical failure",
"// Call maintain for the sendfile poller",
"// Get the sendfile state",
"// Close socket and clear pool",
"// Destroy file descriptor pool, which should close the file",
"// Close the socket, as the response would be incomplete"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
3639,
1071,
918,
1086,
1435,
288,
203,
203,
5411,
1525,
17505,
950,
273,
374,
31,
203,
5411,
368,
9720,
3180,
732,
6798,
279,
5731,
1296,
203,
5411,
1323,
261,
4661,
768,
7051,
13,
288,
203,
203,
7734,
368,
9720,
309,
2494,
353,
17781,
203,
7734,
1323,
261,
4661,
768,
7051,
597,
17781,
13,
288,
203,
10792,
775,
288,
203,
13491,
4884,
18,
19607,
12,
18088,
1769,
203,
10792,
289,
1044,
261,
24485,
503,
425,
13,
288,
203,
13491,
368,
8049,
203,
10792,
289,
203,
7734,
289,
203,
7734,
368,
9720,
309,
24525,
353,
1008,
203,
7734,
1323,
261,
4661,
768,
7051,
597,
1366,
768,
1380,
411,
404,
597,
527,
55,
18,
1467,
1435,
411,
404,
13,
288,
203,
10792,
368,
7151,
17505,
813,
18,
203,
10792,
17505,
950,
273,
374,
31,
203,
10792,
775,
288,
203,
13491,
3852,
261,
2211,
13,
288,
203,
18701,
309,
261,
4661,
768,
7051,
597,
1366,
768,
1380,
411,
404,
597,
527,
55,
18,
1467,
1435,
411,
404,
13,
288,
203,
27573,
333,
18,
7048,
5621,
203,
18701,
289,
203,
13491,
289,
203,
10792,
289,
1044,
261,
24485,
503,
425,
13,
288,
203,
13491,
368,
8049,
203,
10792,
289,
203,
7734,
289,
203,
203,
7734,
368,
7615,
1404,
527,
578,
7672,
309,
326,
24525,
711,
2118,
9627,
203,
7734,
309,
16051,
4661,
768,
7051,
13,
288,
203,
10792,
898,
31,
203,
7734,
289,
203,
203,
7734,
775,
288,
203,
10792,
368,
1436,
2987,
358,
326,
24525,
203,
10792,
309,
261,
1289,
55,
18,
1467,
1435,
405,
374,
13,
288,
203,
13491,
3852,
261,
2211,
13,
288,
203,
18701,
364,
261,
474,
277,
273,
261,
1289,
55,
18,
1467,
1435,
300,
404,
1769,
277,
1545,
374,
31,
277,
413,
13,
288,
203,
27573,
2479,
768,
751,
501,
273,
527,
55,
18,
588,
12,
77,
1769,
203,
27573,
509,
5633,
273,
19160,
18,
1289,
12,
4661,
768,
19085,
542,
16,
501,
18,
7814,
16,
19160,
18,
2203,
54,
67,
14232,
1502,
1693,
1769,
203,
27573,
309,
261,
4962,
422,
2685,
18,
2203,
54,
67,
12778,
13,
288,
203,
4766,
565,
1366,
768,
751,
18,
458,
12,
3708,
18,
1132,
951,
12,
892,
18,
7814,
3631,
501,
1769,
203,
4766,
565,
1366,
768,
1380,
9904,
31,
203,
27573,
289,
469,
288,
203,
4766,
565,
9189,
7675,
8935,
12,
4808,
18,
588,
780,
12,
203,
4766,
5411,
315,
8003,
18,
4661,
768,
18,
1289,
6870,
3113,
203,
4766,
5411,
2144,
18,
1132,
951,
12,
4962,
3631,
203,
4766,
5411,
1068,
18,
701,
1636,
12,
4962,
3719,
1769,
203,
4766,
565,
368,
4480,
1404,
741,
6967,
30,
1746,
326,
2987,
2145,
10804,
203,
4766,
565,
1746,
4534,
12,
892,
18,
7814,
1769,
203,
27573,
289,
203,
18701,
289,
203,
18701,
527,
55,
18,
8507,
5621,
203,
13491,
289,
203,
10792,
289,
203,
203,
10792,
17505,
950,
1011,
7672,
950,
31,
203,
10792,
368,
8828,
364,
326,
1269,
3673,
203,
10792,
509,
5633,
273,
19160,
18,
13835,
12,
4661,
768,
19085,
542,
16,
7672,
950,
16,
3044,
16,
629,
1769,
203,
10792,
309,
261,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
540,
380,
1021,
5412,
2650,
716,
666,
773,
364,
6935,
9911,
19,
2579,
5921,
203,
540,
380,
471,
948,
87,
2182,
3397,
358,
392,
5505,
6659,
18,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6799dcf697315a5db93cc61c2baff7ff31a2418a | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/AsyncStateMachine.java | [
"MIT"
] | Java | asyncPostProcess | SocketState | public synchronized SocketState asyncPostProcess() {
if (state == AsyncState.COMPLETE_PENDING) {
clearNonBlockingListeners();
state = AsyncState.COMPLETING;
return SocketState.ASYNC_END;
} else if (state == AsyncState.DISPATCH_PENDING) {
clearNonBlockingListeners();
state = AsyncState.DISPATCHING;
return SocketState.ASYNC_END;
} else if (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP) {
state = AsyncState.STARTED;
return SocketState.LONG;
} else if (state == AsyncState.MUST_COMPLETE || state == AsyncState.COMPLETING) {
asyncCtxt.fireOnComplete();
state = AsyncState.DISPATCHED;
return SocketState.ASYNC_END;
} else if (state == AsyncState.MUST_DISPATCH) {
state = AsyncState.DISPATCHING;
return SocketState.ASYNC_END;
} else if (state == AsyncState.DISPATCHING) {
state = AsyncState.DISPATCHED;
return SocketState.ASYNC_END;
} else if (state == AsyncState.STARTED) {
// This can occur if an async listener does a dispatch to an async
// servlet during onTimeout
return SocketState.LONG;
} else {
throw new IllegalStateException(
sm.getString("asyncStateMachine.invalidAsyncState",
"asyncPostProcess()", state));
}
} | /*
* Async has been processed. Whether or not to enter a long poll depends on
* current state. For example, as per SRV.2.3.3.3 can now process calls to
* complete() or dispatch().
*/ | Async has been processed. Whether or not to enter a long poll depends on
current state. For example, as per SRV.2.3.3.3 can now process calls to
complete() or dispatch(). | [
"Async",
"has",
"been",
"processed",
".",
"Whether",
"or",
"not",
"to",
"enter",
"a",
"long",
"poll",
"depends",
"on",
"current",
"state",
".",
"For",
"example",
"as",
"per",
"SRV",
".",
"2",
".",
"3",
".",
"3",
".",
"3",
"can",
"now",
"process",
"calls",
"to",
"complete",
"()",
"or",
"dispatch",
"()",
"."
] | public synchronized SocketState asyncPostProcess() {
if (state == AsyncState.COMPLETE_PENDING) {
clearNonBlockingListeners();
state = AsyncState.COMPLETING;
return SocketState.ASYNC_END;
} else if (state == AsyncState.DISPATCH_PENDING) {
clearNonBlockingListeners();
state = AsyncState.DISPATCHING;
return SocketState.ASYNC_END;
} else if (state == AsyncState.STARTING || state == AsyncState.READ_WRITE_OP) {
state = AsyncState.STARTED;
return SocketState.LONG;
} else if (state == AsyncState.MUST_COMPLETE || state == AsyncState.COMPLETING) {
asyncCtxt.fireOnComplete();
state = AsyncState.DISPATCHED;
return SocketState.ASYNC_END;
} else if (state == AsyncState.MUST_DISPATCH) {
state = AsyncState.DISPATCHING;
return SocketState.ASYNC_END;
} else if (state == AsyncState.DISPATCHING) {
state = AsyncState.DISPATCHED;
return SocketState.ASYNC_END;
} else if (state == AsyncState.STARTED) {
return SocketState.LONG;
} else {
throw new IllegalStateException(
sm.getString("asyncStateMachine.invalidAsyncState",
"asyncPostProcess()", state));
}
} | [
"public",
"synchronized",
"SocketState",
"asyncPostProcess",
"(",
")",
"{",
"if",
"(",
"state",
"==",
"AsyncState",
".",
"COMPLETE_PENDING",
")",
"{",
"clearNonBlockingListeners",
"(",
")",
";",
"state",
"=",
"AsyncState",
".",
"COMPLETING",
";",
"return",
"SocketState",
".",
"ASYNC_END",
";",
"}",
"else",
"if",
"(",
"state",
"==",
"AsyncState",
".",
"DISPATCH_PENDING",
")",
"{",
"clearNonBlockingListeners",
"(",
")",
";",
"state",
"=",
"AsyncState",
".",
"DISPATCHING",
";",
"return",
"SocketState",
".",
"ASYNC_END",
";",
"}",
"else",
"if",
"(",
"state",
"==",
"AsyncState",
".",
"STARTING",
"||",
"state",
"==",
"AsyncState",
".",
"READ_WRITE_OP",
")",
"{",
"state",
"=",
"AsyncState",
".",
"STARTED",
";",
"return",
"SocketState",
".",
"LONG",
";",
"}",
"else",
"if",
"(",
"state",
"==",
"AsyncState",
".",
"MUST_COMPLETE",
"||",
"state",
"==",
"AsyncState",
".",
"COMPLETING",
")",
"{",
"asyncCtxt",
".",
"fireOnComplete",
"(",
")",
";",
"state",
"=",
"AsyncState",
".",
"DISPATCHED",
";",
"return",
"SocketState",
".",
"ASYNC_END",
";",
"}",
"else",
"if",
"(",
"state",
"==",
"AsyncState",
".",
"MUST_DISPATCH",
")",
"{",
"state",
"=",
"AsyncState",
".",
"DISPATCHING",
";",
"return",
"SocketState",
".",
"ASYNC_END",
";",
"}",
"else",
"if",
"(",
"state",
"==",
"AsyncState",
".",
"DISPATCHING",
")",
"{",
"state",
"=",
"AsyncState",
".",
"DISPATCHED",
";",
"return",
"SocketState",
".",
"ASYNC_END",
";",
"}",
"else",
"if",
"(",
"state",
"==",
"AsyncState",
".",
"STARTED",
")",
"{",
"return",
"SocketState",
".",
"LONG",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"sm",
".",
"getString",
"(",
"\"asyncStateMachine.invalidAsyncState\"",
",",
"\"asyncPostProcess()\"",
",",
"state",
")",
")",
";",
"}",
"}"
] | Async has been processed. | [
"Async",
"has",
"been",
"processed",
"."
] | [
"// This can occur if an async listener does a dispatch to an async",
"// servlet during onTimeout"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
3852,
8758,
1119,
4326,
3349,
2227,
1435,
288,
203,
3639,
309,
261,
2019,
422,
9672,
1119,
18,
15795,
67,
25691,
13,
288,
203,
5411,
2424,
3989,
8728,
5583,
5621,
203,
5411,
919,
273,
9672,
1119,
18,
10057,
15146,
1360,
31,
203,
5411,
327,
8758,
1119,
18,
3033,
31301,
67,
4415,
31,
203,
3639,
289,
469,
309,
261,
2019,
422,
9672,
1119,
18,
2565,
3118,
5858,
67,
25691,
13,
288,
203,
5411,
2424,
3989,
8728,
5583,
5621,
203,
5411,
919,
273,
9672,
1119,
18,
2565,
3118,
5858,
1360,
31,
203,
5411,
327,
8758,
1119,
18,
3033,
31301,
67,
4415,
31,
203,
3639,
289,
469,
225,
309,
261,
2019,
422,
9672,
1119,
18,
7570,
1360,
747,
919,
422,
9672,
1119,
18,
6949,
67,
11677,
67,
3665,
13,
288,
203,
5411,
919,
273,
9672,
1119,
18,
20943,
6404,
31,
203,
5411,
327,
8758,
1119,
18,
14639,
31,
203,
3639,
289,
469,
309,
261,
2019,
422,
9672,
1119,
18,
49,
5996,
67,
15795,
747,
919,
422,
9672,
1119,
18,
10057,
15146,
1360,
13,
288,
203,
5411,
4326,
28866,
18,
12179,
1398,
6322,
5621,
203,
5411,
919,
273,
9672,
1119,
18,
2565,
3118,
5858,
2056,
31,
203,
5411,
327,
8758,
1119,
18,
3033,
31301,
67,
4415,
31,
203,
3639,
289,
469,
309,
261,
2019,
422,
9672,
1119,
18,
49,
5996,
67,
2565,
3118,
5858,
13,
288,
203,
5411,
919,
273,
9672,
1119,
18,
2565,
3118,
5858,
1360,
31,
203,
5411,
327,
8758,
1119,
18,
3033,
31301,
67,
4415,
31,
203,
3639,
289,
469,
309,
261,
2019,
422,
9672,
1119,
18,
2565,
3118,
5858,
1360,
13,
288,
203,
5411,
919,
273,
9672,
1119,
18,
2565,
3118,
5858,
2056,
31,
203,
5411,
327,
8758,
1119,
18,
3033,
31301,
67,
4415,
31,
203,
3639,
289,
469,
309,
261,
2019,
422,
9672,
1119,
18,
20943,
6404,
13,
288,
203,
5411,
368,
1220,
848,
3334,
309,
392,
4326,
2991,
1552,
279,
3435,
358,
392,
4326,
203,
5411,
368,
8100,
4982,
603,
2694,
203,
5411,
327,
8758,
1119,
18,
14639,
31,
203,
3639,
289,
469,
288,
203,
5411,
604,
394,
5477,
12,
203,
10792,
3029,
18,
588,
780,
2932,
3810,
1119,
6981,
18,
5387,
2771,
1119,
3113,
203,
18701,
315,
3810,
3349,
2227,
1435,
3113,
919,
10019,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
377,
380,
9672,
711,
2118,
5204,
18,
17403,
578,
486,
358,
6103,
279,
1525,
7672,
10935,
603,
203,
377,
380,
783,
919,
18,
2457,
3454,
16,
487,
1534,
19145,
58,
18,
22,
18,
23,
18,
23,
18,
23,
848,
2037,
1207,
4097,
358,
203,
377,
380,
3912,
1435,
578,
3435,
7675,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c96cbb4f4ac973bb3ddae97c0e22ba07780eb0b3 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/OutputBuffer.java | [
"MIT"
] | Java | close | null | @Override
public void close() throws IOException {
if (closed) {
return;
}
if (suspended) {
return;
}
// If there are chars, flush all of them to the byte buffer now as bytes are used to
// calculate the content-length (if everything fits into the byte buffer, of course).
if (cb.remaining() > 0) {
flushCharBuffer();
}
if ((!coyoteResponse.isCommitted()) && (coyoteResponse.getContentLengthLong() == -1)
&& !coyoteResponse.getRequest().method().equals("HEAD")) {
// If this didn't cause a commit of the response, the final content
// length can be calculated. Only do this if this is not a HEAD
// request since in that case no body should have been written and
// setting a value of zero here will result in an explicit content
// length of zero being set on the response.
if (!coyoteResponse.isCommitted()) {
coyoteResponse.setContentLength(bb.remaining());
}
}
if (coyoteResponse.getStatus() == HttpServletResponse.SC_SWITCHING_PROTOCOLS) {
doFlush(true);
} else {
/**
*{@link Response#action(org.apache.coyote.ActionCode, java.lang.Object)}
*/
doFlush(false);
}
closed = true;
// The request should have been completely read by the time the response
// is closed. Further reads of the input a) are pointless and b) really
// confuse AJP (bug 50189) so close the input buffer to prevent them.
Request req = (Request) coyoteResponse.getRequest().getNote(CoyoteAdapter.ADAPTER_NOTES);
req.inputBuffer.close();
coyoteResponse.action(ActionCode.CLOSE, null);
} | /**
* Close the output buffer. This tries to calculate the response size if
* the response has not been committed yet.
*
* @throws IOException An underlying IOException occurred
*/ | Close the output buffer. This tries to calculate the response size if
the response has not been committed yet.
| [
"Close",
"the",
"output",
"buffer",
".",
"This",
"tries",
"to",
"calculate",
"the",
"response",
"size",
"if",
"the",
"response",
"has",
"not",
"been",
"committed",
"yet",
"."
] | @Override
public void close() throws IOException {
if (closed) {
return;
}
if (suspended) {
return;
}
if (cb.remaining() > 0) {
flushCharBuffer();
}
if ((!coyoteResponse.isCommitted()) && (coyoteResponse.getContentLengthLong() == -1)
&& !coyoteResponse.getRequest().method().equals("HEAD")) {
if (!coyoteResponse.isCommitted()) {
coyoteResponse.setContentLength(bb.remaining());
}
}
if (coyoteResponse.getStatus() == HttpServletResponse.SC_SWITCHING_PROTOCOLS) {
doFlush(true);
} else {
/**
*{@link Response#action(org.apache.coyote.ActionCode, java.lang.Object)}
*/
doFlush(false);
}
closed = true;
Request req = (Request) coyoteResponse.getRequest().getNote(CoyoteAdapter.ADAPTER_NOTES);
req.inputBuffer.close();
coyoteResponse.action(ActionCode.CLOSE, null);
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"closed",
")",
"{",
"return",
";",
"}",
"if",
"(",
"suspended",
")",
"{",
"return",
";",
"}",
"if",
"(",
"cb",
".",
"remaining",
"(",
")",
">",
"0",
")",
"{",
"flushCharBuffer",
"(",
")",
";",
"}",
"if",
"(",
"(",
"!",
"coyoteResponse",
".",
"isCommitted",
"(",
")",
")",
"&&",
"(",
"coyoteResponse",
".",
"getContentLengthLong",
"(",
")",
"==",
"-",
"1",
")",
"&&",
"!",
"coyoteResponse",
".",
"getRequest",
"(",
")",
".",
"method",
"(",
")",
".",
"equals",
"(",
"\"HEAD\"",
")",
")",
"{",
"if",
"(",
"!",
"coyoteResponse",
".",
"isCommitted",
"(",
")",
")",
"{",
"coyoteResponse",
".",
"setContentLength",
"(",
"bb",
".",
"remaining",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"coyoteResponse",
".",
"getStatus",
"(",
")",
"==",
"HttpServletResponse",
".",
"SC_SWITCHING_PROTOCOLS",
")",
"{",
"doFlush",
"(",
"true",
")",
";",
"}",
"else",
"{",
"/**\n *{@link Response#action(org.apache.coyote.ActionCode, java.lang.Object)}\n */",
"doFlush",
"(",
"false",
")",
";",
"}",
"closed",
"=",
"true",
";",
"Request",
"req",
"=",
"(",
"Request",
")",
"coyoteResponse",
".",
"getRequest",
"(",
")",
".",
"getNote",
"(",
"CoyoteAdapter",
".",
"ADAPTER_NOTES",
")",
";",
"req",
".",
"inputBuffer",
".",
"close",
"(",
")",
";",
"coyoteResponse",
".",
"action",
"(",
"ActionCode",
".",
"CLOSE",
",",
"null",
")",
";",
"}"
] | Close the output buffer. | [
"Close",
"the",
"output",
"buffer",
"."
] | [
"// If there are chars, flush all of them to the byte buffer now as bytes are used to",
"// calculate the content-length (if everything fits into the byte buffer, of course).",
"// If this didn't cause a commit of the response, the final content",
"// length can be calculated. Only do this if this is not a HEAD",
"// request since in that case no body should have been written and",
"// setting a value of zero here will result in an explicit content",
"// length of zero being set on the response.",
"// The request should have been completely read by the time the response",
"// is closed. Further reads of the input a) are pointless and b) really",
"// confuse AJP (bug 50189) so close the input buffer to prevent them."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
1746,
1435,
1216,
1860,
288,
203,
203,
3639,
309,
261,
12204,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
3639,
309,
261,
87,
22942,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
368,
971,
1915,
854,
5230,
16,
3663,
777,
434,
2182,
358,
326,
1160,
1613,
2037,
487,
1731,
854,
1399,
358,
203,
3639,
368,
4604,
326,
913,
17,
2469,
261,
430,
7756,
13351,
1368,
326,
1160,
1613,
16,
434,
4362,
2934,
203,
3639,
309,
261,
7358,
18,
17956,
1435,
405,
374,
13,
288,
203,
5411,
3663,
2156,
1892,
5621,
203,
3639,
289,
203,
203,
3639,
309,
14015,
5,
2894,
93,
1168,
1064,
18,
291,
27813,
10756,
597,
261,
2894,
93,
1168,
1064,
18,
588,
1350,
1782,
3708,
1435,
422,
300,
21,
13,
203,
7734,
597,
401,
2894,
93,
1168,
1064,
18,
588,
691,
7675,
2039,
7675,
14963,
2932,
12458,
6,
3719,
288,
203,
5411,
368,
971,
333,
10242,
1404,
4620,
279,
3294,
434,
326,
766,
16,
326,
727,
913,
203,
5411,
368,
769,
848,
506,
8894,
18,
5098,
741,
333,
309,
333,
353,
486,
279,
14792,
203,
5411,
368,
590,
3241,
316,
716,
648,
1158,
1417,
1410,
1240,
2118,
5941,
471,
203,
5411,
368,
3637,
279,
460,
434,
3634,
2674,
903,
563,
316,
392,
5515,
913,
203,
5411,
368,
769,
434,
3634,
3832,
444,
603,
326,
766,
18,
203,
5411,
309,
16051,
2894,
93,
1168,
1064,
18,
291,
27813,
10756,
288,
203,
7734,
1825,
93,
1168,
1064,
18,
542,
1350,
1782,
12,
9897,
18,
17956,
10663,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
309,
261,
2894,
93,
1168,
1064,
18,
588,
1482,
1435,
422,
12446,
18,
2312,
67,
18746,
25588,
1360,
67,
16850,
55,
13,
288,
203,
5411,
741,
8207,
12,
3767,
1769,
203,
3639,
289,
469,
288,
203,
5411,
1783,
203,
2398,
380,
95,
36,
1232,
2306,
7,
1128,
12,
3341,
18,
19211,
18,
2894,
93,
1168,
18,
1803,
1085,
16,
2252,
18,
4936,
18,
921,
16869,
203,
2398,
1195,
203,
5411,
741,
8207,
12,
5743,
1769,
203,
3639,
289,
203,
3639,
4375,
273,
638,
31,
203,
203,
3639,
368,
1021,
590,
1410,
1240,
2118,
14416,
855,
635,
326,
813,
326,
766,
203,
3639,
368,
353,
4375,
18,
478,
8753,
6838,
434,
326,
810,
279,
13,
854,
1634,
2656,
471,
324,
13,
8654,
203,
3639,
368,
2195,
1202,
432,
29532,
261,
925,
1381,
1611,
6675,
13,
1427,
1746,
326,
810,
1613,
358,
5309,
2182,
18,
203,
3639,
1567,
1111,
273,
261,
691,
13,
1825,
93,
1168,
1064,
18,
588,
691,
7675,
588,
8067,
12,
4249,
93,
1168,
4216,
18,
1880,
37,
1856,
654,
67,
3417,
7296,
1769,
203,
3639,
1111,
18,
2630,
1892,
18,
4412,
5621,
203,
203,
3639,
1825,
93,
1168,
1064,
18,
1128,
12,
1803,
1085,
18,
13384,
16,
446,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3527,
326,
876,
1613,
18,
1220,
9327,
358,
4604,
326,
766,
963,
309,
203,
377,
380,
326,
766,
711,
486,
2118,
16015,
4671,
18,
203,
377,
380,
203,
377,
380,
632,
15069,
1860,
1922,
6808,
1860,
7841,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c96cbb4f4ac973bb3ddae97c0e22ba07780eb0b3 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/OutputBuffer.java | [
"MIT"
] | Java | realWriteBytes | null | public void realWriteBytes(ByteBuffer buf) throws IOException {
if (closed) {
return;
}
if (coyoteResponse == null) {
return;
}
// If we really have something to write
if (buf.remaining() > 0) {
// real write to the adapter
try {
coyoteResponse.doWrite(buf);
} catch (CloseNowException e) {
// Catch this sub-class as it requires specific handling.
// Examples where this exception is thrown:
// - HTTP/2 stream timeout
// Prevent further output for this response
closed = true;
throw e;
} catch (IOException e) {
// An IOException on a write is almost always due to
// the remote client aborting the request. Wrap this
// so that it can be handled better by the error dispatcher.
throw new ClientAbortException(e);
}
}
} | /**
* Sends the buffer data to the client output, checking the
* state of Response and calling the right interceptors.
*
* @param buf the ByteBuffer to be written to the response
*
* @throws IOException An underlying IOException occurred
*/ | Sends the buffer data to the client output, checking the
state of Response and calling the right interceptors.
@param buf the ByteBuffer to be written to the response
| [
"Sends",
"the",
"buffer",
"data",
"to",
"the",
"client",
"output",
"checking",
"the",
"state",
"of",
"Response",
"and",
"calling",
"the",
"right",
"interceptors",
".",
"@param",
"buf",
"the",
"ByteBuffer",
"to",
"be",
"written",
"to",
"the",
"response"
] | public void realWriteBytes(ByteBuffer buf) throws IOException {
if (closed) {
return;
}
if (coyoteResponse == null) {
return;
}
if (buf.remaining() > 0) {
try {
coyoteResponse.doWrite(buf);
} catch (CloseNowException e) {
closed = true;
throw e;
} catch (IOException e) {
throw new ClientAbortException(e);
}
}
} | [
"public",
"void",
"realWriteBytes",
"(",
"ByteBuffer",
"buf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"closed",
")",
"{",
"return",
";",
"}",
"if",
"(",
"coyoteResponse",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"buf",
".",
"remaining",
"(",
")",
">",
"0",
")",
"{",
"try",
"{",
"coyoteResponse",
".",
"doWrite",
"(",
"buf",
")",
";",
"}",
"catch",
"(",
"CloseNowException",
"e",
")",
"{",
"closed",
"=",
"true",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"ClientAbortException",
"(",
"e",
")",
";",
"}",
"}",
"}"
] | Sends the buffer data to the client output, checking the
state of Response and calling the right interceptors. | [
"Sends",
"the",
"buffer",
"data",
"to",
"the",
"client",
"output",
"checking",
"the",
"state",
"of",
"Response",
"and",
"calling",
"the",
"right",
"interceptors",
"."
] | [
"// If we really have something to write",
"// real write to the adapter",
"// Catch this sub-class as it requires specific handling.",
"// Examples where this exception is thrown:",
"// - HTTP/2 stream timeout",
"// Prevent further output for this response",
"// An IOException on a write is almost always due to",
"// the remote client aborting the request. Wrap this",
"// so that it can be handled better by the error dispatcher."
] | [
{
"param": "buf",
"type": "ByteBuffer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buf",
"type": "ByteBuffer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
2863,
3067,
2160,
12,
12242,
1681,
13,
1216,
1860,
288,
203,
203,
3639,
309,
261,
12204,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
3639,
309,
261,
2894,
93,
1168,
1064,
422,
446,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
368,
971,
732,
8654,
1240,
5943,
358,
1045,
203,
3639,
309,
261,
4385,
18,
17956,
1435,
405,
374,
13,
288,
203,
5411,
368,
2863,
1045,
358,
326,
4516,
203,
5411,
775,
288,
203,
7734,
1825,
93,
1168,
1064,
18,
2896,
3067,
12,
4385,
1769,
203,
5411,
289,
1044,
261,
4605,
8674,
503,
425,
13,
288,
203,
7734,
368,
21984,
333,
720,
17,
1106,
487,
518,
4991,
2923,
5057,
18,
203,
7734,
368,
19830,
1625,
333,
1520,
353,
6718,
30,
203,
7734,
368,
300,
2239,
19,
22,
1407,
2021,
203,
7734,
368,
19412,
9271,
876,
364,
333,
766,
203,
7734,
4375,
273,
638,
31,
203,
7734,
604,
425,
31,
203,
5411,
289,
1044,
261,
14106,
425,
13,
288,
203,
7734,
368,
1922,
1860,
603,
279,
1045,
353,
23889,
3712,
6541,
358,
203,
7734,
368,
326,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2479,
87,
326,
1613,
501,
358,
326,
1004,
876,
16,
6728,
326,
203,
377,
380,
919,
434,
2306,
471,
4440,
326,
2145,
18496,
18,
203,
377,
380,
203,
377,
380,
632,
891,
1681,
326,
7400,
358,
506,
5941,
358,
326,
766,
203,
377,
380,
203,
377,
380,
632,
15069,
1860,
1922,
6808,
1860,
7841,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c96cbb4f4ac973bb3ddae97c0e22ba07780eb0b3 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/OutputBuffer.java | [
"MIT"
] | Java | write | null | @Override
public void write(String s, int off, int len) throws IOException {
if (suspended) {
return;
}
if (s == null) {
throw new NullPointerException(sm.getString("outputBuffer.writeNull"));
}
int sOff = off;
int sEnd = off + len;
while (sOff < sEnd) {
int n = transfer(s, sOff, sEnd - sOff, cb);
sOff += n;
if (isFull(cb)) {
flushCharBuffer();
}
}
charsWritten += len;
} | /**
* Append a string to the buffer
*/ | Append a string to the buffer | [
"Append",
"a",
"string",
"to",
"the",
"buffer"
] | @Override
public void write(String s, int off, int len) throws IOException {
if (suspended) {
return;
}
if (s == null) {
throw new NullPointerException(sm.getString("outputBuffer.writeNull"));
}
int sOff = off;
int sEnd = off + len;
while (sOff < sEnd) {
int n = transfer(s, sOff, sEnd - sOff, cb);
sOff += n;
if (isFull(cb)) {
flushCharBuffer();
}
}
charsWritten += len;
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"String",
"s",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"suspended",
")",
"{",
"return",
";",
"}",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"sm",
".",
"getString",
"(",
"\"outputBuffer.writeNull\"",
")",
")",
";",
"}",
"int",
"sOff",
"=",
"off",
";",
"int",
"sEnd",
"=",
"off",
"+",
"len",
";",
"while",
"(",
"sOff",
"<",
"sEnd",
")",
"{",
"int",
"n",
"=",
"transfer",
"(",
"s",
",",
"sOff",
",",
"sEnd",
"-",
"sOff",
",",
"cb",
")",
";",
"sOff",
"+=",
"n",
";",
"if",
"(",
"isFull",
"(",
"cb",
")",
")",
"{",
"flushCharBuffer",
"(",
")",
";",
"}",
"}",
"charsWritten",
"+=",
"len",
";",
"}"
] | Append a string to the buffer | [
"Append",
"a",
"string",
"to",
"the",
"buffer"
] | [] | [
{
"param": "s",
"type": "String"
},
{
"param": "off",
"type": "int"
},
{
"param": "len",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "len",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
1045,
12,
780,
272,
16,
509,
3397,
16,
509,
562,
13,
1216,
1860,
288,
203,
203,
3639,
309,
261,
87,
22942,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
309,
261,
87,
422,
446,
13,
288,
203,
5411,
604,
394,
10108,
12,
4808,
18,
588,
780,
2932,
2844,
1892,
18,
2626,
2041,
7923,
1769,
203,
3639,
289,
203,
203,
3639,
509,
272,
7210,
273,
3397,
31,
203,
3639,
509,
272,
1638,
273,
3397,
397,
562,
31,
203,
3639,
1323,
261,
87,
7210,
411,
272,
1638,
13,
288,
203,
5411,
509,
290,
273,
7412,
12,
87,
16,
272,
7210,
16,
272,
1638,
300,
272,
7210,
16,
2875,
1769,
203,
5411,
272,
7210,
1011,
290,
31,
203,
5411,
309,
261,
291,
5080,
12,
7358,
3719,
288,
203,
7734,
3663,
2156,
1892,
5621,
203,
5411,
289,
203,
3639,
289,
203,
203,
3639,
5230,
12643,
1011,
562,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
6181,
279,
533,
358,
326,
1613,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
c96cbb4f4ac973bb3ddae97c0e22ba07780eb0b3 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/connector/OutputBuffer.java | [
"MIT"
] | Java | append | null | public void append(byte src[], int off, int len) throws IOException {
if (bb.remaining() == 0) {
appendByteArray(src, off, len);
} else {
int n = transfer(src, off, len, bb);
len = len - n;
off = off + n;
if (isFull(bb)) {
flushByteBuffer();
appendByteArray(src, off, len);
}
}
} | /**
* Add data to the buffer.
*
* @param src Bytes array
* @param off Offset
* @param len Length
* @throws IOException Writing overflow data to the output channel failed
*/ | Add data to the buffer.
@param src Bytes array
@param off Offset
@param len Length
@throws IOException Writing overflow data to the output channel failed | [
"Add",
"data",
"to",
"the",
"buffer",
".",
"@param",
"src",
"Bytes",
"array",
"@param",
"off",
"Offset",
"@param",
"len",
"Length",
"@throws",
"IOException",
"Writing",
"overflow",
"data",
"to",
"the",
"output",
"channel",
"failed"
] | public void append(byte src[], int off, int len) throws IOException {
if (bb.remaining() == 0) {
appendByteArray(src, off, len);
} else {
int n = transfer(src, off, len, bb);
len = len - n;
off = off + n;
if (isFull(bb)) {
flushByteBuffer();
appendByteArray(src, off, len);
}
}
} | [
"public",
"void",
"append",
"(",
"byte",
"src",
"[",
"]",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"bb",
".",
"remaining",
"(",
")",
"==",
"0",
")",
"{",
"appendByteArray",
"(",
"src",
",",
"off",
",",
"len",
")",
";",
"}",
"else",
"{",
"int",
"n",
"=",
"transfer",
"(",
"src",
",",
"off",
",",
"len",
",",
"bb",
")",
";",
"len",
"=",
"len",
"-",
"n",
";",
"off",
"=",
"off",
"+",
"n",
";",
"if",
"(",
"isFull",
"(",
"bb",
")",
")",
"{",
"flushByteBuffer",
"(",
")",
";",
"appendByteArray",
"(",
"src",
",",
"off",
",",
"len",
")",
";",
"}",
"}",
"}"
] | Add data to the buffer. | [
"Add",
"data",
"to",
"the",
"buffer",
"."
] | [] | [
{
"param": "src",
"type": "byte"
},
{
"param": "off",
"type": "int"
},
{
"param": "len",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "src",
"type": "byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "len",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
714,
12,
7229,
1705,
63,
6487,
509,
3397,
16,
509,
562,
13,
1216,
1860,
288,
203,
3639,
309,
261,
9897,
18,
17956,
1435,
422,
374,
13,
288,
203,
5411,
714,
8826,
12,
4816,
16,
3397,
16,
562,
1769,
203,
3639,
289,
469,
288,
203,
5411,
509,
290,
273,
7412,
12,
4816,
16,
3397,
16,
562,
16,
7129,
1769,
203,
5411,
562,
273,
562,
300,
290,
31,
203,
5411,
3397,
273,
3397,
397,
290,
31,
203,
5411,
309,
261,
291,
5080,
12,
9897,
3719,
288,
203,
7734,
3663,
12242,
5621,
203,
7734,
714,
8826,
12,
4816,
16,
3397,
16,
562,
1769,
203,
5411,
289,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1436,
501,
358,
326,
1613,
18,
203,
377,
380,
203,
377,
380,
632,
891,
1705,
5985,
526,
203,
377,
380,
632,
891,
3397,
9874,
203,
377,
380,
632,
891,
562,
11311,
203,
377,
380,
632,
15069,
1860,
10423,
310,
9391,
501,
358,
326,
876,
1904,
2535,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e3d781d8bf3d533deb15eb43ceebe9f8e6c23f9e | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/mbeans/MBeanFactory.java | [
"MIT"
] | Java | createDataSourceRealm | String | public String createDataSourceRealm(String parent, String dataSourceName,
String roleNameCol, String userCredCol, String userNameCol,
String userRoleTable, String userTable) throws Exception {
// Create a new DataSourceRealm instance
DataSourceRealm realm = new DataSourceRealm();
realm.setDataSourceName(dataSourceName);
realm.setRoleNameCol(roleNameCol);
realm.setUserCredCol(userCredCol);
realm.setUserNameCol(userNameCol);
realm.setUserRoleTable(userRoleTable);
realm.setUserTable(userTable);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Container container = getParentContainerFromParent(pname);
// Add the new instance to its parent component
container.setRealm(realm);
// Return the corresponding MBean name
ObjectName oname = realm.getObjectName();
if (oname != null) {
return oname.toString();
} else {
return null;
}
} | /**
* Create a new DataSource Realm.
*
* @param parent MBean Name of the associated parent component
* @param dataSourceName the datasource name
* @param roleNameCol the column name for the role names
* @param userCredCol the column name for the user credentials
* @param userNameCol the column name for the user names
* @param userRoleTable the table name for the roles table
* @param userTable the table name for the users
* @return the object name of the created realm
* @exception Exception if an MBean cannot be created or registered
*/ | Create a new DataSource Realm. | [
"Create",
"a",
"new",
"DataSource",
"Realm",
"."
] | public String createDataSourceRealm(String parent, String dataSourceName,
String roleNameCol, String userCredCol, String userNameCol,
String userRoleTable, String userTable) throws Exception {
DataSourceRealm realm = new DataSourceRealm();
realm.setDataSourceName(dataSourceName);
realm.setRoleNameCol(roleNameCol);
realm.setUserCredCol(userCredCol);
realm.setUserNameCol(userNameCol);
realm.setUserRoleTable(userRoleTable);
realm.setUserTable(userTable);
ObjectName pname = new ObjectName(parent);
Container container = getParentContainerFromParent(pname);
container.setRealm(realm);
ObjectName oname = realm.getObjectName();
if (oname != null) {
return oname.toString();
} else {
return null;
}
} | [
"public",
"String",
"createDataSourceRealm",
"(",
"String",
"parent",
",",
"String",
"dataSourceName",
",",
"String",
"roleNameCol",
",",
"String",
"userCredCol",
",",
"String",
"userNameCol",
",",
"String",
"userRoleTable",
",",
"String",
"userTable",
")",
"throws",
"Exception",
"{",
"DataSourceRealm",
"realm",
"=",
"new",
"DataSourceRealm",
"(",
")",
";",
"realm",
".",
"setDataSourceName",
"(",
"dataSourceName",
")",
";",
"realm",
".",
"setRoleNameCol",
"(",
"roleNameCol",
")",
";",
"realm",
".",
"setUserCredCol",
"(",
"userCredCol",
")",
";",
"realm",
".",
"setUserNameCol",
"(",
"userNameCol",
")",
";",
"realm",
".",
"setUserRoleTable",
"(",
"userRoleTable",
")",
";",
"realm",
".",
"setUserTable",
"(",
"userTable",
")",
";",
"ObjectName",
"pname",
"=",
"new",
"ObjectName",
"(",
"parent",
")",
";",
"Container",
"container",
"=",
"getParentContainerFromParent",
"(",
"pname",
")",
";",
"container",
".",
"setRealm",
"(",
"realm",
")",
";",
"ObjectName",
"oname",
"=",
"realm",
".",
"getObjectName",
"(",
")",
";",
"if",
"(",
"oname",
"!=",
"null",
")",
"{",
"return",
"oname",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Create a new DataSource Realm. | [
"Create",
"a",
"new",
"DataSource",
"Realm",
"."
] | [
"// Create a new DataSourceRealm instance",
"// Add the new instance to its parent component",
"// Add the new instance to its parent component",
"// Return the corresponding MBean name"
] | [
{
"param": "parent",
"type": "String"
},
{
"param": "dataSourceName",
"type": "String"
},
{
"param": "roleNameCol",
"type": "String"
},
{
"param": "userCredCol",
"type": "String"
},
{
"param": "userNameCol",
"type": "String"
},
{
"param": "userRoleTable",
"type": "String"
},
{
"param": "userTable",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dataSourceName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "roleNameCol",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userCredCol",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userNameCol",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userRoleTable",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "userTable",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
514,
752,
8597,
22545,
12,
780,
982,
16,
514,
10233,
461,
16,
203,
3639,
514,
19746,
914,
16,
514,
729,
24201,
914,
16,
514,
12065,
914,
16,
203,
3639,
514,
729,
2996,
1388,
16,
514,
729,
1388,
13,
1216,
1185,
288,
203,
203,
3639,
368,
1788,
279,
394,
12806,
22545,
791,
203,
3639,
12806,
22545,
11319,
273,
394,
12806,
22545,
5621,
203,
3639,
11319,
18,
542,
8597,
461,
12,
892,
1830,
461,
1769,
203,
3639,
11319,
18,
542,
31278,
914,
12,
4615,
461,
914,
1769,
203,
3639,
11319,
18,
542,
1299,
24201,
914,
12,
1355,
24201,
914,
1769,
203,
3639,
11319,
18,
542,
15296,
914,
12,
1355,
461,
914,
1769,
203,
3639,
11319,
18,
542,
1299,
2996,
1388,
12,
1355,
2996,
1388,
1769,
203,
3639,
11319,
18,
542,
1299,
1388,
12,
1355,
1388,
1769,
203,
203,
3639,
368,
1436,
326,
394,
791,
358,
2097,
982,
1794,
203,
3639,
21013,
19952,
273,
394,
21013,
12,
2938,
1769,
203,
3639,
4039,
1478,
273,
5089,
2170,
1265,
3054,
12,
84,
529,
1769,
203,
3639,
368,
1436,
326,
394,
791,
358,
2097,
982,
1794,
203,
3639,
1478,
18,
542,
22545,
12,
24056,
1769,
203,
3639,
368,
2000,
326,
4656,
16622,
508,
203,
3639,
21013,
603,
339,
273,
11319,
18,
588,
16707,
5621,
203,
3639,
309,
261,
265,
339,
480,
446,
13,
288,
203,
5411,
327,
603,
339,
18,
10492,
5621,
203,
3639,
289,
469,
288,
203,
5411,
327,
446,
31,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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434,
326,
3627,
982,
1794,
203,
377,
380,
632,
891,
10233,
461,
326,
9181,
508,
203,
377,
380,
632,
891,
19746,
914,
326,
1057,
508,
364,
326,
2478,
1257,
203,
377,
380,
632,
891,
729,
24201,
914,
326,
1057,
508,
364,
326,
729,
4448,
203,
377,
380,
632,
891,
12065,
914,
326,
1057,
508,
364,
326,
729,
1257,
203,
377,
380,
632,
891,
729,
2996,
1388,
326,
1014,
508,
364,
326,
4900,
1014,
203,
377,
380,
632,
891,
729,
1388,
326,
1014,
508,
364,
326,
3677,
203,
377,
380,
632,
2463,
326,
733,
508,
434,
326,
2522,
11319,
203,
377,
380,
632,
4064,
1185,
2
] |
e3d781d8bf3d533deb15eb43ceebe9f8e6c23f9e | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/mbeans/MBeanFactory.java | [
"MIT"
] | Java | createJNDIRealm | String | public String createJNDIRealm(String parent) throws Exception {
// Create a new JNDIRealm instance
JNDIRealm realm = new JNDIRealm();
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Container container = getParentContainerFromParent(pname);
// Add the new instance to its parent component
container.setRealm(realm);
// Return the corresponding MBean name
ObjectName oname = realm.getObjectName();
if (oname != null) {
return (oname.toString());
} else {
return null;
}
} | /**
* Create a new JNDI Realm.
*
* @param parent MBean Name of the associated parent component
* @return the object name of the created realm
*
* @exception Exception if an MBean cannot be created or registered
*/ | Create a new JNDI Realm.
@param parent MBean Name of the associated parent component
@return the object name of the created realm
@exception Exception if an MBean cannot be created or registered | [
"Create",
"a",
"new",
"JNDI",
"Realm",
".",
"@param",
"parent",
"MBean",
"Name",
"of",
"the",
"associated",
"parent",
"component",
"@return",
"the",
"object",
"name",
"of",
"the",
"created",
"realm",
"@exception",
"Exception",
"if",
"an",
"MBean",
"cannot",
"be",
"created",
"or",
"registered"
] | public String createJNDIRealm(String parent) throws Exception {
JNDIRealm realm = new JNDIRealm();
ObjectName pname = new ObjectName(parent);
Container container = getParentContainerFromParent(pname);
container.setRealm(realm);
ObjectName oname = realm.getObjectName();
if (oname != null) {
return (oname.toString());
} else {
return null;
}
} | [
"public",
"String",
"createJNDIRealm",
"(",
"String",
"parent",
")",
"throws",
"Exception",
"{",
"JNDIRealm",
"realm",
"=",
"new",
"JNDIRealm",
"(",
")",
";",
"ObjectName",
"pname",
"=",
"new",
"ObjectName",
"(",
"parent",
")",
";",
"Container",
"container",
"=",
"getParentContainerFromParent",
"(",
"pname",
")",
";",
"container",
".",
"setRealm",
"(",
"realm",
")",
";",
"ObjectName",
"oname",
"=",
"realm",
".",
"getObjectName",
"(",
")",
";",
"if",
"(",
"oname",
"!=",
"null",
")",
"{",
"return",
"(",
"oname",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Create a new JNDI Realm. | [
"Create",
"a",
"new",
"JNDI",
"Realm",
"."
] | [
"// Create a new JNDIRealm instance",
"// Add the new instance to its parent component",
"// Add the new instance to its parent component",
"// Return the corresponding MBean name"
] | [
{
"param": "parent",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
514,
752,
46,
24513,
22545,
12,
780,
982,
13,
1216,
1185,
288,
203,
203,
540,
368,
1788,
279,
394,
804,
24513,
22545,
791,
203,
3639,
804,
24513,
22545,
11319,
273,
394,
804,
24513,
22545,
5621,
203,
203,
3639,
368,
1436,
326,
394,
791,
358,
2097,
982,
1794,
203,
3639,
21013,
19952,
273,
394,
21013,
12,
2938,
1769,
203,
3639,
4039,
1478,
273,
5089,
2170,
1265,
3054,
12,
84,
529,
1769,
203,
3639,
368,
1436,
326,
394,
791,
358,
2097,
982,
1794,
203,
3639,
1478,
18,
542,
22545,
12,
24056,
1769,
203,
3639,
368,
2000,
326,
4656,
16622,
508,
203,
3639,
21013,
603,
339,
273,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1788,
279,
394,
804,
24513,
15987,
81,
18,
203,
377,
380,
203,
377,
380,
632,
891,
982,
16622,
1770,
434,
326,
3627,
982,
1794,
203,
377,
380,
632,
2463,
326,
733,
508,
434,
326,
2522,
11319,
203,
377,
380,
203,
377,
380,
632,
4064,
1185,
309,
392,
16622,
2780,
506,
2522,
578,
4104,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e3d781d8bf3d533deb15eb43ceebe9f8e6c23f9e | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/mbeans/MBeanFactory.java | [
"MIT"
] | Java | createMemoryRealm | String | public String createMemoryRealm(String parent) throws Exception {
// Create a new MemoryRealm instance
MemoryRealm realm = new MemoryRealm();
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Container container = getParentContainerFromParent(pname);
// Add the new instance to its parent component
container.setRealm(realm);
// Return the corresponding MBean name
ObjectName oname = realm.getObjectName();
if (oname != null) {
return (oname.toString());
} else {
return null;
}
} | /**
* Create a new Memory Realm.
*
* @param parent MBean Name of the associated parent component
* @return the object name of the created realm
*
* @exception Exception if an MBean cannot be created or registered
*/ | Create a new Memory Realm.
@param parent MBean Name of the associated parent component
@return the object name of the created realm
@exception Exception if an MBean cannot be created or registered | [
"Create",
"a",
"new",
"Memory",
"Realm",
".",
"@param",
"parent",
"MBean",
"Name",
"of",
"the",
"associated",
"parent",
"component",
"@return",
"the",
"object",
"name",
"of",
"the",
"created",
"realm",
"@exception",
"Exception",
"if",
"an",
"MBean",
"cannot",
"be",
"created",
"or",
"registered"
] | public String createMemoryRealm(String parent) throws Exception {
MemoryRealm realm = new MemoryRealm();
ObjectName pname = new ObjectName(parent);
Container container = getParentContainerFromParent(pname);
container.setRealm(realm);
ObjectName oname = realm.getObjectName();
if (oname != null) {
return (oname.toString());
} else {
return null;
}
} | [
"public",
"String",
"createMemoryRealm",
"(",
"String",
"parent",
")",
"throws",
"Exception",
"{",
"MemoryRealm",
"realm",
"=",
"new",
"MemoryRealm",
"(",
")",
";",
"ObjectName",
"pname",
"=",
"new",
"ObjectName",
"(",
"parent",
")",
";",
"Container",
"container",
"=",
"getParentContainerFromParent",
"(",
"pname",
")",
";",
"container",
".",
"setRealm",
"(",
"realm",
")",
";",
"ObjectName",
"oname",
"=",
"realm",
".",
"getObjectName",
"(",
")",
";",
"if",
"(",
"oname",
"!=",
"null",
")",
"{",
"return",
"(",
"oname",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Create a new Memory Realm. | [
"Create",
"a",
"new",
"Memory",
"Realm",
"."
] | [
"// Create a new MemoryRealm instance",
"// Add the new instance to its parent component",
"// Add the new instance to its parent component",
"// Return the corresponding MBean name"
] | [
{
"param": "parent",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
514,
752,
6031,
22545,
12,
780,
982,
13,
1216,
1185,
288,
203,
203,
540,
368,
1788,
279,
394,
9251,
22545,
791,
203,
3639,
9251,
22545,
11319,
273,
394,
9251,
22545,
5621,
203,
203,
3639,
368,
1436,
326,
394,
791,
358,
2097,
982,
1794,
203,
3639,
21013,
19952,
273,
394,
21013,
12,
2938,
1769,
203,
3639,
4039,
1478,
273,
5089,
2170,
1265,
3054,
12,
84,
529,
1769,
203,
3639,
368,
1436,
326,
394,
791,
358,
2097,
982,
1794,
203,
3639,
1478,
18,
542,
22545,
12,
24056,
1769,
203,
3639,
368,
2000,
326,
4656,
16622,
508,
203,
3639,
21013,
603,
339,
273,
11319,
18,
588,
16707,
5621,
203,
3639,
309,
261,
265,
339,
480,
446,
13,
288,
203,
5411,
327,
261,
265,
339,
18,
10492,
10663,
203,
3639,
289,
469,
288,
203,
5411,
327,
446,
31,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1788,
279,
394,
9251,
15987,
81,
18,
203,
377,
380,
203,
377,
380,
632,
891,
982,
16622,
1770,
434,
326,
3627,
982,
1794,
203,
377,
380,
632,
2463,
326,
733,
508,
434,
326,
2522,
11319,
203,
377,
380,
203,
377,
380,
632,
4064,
1185,
309,
392,
16622,
2780,
506,
2522,
578,
4104,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e3d781d8bf3d533deb15eb43ceebe9f8e6c23f9e | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/mbeans/MBeanFactory.java | [
"MIT"
] | Java | createStandardContext | String | public String createStandardContext(String parent,
String path,
String docBase,
boolean xmlValidation,
boolean xmlNamespaceAware)
throws Exception {
// Create a new StandardContext instance
StandardContext context = new StandardContext();
path = getPathStr(path);
context.setPath(path);
context.setDocBase(docBase);
context.setXmlValidation(xmlValidation);
context.setXmlNamespaceAware(xmlNamespaceAware);
ContextConfig contextConfig = new ContextConfig();
context.addLifecycleListener(contextConfig);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ObjectName deployer = new ObjectName(pname.getDomain()+
":type=Deployer,host="+
pname.getKeyProperty("host"));
if(mserver.isRegistered(deployer)) {
String contextName = context.getName();
mserver.invoke(deployer, "addServiced",
new Object [] {contextName},
new String [] {"java.lang.String"});
String configPath = (String)mserver.getAttribute(deployer,
"configBaseName");
String baseName = context.getBaseName();
File configFile = new File(new File(configPath), baseName+".xml");
if (configFile.isFile()) {
context.setConfigFile(configFile.toURI().toURL());
}
mserver.invoke(deployer, "manageApp",
new Object[] {context},
new String[] {"org.apache.catalina.Context"});
mserver.invoke(deployer, "removeServiced",
new Object [] {contextName},
new String [] {"java.lang.String"});
} else {
log.warn("Deployer not found for "+pname.getKeyProperty("host"));
Service service = getService(pname);
Engine engine = service.getContainer();
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
host.addChild(context);
}
// Return the corresponding MBean name
return context.getObjectName().toString();
} | /**
* Create a new StandardContext.
*
* @param parent MBean Name of the associated parent component
* @param path The context path for this Context
* @param docBase Document base directory (or WAR) for this Context
* @param xmlValidation if XML descriptors should be validated
* @param xmlNamespaceAware if the XML processor should namespace aware
* @return the object name of the created context
*
* @exception Exception if an MBean cannot be created or registered
*/ | Create a new StandardContext.
@exception Exception if an MBean cannot be created or registered | [
"Create",
"a",
"new",
"StandardContext",
".",
"@exception",
"Exception",
"if",
"an",
"MBean",
"cannot",
"be",
"created",
"or",
"registered"
] | public String createStandardContext(String parent,
String path,
String docBase,
boolean xmlValidation,
boolean xmlNamespaceAware)
throws Exception {
StandardContext context = new StandardContext();
path = getPathStr(path);
context.setPath(path);
context.setDocBase(docBase);
context.setXmlValidation(xmlValidation);
context.setXmlNamespaceAware(xmlNamespaceAware);
ContextConfig contextConfig = new ContextConfig();
context.addLifecycleListener(contextConfig);
ObjectName pname = new ObjectName(parent);
ObjectName deployer = new ObjectName(pname.getDomain()+
":type=Deployer,host="+
pname.getKeyProperty("host"));
if(mserver.isRegistered(deployer)) {
String contextName = context.getName();
mserver.invoke(deployer, "addServiced",
new Object [] {contextName},
new String [] {"java.lang.String"});
String configPath = (String)mserver.getAttribute(deployer,
"configBaseName");
String baseName = context.getBaseName();
File configFile = new File(new File(configPath), baseName+".xml");
if (configFile.isFile()) {
context.setConfigFile(configFile.toURI().toURL());
}
mserver.invoke(deployer, "manageApp",
new Object[] {context},
new String[] {"org.apache.catalina.Context"});
mserver.invoke(deployer, "removeServiced",
new Object [] {contextName},
new String [] {"java.lang.String"});
} else {
log.warn("Deployer not found for "+pname.getKeyProperty("host"));
Service service = getService(pname);
Engine engine = service.getContainer();
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
host.addChild(context);
}
return context.getObjectName().toString();
} | [
"public",
"String",
"createStandardContext",
"(",
"String",
"parent",
",",
"String",
"path",
",",
"String",
"docBase",
",",
"boolean",
"xmlValidation",
",",
"boolean",
"xmlNamespaceAware",
")",
"throws",
"Exception",
"{",
"StandardContext",
"context",
"=",
"new",
"StandardContext",
"(",
")",
";",
"path",
"=",
"getPathStr",
"(",
"path",
")",
";",
"context",
".",
"setPath",
"(",
"path",
")",
";",
"context",
".",
"setDocBase",
"(",
"docBase",
")",
";",
"context",
".",
"setXmlValidation",
"(",
"xmlValidation",
")",
";",
"context",
".",
"setXmlNamespaceAware",
"(",
"xmlNamespaceAware",
")",
";",
"ContextConfig",
"contextConfig",
"=",
"new",
"ContextConfig",
"(",
")",
";",
"context",
".",
"addLifecycleListener",
"(",
"contextConfig",
")",
";",
"ObjectName",
"pname",
"=",
"new",
"ObjectName",
"(",
"parent",
")",
";",
"ObjectName",
"deployer",
"=",
"new",
"ObjectName",
"(",
"pname",
".",
"getDomain",
"(",
")",
"+",
"\":type=Deployer,host=\"",
"+",
"pname",
".",
"getKeyProperty",
"(",
"\"host\"",
")",
")",
";",
"if",
"(",
"mserver",
".",
"isRegistered",
"(",
"deployer",
")",
")",
"{",
"String",
"contextName",
"=",
"context",
".",
"getName",
"(",
")",
";",
"mserver",
".",
"invoke",
"(",
"deployer",
",",
"\"addServiced\"",
",",
"new",
"Object",
"[",
"]",
"{",
"contextName",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"java.lang.String\"",
"}",
")",
";",
"String",
"configPath",
"=",
"(",
"String",
")",
"mserver",
".",
"getAttribute",
"(",
"deployer",
",",
"\"configBaseName\"",
")",
";",
"String",
"baseName",
"=",
"context",
".",
"getBaseName",
"(",
")",
";",
"File",
"configFile",
"=",
"new",
"File",
"(",
"new",
"File",
"(",
"configPath",
")",
",",
"baseName",
"+",
"\".xml\"",
")",
";",
"if",
"(",
"configFile",
".",
"isFile",
"(",
")",
")",
"{",
"context",
".",
"setConfigFile",
"(",
"configFile",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
")",
";",
"}",
"mserver",
".",
"invoke",
"(",
"deployer",
",",
"\"manageApp\"",
",",
"new",
"Object",
"[",
"]",
"{",
"context",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"org.apache.catalina.Context\"",
"}",
")",
";",
"mserver",
".",
"invoke",
"(",
"deployer",
",",
"\"removeServiced\"",
",",
"new",
"Object",
"[",
"]",
"{",
"contextName",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"java.lang.String\"",
"}",
")",
";",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"Deployer not found for \"",
"+",
"pname",
".",
"getKeyProperty",
"(",
"\"host\"",
")",
")",
";",
"Service",
"service",
"=",
"getService",
"(",
"pname",
")",
";",
"Engine",
"engine",
"=",
"service",
".",
"getContainer",
"(",
")",
";",
"Host",
"host",
"=",
"(",
"Host",
")",
"engine",
".",
"findChild",
"(",
"pname",
".",
"getKeyProperty",
"(",
"\"host\"",
")",
")",
";",
"host",
".",
"addChild",
"(",
"context",
")",
";",
"}",
"return",
"context",
".",
"getObjectName",
"(",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Create a new StandardContext. | [
"Create",
"a",
"new",
"StandardContext",
"."
] | [
"// Create a new StandardContext instance",
"// Add the new instance to its parent component",
"// Return the corresponding MBean name"
] | [
{
"param": "parent",
"type": "String"
},
{
"param": "path",
"type": "String"
},
{
"param": "docBase",
"type": "String"
},
{
"param": "xmlValidation",
"type": "boolean"
},
{
"param": "xmlNamespaceAware",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "docBase",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xmlValidation",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xmlNamespaceAware",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
514,
752,
8336,
1042,
12,
780,
982,
16,
203,
4766,
3639,
514,
589,
16,
203,
4766,
3639,
514,
997,
2171,
16,
203,
4766,
3639,
1250,
2025,
4354,
16,
203,
4766,
3639,
1250,
2025,
3402,
10155,
13,
203,
3639,
1216,
1185,
288,
203,
203,
3639,
368,
1788,
279,
394,
8263,
1042,
791,
203,
3639,
8263,
1042,
819,
273,
394,
8263,
1042,
5621,
203,
3639,
589,
273,
4339,
1585,
12,
803,
1769,
203,
3639,
819,
18,
542,
743,
12,
803,
1769,
203,
3639,
819,
18,
542,
1759,
2171,
12,
2434,
2171,
1769,
203,
3639,
819,
18,
542,
4432,
4354,
12,
2902,
4354,
1769,
203,
3639,
819,
18,
542,
4432,
3402,
10155,
12,
2902,
3402,
10155,
1769,
203,
203,
3639,
1772,
809,
819,
809,
273,
394,
1772,
809,
5621,
203,
3639,
819,
18,
1289,
9977,
2223,
12,
2472,
809,
1769,
203,
203,
3639,
368,
1436,
326,
394,
791,
358,
2097,
982,
1794,
203,
3639,
21013,
19952,
273,
394,
21013,
12,
2938,
1769,
203,
3639,
21013,
7286,
264,
273,
394,
21013,
12,
84,
529,
18,
588,
3748,
1435,
15,
203,
4766,
2398,
6398,
723,
33,
10015,
264,
16,
2564,
1546,
15,
203,
4766,
2398,
19952,
18,
588,
653,
1396,
2932,
2564,
7923,
1769,
203,
3639,
309,
12,
81,
3567,
18,
291,
10868,
12,
12411,
264,
3719,
288,
203,
5411,
514,
819,
461,
273,
819,
18,
17994,
5621,
203,
5411,
312,
3567,
18,
14407,
12,
12411,
264,
16,
315,
1289,
1179,
72,
3113,
203,
21821,
394,
1033,
5378,
288,
2472,
461,
5779,
203,
21821,
394,
514,
5378,
12528,
6290,
18,
4936,
18,
780,
6,
22938,
203,
5411,
514,
16012,
273,
261,
780,
13,
81,
3567,
18,
588,
1499,
12,
12411,
264,
16,
203,
4766,
11794,
315,
1425,
29907,
8863,
203,
5411,
514,
16162,
273,
819,
18,
588,
29907,
5621,
203,
5411,
1387,
12247,
273,
394,
1387,
12,
2704,
1387,
12,
1425,
743,
3631,
16162,
9078,
18,
2902,
8863,
203,
5411,
309,
261,
1425,
812,
18,
291,
812,
10756,
288,
203,
7734,
819,
18,
542,
13705,
12,
1425,
812,
18,
869,
3098,
7675,
869,
1785,
10663,
203,
5411,
289,
203,
5411,
312,
3567,
18,
14407,
12,
12411,
264,
16,
315,
12633,
3371,
3113,
203,
21821,
394,
1033,
8526,
288,
2472,
5779,
203,
21821,
394,
514,
8526,
12528,
3341,
18,
19211,
18,
2574,
287,
15314,
18,
1042,
6,
22938,
203,
5411,
312,
3567,
18,
14407,
12,
12411,
264,
16,
315,
4479,
1179,
72,
3113,
203,
21821,
394,
1033,
5378,
288,
2472,
461,
5779,
203,
21821,
394,
514,
5378,
12528,
6290,
18,
4936,
18,
780,
6,
22938,
203,
3639,
289,
469,
288,
203,
5411,
613,
18,
8935,
2932,
10015,
264,
486,
1392,
364,
13773,
84,
529,
18,
588,
653,
1396,
2932,
2564,
7923,
1769,
203,
5411,
1956,
1156,
273,
6373,
12,
84,
529,
1769,
203,
5411,
10507,
4073,
273,
1156,
18,
588,
2170,
5621,
203,
5411,
4893,
1479,
273,
261,
2594,
13,
4073,
18,
4720,
1763,
12,
84,
529,
18,
588,
653,
1396,
2932,
2564,
7923,
1769,
203,
5411,
1479,
18,
1289,
1763,
12,
2472,
1769,
203,
3639,
289,
203,
203,
3639,
368,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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
380,
1788,
279,
394,
8263,
1042,
18,
203,
377,
380,
203,
377,
380,
632,
891,
982,
16622,
1770,
434,
326,
3627,
982,
1794,
203,
377,
380,
632,
891,
589,
1021,
819,
589,
364,
333,
1772,
203,
377,
380,
632,
891,
997,
2171,
4319,
1026,
1867,
261,
280,
678,
985,
13,
364,
333,
1772,
203,
377,
380,
632,
891,
2025,
4354,
309,
3167,
14215,
1410,
506,
10266,
203,
377,
380,
632,
891,
2025,
3402,
10155,
309,
326,
3167,
6659,
1410,
1981,
18999,
203,
377,
380,
632,
2463,
326,
733,
508,
434,
326,
2522,
819,
203,
377,
380,
203,
377,
380,
632,
4064,
1185,
309,
392,
16622,
2780,
506,
2522,
578,
4104,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e3d781d8bf3d533deb15eb43ceebe9f8e6c23f9e | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/mbeans/MBeanFactory.java | [
"MIT"
] | Java | removeContext | null | public void removeContext(String contextName) throws Exception {
// Acquire a reference to the component to be removed
ObjectName oname = new ObjectName(contextName);
String domain = oname.getDomain();
StandardService service = (StandardService) getService(oname);
Engine engine = service.getContainer();
String name = oname.getKeyProperty("name");
name = name.substring(2);
int i = name.indexOf('/');
String hostName = name.substring(0,i);
String path = name.substring(i);
ObjectName deployer = new ObjectName(domain+":type=Deployer,host="+
hostName);
String pathStr = getPathStr(path);
if(mserver.isRegistered(deployer)) {
mserver.invoke(deployer,"addServiced",
new Object[]{pathStr},
new String[] {"java.lang.String"});
mserver.invoke(deployer,"unmanageApp",
new Object[] {pathStr},
new String[] {"java.lang.String"});
mserver.invoke(deployer,"removeServiced",
new Object[] {pathStr},
new String[] {"java.lang.String"});
} else {
log.warn("Deployer not found for "+hostName);
Host host = (Host) engine.findChild(hostName);
Context context = (Context) host.findChild(pathStr);
// Remove this component from its parent component
host.removeChild(context);
if(context instanceof StandardContext)
try {
((StandardContext)context).destroy();
} catch (Exception e) {
log.warn("Error during context [" + context.getName() + "] destroy ", e);
}
}
} | /**
* Remove an existing Context.
*
* @param contextName MBean Name of the component to remove
*
* @exception Exception if a component cannot be removed
*/ | Remove an existing Context.
@param contextName MBean Name of the component to remove
@exception Exception if a component cannot be removed | [
"Remove",
"an",
"existing",
"Context",
".",
"@param",
"contextName",
"MBean",
"Name",
"of",
"the",
"component",
"to",
"remove",
"@exception",
"Exception",
"if",
"a",
"component",
"cannot",
"be",
"removed"
] | public void removeContext(String contextName) throws Exception {
ObjectName oname = new ObjectName(contextName);
String domain = oname.getDomain();
StandardService service = (StandardService) getService(oname);
Engine engine = service.getContainer();
String name = oname.getKeyProperty("name");
name = name.substring(2);
int i = name.indexOf('/');
String hostName = name.substring(0,i);
String path = name.substring(i);
ObjectName deployer = new ObjectName(domain+":type=Deployer,host="+
hostName);
String pathStr = getPathStr(path);
if(mserver.isRegistered(deployer)) {
mserver.invoke(deployer,"addServiced",
new Object[]{pathStr},
new String[] {"java.lang.String"});
mserver.invoke(deployer,"unmanageApp",
new Object[] {pathStr},
new String[] {"java.lang.String"});
mserver.invoke(deployer,"removeServiced",
new Object[] {pathStr},
new String[] {"java.lang.String"});
} else {
log.warn("Deployer not found for "+hostName);
Host host = (Host) engine.findChild(hostName);
Context context = (Context) host.findChild(pathStr);
host.removeChild(context);
if(context instanceof StandardContext)
try {
((StandardContext)context).destroy();
} catch (Exception e) {
log.warn("Error during context [" + context.getName() + "] destroy ", e);
}
}
} | [
"public",
"void",
"removeContext",
"(",
"String",
"contextName",
")",
"throws",
"Exception",
"{",
"ObjectName",
"oname",
"=",
"new",
"ObjectName",
"(",
"contextName",
")",
";",
"String",
"domain",
"=",
"oname",
".",
"getDomain",
"(",
")",
";",
"StandardService",
"service",
"=",
"(",
"StandardService",
")",
"getService",
"(",
"oname",
")",
";",
"Engine",
"engine",
"=",
"service",
".",
"getContainer",
"(",
")",
";",
"String",
"name",
"=",
"oname",
".",
"getKeyProperty",
"(",
"\"name\"",
")",
";",
"name",
"=",
"name",
".",
"substring",
"(",
"2",
")",
";",
"int",
"i",
"=",
"name",
".",
"indexOf",
"(",
"'/'",
")",
";",
"String",
"hostName",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"i",
")",
";",
"String",
"path",
"=",
"name",
".",
"substring",
"(",
"i",
")",
";",
"ObjectName",
"deployer",
"=",
"new",
"ObjectName",
"(",
"domain",
"+",
"\":type=Deployer,host=\"",
"+",
"hostName",
")",
";",
"String",
"pathStr",
"=",
"getPathStr",
"(",
"path",
")",
";",
"if",
"(",
"mserver",
".",
"isRegistered",
"(",
"deployer",
")",
")",
"{",
"mserver",
".",
"invoke",
"(",
"deployer",
",",
"\"addServiced\"",
",",
"new",
"Object",
"[",
"]",
"{",
"pathStr",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"java.lang.String\"",
"}",
")",
";",
"mserver",
".",
"invoke",
"(",
"deployer",
",",
"\"unmanageApp\"",
",",
"new",
"Object",
"[",
"]",
"{",
"pathStr",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"java.lang.String\"",
"}",
")",
";",
"mserver",
".",
"invoke",
"(",
"deployer",
",",
"\"removeServiced\"",
",",
"new",
"Object",
"[",
"]",
"{",
"pathStr",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"java.lang.String\"",
"}",
")",
";",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"Deployer not found for \"",
"+",
"hostName",
")",
";",
"Host",
"host",
"=",
"(",
"Host",
")",
"engine",
".",
"findChild",
"(",
"hostName",
")",
";",
"Context",
"context",
"=",
"(",
"Context",
")",
"host",
".",
"findChild",
"(",
"pathStr",
")",
";",
"host",
".",
"removeChild",
"(",
"context",
")",
";",
"if",
"(",
"context",
"instanceof",
"StandardContext",
")",
"try",
"{",
"(",
"(",
"StandardContext",
")",
"context",
")",
".",
"destroy",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Error during context [\"",
"+",
"context",
".",
"getName",
"(",
")",
"+",
"\"] destroy \"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Remove an existing Context. | [
"Remove",
"an",
"existing",
"Context",
"."
] | [
"// Acquire a reference to the component to be removed",
"// Remove this component from its parent component"
] | [
{
"param": "contextName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "contextName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1206,
1042,
12,
780,
819,
461,
13,
1216,
1185,
288,
203,
203,
3639,
368,
28822,
279,
2114,
358,
326,
1794,
358,
506,
3723,
203,
3639,
21013,
603,
339,
273,
394,
21013,
12,
2472,
461,
1769,
203,
3639,
514,
2461,
273,
603,
339,
18,
588,
3748,
5621,
203,
3639,
8263,
1179,
1156,
273,
261,
8336,
1179,
13,
6373,
12,
265,
339,
1769,
203,
203,
3639,
10507,
4073,
273,
1156,
18,
588,
2170,
5621,
203,
3639,
514,
508,
273,
603,
339,
18,
588,
653,
1396,
2932,
529,
8863,
203,
3639,
508,
273,
508,
18,
28023,
12,
22,
1769,
203,
3639,
509,
277,
273,
508,
18,
31806,
2668,
2473,
1769,
203,
3639,
514,
19266,
273,
508,
18,
28023,
12,
20,
16,
77,
1769,
203,
3639,
514,
589,
273,
508,
18,
28023,
12,
77,
1769,
203,
3639,
21013,
7286,
264,
273,
394,
21013,
12,
4308,
15,
6877,
723,
33,
10015,
264,
16,
2564,
1546,
15,
203,
4766,
2398,
19266,
1769,
203,
3639,
514,
589,
1585,
273,
4339,
1585,
12,
803,
1769,
203,
3639,
309,
12,
81,
3567,
18,
291,
10868,
12,
12411,
264,
3719,
288,
203,
5411,
312,
3567,
18,
14407,
12,
12411,
264,
10837,
1289,
1179,
72,
3113,
203,
21821,
394,
1033,
63,
7073,
803,
1585,
5779,
203,
21821,
394,
514,
8526,
12528,
6290,
18,
4936,
18,
780,
6,
22938,
203,
5411,
312,
3567,
18,
14407,
12,
12411,
264,
10837,
318,
12633,
3371,
3113,
203,
21821,
394,
1033,
8526,
288,
803,
1585,
5779,
203,
21821,
394,
514,
8526,
12528,
6290,
18,
4936,
18,
780,
6,
22938,
203,
5411,
312,
3567,
18,
14407,
12,
12411,
264,
10837,
4479,
1179,
72,
3113,
203,
21821,
394,
1033,
8526,
288,
803,
1585,
5779,
203,
21821,
394,
514,
8526,
12528,
6290,
18,
4936,
18,
780,
6,
22938,
203,
3639,
289,
469,
288,
203,
5411,
613,
18,
8935,
2932,
10015,
264,
486,
1392,
364,
13773,
2564,
461,
1769,
203,
5411,
4893,
1479,
273,
261,
2594,
13,
4073,
18,
4720,
1763,
12,
2564,
461,
1769,
203,
5411,
1772,
819,
273,
261,
1042,
13,
1479,
18,
4720,
1763,
12,
803,
1585,
1769,
203,
5411,
368,
3581,
333,
1794,
628,
2097,
982,
1794,
203,
5411,
1479,
18,
4479,
1763,
12,
2472,
1769,
203,
5411,
309,
12,
2472,
1276,
8263,
1042,
13,
203,
5411,
775,
288,
203,
7734,
14015,
8336,
1042,
13,
2472,
2934,
11662,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
8935,
2932,
668,
4982,
819,
8247,
397,
819,
18,
17994,
1435,
397,
9850,
5546,
3104,
425,
1769,
203,
6647,
289,
203,
203,
3639,
289,
203,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3581,
392,
2062,
1772,
18,
203,
377,
380,
203,
377,
380,
632,
891,
819,
461,
16622,
1770,
434,
326,
1794,
358,
1206,
203,
377,
380,
203,
377,
380,
632,
4064,
1185,
309,
279,
1794,
2780,
506,
3723,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fe6286f402d7c86f5d4732f3bde5328ee34604ce | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/core/ContainerBase.java | [
"MIT"
] | Java | findChild | Container | @Override
public Container findChild(String name) {
if (name == null) {
return null;
}
synchronized (children) {
return children.get(name);
}
} | /**
* Return the child Container, associated with this Container, with
* the specified name (if any); otherwise, return <code>null</code>
*
* @param name Name of the child Container to be retrieved
*/ | Return the child Container, associated with this Container, with
the specified name (if any); otherwise, return null
@param name Name of the child Container to be retrieved | [
"Return",
"the",
"child",
"Container",
"associated",
"with",
"this",
"Container",
"with",
"the",
"specified",
"name",
"(",
"if",
"any",
")",
";",
"otherwise",
"return",
"null",
"@param",
"name",
"Name",
"of",
"the",
"child",
"Container",
"to",
"be",
"retrieved"
] | @Override
public Container findChild(String name) {
if (name == null) {
return null;
}
synchronized (children) {
return children.get(name);
}
} | [
"@",
"Override",
"public",
"Container",
"findChild",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"synchronized",
"(",
"children",
")",
"{",
"return",
"children",
".",
"get",
"(",
"name",
")",
";",
"}",
"}"
] | Return the child Container, associated with this Container, with
the specified name (if any); otherwise, return <code>null</code> | [
"Return",
"the",
"child",
"Container",
"associated",
"with",
"this",
"Container",
"with",
"the",
"specified",
"name",
"(",
"if",
"any",
")",
";",
"otherwise",
"return",
"<code",
">",
"null<",
"/",
"code",
">"
] | [] | [
{
"param": "name",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
4039,
1104,
1763,
12,
780,
508,
13,
288,
203,
3639,
309,
261,
529,
422,
446,
13,
288,
203,
5411,
327,
446,
31,
203,
3639,
289,
203,
3639,
3852,
261,
5906,
13,
288,
203,
5411,
327,
2325,
18,
588,
12,
529,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2000,
326,
1151,
4039,
16,
3627,
598,
333,
4039,
16,
598,
203,
377,
380,
326,
1269,
508,
261,
430,
1281,
1769,
3541,
16,
327,
411,
710,
34,
2011,
1757,
710,
34,
203,
377,
380,
203,
377,
380,
632,
891,
508,
1770,
434,
326,
1151,
4039,
358,
506,
10295,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fe6286f402d7c86f5d4732f3bde5328ee34604ce | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/core/ContainerBase.java | [
"MIT"
] | Java | findContainerListeners | null | @Override
public ContainerListener[] findContainerListeners() {
ContainerListener[] results =
new ContainerListener[0];
return listeners.toArray(results);
} | /**
* Return the set of container listeners associated with this Container.
* If this Container has no registered container listeners, a zero-length
* array is returned.
*/ | Return the set of container listeners associated with this Container.
If this Container has no registered container listeners, a zero-length
array is returned. | [
"Return",
"the",
"set",
"of",
"container",
"listeners",
"associated",
"with",
"this",
"Container",
".",
"If",
"this",
"Container",
"has",
"no",
"registered",
"container",
"listeners",
"a",
"zero",
"-",
"length",
"array",
"is",
"returned",
"."
] | @Override
public ContainerListener[] findContainerListeners() {
ContainerListener[] results =
new ContainerListener[0];
return listeners.toArray(results);
} | [
"@",
"Override",
"public",
"ContainerListener",
"[",
"]",
"findContainerListeners",
"(",
")",
"{",
"ContainerListener",
"[",
"]",
"results",
"=",
"new",
"ContainerListener",
"[",
"0",
"]",
";",
"return",
"listeners",
".",
"toArray",
"(",
"results",
")",
";",
"}"
] | Return the set of container listeners associated with this Container. | [
"Return",
"the",
"set",
"of",
"container",
"listeners",
"associated",
"with",
"this",
"Container",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
4039,
2223,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377,
380,
2000,
326,
444,
434,
1478,
4679,
3627,
598,
333,
4039,
18,
203,
377,
380,
971,
333,
4039,
711,
1158,
4104,
1478,
4679,
16,
279,
3634,
17,
2469,
203,
377,
380,
526,
353,
2106,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fe6286f402d7c86f5d4732f3bde5328ee34604ce | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/core/ContainerBase.java | [
"MIT"
] | Java | removeChild | null | @Override
public void removeChild(Container child) {
if (child == null) {
return;
}
try {
if (child.getState().isAvailable()) {
child.stop();
}
} catch (LifecycleException e) {
log.error("ContainerBase.removeChild: stop: ", e);
}
try {
// child.destroy() may have already been called which would have
// triggered this call. If that is the case, no need to destroy the
// child again.
if (!LifecycleState.DESTROYING.equals(child.getState())) {
child.destroy();
}
} catch (LifecycleException e) {
log.error("ContainerBase.removeChild: destroy: ", e);
}
synchronized(children) {
if (children.get(child.getName()) == null)
return;
children.remove(child.getName());
}
fireContainerEvent(REMOVE_CHILD_EVENT, child);
} | /**
* Remove an existing child Container from association with this parent
* Container.
*
* @param child Existing child Container to be removed
*/ | Remove an existing child Container from association with this parent
Container.
@param child Existing child Container to be removed | [
"Remove",
"an",
"existing",
"child",
"Container",
"from",
"association",
"with",
"this",
"parent",
"Container",
".",
"@param",
"child",
"Existing",
"child",
"Container",
"to",
"be",
"removed"
] | @Override
public void removeChild(Container child) {
if (child == null) {
return;
}
try {
if (child.getState().isAvailable()) {
child.stop();
}
} catch (LifecycleException e) {
log.error("ContainerBase.removeChild: stop: ", e);
}
try {
if (!LifecycleState.DESTROYING.equals(child.getState())) {
child.destroy();
}
} catch (LifecycleException e) {
log.error("ContainerBase.removeChild: destroy: ", e);
}
synchronized(children) {
if (children.get(child.getName()) == null)
return;
children.remove(child.getName());
}
fireContainerEvent(REMOVE_CHILD_EVENT, child);
} | [
"@",
"Override",
"public",
"void",
"removeChild",
"(",
"Container",
"child",
")",
"{",
"if",
"(",
"child",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"if",
"(",
"child",
".",
"getState",
"(",
")",
".",
"isAvailable",
"(",
")",
")",
"{",
"child",
".",
"stop",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"LifecycleException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"ContainerBase.removeChild: stop: \"",
",",
"e",
")",
";",
"}",
"try",
"{",
"if",
"(",
"!",
"LifecycleState",
".",
"DESTROYING",
".",
"equals",
"(",
"child",
".",
"getState",
"(",
")",
")",
")",
"{",
"child",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"LifecycleException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"ContainerBase.removeChild: destroy: \"",
",",
"e",
")",
";",
"}",
"synchronized",
"(",
"children",
")",
"{",
"if",
"(",
"children",
".",
"get",
"(",
"child",
".",
"getName",
"(",
")",
")",
"==",
"null",
")",
"return",
";",
"children",
".",
"remove",
"(",
"child",
".",
"getName",
"(",
")",
")",
";",
"}",
"fireContainerEvent",
"(",
"REMOVE_CHILD_EVENT",
",",
"child",
")",
";",
"}"
] | Remove an existing child Container from association with this parent
Container. | [
"Remove",
"an",
"existing",
"child",
"Container",
"from",
"association",
"with",
"this",
"parent",
"Container",
"."
] | [
"// child.destroy() may have already been called which would have",
"// triggered this call. If that is the case, no need to destroy the",
"// child again."
] | [
{
"param": "child",
"type": "Container"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "child",
"type": "Container",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
14213,
12,
2170,
1151,
13,
288,
203,
203,
3639,
309,
261,
3624,
422,
446,
13,
288,
203,
5411,
327,
31,
203,
3639,
289,
203,
203,
3639,
775,
288,
203,
5411,
309,
261,
3624,
18,
588,
1119,
7675,
291,
5268,
10756,
288,
203,
7734,
1151,
18,
5681,
5621,
203,
5411,
289,
203,
3639,
289,
1044,
261,
9977,
503,
425,
13,
288,
203,
5411,
613,
18,
1636,
2932,
2170,
2171,
18,
4479,
1763,
30,
2132,
30,
3104,
425,
1769,
203,
3639,
289,
203,
203,
3639,
775,
288,
203,
5411,
368,
1151,
18,
11662,
1435,
2026,
1240,
1818,
2118,
2566,
1492,
4102,
1240,
203,
5411,
368,
10861,
333,
745,
18,
971,
716,
353,
326,
648,
16,
1158,
1608,
358,
5546,
326,
203,
5411,
368,
1151,
3382,
18,
203,
5411,
309,
16051,
9977,
1119,
18,
1639,
25870,
61,
1360,
18,
14963,
12,
3624,
18,
588,
1119,
1435,
3719,
288,
203,
7734,
1151,
18,
11662,
5621,
203,
5411,
289,
203,
3639,
289,
1044,
261,
9977,
503,
425,
13,
288,
203,
5411,
613,
18,
1636,
2932,
2170,
2171,
18,
4479,
1763,
30,
5546,
30,
3104,
425,
1769,
203,
3639,
289,
203,
203,
3639,
3852,
12,
5906,
13,
288,
203,
5411,
309,
261,
5906,
18,
588,
12,
3624,
18,
17994,
10756,
422,
446,
13,
203,
7734,
327,
31,
203,
5411,
2325,
18,
4479,
12,
3624,
18,
17994,
10663,
203,
3639,
289,
203,
203,
3639,
4452,
2170,
1133,
12,
22122,
67,
27043,
67,
10454,
16,
1151,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3581,
392,
2062,
1151,
4039,
628,
6384,
598,
333,
982,
203,
377,
380,
4039,
18,
203,
377,
380,
203,
377,
380,
632,
891,
1151,
28257,
1151,
4039,
358,
506,
3723,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fe6286f402d7c86f5d4732f3bde5328ee34604ce | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/core/ContainerBase.java | [
"MIT"
] | Java | stopInternal | null | @Override
protected synchronized void stopInternal() throws LifecycleException {
// Stop our thread
threadStop();
setState(LifecycleState.STOPPING);
// Stop the Valves in our pipeline (including the basic), if any
if (pipeline instanceof Lifecycle &&
((Lifecycle) pipeline).getState().isAvailable()) {
((Lifecycle) pipeline).stop();
}
// Stop our child containers, if any
Container children[] = findChildren();
List<Future<Void>> results = new ArrayList<>();
for (int i = 0; i < children.length; i++) {
results.add(startStopExecutor.submit(new StopChild(children[i])));
}
boolean fail = false;
for (Future<Void> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString("containerBase.threadedStopFailed"), e);
fail = true;
}
}
if (fail) {
throw new LifecycleException(
sm.getString("containerBase.threadedStopFailed"));
}
// Stop our subordinate components, if any
Realm realm = getRealmInternal();
if (realm instanceof Lifecycle) {
((Lifecycle) realm).stop();
}
Cluster cluster = getClusterInternal();
if (cluster instanceof Lifecycle) {
((Lifecycle) cluster).stop();
}
} | /**
* Stop this component and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/ | Stop this component and implement the requirements
of org.apache.catalina.util.LifecycleBase#stopInternal().
@exception LifecycleException if this component detects a fatal error
that prevents this component from being used | [
"Stop",
"this",
"component",
"and",
"implement",
"the",
"requirements",
"of",
"org",
".",
"apache",
".",
"catalina",
".",
"util",
".",
"LifecycleBase#stopInternal",
"()",
".",
"@exception",
"LifecycleException",
"if",
"this",
"component",
"detects",
"a",
"fatal",
"error",
"that",
"prevents",
"this",
"component",
"from",
"being",
"used"
] | @Override
protected synchronized void stopInternal() throws LifecycleException {
threadStop();
setState(LifecycleState.STOPPING);
if (pipeline instanceof Lifecycle &&
((Lifecycle) pipeline).getState().isAvailable()) {
((Lifecycle) pipeline).stop();
}
Container children[] = findChildren();
List<Future<Void>> results = new ArrayList<>();
for (int i = 0; i < children.length; i++) {
results.add(startStopExecutor.submit(new StopChild(children[i])));
}
boolean fail = false;
for (Future<Void> result : results) {
try {
result.get();
} catch (Exception e) {
log.error(sm.getString("containerBase.threadedStopFailed"), e);
fail = true;
}
}
if (fail) {
throw new LifecycleException(
sm.getString("containerBase.threadedStopFailed"));
}
Realm realm = getRealmInternal();
if (realm instanceof Lifecycle) {
((Lifecycle) realm).stop();
}
Cluster cluster = getClusterInternal();
if (cluster instanceof Lifecycle) {
((Lifecycle) cluster).stop();
}
} | [
"@",
"Override",
"protected",
"synchronized",
"void",
"stopInternal",
"(",
")",
"throws",
"LifecycleException",
"{",
"threadStop",
"(",
")",
";",
"setState",
"(",
"LifecycleState",
".",
"STOPPING",
")",
";",
"if",
"(",
"pipeline",
"instanceof",
"Lifecycle",
"&&",
"(",
"(",
"Lifecycle",
")",
"pipeline",
")",
".",
"getState",
"(",
")",
".",
"isAvailable",
"(",
")",
")",
"{",
"(",
"(",
"Lifecycle",
")",
"pipeline",
")",
".",
"stop",
"(",
")",
";",
"}",
"Container",
"children",
"[",
"]",
"=",
"findChildren",
"(",
")",
";",
"List",
"<",
"Future",
"<",
"Void",
">",
">",
"results",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"results",
".",
"add",
"(",
"startStopExecutor",
".",
"submit",
"(",
"new",
"StopChild",
"(",
"children",
"[",
"i",
"]",
")",
")",
")",
";",
"}",
"boolean",
"fail",
"=",
"false",
";",
"for",
"(",
"Future",
"<",
"Void",
">",
"result",
":",
"results",
")",
"{",
"try",
"{",
"result",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"sm",
".",
"getString",
"(",
"\"containerBase.threadedStopFailed\"",
")",
",",
"e",
")",
";",
"fail",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"fail",
")",
"{",
"throw",
"new",
"LifecycleException",
"(",
"sm",
".",
"getString",
"(",
"\"containerBase.threadedStopFailed\"",
")",
")",
";",
"}",
"Realm",
"realm",
"=",
"getRealmInternal",
"(",
")",
";",
"if",
"(",
"realm",
"instanceof",
"Lifecycle",
")",
"{",
"(",
"(",
"Lifecycle",
")",
"realm",
")",
".",
"stop",
"(",
")",
";",
"}",
"Cluster",
"cluster",
"=",
"getClusterInternal",
"(",
")",
";",
"if",
"(",
"cluster",
"instanceof",
"Lifecycle",
")",
"{",
"(",
"(",
"Lifecycle",
")",
"cluster",
")",
".",
"stop",
"(",
")",
";",
"}",
"}"
] | Stop this component and implement the requirements
of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. | [
"Stop",
"this",
"component",
"and",
"implement",
"the",
"requirements",
"of",
"{",
"@link",
"org",
".",
"apache",
".",
"catalina",
".",
"util",
".",
"LifecycleBase#stopInternal",
"()",
"}",
"."
] | [
"// Stop our thread",
"// Stop the Valves in our pipeline (including the basic), if any",
"// Stop our child containers, if any",
"// Stop our subordinate components, if any"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
4750,
3852,
918,
2132,
3061,
1435,
1216,
14283,
503,
288,
203,
203,
3639,
368,
5131,
3134,
2650,
203,
3639,
2650,
4947,
5621,
203,
203,
3639,
12947,
12,
9977,
1119,
18,
17513,
20002,
1769,
203,
203,
3639,
368,
5131,
326,
12747,
3324,
316,
3134,
5873,
261,
31348,
326,
5337,
3631,
309,
1281,
203,
3639,
309,
261,
14511,
1276,
14283,
597,
203,
7734,
14015,
9977,
13,
5873,
2934,
588,
1119,
7675,
291,
5268,
10756,
288,
203,
5411,
14015,
9977,
13,
5873,
2934,
5681,
5621,
203,
3639,
289,
203,
203,
3639,
368,
5131,
3134,
1151,
8475,
16,
309,
1281,
203,
3639,
4039,
2325,
8526,
273,
1104,
4212,
5621,
203,
3639,
987,
32,
4118,
32,
19038,
9778,
1686,
273,
394,
2407,
29667,
5621,
203,
3639,
364,
261,
474,
277,
273,
374,
31,
277,
411,
2325,
18,
2469,
31,
277,
27245,
288,
203,
5411,
1686,
18,
1289,
12,
1937,
4947,
6325,
18,
9297,
12,
2704,
5131,
1763,
12,
5906,
63,
77,
22643,
1769,
203,
3639,
289,
203,
203,
3639,
1250,
2321,
273,
629,
31,
203,
3639,
364,
261,
4118,
32,
19038,
34,
563,
294,
1686,
13,
288,
203,
5411,
775,
288,
203,
7734,
563,
18,
588,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
1636,
12,
4808,
18,
588,
780,
2932,
3782,
2171,
18,
451,
20528,
4947,
2925,
6,
3631,
425,
1769,
203,
7734,
2321,
273,
638,
31,
203,
5411,
289,
203,
3639,
289,
203,
3639,
309,
261,
6870,
13,
288,
203,
5411,
604,
394,
14283,
503,
12,
203,
10792,
3029,
18,
588,
780,
2932,
3782,
2171,
18,
451,
20528,
4947,
2925,
7923,
1769,
203,
3639,
289,
203,
203,
3639,
368,
5131,
3134,
720,
22454,
4085,
16,
309,
1281,
203,
3639,
15987,
81,
11319,
273,
12361,
81,
3061,
5621,
203,
3639,
309,
261,
24056,
1276,
14283,
13,
288,
203,
5411,
14015,
9977,
13,
11319,
2934,
5681,
5621,
203,
3639,
289,
203,
3639,
5584,
2855,
273,
21206,
3061,
5621,
203,
3639,
309,
261,
7967,
1276,
14283,
13,
288,
203,
5411,
14015,
9977,
13,
2855,
2934,
5681,
5621,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5131,
333,
1794,
471,
2348,
326,
8433,
203,
377,
380,
434,
8901,
1232,
2358,
18,
19211,
18,
2574,
287,
15314,
18,
1367,
18,
9977,
2171,
7,
5681,
3061,
1435,
5496,
203,
377,
380,
203,
377,
380,
632,
4064,
14283,
503,
309,
333,
1794,
5966,
87,
279,
10081,
555,
203,
377,
380,
225,
716,
17793,
333,
1794,
628,
3832,
1399,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fe6286f402d7c86f5d4732f3bde5328ee34604ce | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/core/ContainerBase.java | [
"MIT"
] | Java | backgroundProcess | null | @Override
public void backgroundProcess() {
if (!getState().isAvailable())
return;
Cluster cluster = getClusterInternal();
if (cluster != null) {
try {
cluster.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.cluster",
cluster), e);
}
}
Realm realm = getRealmInternal();
if (realm != null) {
try {
realm.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.realm", realm), e);
}
}
Valve current = pipeline.getFirst();
while (current != null) {
try {
current.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.valve", current), e);
}
current = current.getNext();
}
fireLifecycleEvent(Lifecycle.PERIODIC_EVENT, null);
} | /**
* Execute a periodic task, such as reloading, etc. This method will be
* invoked inside the classloading context of this container. Unexpected
* throwables will be caught and logged.
*/ | Execute a periodic task, such as reloading, etc. This method will be
invoked inside the classloading context of this container. Unexpected
throwables will be caught and logged. | [
"Execute",
"a",
"periodic",
"task",
"such",
"as",
"reloading",
"etc",
".",
"This",
"method",
"will",
"be",
"invoked",
"inside",
"the",
"classloading",
"context",
"of",
"this",
"container",
".",
"Unexpected",
"throwables",
"will",
"be",
"caught",
"and",
"logged",
"."
] | @Override
public void backgroundProcess() {
if (!getState().isAvailable())
return;
Cluster cluster = getClusterInternal();
if (cluster != null) {
try {
cluster.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.cluster",
cluster), e);
}
}
Realm realm = getRealmInternal();
if (realm != null) {
try {
realm.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.realm", realm), e);
}
}
Valve current = pipeline.getFirst();
while (current != null) {
try {
current.backgroundProcess();
} catch (Exception e) {
log.warn(sm.getString("containerBase.backgroundProcess.valve", current), e);
}
current = current.getNext();
}
fireLifecycleEvent(Lifecycle.PERIODIC_EVENT, null);
} | [
"@",
"Override",
"public",
"void",
"backgroundProcess",
"(",
")",
"{",
"if",
"(",
"!",
"getState",
"(",
")",
".",
"isAvailable",
"(",
")",
")",
"return",
";",
"Cluster",
"cluster",
"=",
"getClusterInternal",
"(",
")",
";",
"if",
"(",
"cluster",
"!=",
"null",
")",
"{",
"try",
"{",
"cluster",
".",
"backgroundProcess",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"containerBase.backgroundProcess.cluster\"",
",",
"cluster",
")",
",",
"e",
")",
";",
"}",
"}",
"Realm",
"realm",
"=",
"getRealmInternal",
"(",
")",
";",
"if",
"(",
"realm",
"!=",
"null",
")",
"{",
"try",
"{",
"realm",
".",
"backgroundProcess",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"containerBase.backgroundProcess.realm\"",
",",
"realm",
")",
",",
"e",
")",
";",
"}",
"}",
"Valve",
"current",
"=",
"pipeline",
".",
"getFirst",
"(",
")",
";",
"while",
"(",
"current",
"!=",
"null",
")",
"{",
"try",
"{",
"current",
".",
"backgroundProcess",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"sm",
".",
"getString",
"(",
"\"containerBase.backgroundProcess.valve\"",
",",
"current",
")",
",",
"e",
")",
";",
"}",
"current",
"=",
"current",
".",
"getNext",
"(",
")",
";",
"}",
"fireLifecycleEvent",
"(",
"Lifecycle",
".",
"PERIODIC_EVENT",
",",
"null",
")",
";",
"}"
] | Execute a periodic task, such as reloading, etc. | [
"Execute",
"a",
"periodic",
"task",
"such",
"as",
"reloading",
"etc",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6618,
203,
565,
1071,
918,
5412,
2227,
1435,
288,
203,
203,
3639,
309,
16051,
588,
1119,
7675,
291,
5268,
10756,
203,
5411,
327,
31,
203,
203,
3639,
5584,
2855,
273,
21206,
3061,
5621,
203,
3639,
309,
261,
7967,
480,
446,
13,
288,
203,
5411,
775,
288,
203,
7734,
2855,
18,
9342,
2227,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
8935,
12,
4808,
18,
588,
780,
2932,
3782,
2171,
18,
9342,
2227,
18,
7967,
3113,
203,
13491,
2855,
3631,
425,
1769,
203,
5411,
289,
203,
3639,
289,
203,
3639,
15987,
81,
11319,
273,
12361,
81,
3061,
5621,
203,
3639,
309,
261,
24056,
480,
446,
13,
288,
203,
5411,
775,
288,
203,
7734,
11319,
18,
9342,
2227,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
8935,
12,
4808,
18,
588,
780,
2932,
3782,
2171,
18,
9342,
2227,
18,
24056,
3113,
11319,
3631,
425,
1769,
203,
5411,
289,
203,
3639,
289,
203,
3639,
12747,
537,
783,
273,
5873,
18,
588,
3759,
5621,
203,
3639,
1323,
261,
2972,
480,
446,
13,
288,
203,
5411,
775,
288,
203,
7734,
783,
18,
9342,
2227,
5621,
203,
5411,
289,
1044,
261,
503,
425,
13,
288,
203,
7734,
613,
18,
8935,
12,
4808,
18,
588,
780,
2932,
3782,
2171,
18,
9342,
2227,
18,
1125,
537,
3113,
783,
3631,
425,
1769,
203,
5411,
289,
203,
5411,
783,
273,
783,
18,
588,
2134,
5621,
203,
3639,
289,
203,
3639,
4452,
9977,
1133,
12,
9977,
18,
28437,
2871,
67,
10454,
16,
446,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7903,
279,
17478,
1562,
16,
4123,
487,
7749,
310,
16,
5527,
18,
1220,
707,
903,
506,
203,
377,
380,
8187,
4832,
326,
667,
15174,
819,
434,
333,
1478,
18,
9649,
203,
377,
380,
604,
1538,
903,
506,
13537,
471,
7545,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
fe6286f402d7c86f5d4732f3bde5328ee34604ce | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/catalina/core/ContainerBase.java | [
"MIT"
] | Java | threadStart | null | protected void threadStart() {
if (thread != null)
return;
if (backgroundProcessorDelay <= 0)
return;
threadDone = false;
String threadName = "ContainerBackgroundProcessor[" + toString() + "]";
thread = new Thread(new ContainerBackgroundProcessor(), threadName);
thread.setDaemon(true);
/**
*
* ContainerBackgroundProcessor[StandardEngine[Catalina]]
* {@link ContainerBase#threadStart()}
*/
thread.start();
} | /**
* Start the background thread that will periodically check for
* session timeouts.
*/ | Start the background thread that will periodically check for
session timeouts. | [
"Start",
"the",
"background",
"thread",
"that",
"will",
"periodically",
"check",
"for",
"session",
"timeouts",
"."
] | protected void threadStart() {
if (thread != null)
return;
if (backgroundProcessorDelay <= 0)
return;
threadDone = false;
String threadName = "ContainerBackgroundProcessor[" + toString() + "]";
thread = new Thread(new ContainerBackgroundProcessor(), threadName);
thread.setDaemon(true);
/**
*
* ContainerBackgroundProcessor[StandardEngine[Catalina]]
* {@link ContainerBase#threadStart()}
*/
thread.start();
} | [
"protected",
"void",
"threadStart",
"(",
")",
"{",
"if",
"(",
"thread",
"!=",
"null",
")",
"return",
";",
"if",
"(",
"backgroundProcessorDelay",
"<=",
"0",
")",
"return",
";",
"threadDone",
"=",
"false",
";",
"String",
"threadName",
"=",
"\"ContainerBackgroundProcessor[\"",
"+",
"toString",
"(",
")",
"+",
"\"]\"",
";",
"thread",
"=",
"new",
"Thread",
"(",
"new",
"ContainerBackgroundProcessor",
"(",
")",
",",
"threadName",
")",
";",
"thread",
".",
"setDaemon",
"(",
"true",
")",
";",
"/**\n *\n * ContainerBackgroundProcessor[StandardEngine[Catalina]]\n * {@link ContainerBase#threadStart()}\n */",
"thread",
".",
"start",
"(",
")",
";",
"}"
] | Start the background thread that will periodically check for
session timeouts. | [
"Start",
"the",
"background",
"thread",
"that",
"will",
"periodically",
"check",
"for",
"session",
"timeouts",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
2650,
1685,
1435,
288,
203,
203,
3639,
309,
261,
5930,
480,
446,
13,
203,
5411,
327,
31,
203,
3639,
309,
261,
9342,
5164,
6763,
1648,
374,
13,
203,
5411,
327,
31,
203,
203,
3639,
2650,
7387,
273,
629,
31,
203,
3639,
514,
2650,
461,
273,
315,
2170,
8199,
5164,
9614,
397,
1762,
1435,
397,
9870,
31,
203,
3639,
2650,
273,
394,
4884,
12,
2704,
4039,
8199,
5164,
9334,
2650,
461,
1769,
203,
3639,
2650,
18,
542,
12858,
12,
3767,
1769,
203,
3639,
1783,
203,
540,
380,
203,
540,
380,
4039,
8199,
5164,
63,
8336,
4410,
63,
39,
3145,
15314,
13563,
203,
540,
380,
8901,
1232,
4039,
2171,
7,
5930,
1685,
17767,
203,
540,
1195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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
3603,
326,
5412,
2650,
716,
903,
26736,
866,
364,
203,
377,
380,
1339,
20395,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
f58a4fe6b75f2fdc7678644108b2a573029cddd1 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11InputBuffer.java | [
"MIT"
] | Java | available | null | int available(boolean read) {
int available = byteBuffer.remaining();
if ((available == 0) && (lastActiveFilter >= 0)) {
for (int i = 0; (available == 0) && (i <= lastActiveFilter); i++) {
available = activeFilters[i].available();
}
}
if (available > 0 || !read) {
return available;
}
try {
if (wrapper.hasDataToRead()) {
fill(false);
available = byteBuffer.remaining();
}
} catch (IOException ioe) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("iib.available.readFail"), ioe);
}
// Not ideal. This will indicate that data is available which should
// trigger a read which in turn will trigger another IOException and
// that one can be thrown.
available = 1;
}
return available;
} | /**
* Available bytes in the buffers (note that due to encoding, this may not
* correspond).
*/ | Available bytes in the buffers (note that due to encoding, this may not
correspond). | [
"Available",
"bytes",
"in",
"the",
"buffers",
"(",
"note",
"that",
"due",
"to",
"encoding",
"this",
"may",
"not",
"correspond",
")",
"."
] | int available(boolean read) {
int available = byteBuffer.remaining();
if ((available == 0) && (lastActiveFilter >= 0)) {
for (int i = 0; (available == 0) && (i <= lastActiveFilter); i++) {
available = activeFilters[i].available();
}
}
if (available > 0 || !read) {
return available;
}
try {
if (wrapper.hasDataToRead()) {
fill(false);
available = byteBuffer.remaining();
}
} catch (IOException ioe) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("iib.available.readFail"), ioe);
}
available = 1;
}
return available;
} | [
"int",
"available",
"(",
"boolean",
"read",
")",
"{",
"int",
"available",
"=",
"byteBuffer",
".",
"remaining",
"(",
")",
";",
"if",
"(",
"(",
"available",
"==",
"0",
")",
"&&",
"(",
"lastActiveFilter",
">=",
"0",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"(",
"available",
"==",
"0",
")",
"&&",
"(",
"i",
"<=",
"lastActiveFilter",
")",
";",
"i",
"++",
")",
"{",
"available",
"=",
"activeFilters",
"[",
"i",
"]",
".",
"available",
"(",
")",
";",
"}",
"}",
"if",
"(",
"available",
">",
"0",
"||",
"!",
"read",
")",
"{",
"return",
"available",
";",
"}",
"try",
"{",
"if",
"(",
"wrapper",
".",
"hasDataToRead",
"(",
")",
")",
"{",
"fill",
"(",
"false",
")",
";",
"available",
"=",
"byteBuffer",
".",
"remaining",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"sm",
".",
"getString",
"(",
"\"iib.available.readFail\"",
")",
",",
"ioe",
")",
";",
"}",
"available",
"=",
"1",
";",
"}",
"return",
"available",
";",
"}"
] | Available bytes in the buffers (note that due to encoding, this may not
correspond). | [
"Available",
"bytes",
"in",
"the",
"buffers",
"(",
"note",
"that",
"due",
"to",
"encoding",
"this",
"may",
"not",
"correspond",
")",
"."
] | [
"// Not ideal. This will indicate that data is available which should",
"// trigger a read which in turn will trigger another IOException and",
"// that one can be thrown."
] | [
{
"param": "read",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "read",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
509,
2319,
12,
6494,
855,
13,
288,
203,
3639,
509,
2319,
273,
21734,
18,
17956,
5621,
203,
3639,
309,
14015,
5699,
422,
374,
13,
597,
261,
2722,
3896,
1586,
1545,
374,
3719,
288,
203,
5411,
364,
261,
474,
277,
273,
374,
31,
261,
5699,
422,
374,
13,
597,
261,
77,
1648,
1142,
3896,
1586,
1769,
277,
27245,
288,
203,
7734,
2319,
273,
2695,
5422,
63,
77,
8009,
5699,
5621,
203,
5411,
289,
203,
3639,
289,
203,
3639,
309,
261,
5699,
405,
374,
747,
401,
896,
13,
288,
203,
5411,
327,
2319,
31,
203,
3639,
289,
203,
203,
3639,
775,
288,
203,
5411,
309,
261,
8376,
18,
5332,
751,
23321,
10756,
288,
203,
7734,
3636,
12,
5743,
1769,
203,
7734,
2319,
273,
21734,
18,
17956,
5621,
203,
5411,
289,
203,
3639,
289,
1044,
261,
14106,
10847,
13,
288,
203,
5411,
309,
261,
1330,
18,
291,
2829,
1526,
10756,
288,
203,
7734,
613,
18,
4148,
12,
4808,
18,
588,
780,
2932,
77,
495,
18,
5699,
18,
896,
3754,
6,
3631,
10847,
1769,
203,
5411,
289,
203,
5411,
368,
2288,
23349,
18,
1220,
903,
10768,
716,
501,
353,
2319,
1492,
1410,
203,
5411,
368,
3080,
279,
855,
1492,
316,
7005,
903,
3080,
4042,
1860,
471,
203,
5411,
368,
716,
1245,
848,
506,
6718,
18,
203,
5411,
2319,
273,
404,
31,
203,
3639,
289,
203,
3639,
327,
2319,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
f58a4fe6b75f2fdc7678644108b2a573029cddd1 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11InputBuffer.java | [
"MIT"
] | Java | parseHeader | HeaderParseStatus | private HeaderParseStatus parseHeader() throws IOException {
//
// Check for blank line
//
byte chr = 0;
while (headerParsePos == HeaderParsePosition.HEADER_START) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
headerParsePos = HeaderParsePosition.HEADER_START;
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get();
if (chr == Constants.CR) {
// Skip
} else if (chr == Constants.LF) {
return HeaderParseStatus.DONE;
} else {
byteBuffer.position(byteBuffer.position() - 1);
break;
}
}
if (headerParsePos == HeaderParsePosition.HEADER_START) {
// Mark the current buffer position
headerData.start = byteBuffer.position();
headerParsePos = HeaderParsePosition.HEADER_NAME;
}
//
// Reading the header name
// Header name is always US-ASCII
//
while (headerParsePos == HeaderParsePosition.HEADER_NAME) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
//解析http头的时候是不会阻塞的。
if (!fill(false)) { // parse header
return HeaderParseStatus.NEED_MORE_DATA;
}
}
int pos = byteBuffer.position();
chr = byteBuffer.get();
if (chr == Constants.COLON) {
headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
headerData.headerValue = headers.addValue(byteBuffer.array(), headerData.start,
pos - headerData.start);
pos = byteBuffer.position();
// Mark the current buffer position
headerData.start = pos;
headerData.realPos = pos;
headerData.lastSignificantChar = pos;
break;
} else if (!HttpParser.isToken(chr)) {
// Non-token characters are illegal in header names
// Parsing continues so the error can be reported in context
headerData.lastSignificantChar = pos;
byteBuffer.position(byteBuffer.position() - 1);
// skipLine() will handle the error
return skipLine();
}
// chr is next byte of header name. Convert to lowercase.
if ((chr >= Constants.A) && (chr <= Constants.Z)) {
byteBuffer.put(pos, (byte) (chr - Constants.LC_OFFSET));
}
}
// Skip the line and ignore the header
if (headerParsePos == HeaderParsePosition.HEADER_SKIPLINE) {
return skipLine();
}
//
// Reading the header value (which can be spanned over multiple lines)
//
while (headerParsePos == HeaderParsePosition.HEADER_VALUE_START ||
headerParsePos == HeaderParsePosition.HEADER_VALUE ||
headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
if (headerParsePos == HeaderParsePosition.HEADER_VALUE_START) {
// Skipping spaces
while (true) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
// HEADER_VALUE_START
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get();
if (!(chr == Constants.SP || chr == Constants.HT)) {
headerParsePos = HeaderParsePosition.HEADER_VALUE;
byteBuffer.position(byteBuffer.position() - 1);
break;
}
}
}
if (headerParsePos == HeaderParsePosition.HEADER_VALUE) {
// Reading bytes until the end of the line
boolean eol = false;
while (!eol) {
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
// HEADER_VALUE
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get();
if (chr == Constants.CR) {
// Skip
} else if (chr == Constants.LF) {
eol = true;
} else if (chr == Constants.SP || chr == Constants.HT) {
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
} else {
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
headerData.lastSignificantChar = headerData.realPos;
}
}
// Ignore whitespaces at the end of the line
headerData.realPos = headerData.lastSignificantChar;
// Checking the first character of the new line. If the character
// is a LWS, then it's a multiline header
headerParsePos = HeaderParsePosition.HEADER_MULTI_LINE;
}
// Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) {// parse header
// HEADER_MULTI_LINE
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get(byteBuffer.position());
if (headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
if ((chr != Constants.SP) && (chr != Constants.HT)) {
headerParsePos = HeaderParsePosition.HEADER_START;
break;
} else {
// Copying one extra space in the buffer (since there must
// be at least one space inserted between the lines)
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
}
}
}
// Set the header value
headerData.headerValue.setBytes(byteBuffer.array(), headerData.start,
headerData.lastSignificantChar - headerData.start);
headerData.recycle();
return HeaderParseStatus.HAVE_MORE_HEADERS;
} | /**
* Parse an HTTP header.
*
* @return false after reading a blank line (which indicates that the
* HTTP header parsing is done
*/ | Parse an HTTP header.
@return false after reading a blank line (which indicates that the
HTTP header parsing is done | [
"Parse",
"an",
"HTTP",
"header",
".",
"@return",
"false",
"after",
"reading",
"a",
"blank",
"line",
"(",
"which",
"indicates",
"that",
"the",
"HTTP",
"header",
"parsing",
"is",
"done"
] | private HeaderParseStatus parseHeader() throws IOException {
Check for blank line
byte chr = 0;
while (headerParsePos == HeaderParsePosition.HEADER_START) {
Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) { parse header
headerParsePos = HeaderParsePosition.HEADER_START;
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get();
if (chr == Constants.CR) {
Skip
} else if (chr == Constants.LF) {
return HeaderParseStatus.DONE;
} else {
byteBuffer.position(byteBuffer.position() - 1);
break;
}
}
if (headerParsePos == HeaderParsePosition.HEADER_START) {
Mark the current buffer position
headerData.start = byteBuffer.position();
headerParsePos = HeaderParsePosition.HEADER_NAME;
}
Reading the header name
Header name is always US-ASCII
while (headerParsePos == HeaderParsePosition.HEADER_NAME) {
Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
解析http头的时候是不会阻塞的。
if (!fill(false)) { parse header
return HeaderParseStatus.NEED_MORE_DATA;
}
}
int pos = byteBuffer.position();
chr = byteBuffer.get();
if (chr == Constants.COLON) {
headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
headerData.headerValue = headers.addValue(byteBuffer.array(), headerData.start,
pos - headerData.start);
pos = byteBuffer.position();
Mark the current buffer position
headerData.start = pos;
headerData.realPos = pos;
headerData.lastSignificantChar = pos;
break;
} else if (!HttpParser.isToken(chr)) {
Non-token characters are illegal in header names
Parsing continues so the error can be reported in context
headerData.lastSignificantChar = pos;
byteBuffer.position(byteBuffer.position() - 1);
skipLine() will handle the error
return skipLine();
}
chr is next byte of header name. Convert to lowercase.
if ((chr >= Constants.A) && (chr <= Constants.Z)) {
byteBuffer.put(pos, (byte) (chr - Constants.LC_OFFSET));
}
}
Skip the line and ignore the header
if (headerParsePos == HeaderParsePosition.HEADER_SKIPLINE) {
return skipLine();
}
Reading the header value (which can be spanned over multiple lines)
while (headerParsePos == HeaderParsePosition.HEADER_VALUE_START ||
headerParsePos == HeaderParsePosition.HEADER_VALUE ||
headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
if (headerParsePos == HeaderParsePosition.HEADER_VALUE_START) {
Skipping spaces
while (true) {
Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) { parse header
HEADER_VALUE_START
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get();
if (!(chr == Constants.SP || chr == Constants.HT)) {
headerParsePos = HeaderParsePosition.HEADER_VALUE;
byteBuffer.position(byteBuffer.position() - 1);
break;
}
}
}
if (headerParsePos == HeaderParsePosition.HEADER_VALUE) {
Reading bytes until the end of the line
boolean eol = false;
while (!eol) {
Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) { parse header
HEADER_VALUE
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get();
if (chr == Constants.CR) {
Skip
} else if (chr == Constants.LF) {
eol = true;
} else if (chr == Constants.SP || chr == Constants.HT) {
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
} else {
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
headerData.lastSignificantChar = headerData.realPos;
}
}
Ignore whitespaces at the end of the line
headerData.realPos = headerData.lastSignificantChar;
Checking the first character of the new line. If the character
is a LWS, then it's a multiline header
headerParsePos = HeaderParsePosition.HEADER_MULTI_LINE;
}
Read new bytes if needed
if (byteBuffer.position() >= byteBuffer.limit()) {
if (!fill(false)) { parse header
HEADER_MULTI_LINE
return HeaderParseStatus.NEED_MORE_DATA;
}
}
chr = byteBuffer.get(byteBuffer.position());
if (headerParsePos == HeaderParsePosition.HEADER_MULTI_LINE) {
if ((chr != Constants.SP) && (chr != Constants.HT)) {
headerParsePos = HeaderParsePosition.HEADER_START;
break;
} else {
Copying one extra space in the buffer (since there must
be at least one space inserted between the lines)
byteBuffer.put(headerData.realPos, chr);
headerData.realPos++;
headerParsePos = HeaderParsePosition.HEADER_VALUE_START;
}
}
}
Set the header value
headerData.headerValue.setBytes(byteBuffer.array(), headerData.start,
headerData.lastSignificantChar - headerData.start);
headerData.recycle();
return HeaderParseStatus.HAVE_MORE_HEADERS;
} | [
"private",
"HeaderParseStatus",
"parseHeader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"chr",
"=",
"0",
";",
"while",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_START",
")",
"{",
"if",
"(",
"byteBuffer",
".",
"position",
"(",
")",
">=",
"byteBuffer",
".",
"limit",
"(",
")",
")",
"{",
"if",
"(",
"!",
"fill",
"(",
"false",
")",
")",
"{",
"headerParsePos",
"=",
"HeaderParsePosition",
".",
"HEADER_START",
";",
"return",
"HeaderParseStatus",
".",
"NEED_MORE_DATA",
";",
"}",
"}",
"chr",
"=",
"byteBuffer",
".",
"get",
"(",
")",
";",
"if",
"(",
"chr",
"==",
"Constants",
".",
"CR",
")",
"{",
"}",
"else",
"if",
"(",
"chr",
"==",
"Constants",
".",
"LF",
")",
"{",
"return",
"HeaderParseStatus",
".",
"DONE",
";",
"}",
"else",
"{",
"byteBuffer",
".",
"position",
"(",
"byteBuffer",
".",
"position",
"(",
")",
"-",
"1",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_START",
")",
"{",
"headerData",
".",
"start",
"=",
"byteBuffer",
".",
"position",
"(",
")",
";",
"headerParsePos",
"=",
"HeaderParsePosition",
".",
"HEADER_NAME",
";",
"}",
"while",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_NAME",
")",
"{",
"if",
"(",
"byteBuffer",
".",
"position",
"(",
")",
">=",
"byteBuffer",
".",
"limit",
"(",
")",
")",
"{",
"if",
"(",
"!",
"fill",
"(",
"false",
")",
")",
"{",
"return",
"HeaderParseStatus",
".",
"NEED_MORE_DATA",
";",
"}",
"}",
"int",
"pos",
"=",
"byteBuffer",
".",
"position",
"(",
")",
";",
"chr",
"=",
"byteBuffer",
".",
"get",
"(",
")",
";",
"if",
"(",
"chr",
"==",
"Constants",
".",
"COLON",
")",
"{",
"headerParsePos",
"=",
"HeaderParsePosition",
".",
"HEADER_VALUE_START",
";",
"headerData",
".",
"headerValue",
"=",
"headers",
".",
"addValue",
"(",
"byteBuffer",
".",
"array",
"(",
")",
",",
"headerData",
".",
"start",
",",
"pos",
"-",
"headerData",
".",
"start",
")",
";",
"pos",
"=",
"byteBuffer",
".",
"position",
"(",
")",
";",
"headerData",
".",
"start",
"=",
"pos",
";",
"headerData",
".",
"realPos",
"=",
"pos",
";",
"headerData",
".",
"lastSignificantChar",
"=",
"pos",
";",
"break",
";",
"}",
"else",
"if",
"(",
"!",
"HttpParser",
".",
"isToken",
"(",
"chr",
")",
")",
"{",
"headerData",
".",
"lastSignificantChar",
"=",
"pos",
";",
"byteBuffer",
".",
"position",
"(",
"byteBuffer",
".",
"position",
"(",
")",
"-",
"1",
")",
";",
"return",
"skipLine",
"(",
")",
";",
"}",
"if",
"(",
"(",
"chr",
">=",
"Constants",
".",
"A",
")",
"&&",
"(",
"chr",
"<=",
"Constants",
".",
"Z",
")",
")",
"{",
"byteBuffer",
".",
"put",
"(",
"pos",
",",
"(",
"byte",
")",
"(",
"chr",
"-",
"Constants",
".",
"LC_OFFSET",
")",
")",
";",
"}",
"}",
"if",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_SKIPLINE",
")",
"{",
"return",
"skipLine",
"(",
")",
";",
"}",
"while",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_VALUE_START",
"||",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_VALUE",
"||",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_MULTI_LINE",
")",
"{",
"if",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_VALUE_START",
")",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"byteBuffer",
".",
"position",
"(",
")",
">=",
"byteBuffer",
".",
"limit",
"(",
")",
")",
"{",
"if",
"(",
"!",
"fill",
"(",
"false",
")",
")",
"{",
"return",
"HeaderParseStatus",
".",
"NEED_MORE_DATA",
";",
"}",
"}",
"chr",
"=",
"byteBuffer",
".",
"get",
"(",
")",
";",
"if",
"(",
"!",
"(",
"chr",
"==",
"Constants",
".",
"SP",
"||",
"chr",
"==",
"Constants",
".",
"HT",
")",
")",
"{",
"headerParsePos",
"=",
"HeaderParsePosition",
".",
"HEADER_VALUE",
";",
"byteBuffer",
".",
"position",
"(",
"byteBuffer",
".",
"position",
"(",
")",
"-",
"1",
")",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_VALUE",
")",
"{",
"boolean",
"eol",
"=",
"false",
";",
"while",
"(",
"!",
"eol",
")",
"{",
"if",
"(",
"byteBuffer",
".",
"position",
"(",
")",
">=",
"byteBuffer",
".",
"limit",
"(",
")",
")",
"{",
"if",
"(",
"!",
"fill",
"(",
"false",
")",
")",
"{",
"return",
"HeaderParseStatus",
".",
"NEED_MORE_DATA",
";",
"}",
"}",
"chr",
"=",
"byteBuffer",
".",
"get",
"(",
")",
";",
"if",
"(",
"chr",
"==",
"Constants",
".",
"CR",
")",
"{",
"}",
"else",
"if",
"(",
"chr",
"==",
"Constants",
".",
"LF",
")",
"{",
"eol",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"chr",
"==",
"Constants",
".",
"SP",
"||",
"chr",
"==",
"Constants",
".",
"HT",
")",
"{",
"byteBuffer",
".",
"put",
"(",
"headerData",
".",
"realPos",
",",
"chr",
")",
";",
"headerData",
".",
"realPos",
"++",
";",
"}",
"else",
"{",
"byteBuffer",
".",
"put",
"(",
"headerData",
".",
"realPos",
",",
"chr",
")",
";",
"headerData",
".",
"realPos",
"++",
";",
"headerData",
".",
"lastSignificantChar",
"=",
"headerData",
".",
"realPos",
";",
"}",
"}",
"headerData",
".",
"realPos",
"=",
"headerData",
".",
"lastSignificantChar",
";",
"headerParsePos",
"=",
"HeaderParsePosition",
".",
"HEADER_MULTI_LINE",
";",
"}",
"if",
"(",
"byteBuffer",
".",
"position",
"(",
")",
">=",
"byteBuffer",
".",
"limit",
"(",
")",
")",
"{",
"if",
"(",
"!",
"fill",
"(",
"false",
")",
")",
"{",
"return",
"HeaderParseStatus",
".",
"NEED_MORE_DATA",
";",
"}",
"}",
"chr",
"=",
"byteBuffer",
".",
"get",
"(",
"byteBuffer",
".",
"position",
"(",
")",
")",
";",
"if",
"(",
"headerParsePos",
"==",
"HeaderParsePosition",
".",
"HEADER_MULTI_LINE",
")",
"{",
"if",
"(",
"(",
"chr",
"!=",
"Constants",
".",
"SP",
")",
"&&",
"(",
"chr",
"!=",
"Constants",
".",
"HT",
")",
")",
"{",
"headerParsePos",
"=",
"HeaderParsePosition",
".",
"HEADER_START",
";",
"break",
";",
"}",
"else",
"{",
"byteBuffer",
".",
"put",
"(",
"headerData",
".",
"realPos",
",",
"chr",
")",
";",
"headerData",
".",
"realPos",
"++",
";",
"headerParsePos",
"=",
"HeaderParsePosition",
".",
"HEADER_VALUE_START",
";",
"}",
"}",
"}",
"headerData",
".",
"headerValue",
".",
"setBytes",
"(",
"byteBuffer",
".",
"array",
"(",
")",
",",
"headerData",
".",
"start",
",",
"headerData",
".",
"lastSignificantChar",
"-",
"headerData",
".",
"start",
")",
";",
"headerData",
".",
"recycle",
"(",
")",
";",
"return",
"HeaderParseStatus",
".",
"HAVE_MORE_HEADERS",
";",
"}"
] | Parse an HTTP header. | [
"Parse",
"an",
"HTTP",
"header",
"."
] | [
"//",
"// Check for blank line",
"//",
"// Read new bytes if needed",
"// parse header",
"// Skip",
"// Mark the current buffer position",
"//",
"// Reading the header name",
"// Header name is always US-ASCII",
"//",
"// Read new bytes if needed",
"//解析http头的时候是不会阻塞的。",
"// parse header",
"// Mark the current buffer position",
"// Non-token characters are illegal in header names",
"// Parsing continues so the error can be reported in context",
"// skipLine() will handle the error",
"// chr is next byte of header name. Convert to lowercase.",
"// Skip the line and ignore the header",
"//",
"// Reading the header value (which can be spanned over multiple lines)",
"//",
"// Skipping spaces",
"// Read new bytes if needed",
"// parse header",
"// HEADER_VALUE_START",
"// Reading bytes until the end of the line",
"// Read new bytes if needed",
"// parse header",
"// HEADER_VALUE",
"// Skip",
"// Ignore whitespaces at the end of the line",
"// Checking the first character of the new line. If the character",
"// is a LWS, then it's a multiline header",
"// Read new bytes if needed",
"// parse header",
"// HEADER_MULTI_LINE",
"// Copying one extra space in the buffer (since there must",
"// be at least one space inserted between the lines)",
"// Set the header value"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
4304,
3201,
1482,
1109,
1864,
1435,
1216,
1860,
288,
203,
203,
3639,
368,
203,
3639,
368,
2073,
364,
7052,
980,
203,
3639,
368,
203,
203,
3639,
1160,
4513,
273,
374,
31,
203,
3639,
1323,
261,
3374,
3201,
1616,
422,
4304,
3201,
2555,
18,
7557,
67,
7570,
13,
288,
203,
203,
5411,
368,
2720,
394,
1731,
309,
3577,
203,
5411,
309,
261,
7229,
1892,
18,
3276,
1435,
1545,
21734,
18,
3595,
10756,
288,
203,
7734,
309,
16051,
5935,
12,
5743,
3719,
288,
759,
1109,
1446,
203,
10792,
1446,
3201,
1616,
273,
4304,
3201,
2555,
18,
7557,
67,
7570,
31,
203,
10792,
327,
4304,
3201,
1482,
18,
5407,
2056,
67,
31078,
67,
4883,
31,
203,
7734,
289,
203,
5411,
289,
203,
203,
5411,
4513,
273,
21734,
18,
588,
5621,
203,
203,
5411,
309,
261,
15182,
422,
5245,
18,
5093,
13,
288,
203,
7734,
368,
6611,
203,
5411,
289,
469,
309,
261,
15182,
422,
5245,
18,
9105,
13,
288,
203,
7734,
327,
4304,
3201,
1482,
18,
26875,
31,
203,
5411,
289,
469,
288,
203,
7734,
21734,
18,
3276,
12,
7229,
1892,
18,
3276,
1435,
300,
404,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
203,
3639,
289,
203,
203,
3639,
309,
261,
3374,
3201,
1616,
422,
4304,
3201,
2555,
18,
7557,
67,
7570,
13,
288,
203,
5411,
368,
6622,
326,
783,
1613,
1754,
203,
5411,
1446,
751,
18,
1937,
273,
21734,
18,
3276,
5621,
203,
5411,
1446,
3201,
1616,
273,
4304,
3201,
2555,
18,
7557,
67,
1985,
31,
203,
3639,
289,
203,
203,
3639,
368,
203,
3639,
368,
31941,
326,
1446,
508,
203,
3639,
368,
4304,
508,
353,
3712,
11836,
17,
13756,
203,
3639,
368,
203,
203,
3639,
1323,
261,
3374,
3201,
1616,
422,
4304,
3201,
2555,
18,
7557,
67,
1985,
13,
288,
203,
203,
5411,
368,
2720,
394,
1731,
309,
3577,
203,
5411,
309,
261,
7229,
1892,
18,
3276,
1435,
1545,
21734,
18,
3595,
10756,
288,
203,
7734,
368,
169,
105,
101,
167,
257,
243,
2505,
166,
102,
117,
168,
253,
231,
167,
250,
119,
166,
227,
252,
167,
251,
112,
165,
121,
240,
165,
125,
253,
170,
251,
124,
166,
99,
257,
168,
253,
231,
164,
227,
229,
203,
7734,
309,
16051,
5935,
12,
5743,
3719,
288,
368,
1109,
1446,
203,
10792,
327,
4304,
3201,
1482,
18,
5407,
2056,
67,
31078,
67,
4883,
31,
203,
7734,
289,
203,
5411,
289,
203,
203,
5411,
509,
949,
273,
21734,
18,
3276,
5621,
203,
5411,
4513,
273,
21734,
18,
588,
5621,
203,
5411,
309,
261,
15182,
422,
5245,
18,
4935,
673,
13,
288,
203,
7734,
1446,
3201,
1616,
273,
4304,
3201,
2555,
18,
7557,
67,
4051,
67,
7570,
31,
203,
7734,
1446,
751,
18,
3374,
620,
273,
1607,
18,
1289,
620,
12,
7229,
1892,
18,
1126,
9334,
1446,
751,
18,
1937,
16,
203,
13491,
949,
300,
1446,
751,
18,
1937,
1769,
203,
7734,
949,
273,
21734,
18,
3276,
5621,
203,
7734,
368,
6622,
326,
783,
1613,
1754,
203,
7734,
1446,
751,
18,
1937,
273,
949,
31,
203,
7734,
1446,
751,
18,
7688,
1616,
273,
949,
31,
203,
7734,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
377,
380,
2884,
392,
2239,
1446,
18,
203,
377,
380,
203,
377,
380,
632,
2463,
629,
1839,
6453,
279,
7052,
980,
261,
12784,
8527,
716,
326,
203,
377,
380,
2239,
1446,
5811,
353,
2731,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
f58a4fe6b75f2fdc7678644108b2a573029cddd1 | wenlf/Tomcat8-Source-Read | apache-tomcat-8.5.49-src/java/org/apache/coyote/http11/Http11InputBuffer.java | [
"MIT"
] | Java | doRead | null | @Deprecated
@Override
public int doRead(ByteChunk chunk) throws IOException {
if (byteBuffer.position() >= byteBuffer.limit()) {
// The application is reading the HTTP request body which is
// always a blocking operation.
/**
* 读取HttpBody的时候是会阻塞的。
*/
if (!fill(true))
return -1;
}
int length = byteBuffer.remaining();
chunk.setBytes(byteBuffer.array(), byteBuffer.position(), length);
byteBuffer.position(byteBuffer.limit());
return length;
} | /**
*
* @deprecated Unused. Will be removed in Tomcat 9. Use
* {@link #doRead(ApplicationBufferHandler)}
*/ | @deprecated Unused. Will be removed in Tomcat 9. | [
"@deprecated",
"Unused",
".",
"Will",
"be",
"removed",
"in",
"Tomcat",
"9",
"."
] | @Deprecated
@Override
public int doRead(ByteChunk chunk) throws IOException {
if (byteBuffer.position() >= byteBuffer.limit()) {
/**
* 读取HttpBody的时候是会阻塞的。
*/
if (!fill(true))
return -1;
}
int length = byteBuffer.remaining();
chunk.setBytes(byteBuffer.array(), byteBuffer.position(), length);
byteBuffer.position(byteBuffer.limit());
return length;
} | [
"@",
"Deprecated",
"@",
"Override",
"public",
"int",
"doRead",
"(",
"ByteChunk",
"chunk",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteBuffer",
".",
"position",
"(",
")",
">=",
"byteBuffer",
".",
"limit",
"(",
")",
")",
"{",
"/**\n * 读取HttpBody的时候是会阻塞的。\n */",
"if",
"(",
"!",
"fill",
"(",
"true",
")",
")",
"return",
"-",
"1",
";",
"}",
"int",
"length",
"=",
"byteBuffer",
".",
"remaining",
"(",
")",
";",
"chunk",
".",
"setBytes",
"(",
"byteBuffer",
".",
"array",
"(",
")",
",",
"byteBuffer",
".",
"position",
"(",
")",
",",
"length",
")",
";",
"byteBuffer",
".",
"position",
"(",
"byteBuffer",
".",
"limit",
"(",
")",
")",
";",
"return",
"length",
";",
"}"
] | @deprecated Unused. | [
"@deprecated",
"Unused",
"."
] | [
"// The application is reading the HTTP request body which is",
"// always a blocking operation."
] | [
{
"param": "chunk",
"type": "ByteChunk"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chunk",
"type": "ByteChunk",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
13534,
203,
3639,
632,
6618,
203,
3639,
1071,
509,
741,
1994,
12,
3216,
5579,
2441,
13,
1216,
1860,
288,
203,
203,
5411,
309,
261,
7229,
1892,
18,
3276,
1435,
1545,
21734,
18,
3595,
10756,
288,
203,
7734,
368,
1021,
2521,
353,
6453,
326,
2239,
590,
1417,
1492,
353,
203,
7734,
368,
3712,
279,
9445,
1674,
18,
203,
7734,
1783,
203,
1171,
380,
225,
169,
112,
124,
166,
242,
249,
2940,
2250,
168,
253,
231,
167,
250,
119,
166,
227,
252,
167,
251,
112,
165,
125,
253,
170,
251,
124,
166,
99,
257,
168,
253,
231,
164,
227,
229,
203,
1171,
1195,
203,
7734,
309,
16051,
5935,
12,
3767,
3719,
203,
10792,
327,
300,
21,
31,
203,
5411,
289,
203,
203,
5411,
509,
769,
273,
21734,
18,
17956,
5621,
203,
5411,
2441,
18,
542,
2160,
12,
7229,
1892,
18,
1126,
9334,
21734,
18,
3276,
9334,
769,
1769,
203,
5411,
21734,
18,
3276,
12,
7229,
1892,
18,
3595,
10663,
203,
203,
5411,
327,
769,
31,
203,
3639,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
540,
380,
203,
540,
380,
632,
14089,
1351,
3668,
18,
9980,
506,
3723,
316,
399,
362,
2574,
2468,
18,
2672,
203,
540,
380,
2398,
8901,
1232,
468,
2896,
1994,
12,
3208,
1892,
1503,
16869,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |