Java: update exception models and add test

This commit is contained in:
Jami Cogswell
2022-12-15 22:53:14 -05:00
parent 56acfdf672
commit 08546549bf
4 changed files with 29 additions and 8 deletions

View File

@@ -0,0 +1,23 @@
public class Test {
void sink(Object o) { }
Object source() { return null; }
public void test() throws Exception {
Exception e1 = new RuntimeException((String)source());
sink((String)e1.getMessage()); // $hasValueFlow
Exception e2 = new RuntimeException((Throwable)source());
sink((Throwable)e2.getCause()); // $hasValueFlow
Exception e3 = new IllegalArgumentException((String)source());
sink((String)e3.getMessage()); // $hasValueFlow
Exception e4 = new IllegalStateException((String)source());
sink((String)e4.getMessage()); // $hasValueFlow
Throwable t = new Throwable((Throwable)source());
sink((Throwable)t.getCause()); // $hasValueFlow
}
}

View File

@@ -0,0 +1,2 @@
import java
import TestUtilities.InlineFlowTest