Skip to content

Commit b2a6eea

Browse files
committed
Upgrade to Java 11 and parent version 2.0, and removed deprecated methods
1 parent 87143c3 commit b2a6eea

File tree

12 files changed

+46
-326
lines changed

12 files changed

+46
-326
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
29-
java: [8, 11, 17, 21]
29+
java: [11, 17, 21]
3030
fail-fast: false
3131
steps:
3232
- uses: actions/checkout@v5
@@ -43,18 +43,18 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v5
46-
- name: Set up JDK 8
46+
- name: Set up JDK 11
4747
uses: actions/setup-java@v5
4848
with:
49-
java-version: '8'
49+
java-version: '11'
5050
distribution: 'temurin'
5151
cache: 'maven'
5252
- name: Build with Maven
5353
run: mvn compile --file pom.xml -B --no-transfer-progress
5454
- name: Test with Maven
5555
run: mvn test --file pom.xml -B --no-transfer-progress -Pmin-versions
5656

57-
native-module:
57+
site:
5858
runs-on: ubuntu-latest
5959
steps:
6060
- uses: actions/checkout@v5
@@ -65,17 +65,4 @@ jobs:
6565
distribution: 'temurin'
6666
cache: 'maven'
6767
- name: Build with Maven
68-
run: mvn package --file pom.xml -B --no-transfer-progress -Pnative-module
69-
70-
site:
71-
runs-on: ubuntu-latest
72-
steps:
73-
- uses: actions/checkout@v5
74-
- name: Set up JDK 8
75-
uses: actions/setup-java@v5
76-
with:
77-
java-version: '8'
78-
distribution: 'temurin'
79-
cache: 'maven'
80-
- name: Build with Maven
81-
run: mvn site --file pom.xml -B --no-transfer-progress
68+
run: mvn package site --file pom.xml -B --no-transfer-progress -DskipTests

.github/workflows/release-site.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v5
29-
- name: Set up JDK 8
29+
- name: Set up JDK 11
3030
uses: actions/setup-java@v5
3131
with:
32-
java-version: '8'
32+
java-version: '11'
3333
distribution: 'temurin'
3434
cache: 'maven'
3535
- name: Build site
3636
run: |
37-
mvn site --file pom.xml -B --no-transfer-progress
37+
mvn package site --file pom.xml -B --no-transfer-progress -DskipTests
3838
for i in `grep '<module>.*</module>' pom.xml`; do
3939
module=`echo $i | sed 's~<module>\(.*\)</module>~\1~g'`
4040
echo "Moving site for module $module to target/site"

pom.xml

Lines changed: 22 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
<parent>
2323
<groupId>com.github.robtimus</groupId>
2424
<artifactId>robtimus-parent</artifactId>
25-
<version>1.18</version>
25+
<version>2.0</version>
2626
<relativePath />
2727
</parent>
2828

2929
<artifactId>ftp-fs</artifactId>
30-
<version>3.4-SNAPSHOT</version>
30+
<version>4.0-SNAPSHOT</version>
3131
<packaging>jar</packaging>
3232

3333
<name>ftp-fs</name>
@@ -74,10 +74,12 @@
7474
</issueManagement>
7575

7676
<properties>
77+
<version.java>11</version.java>
78+
7779
<version.awaitility>4.3.0</version.awaitility>
7880
<version.commons-net>3.11.1</version.commons-net>
7981
<version.fs-core>2.3</version.fs-core>
80-
<version.junit-support>2.2</version.junit-support>
82+
<version.junit-support>3.1</version.junit-support>
8183
<version.MockFtpServer>3.2.0</version.MockFtpServer>
8284
<version.simple-pool>1.0</version.simple-pool>
8385
<version.slf4j>2.0.17</version.slf4j>
@@ -166,13 +168,8 @@
166168
<sourcepath>${project.basedir}/src/main/java</sourcepath>
167169
<links>
168170
<link>https://robtimus.github.io/fs-core/apidocs/</link>
171+
<link>https://commons.apache.org/proper/commons-net/apidocs/</link>
169172
</links>
170-
<offlineLinks>
171-
<offlineLink>
172-
<url>https://commons.apache.org/proper/commons-net/apidocs/</url>
173-
<location>${project.basedir}/src/main/apidocs/commons-net/commons-net</location>
174-
</offlineLink>
175-
</offlineLinks>
176173
</configuration>
177174
</plugin>
178175
</plugins>
@@ -187,6 +184,13 @@
187184
<plugin>
188185
<groupId>org.apache.maven.plugins</groupId>
189186
<artifactId>maven-dependency-plugin</artifactId>
187+
<executions>
188+
<execution>
189+
<goals>
190+
<goal>properties</goal>
191+
</goals>
192+
</execution>
193+
</executions>
190194
</plugin>
191195

192196
<plugin>
@@ -235,11 +239,6 @@
235239
</executions>
236240
</plugin>
237241

238-
<plugin>
239-
<groupId>org.moditect</groupId>
240-
<artifactId>moditect-maven-plugin</artifactId>
241-
</plugin>
242-
243242
<plugin>
244243
<groupId>com.github.robtimus</groupId>
245244
<artifactId>build-helper-maven-plugin</artifactId>
@@ -264,6 +263,15 @@
264263
<plugin>
265264
<groupId>org.apache.maven.plugins</groupId>
266265
<artifactId>maven-surefire-plugin</artifactId>
266+
<configuration>
267+
<argLine>
268+
@{argLine}
269+
-javaagent:${org.mockito:mockito-core:jar}
270+
<!-- Allow JUnit to fully access the test classes -->
271+
--add-opens com.github.robtimus.filesystems.ftp/com.github.robtimus.filesystems.ftp=ALL-UNNAMED
272+
--add-reads com.github.robtimus.filesystems.ftp=org.slf4j
273+
</argLine>
274+
</configuration>
267275
</plugin>
268276

269277
<plugin>
@@ -310,54 +318,5 @@
310318
<version.commons-net>3.11.0</version.commons-net>
311319
</properties>
312320
</profile>
313-
314-
<profile>
315-
<id>native-module</id>
316-
<properties>
317-
<version.java>11</version.java>
318-
</properties>
319-
<build>
320-
<plugins>
321-
<plugin>
322-
<groupId>org.apache.maven.plugins</groupId>
323-
<artifactId>maven-surefire-plugin</artifactId>
324-
<configuration>
325-
<!-- Allow JUnit to fully access the test classes -->
326-
<argLine>
327-
@{argLine}
328-
--add-opens com.github.robtimus.filesystems.ftp/com.github.robtimus.filesystems.ftp=ALL-UNNAMED
329-
--add-reads com.github.robtimus.filesystems.ftp=org.slf4j
330-
</argLine>
331-
</configuration>
332-
</plugin>
333-
334-
<plugin>
335-
<groupId>org.moditect</groupId>
336-
<artifactId>moditect-maven-plugin</artifactId>
337-
<configuration>
338-
<skip>true</skip>
339-
</configuration>
340-
</plugin>
341-
342-
<plugin>
343-
<groupId>org.codehaus.mojo</groupId>
344-
<artifactId>build-helper-maven-plugin</artifactId>
345-
<executions>
346-
<execution>
347-
<phase>generate-sources</phase>
348-
<goals>
349-
<goal>add-source</goal>
350-
</goals>
351-
<configuration>
352-
<sources>
353-
<source>${project.basedir}/src/moditect</source>
354-
</sources>
355-
</configuration>
356-
</execution>
357-
</executions>
358-
</plugin>
359-
</plugins>
360-
</build>
361-
</profile>
362321
</profiles>
363322
</project>

src/main/apidocs/commons-net/commons-net/package-list

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/main/java/com/github/robtimus/filesystems/ftp/FTPEnvironment.java

Lines changed: 5 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package com.github.robtimus.filesystems.ftp;
1919

2020
import java.io.IOException;
21-
import java.io.UnsupportedEncodingException;
2221
import java.lang.annotation.Documented;
2322
import java.lang.annotation.ElementType;
2423
import java.lang.annotation.Repeatable;
@@ -35,6 +34,7 @@
3534
import java.net.URLDecoder;
3635
import java.net.UnknownHostException;
3736
import java.nio.charset.Charset;
37+
import java.nio.charset.StandardCharsets;
3838
import java.nio.file.Path;
3939
import java.nio.file.spi.FileSystemProvider;
4040
import java.time.Duration;
@@ -371,19 +371,6 @@ public FTPEnvironment withStrictMultilineParsing(boolean strictMultilineParsing)
371371

372372
// FTPClient
373373

374-
/**
375-
* Stores the timeout in milliseconds to use when reading from data connections.
376-
*
377-
* @param timeout The timeout in milliseconds that is used when opening data connection sockets.
378-
* @return This object.
379-
* @deprecated Use {@link #withDataTimeout(Duration)} instead.
380-
*/
381-
@Deprecated
382-
public FTPEnvironment withDataTimeout(int timeout) {
383-
put(DATA_TIMEOUT, timeout);
384-
return this;
385-
}
386-
387374
/**
388375
* Stores the timeout to use when reading from data connections.
389376
*
@@ -578,19 +565,6 @@ public FTPEnvironment withUseEPSVwithIPv4(boolean selected) {
578565
return this;
579566
}
580567

581-
/**
582-
* Stores the time to wait between sending control connection keep-alive messages when processing file upload or download.
583-
*
584-
* @param timeout The keep-alive timeout to use, in milliseconds.
585-
* @return This object.
586-
* @deprecated Use {@link #withControlKeepAliveTimeout(Duration)} instead.
587-
*/
588-
@Deprecated
589-
public FTPEnvironment withControlKeepAliveTimeout(long timeout) {
590-
put(CONTROL_KEEP_ALIVE_TIMEOUT, timeout);
591-
return this;
592-
}
593-
594568
/**
595569
* Stores the time to wait between sending control connection keep-alive messages when processing file upload or download.
596570
*
@@ -604,19 +578,6 @@ public FTPEnvironment withControlKeepAliveTimeout(Duration timeout) {
604578
return this;
605579
}
606580

607-
/**
608-
* Stores how long to wait for control keep-alive message replies.
609-
*
610-
* @param timeout The keep-alive reply timeout to use, in milliseconds.
611-
* @return This object.
612-
* @deprecated Use {@link #withControlKeepAliveReplyTimeout(Duration)} instead.
613-
*/
614-
@Deprecated
615-
public FTPEnvironment withControlKeepAliveReplyTimeout(int timeout) {
616-
put(CONTROL_KEEP_ALIVE_REPLY_TIMEOUT, timeout);
617-
return this;
618-
}
619-
620581
/**
621582
* Stores how long to wait for control keep-alive message replies.
622583
*
@@ -1040,12 +1001,7 @@ private void configureStrictMultilineParsing(FTPClient client) {
10401001

10411002
private void configureDataTimeout(FTPClient client) {
10421003
if (containsKey(DATA_TIMEOUT)) {
1043-
Duration timeout;
1044-
try {
1045-
timeout = FileSystemProviderSupport.getValue(this, DATA_TIMEOUT, Duration.class);
1046-
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
1047-
timeout = Duration.ofMillis(FileSystemProviderSupport.getIntValue(this, DATA_TIMEOUT));
1048-
}
1004+
Duration timeout = FileSystemProviderSupport.getValue(this, DATA_TIMEOUT, Duration.class);
10491005
client.setDataTimeout(timeout);
10501006
}
10511007
}
@@ -1118,25 +1074,14 @@ private void configureUseEPSVwithIPv4(FTPClient client) {
11181074

11191075
private void configureControlKeepAliveTimeout(FTPClient client) {
11201076
if (containsKey(CONTROL_KEEP_ALIVE_TIMEOUT)) {
1121-
Duration controlIdle;
1122-
try {
1123-
controlIdle = FileSystemProviderSupport.getValue(this, CONTROL_KEEP_ALIVE_TIMEOUT, Duration.class);
1124-
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
1125-
// the value is stored as ms
1126-
controlIdle = Duration.ofMillis(FileSystemProviderSupport.getLongValue(this, CONTROL_KEEP_ALIVE_TIMEOUT));
1127-
}
1077+
Duration controlIdle = FileSystemProviderSupport.getValue(this, CONTROL_KEEP_ALIVE_TIMEOUT, Duration.class);
11281078
client.setControlKeepAliveTimeout(controlIdle);
11291079
}
11301080
}
11311081

11321082
private void configureControlKeepAliveReplyTimeout(FTPClient client) {
11331083
if (containsKey(CONTROL_KEEP_ALIVE_REPLY_TIMEOUT)) {
1134-
Duration timeout;
1135-
try {
1136-
timeout = FileSystemProviderSupport.getValue(this, CONTROL_KEEP_ALIVE_REPLY_TIMEOUT, Duration.class);
1137-
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
1138-
timeout = Duration.ofMillis(FileSystemProviderSupport.getIntValue(this, CONTROL_KEEP_ALIVE_REPLY_TIMEOUT));
1139-
}
1084+
Duration timeout = FileSystemProviderSupport.getValue(this, CONTROL_KEEP_ALIVE_REPLY_TIMEOUT, Duration.class);
11401085
client.setControlKeepAliveReplyTimeout(timeout);
11411086
}
11421087
}
@@ -1450,11 +1395,7 @@ void processQueryParam(String name, String value) throws IOException {
14501395
}
14511396

14521397
private String decode(String value) {
1453-
try {
1454-
return URLDecoder.decode(value, "UTF-8"); //$NON-NLS-1$
1455-
} catch (UnsupportedEncodingException e) {
1456-
throw new IllegalStateException(e);
1457-
}
1398+
return URLDecoder.decode(value, StandardCharsets.UTF_8);
14581399
}
14591400

14601401
private FTPPoolConfig.Builder poolConfigBuilder() {

0 commit comments

Comments
 (0)