mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Initial support for capturing sink models
This commit is contained in:
@@ -0,0 +1 @@
|
||||
| p;Sinks;true;copyFileToDirectory;(Path,Path,CopyOption[]);;Argument[1];create-file; |
|
||||
@@ -0,0 +1 @@
|
||||
utils/model-generator/CaptureSinkModels.ql
|
||||
25
java/ql/test/utils/model-generator/p/Sinks.java
Normal file
25
java/ql/test/utils/model-generator/p/Sinks.java
Normal file
@@ -0,0 +1,25 @@
|
||||
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.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class Sinks {
|
||||
|
||||
public Path copyFileToDirectory(final Path sourceFile, final Path targetDirectory, final CopyOption... copyOptions) throws IOException {
|
||||
return Files.copy(sourceFile, targetDirectory.resolve(sourceFile.getFileName()), copyOptions);
|
||||
}
|
||||
|
||||
// TODO: not detected
|
||||
public String readUrl(final URL url, Charset encoding) throws IOException {
|
||||
try (InputStream in = url.openStream()) {
|
||||
byte[] bytes = in.readAllBytes();
|
||||
return new String(bytes, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user