Commit f07f951a authored by Joachim Müssig's avatar Joachim Müssig

use ClassLoader to get JAVALANG.txt resource instead of FileInputStream

parent 55e3f655
......@@ -49,7 +49,11 @@ public class CopyKeYCompatibleListener extends Java8BaseListener implements Java
Set<StaticCGJavaMethod> neededMethods;
public CopyKeYCompatibleListener(String mainPackageName) throws FileNotFoundException, IOException {
InputStream is = new FileInputStream(ViolationsWrapper.KeY_COMPATIBLE_JAVA_FEATURES);
// InputStream is = new FileInputStream(ViolationsWrapper.KeY_COMPATIBLE_JAVA_FEATURES);
InputStream is = this.getClass().getClassLoader().getResourceAsStream(ViolationsWrapper.KeY_COMPATIBLE_JAVA_FEATURES);
if (is == null) {
System.out.println("could not read JAVALANG.txt");
}
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String line = buf.readLine();
this.mainPackageName = mainPackageName;
......
......@@ -63,7 +63,7 @@ public class ViolationsWrapper {
static final String SOURCE = "src";
static final String SINK = "sink";
public static final String KeY_COMPATIBLE_JAVA_FEATURES = "otherdata/JAVALANG.txt";
public static final String KeY_COMPATIBLE_JAVA_FEATURES = "resources/JAVALANG.txt";//"otherdata/JAVALANG.txt";
private Collection<? extends IViolation<SecurityNode>> uncheckedViolations;
private SDG sdg;
......@@ -91,7 +91,12 @@ public class ViolationsWrapper {
this.callGraph = callGraph;
this.ana = ana;
InputStream is = new FileInputStream(KeY_COMPATIBLE_JAVA_FEATURES);
// InputStream is = new FileInputStream(KeY_COMPATIBLE_JAVA_FEATURES);
InputStream is = this.getClass().getClassLoader().getResourceAsStream("resources/JAVALANG.txt");
if (is == null) {
System.out.println("could not read JAVALANG.txt");
}
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String line = buf.readLine();
while (line != null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment