Debian Codegraph @

test/harness/jpype/closeable/CloseableTest.java

raw symbols SCIP
1 /* ****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 **************************************************************************** */
16 package jpype.closeable;
17
18 class CloseableTest implements java.io.Closeable
19 {
20
21 public static boolean closed = false;
22 public static String printed = "";
23 public static boolean willfail = false;
24 public static boolean failed = false;
25
26 public static void reset()
27 {
28 closed = false;
29 willfail = false;
30 failed = false;
31 printed = "";
32 }
33
34 public CloseableTest()
35 {
36 }
37
38 public void print(String value)
39 {
40 printed = value;
41 }
42
43 public void throwException()
44 {
45 throw new RuntimeException("oh no!");
46 }
47
48 public void close() throws java.io.IOException
49 {
50 closed = true;
51 if (willfail)
52 {
53 failed = true;
54 throw new java.io.IOException("oh my?");
55 }
56 }
57
58 }