ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
Last change
on this file since a8b27c6 was 9c14ae9, checked in by Rob Schluntz <rschlunt@…>, 9 years ago |
add thesis source
|
-
Property mode
set to
100644
|
File size:
916 bytes
|
Line | |
---|
1 | public class res {
|
---|
2 | private ires res;
|
---|
3 | public res(ires res) {
|
---|
4 | this.res = res;
|
---|
5 | }
|
---|
6 |
|
---|
7 | public void dotest(String msg, int open, int write, int close) {
|
---|
8 | try {
|
---|
9 | System.out.println(msg);
|
---|
10 | FileOutputStream.throwOnOpen = open;
|
---|
11 | FileOutputStream.throwOnWrite = write;
|
---|
12 | FileOutputStream.throwOnClose = close;
|
---|
13 | res.write("foo.txt", "output message");
|
---|
14 | } catch (Exception ex) {
|
---|
15 | }
|
---|
16 | FileOutputStream.numOpens = 0;
|
---|
17 | FileOutputStream.numWrites = 0;
|
---|
18 | FileOutputStream.numCloses = 0;
|
---|
19 | System.gc();
|
---|
20 | System.runFinalization();
|
---|
21 | System.out.println();
|
---|
22 | System.out.flush();
|
---|
23 | }
|
---|
24 |
|
---|
25 | public static void dotest(ires res) {
|
---|
26 | res r = new res(res);
|
---|
27 | r.dotest("Exception on open 1", 1, 0, 0);
|
---|
28 | r.dotest("Exception on open 2", 2, 0, 0);
|
---|
29 | r.dotest("Exception on write 1", 0, 1, 0);
|
---|
30 | r.dotest("Exception on write 2", 0, 2, 0);
|
---|
31 | r.dotest("Exception on close 1", 0, 0, 1);
|
---|
32 | r.dotest("Exception on close 2", 0, 0, 2);
|
---|
33 | }
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.