1 // Tags: JDK1.1 |
|
2 |
|
3 // Copyright (C) 2006 Free Software Foundation, Inc. |
|
4 // Written by Mark J. Wielaard (mark@klomp.org) |
|
5 |
|
6 // This file is part of Mauve. |
|
7 |
|
8 // Mauve is free software; you can redistribute it and/or modify |
|
9 // it under the terms of the GNU General Public License as published by |
|
10 // the Free Software Foundation; either version 2, or (at your option) |
|
11 // any later version. |
|
12 |
|
13 // Mauve is distributed in the hope that it will be useful, |
|
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 // GNU General Public License for more details. |
|
17 |
|
18 // You should have received a copy of the GNU General Public License |
|
19 // along with Mauve; see the file COPYING. If not, write to |
|
20 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
21 // Boston, MA 02110-1301 USA. |
|
22 |
|
23 |
|
24 package gnu.testlet.java.lang.ClassLoader; |
|
25 |
|
26 import gnu.testlet.TestHarness; |
|
27 import gnu.testlet.Testlet; |
|
28 |
|
29 public class loadClass extends ClassLoader implements Testlet |
|
30 { |
|
31 public void test(TestHarness harness) |
|
32 { |
|
33 ClassLoader cl = this.getClass().getClassLoader(); |
|
34 boolean cnf_thrown; |
|
35 try |
|
36 { |
|
37 cl.loadClass("gnu"); |
|
38 cnf_thrown = false; |
|
39 } |
|
40 catch(ClassNotFoundException x) |
|
41 { |
|
42 cnf_thrown = true; |
|
43 } |
|
44 harness.check(cnf_thrown); |
|
45 |
|
46 try |
|
47 { |
|
48 cl.loadClass("gnu."); |
|
49 cnf_thrown = false; |
|
50 } |
|
51 catch(ClassNotFoundException x) |
|
52 { |
|
53 cnf_thrown = true; |
|
54 } |
|
55 harness.check(cnf_thrown); |
|
56 |
|
57 try |
|
58 { |
|
59 cl.loadClass("."); |
|
60 cnf_thrown = false; |
|
61 } |
|
62 catch(ClassNotFoundException x) |
|
63 { |
|
64 cnf_thrown = true; |
|
65 } |
|
66 harness.check(cnf_thrown); |
|
67 |
|
68 try |
|
69 { |
|
70 cl.loadClass("/"); |
|
71 cnf_thrown = false; |
|
72 } |
|
73 catch(ClassNotFoundException x) |
|
74 { |
|
75 cnf_thrown = true; |
|
76 } |
|
77 harness.check(cnf_thrown); |
|
78 |
|
79 try |
|
80 { |
|
81 cl.loadClass("["); |
|
82 cnf_thrown = false; |
|
83 } |
|
84 catch(ClassNotFoundException x) |
|
85 { |
|
86 cnf_thrown = true; |
|
87 } |
|
88 harness.check(cnf_thrown); |
|
89 |
|
90 try |
|
91 { |
|
92 cl.loadClass("[["); |
|
93 cnf_thrown = false; |
|
94 } |
|
95 catch(ClassNotFoundException x) |
|
96 { |
|
97 cnf_thrown = true; |
|
98 } |
|
99 harness.check(cnf_thrown); |
|
100 |
|
101 try |
|
102 { |
|
103 cl.loadClass("[]"); |
|
104 cnf_thrown = false; |
|
105 } |
|
106 catch(ClassNotFoundException x) |
|
107 { |
|
108 cnf_thrown = true; |
|
109 } |
|
110 harness.check(cnf_thrown); |
|
111 |
|
112 try |
|
113 { |
|
114 cl.loadClass("L;"); |
|
115 cnf_thrown = false; |
|
116 } |
|
117 catch(ClassNotFoundException x) |
|
118 { |
|
119 cnf_thrown = true; |
|
120 } |
|
121 harness.check(cnf_thrown); |
|
122 |
|
123 try |
|
124 { |
|
125 cl.loadClass("L."); |
|
126 cnf_thrown = false; |
|
127 } |
|
128 catch(ClassNotFoundException x) |
|
129 { |
|
130 cnf_thrown = true; |
|
131 } |
|
132 harness.check(cnf_thrown); |
|
133 |
|
134 try |
|
135 { |
|
136 cl.loadClass("L["); |
|
137 cnf_thrown = false; |
|
138 } |
|
139 catch(ClassNotFoundException x) |
|
140 { |
|
141 cnf_thrown = true; |
|
142 } |
|
143 harness.check(cnf_thrown); |
|
144 |
|
145 try |
|
146 { |
|
147 cl.loadClass("[L;"); |
|
148 cnf_thrown = false; |
|
149 } |
|
150 catch(ClassNotFoundException x) |
|
151 { |
|
152 cnf_thrown = true; |
|
153 } |
|
154 harness.check(cnf_thrown); |
|
155 |
|
156 try |
|
157 { |
|
158 cl.loadClass("[L[;"); |
|
159 cnf_thrown = false; |
|
160 } |
|
161 catch(ClassNotFoundException x) |
|
162 { |
|
163 cnf_thrown = true; |
|
164 } |
|
165 harness.check(cnf_thrown); |
|
166 |
|
167 try |
|
168 { |
|
169 cl.loadClass("[L.;"); |
|
170 cnf_thrown = false; |
|
171 } |
|
172 catch(ClassNotFoundException x) |
|
173 { |
|
174 cnf_thrown = true; |
|
175 } |
|
176 harness.check(cnf_thrown); |
|
177 |
|
178 try |
|
179 { |
|
180 cl.loadClass("[Lgnu;"); |
|
181 cnf_thrown = false; |
|
182 } |
|
183 catch(ClassNotFoundException x) |
|
184 { |
|
185 cnf_thrown = true; |
|
186 } |
|
187 harness.check(cnf_thrown); |
|
188 |
|
189 try |
|
190 { |
|
191 cl.loadClass("[Lgnu.;"); |
|
192 cnf_thrown = false; |
|
193 } |
|
194 catch(ClassNotFoundException x) |
|
195 { |
|
196 cnf_thrown = true; |
|
197 } |
|
198 harness.check(cnf_thrown); |
|
199 |
|
200 try |
|
201 { |
|
202 cl.loadClass(""); |
|
203 cnf_thrown = false; |
|
204 } |
|
205 catch(ClassNotFoundException x) |
|
206 { |
|
207 cnf_thrown = true; |
|
208 } |
|
209 harness.check(cnf_thrown); |
|
210 } |
|
211 } |
|