Skip to content

Commit be256cb

Browse files
authored
Merge branch 'main' into upgradeMaven
2 parents f56e67f + 6f849f1 commit be256cb

27 files changed

Lines changed: 305 additions & 387 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ jobs:
8383
- name: Archive IT test logs
8484
id: archive-logs
8585
if: always()
86-
uses: actions/upload-artifact@v6
86+
uses: actions/upload-artifact@v7
8787
with:
8888
name: it-test-logs-jdk-${{ matrix.jdk_test_version }}
8989
retention-days: 7
9090
path: maven/target/it/**/build.log
9191
- name: Archive code coverage results
9292
if: matrix.jdk_test_version == matrix.jdk_default_version
9393
id: archive-coverage
94-
uses: actions/upload-artifact@v6
94+
uses: actions/upload-artifact@v7
9595
with:
9696
name: code-coverage-report
9797
retention-days: 7
@@ -101,7 +101,7 @@ jobs:
101101
- name: Archive Snapshot
102102
if: matrix.jdk_test_version == matrix.jdk_default_version
103103
id: archive-snapshot
104-
uses: actions/upload-artifact@v6
104+
uses: actions/upload-artifact@v7
105105
with:
106106
name: archive-snapshot
107107
retention-days: 7
@@ -131,7 +131,7 @@ jobs:
131131
cache: 'maven'
132132
cache-dependency-path: '**/pom.xml'
133133
- name: Download release build
134-
uses: actions/download-artifact@v7
134+
uses: actions/download-artifact@v8
135135
with:
136136
name: archive-snapshot
137137
- name: Set up Docker

.github/workflows/false-positive-ops.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
--ossIndexPassword ${{ secrets.OSS_INDEX_API_TOKEN }}
145145
- name: Upload FP Report
146146
if: steps.check_files.outputs.files_exists == 'true'
147-
uses: actions/upload-artifact@v6
147+
uses: actions/upload-artifact@v7
148148
with:
149149
name: FP Report
150150
path: ${{github.workspace}}/reports

.github/workflows/pull_requests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
- name: Archive Snapshot
8282
if: matrix.jdk_test_version == matrix.jdk_default_version
8383
id: archive-snapshot
84-
uses: actions/upload-artifact@v6
84+
uses: actions/upload-artifact@v7
8585
with:
8686
name: archive-snapshot
8787
retention-days: 1
@@ -146,7 +146,7 @@ jobs:
146146
- name: Archive IT test logs
147147
id: archive-logs
148148
if: always()
149-
uses: actions/upload-artifact@v6
149+
uses: actions/upload-artifact@v7
150150
with:
151151
name: it-test-logs-jdk-${{ matrix.jdk_test_version }}
152152
retention-days: 7
@@ -202,7 +202,7 @@ jobs:
202202
cache: 'maven'
203203
cache-dependency-path: '**/pom.xml'
204204
- name: Download release build
205-
uses: actions/download-artifact@v7
205+
uses: actions/download-artifact@v8
206206
with:
207207
name: archive-snapshot
208208
- name: Set up Docker

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
--no-transfer-progress --batch-mode -Dstyle.color=always
8282
- name: Archive code coverage results
8383
id: archive-coverage
84-
uses: actions/upload-artifact@v6
84+
uses: actions/upload-artifact@v7
8585
with:
8686
name: code-coverage-report
8787
retention-days: 7
@@ -90,7 +90,7 @@ jobs:
9090
**/target/jacoco-results/**/*.html
9191
- name: Archive Release
9292
id: archive-release
93-
uses: actions/upload-artifact@v6
93+
uses: actions/upload-artifact@v7
9494
with:
9595
name: archive-release
9696
retention-days: 7
@@ -103,7 +103,7 @@ jobs:
103103
target/*.buildinfo
104104
- name: Archive Site
105105
id: archive-site
106-
uses: actions/upload-artifact@v6
106+
uses: actions/upload-artifact@v7
107107
with:
108108
name: archive-site
109109
retention-days: 7
@@ -134,7 +134,7 @@ jobs:
134134
cache: 'maven'
135135
cache-dependency-path: '**/pom.xml'
136136
- name: Download release build
137-
uses: actions/download-artifact@v7
137+
uses: actions/download-artifact@v8
138138
with:
139139
name: archive-release
140140
- name: Set up Docker
@@ -168,7 +168,7 @@ jobs:
168168
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )
169169
echo "VERSION=$VERSION" >> $GITHUB_ENV
170170
- name: Download release build
171-
uses: actions/download-artifact@v7
171+
uses: actions/download-artifact@v8
172172
with:
173173
name: archive-release
174174
- name: Create Release
@@ -243,7 +243,7 @@ jobs:
243243
- name: Checkout code
244244
uses: actions/checkout@v6
245245
- name: Download Site
246-
uses: actions/download-artifact@v7
246+
uses: actions/download-artifact@v8
247247
with:
248248
name: archive-site
249249
path: target/staging

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM golang:1.26.0-alpine AS go
22

33
FROM azul/zulu-openjdk-alpine:25 AS jlink
44

5-
RUN "$JAVA_HOME/bin/jlink" --compress=zip-6 --module-path /opt/java/openjdk/jmods --add-modules java.base,java.compiler,java.datatransfer,jdk.crypto.ec,java.desktop,java.instrument,java.logging,java.management,java.naming,java.rmi,java.scripting,java.security.sasl,java.sql,java.transaction.xa,java.xml,jdk.unsupported --output /jlinked
5+
RUN "$JAVA_HOME/bin/jlink" --compress=zip-6 --module-path /opt/java/openjdk/jmods --add-modules java.base,java.compiler,java.datatransfer,jdk.crypto.ec,java.desktop,java.instrument,java.logging,java.management,java.naming,java.rmi,java.scripting,java.security.sasl,java.sql,java.transaction.xa,java.xml,jdk.unsupported,jdk.net --output /jlinked
66

77
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine
88

ant/src/test/java/org/owasp/dependencycheck/ant/logging/AntSlf4jServiceProviderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.slf4j.Logger;
3434
import org.slf4j.spi.SLF4JServiceProvider;
3535

36+
import static java.nio.charset.StandardCharsets.UTF_8;
3637
import static org.junit.jupiter.api.Assertions.assertEquals;
3738
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
3839
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -100,7 +101,7 @@ void testServiceDescriptorContainsCorrectClassName() throws Exception {
100101
assertEquals(AntSlf4jServiceProvider.class.getName(), line.trim());
101102
}
102103
} else {
103-
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
104+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8))) {
104105
String line = reader.readLine();
105106
assertNotNull(line);
106107
assertEquals(AntSlf4jServiceProvider.class.getName(), line.trim());

cli/src/test/java/org/owasp/dependencycheck/CliParserTest.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.io.ByteArrayOutputStream;
2424
import java.io.File;
2525
import java.io.FileNotFoundException;
26-
import java.io.IOException;
2726
import java.io.PrintStream;
2827

2928
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -51,7 +50,7 @@ void testParse() throws Exception {
5150
String[] args = {};
5251

5352
ByteArrayOutputStream baos = new ByteArrayOutputStream();
54-
System.setOut(new PrintStream(baos));
53+
System.setOut(new PrintStream(baos, true, UTF_8));
5554

5655
CliParser instance = new CliParser(getSettings());
5756
instance.parse(args);
@@ -165,8 +164,8 @@ void testParse_unknown() {
165164

166165
ByteArrayOutputStream baos_out = new ByteArrayOutputStream();
167166
ByteArrayOutputStream baos_err = new ByteArrayOutputStream();
168-
System.setOut(new PrintStream(baos_out));
169-
System.setErr(new PrintStream(baos_err));
167+
System.setOut(new PrintStream(baos_out, true, UTF_8));
168+
System.setErr(new PrintStream(baos_err, true, UTF_8));
170169

171170
CliParser instance = new CliParser(getSettings());
172171

@@ -249,20 +248,16 @@ void testParse_printVersionInfo() {
249248

250249
PrintStream out = System.out;
251250
ByteArrayOutputStream baos = new ByteArrayOutputStream();
252-
System.setOut(new PrintStream(baos));
251+
System.setOut(new PrintStream(baos, true, UTF_8));
253252

254253
CliParser instance = new CliParser(getSettings());
255254
instance.printVersionInfo();
256255
try {
257-
baos.flush();
258256
String text = baos.toString(UTF_8).toLowerCase();
259257
String[] lines = text.split(System.lineSeparator());
260258
assertTrue(lines.length >= 1);
261259
assertTrue(text.contains("version"));
262260
assertFalse(text.contains("unknown"));
263-
} catch (IOException ex) {
264-
System.setOut(out);
265-
fail("CliParser.printVersionInfo did not write anything to system.out.", ex);
266261
} finally {
267262
System.setOut(out);
268263
}
@@ -279,7 +274,7 @@ void testParse_printHelp() throws Exception {
279274

280275
PrintStream out = System.out;
281276
ByteArrayOutputStream baos = new ByteArrayOutputStream();
282-
System.setOut(new PrintStream(baos));
277+
System.setOut(new PrintStream(baos, true, UTF_8));
283278

284279
CliParser instance = new CliParser(getSettings());
285280
String[] args = {"-h"};
@@ -289,14 +284,10 @@ void testParse_printHelp() throws Exception {
289284
instance.parse(args);
290285
instance.printHelp();
291286
try {
292-
baos.flush();
293287
String text = (baos.toString(UTF_8));
294288
String[] lines = text.split(System.lineSeparator());
295289
assertTrue(lines[0].startsWith("usage: "));
296290
assertTrue((lines.length > 2));
297-
} catch (IOException ex) {
298-
System.setOut(out);
299-
fail("CliParser.printVersionInfo did not write anything to system.out.");
300291
} finally {
301292
System.setOut(out);
302293
}

cli/src/test/java/org/owasp/dependencycheck/PluginLoaderTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.nio.file.Path;
1414
import java.util.regex.Pattern;
1515

16+
import static java.nio.charset.StandardCharsets.UTF_8;
1617
import static org.hamcrest.MatcherAssert.assertThat;
1718
import static org.hamcrest.Matchers.matchesPattern;
1819
import static org.mockito.ArgumentMatchers.assertArg;
@@ -52,11 +53,11 @@ void shouldAddJarToClassPath() throws Exception {
5253
void shouldStopLoadingPluginsOnBadJarButSucceed() throws Exception {
5354
PrintStream originalErr = System.err;
5455
ByteArrayOutputStream errContent = new ByteArrayOutputStream();
55-
System.setErr(new PrintStream(errContent));
56+
System.setErr(new PrintStream(errContent, true, UTF_8));
5657
try {
5758
createEmptyBadJar();
5859
PluginLoader.premain(tempDir.toString(), instrumentation);
59-
assertThat(errContent.toString(), matchesPattern(Pattern.compile("\\[WARN\\] Failed to read plugin jar file at .*/dummy.*\\.jar\\. Jar will not be available on classpath.*zip file is empty.*", Pattern.DOTALL)));
60+
assertThat(errContent.toString(), matchesPattern(Pattern.compile("\\[WARN] Failed to read plugin jar file at .*/dummy.*\\.jar\\. Jar will not be available on classpath.*zip file is empty.*", Pattern.DOTALL)));
6061
} finally {
6162
System.setErr(originalErr);
6263
}

core/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved.
468468
<plugin>
469469
<groupId>org.apache.maven.plugins</groupId>
470470
<artifactId>maven-dependency-plugin</artifactId>
471-
<version>${maven-dependency-plugin.version}</version>
472471
<executions>
473472
<execution>
474473
<id>copy-test-dependencies</id>

core/src/main/java/org/owasp/dependencycheck/analyzer/JarAnalyzer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.io.InputStream;
3131
import java.io.InputStreamReader;
3232
import java.io.Reader;
33-
import java.io.UnsupportedEncodingException;
3433
import java.nio.charset.StandardCharsets;
3534
import java.nio.file.Paths;
3635
import java.util.ArrayList;
@@ -520,8 +519,6 @@ private Properties retrievePomProperties(String path, final JarFile jar) {
520519
try (Reader reader = new InputStreamReader(jar.getInputStream(propEntry), StandardCharsets.UTF_8)) {
521520
pomProperties.load(reader);
522521
LOGGER.debug("Read pom.properties: {}", propPath);
523-
} catch (UnsupportedEncodingException ex) {
524-
LOGGER.trace("UTF-8 is not supported", ex);
525522
} catch (IOException ex) {
526523
LOGGER.trace("Unable to read the POM properties", ex);
527524
}

0 commit comments

Comments
 (0)