From 0698d5e4e7adf79bf4e059968b25e91dffcfbbfa Mon Sep 17 00:00:00 2001 From: Markus Paulsen Date: Fri, 6 Dec 2024 11:01:32 +0100 Subject: [PATCH] Fixed FileChannel.open --- .../pointcut/JavaInstrumentationPointcutDefinitions.java | 8 ++++---- .../fileSystem/FileSystemAccessPenguin.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/tum/cit/ase/ares/api/aop/java/instrumentation/pointcut/JavaInstrumentationPointcutDefinitions.java b/src/main/java/de/tum/cit/ase/ares/api/aop/java/instrumentation/pointcut/JavaInstrumentationPointcutDefinitions.java index 84e53b57..26e46ae7 100644 --- a/src/main/java/de/tum/cit/ase/ares/api/aop/java/instrumentation/pointcut/JavaInstrumentationPointcutDefinitions.java +++ b/src/main/java/de/tum/cit/ase/ares/api/aop/java/instrumentation/pointcut/JavaInstrumentationPointcutDefinitions.java @@ -142,7 +142,9 @@ static ElementMatcher getMethodsMatcher( "java.io.BufferedReader", List.of("lines"), "java.nio.channels.FileChannel", - List.of("open") + List.of("open"), + "java.nio.file.spi.FileSystemProvider", + List.of("newFileChannel") ); // @@ -167,9 +169,7 @@ static ElementMatcher getMethodsMatcher( "java.nio.file.Files", List.of("write", "writeString", "newOutputStream", "writeBytes", "writeAllBytes", "writeLines"), "java.io.File", - List.of("setWritable"), - "java.nio.channels.FileChannel", - List.of("open") + List.of("setWritable") ); // diff --git a/src/test/java/de/tum/cit/ase/ares/integration/testuser/subject/architectureTests/fileSystem/FileSystemAccessPenguin.java b/src/test/java/de/tum/cit/ase/ares/integration/testuser/subject/architectureTests/fileSystem/FileSystemAccessPenguin.java index ced459d4..ea40ab50 100644 --- a/src/test/java/de/tum/cit/ase/ares/integration/testuser/subject/architectureTests/fileSystem/FileSystemAccessPenguin.java +++ b/src/test/java/de/tum/cit/ase/ares/integration/testuser/subject/architectureTests/fileSystem/FileSystemAccessPenguin.java @@ -228,7 +228,7 @@ public static void accessFileSystemViaPrintStream() throws FileNotFoundException * Access the file system using the {@link FileChannel} class for writing. */ public static void accessFileSystemViaFileChannelWrite() throws IOException { - FileChannel fileChannel = FileChannel.open(Path.of("pom123.xml")); + FileChannel fileChannel = FileChannel.open(Path.of("pom123.xml"), StandardOpenOption.WRITE); fileChannel.write(ByteBuffer.allocate(10)); }