Skip to content

Commit 6feec9f

Browse files
committed
Merge branch 'release/2.0.0'
2 parents 8e5b1df + 48b241c commit 6feec9f

35 files changed

+909
-1164
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ jobs:
77
runs-on: ubuntu-latest
88
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-java@v1
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-java@v3
1212
with:
13-
java-version: 11
14-
- uses: actions/cache@v2
15-
with:
16-
path: ~/.m2/repository
17-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
18-
restore-keys: |
19-
${{ runner.os }}-maven-
13+
java-version: 17
14+
distribution: 'temurin'
15+
cache: 'maven'
2016
- name: Ensure to use tagged version
2117
if: startsWith(github.ref, 'refs/tags/')
2218
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
@@ -29,16 +25,14 @@ jobs:
2925
env:
3026
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
3127
continue-on-error: true
32-
- uses: actions/upload-artifact@v2
28+
- uses: actions/upload-artifact@v3
3329
with:
3430
name: artifacts
3531
path: target/*.jar
3632
- name: Create Release
37-
uses: actions/create-release@v1
33+
uses: softprops/action-gh-release@v1
3834
if: startsWith(github.ref, 'refs/tags/')
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} # release as "cryptobot"
4135
with:
42-
tag_name: ${{ github.ref }}
43-
release_name: Release ${{ github.ref }}
44-
prerelease: true
36+
prerelease: true
37+
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
38+
generate_release_notes: true

.github/workflows/publish-central.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,29 @@ jobs:
1010
publish:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414
with:
1515
ref: "refs/tags/${{ github.event.inputs.tag }}"
16-
- uses: actions/setup-java@v1
16+
- uses: actions/setup-java@v3
1717
with:
18-
java-version: 11
18+
java-version: 17
19+
distribution: 'temurin'
20+
cache: 'maven'
1921
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
2022
server-username: MAVEN_USERNAME # env variable for username in deploy
2123
server-password: MAVEN_PASSWORD # env variable for token in deploy
2224
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
2325
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
24-
- uses: actions/cache@v2
25-
with:
26-
path: ~/.m2/repository
27-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28-
restore-keys: |
29-
${{ runner.os }}-maven-
3026
- name: Enforce project version ${{ github.event.inputs.tag }}
3127
run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }}
3228
- name: Deploy
3329
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
3430
env:
31+
MAVEN_OPTS: >
32+
--add-opens=java.base/java.util=ALL-UNNAMED
33+
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
34+
--add-opens=java.base/java.text=ALL-UNNAMED
35+
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED
3536
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3637
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
3738
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}

.github/workflows/publish-github.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ jobs:
77
runs-on: ubuntu-latest
88
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-java@v1
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-java@v3
1212
with:
13-
java-version: 11
13+
java-version: 17
14+
distribution: 'temurin'
15+
cache: 'maven'
1416
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
1517
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
16-
- uses: actions/cache@v2
17-
with:
18-
path: ~/.m2/repository
19-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
20-
restore-keys: |
21-
${{ runner.os }}-maven-
2218
- name: Enforce project version ${{ github.event.release.tag_name }}
2319
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
2420
- name: Deploy

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.cryptomator</groupId>
55
<artifactId>webdav-nio-adapter</artifactId>
6-
<version>1.2.8</version>
6+
<version>2.0.0</version>
77
<name>WebDAV-NIO Adapter</name>
88
<description>Embedded Jetty serving a WebDAV servlet to access resources at a given NIO path.</description>
99
<url>https://github.com/cryptomator/webdav-nio-adapter</url>
@@ -15,22 +15,23 @@
1515
</scm>
1616

1717
<properties>
18+
<project.build.jdk>17</project.build.jdk>
1819
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1920

2021
<!-- dependencies -->
21-
<webdavservlet.version>1.2.1</webdavservlet.version>
22-
<dagger.version>2.41</dagger.version>
23-
<jetty.version>10.0.10</jetty.version>
24-
<guava.version>31.1-jre</guava.version>
25-
<slf4j.version>1.7.36</slf4j.version>
22+
<integrations-api.version>1.2.0</integrations-api.version>
23+
<webdavservlet.version>1.2.3</webdavservlet.version>
24+
<jetty.version>10.0.13</jetty.version>
25+
<slf4j.version>2.0.6</slf4j.version>
2626

2727
<!-- test dependencies -->
28-
<junit.jupiter.version>5.8.2</junit.jupiter.version>
28+
<junit.jupiter.version>5.9.2</junit.jupiter.version>
2929

3030
<!-- mvn plugin dependencies -->
31-
<dependency-check.version>7.0.0</dependency-check.version>
32-
<jacoco.version>0.8.7</jacoco.version>
31+
<dependency-check.version>8.1.0</dependency-check.version>
32+
<jacoco.version>0.8.8</jacoco.version>
3333
<nexus-staging.version>1.6.8</nexus-staging.version>
34+
<maven.deploy.version>3.1.0</maven.deploy.version>
3435
</properties>
3536

3637
<licenses>
@@ -58,6 +59,13 @@
5859
<version>${webdavservlet.version}</version>
5960
</dependency>
6061

62+
<!-- Mount API -->
63+
<dependency>
64+
<groupId>org.cryptomator</groupId>
65+
<artifactId>integrations-api</artifactId>
66+
<version>${integrations-api.version}</version>
67+
</dependency>
68+
6169
<!-- Jetty -->
6270
<dependency>
6371
<groupId>org.eclipse.jetty</groupId>
@@ -70,11 +78,12 @@
7078
<version>${jetty.version}</version>
7179
</dependency>
7280

73-
<!-- Guava -->
81+
<!-- Correctness -->
7482
<dependency>
75-
<groupId>com.google.guava</groupId>
76-
<artifactId>guava</artifactId>
77-
<version>${guava.version}</version>
83+
<groupId>org.jetbrains</groupId>
84+
<artifactId>annotations</artifactId>
85+
<version>23.0.0</version>
86+
<scope>provided</scope>
7887
</dependency>
7988

8089
<!-- Logging -->
@@ -84,13 +93,6 @@
8493
<version>${slf4j.version}</version>
8594
</dependency>
8695

87-
<!-- DI -->
88-
<dependency>
89-
<groupId>com.google.dagger</groupId>
90-
<artifactId>dagger</artifactId>
91-
<version>${dagger.version}</version>
92-
</dependency>
93-
9496
<!-- Test -->
9597
<dependency>
9698
<groupId>org.junit.jupiter</groupId>
@@ -113,26 +115,19 @@
113115
<artifactId>maven-compiler-plugin</artifactId>
114116
<version>3.10.1</version>
115117
<configuration>
116-
<release>11</release>
118+
<release>${project.build.jdk}</release>
117119
<showWarnings>true</showWarnings>
118-
<annotationProcessorPaths>
119-
<path>
120-
<groupId>com.google.dagger</groupId>
121-
<artifactId>dagger-compiler</artifactId>
122-
<version>${dagger.version}</version>
123-
</path>
124-
</annotationProcessorPaths>
125120
</configuration>
126121
</plugin>
127122
<plugin>
128123
<groupId>org.apache.maven.plugins</groupId>
129124
<artifactId>maven-surefire-plugin</artifactId>
130-
<version>2.22.2</version>
125+
<version>3.0.0-M7</version>
131126
</plugin>
132127
<plugin>
133128
<groupId>org.apache.maven.plugins</groupId>
134129
<artifactId>maven-jar-plugin</artifactId>
135-
<version>3.2.2</version>
130+
<version>3.3.0</version>
136131
</plugin>
137132
<plugin>
138133
<artifactId>maven-source-plugin</artifactId>
@@ -148,7 +143,7 @@
148143
</plugin>
149144
<plugin>
150145
<artifactId>maven-javadoc-plugin</artifactId>
151-
<version>3.3.2</version>
146+
<version>3.4.1</version>
152147
<executions>
153148
<execution>
154149
<id>attach-javadocs</id>
@@ -280,6 +275,15 @@
280275
<url>https://maven.pkg.github.com/cryptomator/webdav-nio-adapter</url>
281276
</repository>
282277
</distributionManagement>
278+
<build>
279+
<plugins>
280+
<plugin>
281+
<groupId>org.apache.maven.plugins</groupId>
282+
<artifactId>maven-deploy-plugin</artifactId>
283+
<version>${maven.deploy.version}</version>
284+
</plugin>
285+
</plugins>
286+
</build>
283287
</profile>
284288
</profiles>
285289
</project>

src/main/java/module-info.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1+
import org.cryptomator.frontend.webdav.mount.FallbackMounter;
2+
import org.cryptomator.frontend.webdav.mount.LinuxGioMounter;
3+
import org.cryptomator.frontend.webdav.mount.MacAppleScriptMounter;
4+
import org.cryptomator.frontend.webdav.mount.WindowsMounter;
5+
import org.cryptomator.integrations.mount.MountService;
6+
17
module org.cryptomator.frontend.webdav {
28
requires org.cryptomator.frontend.webdav.servlet;
9+
requires org.cryptomator.integrations.api;
310
requires org.eclipse.jetty.server;
411
requires org.eclipse.jetty.servlet;
5-
requires com.google.common;
612
requires org.slf4j;
7-
requires dagger;
8-
9-
// filename-based module required by dagger
10-
// we will probably need to live with this for a while:
11-
// https://github.com/javax-inject/javax-inject/issues/33
12-
// May be provided by another lib during runtime
13-
requires static javax.inject;
13+
requires static org.jetbrains.annotations;
1414

15-
exports org.cryptomator.frontend.webdav;
16-
exports org.cryptomator.frontend.webdav.mount;
17-
exports org.cryptomator.frontend.webdav.servlet;
15+
provides MountService with MacAppleScriptMounter, FallbackMounter, WindowsMounter, LinuxGioMounter;
1816
}

src/main/java/org/cryptomator/frontend/webdav/DefaultServlet.java

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,23 @@
88
*******************************************************************************/
99
package org.cryptomator.frontend.webdav;
1010

11-
import java.io.IOException;
12-
import java.util.Collection;
13-
14-
import javax.inject.Inject;
15-
import javax.inject.Singleton;
1611
import javax.servlet.ServletException;
1712
import javax.servlet.http.HttpServlet;
1813
import javax.servlet.http.HttpServletRequest;
1914
import javax.servlet.http.HttpServletResponse;
15+
import java.io.IOException;
16+
import java.util.Collection;
17+
import java.util.function.Predicate;
18+
import java.util.regex.Pattern;
2019

21-
import org.cryptomator.frontend.webdav.WebDavServerModule.ContextPaths;
22-
23-
import com.google.common.base.Splitter;
24-
import com.google.common.collect.Iterables;
25-
26-
@Singleton
2720
class DefaultServlet extends HttpServlet {
2821

2922
private static final String METHOD_PROPFIND = "PROPFIND";
3023
private static final int TARPIT_DELAY_MS = 5000;
24+
private static final Pattern PATH_SEP_PATTERN = Pattern.compile("/");
3125
private final Collection<String> contextPaths;
3226

33-
@Inject
34-
public DefaultServlet(@ContextPaths Collection<String> contextPaths) {
27+
public DefaultServlet(Collection<String> contextPaths) {
3528
this.contextPaths = contextPaths;
3629
}
3730

@@ -60,7 +53,7 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
6053
}
6154

6255
@Override
63-
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
56+
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) {
6457
resp.addHeader("DAV", "1, 2");
6558
resp.addHeader("MS-Author-Via", "DAV");
6659
resp.addHeader("Allow", "OPTIONS, PROPFIND, GET, HEAD");
@@ -85,12 +78,12 @@ protected void doPropfind(HttpServletRequest req, HttpServletResponse resp) thro
8578
}
8679

8780
private boolean isRequestedResourcePathPartOfValidContextPath(String requestedResourcePath) {
88-
return contextPaths.stream().filter(cp -> isParentOrSamePath(cp, requestedResourcePath)).findAny().isPresent();
81+
return contextPaths.stream().anyMatch(cp -> isParentOrSamePath(cp, requestedResourcePath));
8982
}
9083

9184
private boolean isParentOrSamePath(String path, String potentialParent) {
92-
String[] pathComponents = Iterables.toArray(Splitter.on('/').omitEmptyStrings().split(path), String.class);
93-
String[] parentPathComponents = Iterables.toArray(Splitter.on('/').omitEmptyStrings().split(potentialParent), String.class);
85+
String[] pathComponents = PATH_SEP_PATTERN.splitAsStream(path).filter(Predicate.not(String::isBlank)).toArray(String[]::new);
86+
String[] parentPathComponents = PATH_SEP_PATTERN.splitAsStream(potentialParent).filter(Predicate.not(String::isBlank)).toArray(String[]::new);
9487
if (pathComponents.length < parentPathComponents.length) {
9588
return false; // parent can not be parent of path, if it is longer than path.
9689
}

0 commit comments

Comments
 (0)