1 /* Except.java -- Regression test for URLStreamHandler |
|
2 Copyright (C) 2006 Red Hat, Inc. |
|
3 This file is part of Mauve. |
|
4 |
|
5 Mauve is free software; you can redistribute it and/or modify |
|
6 it under the terms of the GNU General Public License as published by |
|
7 the Free Software Foundation; either version 2, or (at your option) |
|
8 any later version. |
|
9 |
|
10 Mauve is distributed in the hope that it will be useful, but |
|
11 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU General Public License |
|
16 along with Mauve; see the file COPYING. If not, write to the |
|
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 02110-1301 USA. |
|
19 |
|
20 */ |
|
21 |
|
22 // Tags: JDK1.4 |
|
23 |
|
24 package gnu.testlet.java.net.URLStreamHandler; |
|
25 |
|
26 import java.net.MalformedURLException; |
|
27 import java.net.URL; |
|
28 import java.net.URLConnection; |
|
29 import java.net.URLStreamHandler; |
|
30 |
|
31 import gnu.testlet.TestHarness; |
|
32 import gnu.testlet.Testlet; |
|
33 |
|
34 /** |
|
35 * PR 28095 regression test. |
|
36 */ |
|
37 public class Except implements Testlet { |
|
38 public static class Handler extends URLStreamHandler |
|
39 { |
|
40 protected URLConnection openConnection(URL u) |
|
41 { |
|
42 return null; |
|
43 } |
|
44 |
|
45 protected void parseURL(URL url, String spec, int start, int end) |
|
46 { |
|
47 throw new RuntimeException(); |
|
48 } |
|
49 } |
|
50 |
|
51 public void test(TestHarness harness) { |
|
52 boolean ok = false; |
|
53 try { |
|
54 URL u = new URL(null, "blah://", new Handler()); |
|
55 } catch (MalformedURLException ignore) { |
|
56 ok = true; |
|
57 } catch (Exception ex) { |
|
58 harness.debug(ex); |
|
59 } |
|
60 harness.check(ok); |
|
61 } |
|
62 } |
|