mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Java: Convert remaining tests to inline flow tests.
This commit is contained in:
@@ -3,32 +3,39 @@ package p;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.nio.file.CopyOption;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.CopyOption;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Sinks {
|
||||
|
||||
public Path copyFileToDirectory(final Path sourceFile, final Path targetFile, final CopyOption... copyOptions) throws IOException {
|
||||
return Files.copy(sourceFile, targetFile, copyOptions);
|
||||
}
|
||||
|
||||
public String readUrl(final URL url, Charset encoding) throws IOException {
|
||||
try (InputStream in = url.openStream()) {
|
||||
byte[] bytes = in.readAllBytes();
|
||||
return new String(bytes, encoding);
|
||||
}
|
||||
}
|
||||
// sink=p;Sinks;true;copyFileToDirectory;(Path,Path,CopyOption[]);;Argument[0];path-injection;df-generated
|
||||
// sink=p;Sinks;true;copyFileToDirectory;(Path,Path,CopyOption[]);;Argument[1];path-injection;df-generated
|
||||
// neutral=p;Sinks;copyFileToDirectory;(Path,Path,CopyOption[]);summary;df-generated
|
||||
public Path copyFileToDirectory(
|
||||
final Path sourceFile, final Path targetFile, final CopyOption... copyOptions)
|
||||
throws IOException {
|
||||
return Files.copy(sourceFile, targetFile, copyOptions);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
String foo = new Sinks().readUrl(new URL(args[0]), Charset.defaultCharset());
|
||||
// sink=p;Sinks;true;readUrl;(URL,Charset);;Argument[0];request-forgery;df-generated
|
||||
// neutral=p;Sinks;readUrl;(URL,Charset);summary;df-generated
|
||||
public String readUrl(final URL url, Charset encoding) throws IOException {
|
||||
try (InputStream in = url.openStream()) {
|
||||
byte[] bytes = in.readAllBytes();
|
||||
return new String(bytes, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
public void propagate(String s) {
|
||||
Logger logger = Logger.getLogger(Sinks.class.getSimpleName());
|
||||
logger.warning(s);
|
||||
}
|
||||
public static void main(String[] args) throws IOException {
|
||||
String foo = new Sinks().readUrl(new URL(args[0]), Charset.defaultCharset());
|
||||
}
|
||||
|
||||
// neutral=p;Sinks;propagate;(String);summary;df-generated
|
||||
public void propagate(String s) {
|
||||
Logger logger = Logger.getLogger(Sinks.class.getSimpleName());
|
||||
logger.warning(s);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user