Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usages of Commons IO #142

Merged
merged 1 commit into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@
<artifactId>asm-util</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand Down Expand Up @@ -38,9 +37,11 @@ public void testInstrumentations() throws Exception {
TransformerImpl t = new TransformerImpl(specs);

String name = c.getName().replace('.', '/');
InputStream resource = getClass().getClassLoader().getResourceAsStream(name + ".class");
assertNotNull("Could not load " + name + ".class", resource);
byte[] data = IOUtils.toByteArray(resource);
byte[] data;
try (InputStream resource = getClass().getClassLoader().getResourceAsStream(name + ".class")) {
assertNotNull("Could not load " + name + ".class", resource);
data = resource.readAllBytes();
}
byte[] data2 = t.transform(name, data);

// File classFile = new File("/tmp/" + name + ".class");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.nio.file.StandardOpenOption;
import java.util.stream.Stream;

import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -94,8 +93,9 @@ public void unregisterListener() {
@Before
public void prepareOutput() throws Exception {
output.getBuffer().setLength(0);
tempFile = File.createTempFile("file-leak-detector-FileDemo", ".tmp");
FileUtils.writeStringToFile(tempFile, "teststring123", StandardCharsets.UTF_8);
Path tempPath = Files.createTempFile("file-leak-detector-FileDemo", ".tmp");
Files.writeString(tempPath, "teststring123", StandardCharsets.UTF_8);
tempFile = tempPath.toFile();
}

@After
Expand Down