mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
26 lines
712 B
Java
26 lines
712 B
Java
import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
|
|
public class ExampleRuntimeHalt {
|
|
|
|
public static void main(String[] args) {
|
|
Action action = new Action();
|
|
action.run();
|
|
Runtime.getRuntime().halt(0); // COMPLIANT
|
|
}
|
|
|
|
static class Action {
|
|
public void run() {
|
|
try {
|
|
FileOutputStream fos = new FileOutputStream("output.txt");
|
|
fos.write("Hello, World!".getBytes());
|
|
fos.close();
|
|
Runtime.getRuntime().halt(0); // $ Alert
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
Runtime.getRuntime().halt(1); // $ Alert
|
|
}
|
|
}
|
|
}
|
|
}
|