Skip to content

Commit

Permalink
Merge pull request #122 from cryptomator/feature/jdk-22
Browse files Browse the repository at this point in the history
Feature: JDK 22
  • Loading branch information
infeo authored Apr 19, 2024
2 parents 6d00e55 + 843cb15 commit 2c4268c
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
- name: Ensure to use tagged version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 2
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
runner-os: 'ubuntu-latest'
java-distribution: 'zulu'
java-version: 21
java-version: 22
secrets:
nvd-api-key: ${{ secrets.NVD_API_KEY }}
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
ref: "refs/tags/${{ github.event.inputs.tag }}"
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
Expand Down
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Mirror.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.jdk>21</project.build.jdk>
<project.build.jdk>22</project.build.jdk>

<!-- dependencies -->
<integrations-api.version>1.3.1</integrations-api.version>
<jfuse.version>0.6.3</jfuse.version>
<jfuse.version>0.7.0</jfuse.version>
<slf4j.version>2.0.13</slf4j.version>
<caffeine.version>3.1.8</caffeine.version>

Expand Down Expand Up @@ -156,9 +156,6 @@
<configuration>
<showWarnings>true</showWarnings>
<release>${project.build.jdk}</release>
<compilerArgs>
<compilerArg>--enable-preview</compilerArg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -194,7 +191,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<argLine>@{surefire.jacoco.args} -javaagent:${net.bytebuddy:byte-buddy-agent:jar} --enable-preview --enable-native-access=org.cryptomator.jfuse.linux.amd64,org.cryptomator.jfuse.linux.aarch64,org.cryptomator.jfuse.mac,org.cryptomator.jfuse.win</argLine>
<argLine>@{surefire.jacoco.args} -javaagent:${net.bytebuddy:byte-buddy-agent:jar}</argLine>
</configuration>
</plugin>
<plugin>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ protected int checkAccess(Path path, Set<AccessMode> requiredAccessModes, Set<Ac
@Override
public int readlink(String path, ByteBuffer buf, long size) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
return linkHandler.readlink(node, buf, size);
} catch (NotLinkException | NoSuchFileException e) {
Expand All @@ -197,7 +197,7 @@ public int readlink(String path, ByteBuffer buf, long size) {
@Override
public int getattr(String path, Stat stat, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
BasicFileAttributes attrs;
if (fileStore.supportsFileAttributeView(PosixFileAttributeView.class)) {
Expand Down Expand Up @@ -230,7 +230,7 @@ public int getattr(String path, Stat stat, FileInfo fi) {
@Override
public int getxattr(String path, String name, ByteBuffer value) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
Path node = resolvePath(path);
LOG.trace("getxattr {} {}", path, name);
var xattr = Files.getFileAttributeView(node, UserDefinedFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
Expand Down Expand Up @@ -263,7 +263,7 @@ public int getxattr(String path, String name, ByteBuffer value) {
@Override
public int listxattr(String path, ByteBuffer list) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
Path node = resolvePath(path);
LOG.trace("listxattr {}", path);
var xattr = Files.getFileAttributeView(node, UserDefinedFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
Expand Down Expand Up @@ -299,7 +299,7 @@ public int opendir(String path, FileInfo fi) {
@Override
public int readdir(String path, DirFiller filler, long offset, FileInfo fi, int flags) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
LOG.trace("readdir {}", path);
return dirHandler.readdir(node, filler, offset, fi);
Expand All @@ -320,7 +320,7 @@ public int releasedir(String path, FileInfo fi) {
@Override
public int open(String path, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
LOG.trace("open {} ({})", path, fi.getFh());
fileHandler.open(node, fi);
Expand All @@ -340,7 +340,7 @@ public int open(String path, FileInfo fi) {
@Override
public int read(String path, ByteBuffer buf, long size, long offset, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
LOG.trace("read {} bytes from file {} starting at {}...", size, path, offset);
int read = fileHandler.read(buf, size, offset, fi);
LOG.trace("read {} bytes from file {}", read, path);
Expand All @@ -357,7 +357,7 @@ public int read(String path, ByteBuffer buf, long size, long offset, FileInfo fi
@Override
public int release(String path, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForReading()) {
DataLock _ = pathLock.lockDataForReading()) {
LOG.trace("release {} ({})", path, fi.getFh());
fileHandler.release(fi);
return 0;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected int checkAccess(Path path, Set<AccessMode> requiredAccessModes) {
@Override
public int mkdir(String path, int mode) {
try (PathLock pathLock = lockManager.lockForWriting(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
LOG.trace("mkdir {} ({})", path, mode);
Files.createDirectory(node);
Expand All @@ -105,7 +105,7 @@ public int mkdir(String path, int mode) {
@Override
public int removexattr(String path, String name) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(path);
LOG.trace("removexattr {} {}", path, name);
var xattr = Files.getFileAttributeView(node, UserDefinedFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
Expand All @@ -124,7 +124,7 @@ public int removexattr(String path, String name) {
@Override
public int setxattr(String path, String name, ByteBuffer value, int flags) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(path);
LOG.trace("setxattr {} {}", path, name);
var xattr = Files.getFileAttributeView(node, UserDefinedFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
Expand All @@ -143,7 +143,7 @@ public int setxattr(String path, String name, ByteBuffer value, int flags) {
@Override
public int symlink(String targetPath, String linkPath) {
try (PathLock pathLock = lockManager.lockForWriting(linkPath);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path link = resolvePath(fileNameTranscoder.fuseToNio(linkPath));
Path target = link.getFileSystem().getPath(fileNameTranscoder.fuseToNio(targetPath));
LOG.trace("symlink {} -> {}", linkPath, targetPath);
Expand All @@ -163,7 +163,7 @@ public int symlink(String targetPath, String linkPath) {
@Override
public int create(String path, int mode, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForWriting(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
var flags = fi.getOpenFlags();
LOG.trace("create {} with flags {}", path, flags);
Expand Down Expand Up @@ -194,7 +194,7 @@ public int chown(String path, int uid, int gid, FileInfo fi) {
@Override
public int chmod(String path, int mode, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
LOG.trace("chmod {} ({})", path, mode);
Files.setPosixFilePermissions(node, FileAttributesUtil.octalModeToPosixPermissions(mode));
Expand All @@ -216,7 +216,7 @@ public int chmod(String path, int mode, FileInfo fi) {
@Override
public int unlink(String path) {
try (PathLock pathLock = lockManager.lockForWriting(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
if (Files.isDirectory(node, LinkOption.NOFOLLOW_LINKS)) {
LOG.warn("unlink {} failed, node is a directory.", path);
Expand All @@ -237,7 +237,7 @@ public int unlink(String path) {
@Override
public int rmdir(String path) {
try (PathLock pathLock = lockManager.lockForWriting(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
if (!Files.isDirectory(node, LinkOption.NOFOLLOW_LINKS)) {
throw new NotDirectoryException(path);
Expand Down Expand Up @@ -306,7 +306,7 @@ public int rename(String oldPath, String newPath, int flags) {
@Override
public int utimens(String path, TimeSpec atime, TimeSpec mtime, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
LOG.trace("utimens {} (last modification {}, last access {})", path, mtime, atime);
fileHandler.utimens(node, mtime, atime);
Expand All @@ -323,7 +323,7 @@ public int utimens(String path, TimeSpec atime, TimeSpec mtime, FileInfo fi) {
@Override
public int write(String path, ByteBuffer buf, long size, long offset, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
LOG.trace("write {} bytes to file {} starting at {}...", size, path, offset);
int written = fileHandler.write(buf, size, offset, fi);
LOG.trace("wrote {} bytes to file {}.", written, path);
Expand All @@ -340,7 +340,7 @@ public int write(String path, ByteBuffer buf, long size, long offset, FileInfo f
@Override
public int truncate(String path, long size, FileInfo fi) {
try (PathLock pathLock = lockManager.lockForReading(path);
DataLock dataLock = pathLock.lockDataForWriting()) {
DataLock _ = pathLock.lockDataForWriting()) {
Path node = resolvePath(fileNameTranscoder.fuseToNio(path));
LOG.trace("truncate {} {}", path, size);
if (fi != null) {
Expand Down

0 comments on commit 2c4268c

Please sign in to comment.