Skip to content

Commit 6fb4af0

Browse files
authored
Merge pull request #3 from tls-attacker/java21
Java21 and new BOM
2 parents 0ca99f9 + bfeb9a2 commit 6fb4af0

File tree

4 files changed

+38
-24
lines changed

4 files changed

+38
-24
lines changed

Jenkinsfile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ pipeline {
22
agent any
33

44
environment {
5-
JDK_TOOL_NAME = 'JDK 11'
6-
MAVEN_TOOL_NAME = 'Maven 3.8.6'
5+
JDK_TOOL_NAME = 'JDK 21'
6+
MAVEN_TOOL_NAME = 'Maven 3.9.9'
77
}
88

99
options {
@@ -48,7 +48,7 @@ pipeline {
4848
stage('Code Analysis') {
4949
when {
5050
anyOf {
51-
branch 'master'
51+
branch 'main'
5252
tag 'v*'
5353
changeRequest()
5454
}
@@ -58,7 +58,7 @@ pipeline {
5858
}
5959
steps {
6060
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
61-
sh 'mvn pmd:pmd pmd:cpd spotbugs:spotbugs'
61+
sh 'mvn -DskipTests=true package pmd:pmd pmd:cpd spotbugs:spotbugs'
6262
}
6363
}
6464
post {
@@ -70,7 +70,7 @@ pipeline {
7070
stage('Unit Tests') {
7171
when {
7272
anyOf {
73-
branch 'master'
73+
branch 'main'
7474
tag 'v*'
7575
changeRequest()
7676
}
@@ -92,13 +92,13 @@ pipeline {
9292
stage('Integration Tests') {
9393
when {
9494
anyOf {
95-
branch 'master'
95+
branch 'main'
9696
tag 'v*'
9797
changeRequest()
9898
}
9999
}
100100
options {
101-
timeout(activity: true, time: 120, unit: 'SECONDS')
101+
timeout(activity: true, time: 1800, unit: 'SECONDS')
102102
}
103103
steps {
104104
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
@@ -110,14 +110,17 @@ pipeline {
110110
junit testResults: '**/target/failsafe-reports/TEST-*.xml', allowEmptyResults: true
111111
}
112112
success {
113-
publishCoverage adapters: [jacoco(mergeToOneReport: true, path: '**/target/site/jacoco/jacoco.xml')]
113+
discoverReferenceBuild()
114+
recordCoverage(tools: [[ parser: 'JACOCO' ]],
115+
id: 'jacoco', name: 'JaCoCo Coverage',
116+
sourceCodeRetention: 'LAST_BUILD')
114117
}
115118
}
116119
}
117120
stage('Deploy Jar to Internal Nexus Repository') {
118121
when {
119122
anyOf {
120-
branch 'master'
123+
branch 'main'
121124
tag 'v*'
122125
}
123126
}

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>de.rub.nds</groupId>
66
<artifactId>protocol-toolkit-bom</artifactId>
7-
<version>4.4.0</version>
7+
<version>5.2.0</version>
88
</parent>
99

1010
<artifactId>crawler-core</artifactId>
@@ -80,8 +80,8 @@
8080
<properties>
8181
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8282
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
83-
<maven.compiler.source>11</maven.compiler.source>
84-
<maven.compiler.target>11</maven.compiler.target>
83+
<maven.compiler.source>21</maven.compiler.source>
84+
<maven.compiler.target>21</maven.compiler.target>
8585
<!-- The following variables are required for Jenkins CI -->
8686
<skipTests>false</skipTests>
8787
<skip.surefire.tests>${skipTests}</skip.surefire.tests>
@@ -222,11 +222,11 @@
222222
<spacesPerTab>4</spacesPerTab>
223223
</indent>
224224
<googleJavaFormat>
225-
<version>1.15.0</version>
225+
<version>1.25.2</version>
226226
<style>AOSP</style>
227227
</googleJavaFormat>
228228
<licenseHeader>
229-
<file>${project.basedir}/license_header_plain.txt</file>
229+
<file>${basedir}/license_header_plain.txt</file>
230230
</licenseHeader>
231231
</java>
232232
</configuration>

src/main/java/de/rub/nds/crawler/core/jobs/PublishBulkScanJob.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,22 @@ public void execute(JobExecutionContext context) throws JobExecutionException {
7878
long submittedJobs = parsedJobStatuses.getOrDefault(JobStatus.TO_BE_EXECUTED, 0L);
7979
long unresolvedJobs = parsedJobStatuses.getOrDefault(JobStatus.UNRESOLVABLE, 0L);
8080
long denylistedJobs = parsedJobStatuses.getOrDefault(JobStatus.DENYLISTED, 0L);
81-
long resolutionErrorJobs = parsedJobStatuses.getOrDefault(JobStatus.RESOLUTION_ERROR, 0L);
81+
long resolutionErrorJobs =
82+
parsedJobStatuses.getOrDefault(JobStatus.RESOLUTION_ERROR, 0L);
8283
bulkScan.setScanJobsPublished(submittedJobs);
83-
bulkScan.setScanJobsResolutionErrors(unresolvedJobs+resolutionErrorJobs);
84+
bulkScan.setScanJobsResolutionErrors(unresolvedJobs + resolutionErrorJobs);
8485
bulkScan.setScanJobsDenylisted(denylistedJobs);
8586
persistenceProvider.updateBulkScan(bulkScan);
8687

8788
if (controllerConfig.isMonitored() && submittedJobs == 0) {
8889
progressMonitor.stopMonitoringAndFinalizeBulkScan(bulkScan.get_id());
8990
}
90-
LOGGER.info("Submitted {} scan jobs to RabbitMq (Not submitted: {} Unresolvable, {} Denylisted, {} unhandled Error)", submittedJobs,unresolvedJobs, denylistedJobs, resolutionErrorJobs);
91+
LOGGER.info(
92+
"Submitted {} scan jobs to RabbitMq (Not submitted: {} Unresolvable, {} Denylisted, {} unhandled Error)",
93+
submittedJobs,
94+
unresolvedJobs,
95+
denylistedJobs,
96+
resolutionErrorJobs);
9197
} catch (Exception e) {
9298
LOGGER.error("Exception while publishing BulkScan: ", e);
9399
JobExecutionException e2 = new JobExecutionException(e);
@@ -124,17 +130,21 @@ public JobStatus apply(String targetString) {
124130
var targetInfo =
125131
ScanTarget.fromTargetString(targetString, defaultPort, denylistProvider);
126132
jobDescription =
127-
new ScanJobDescription(targetInfo.getLeft(), bulkScan, targetInfo.getRight());
128-
}catch (Exception e){
129-
jobDescription = new ScanJobDescription(new ScanTarget(), bulkScan, JobStatus.RESOLUTION_ERROR);
133+
new ScanJobDescription(
134+
targetInfo.getLeft(), bulkScan, targetInfo.getRight());
135+
} catch (Exception e) {
136+
jobDescription =
137+
new ScanJobDescription(
138+
new ScanTarget(), bulkScan, JobStatus.RESOLUTION_ERROR);
130139
errorResult = ScanResult.fromException(jobDescription, e);
131-
LOGGER.error("Error while creating ScanJobDescription for target '{}'", targetString, e);
140+
LOGGER.error(
141+
"Error while creating ScanJobDescription for target '{}'", targetString, e);
132142
}
133143

134144
if (jobDescription.getStatus() == JobStatus.TO_BE_EXECUTED) {
135145
orchestrationProvider.submitScanJob(jobDescription);
136146
} else {
137-
if(errorResult == null){
147+
if (errorResult == null) {
138148
errorResult = new ScanResult(jobDescription, null);
139149
}
140150
persistenceProvider.insertScanResult(errorResult, jobDescription);

src/main/java/de/rub/nds/crawler/targetlist/TargetFileProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ public List<String> getTargetList() {
3333
List<String> targetList;
3434
try (Stream<String> lines = Files.lines(Paths.get(filename))) {
3535
// remove comments and empty lines
36-
targetList = lines.filter(line -> !(line.startsWith("#") || line.isEmpty()))
37-
.collect(Collectors.toList());
36+
targetList =
37+
lines.filter(line -> !(line.startsWith("#") || line.isEmpty()))
38+
.collect(Collectors.toList());
3839
} catch (IOException ex) {
3940
throw new RuntimeException("Could not load " + filename, ex);
4041
}

0 commit comments

Comments
 (0)