Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8956e9909ed7dcb2be2eaf4a4c7b3209856dff91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2003, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.osgi.internal.url;

import java.io.IOException;
import java.net.*;
import org.osgi.service.url.URLStreamHandlerService;
import org.osgi.service.url.URLStreamHandlerSetter;

/**
 * The NullURLStreamService is created when a registered URLStreamHandler service
 * with an associated URLStreamHandlerProxy becomes unregistered.  The associated
 * URLStreamHandlerProxy must still handle all future requests for the now unregistered
 * scheme (the JVM caches URLStreamHandlers making up impossible to "unregister" them). 
 * When requests come in for an unregistered URLStreamHandlerService, the
 * NullURLStreamHandlerService is used in it's place.
 */

public class NullURLStreamHandlerService implements URLStreamHandlerService {

	public URLConnection openConnection(URL u) throws IOException {
		throw new MalformedURLException();
	}

	public boolean equals(URL url1, URL url2) {
		throw new IllegalStateException();
	}

	public int getDefaultPort() {
		throw new IllegalStateException();
	}

	public InetAddress getHostAddress(URL url) {
		throw new IllegalStateException();
	}

	public int hashCode(URL url) {
		throw new IllegalStateException();
	}

	public boolean hostsEqual(URL url1, URL url2) {
		throw new IllegalStateException();
	}

	public boolean sameFile(URL url1, URL url2) {
		throw new IllegalStateException();
	}

	public void setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String file, String query, String ref) {
		throw new IllegalStateException();
	}

	public void setURL(URL u, String protocol, String host, int port, String file, String ref) {
		throw new IllegalStateException();
	}

	public String toExternalForm(URL url) {
		throw new IllegalStateException();
	}

	public void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit) {
		throw new IllegalStateException();
	}

}

Back to the top