ServerListener uses Path as it has to Write a file reliably

This commit is contained in:
Joakim Erdfelt 2022-10-13 09:53:39 -05:00
parent caf69690ca
commit c9910cec13
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
2 changed files with 8 additions and 8 deletions

View File

@ -14,10 +14,9 @@
package org.eclipse.jetty.ee10.maven.plugin;
import java.nio.file.Files;
import java.nio.file.Path;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/**
* ServerListener
@ -47,8 +46,9 @@ public class ServerListener implements LifeCycle.Listener
{
try
{
Resource r = ResourceFactory.root().newResource(_tokenFile); // TODO leak
Files.createFile(r.getPath());
// Using Path, as we need to reliably create/write a file.
Path path = Path.of(_tokenFile);
Files.createFile(path);
}
catch (Exception e)
{

View File

@ -14,10 +14,9 @@
package org.eclipse.jetty.ee9.maven.plugin;
import java.nio.file.Files;
import java.nio.file.Path;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/**
* ServerListener
@ -47,8 +46,9 @@ public class ServerListener implements LifeCycle.Listener
{
try
{
Resource r = ResourceFactory.root().newResource(_tokenFile); // TODO leak
Files.createFile(r.getPath());
// Using Path, as we need to reliably create/write a file.
Path path = Path.of(_tokenFile);
Files.createFile(path);
}
catch (Exception e)
{