1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io.imagery;
|
---|
3 |
|
---|
4 | import java.net.URL;
|
---|
5 | import java.util.Arrays;
|
---|
6 | import java.util.Collection;
|
---|
7 |
|
---|
8 | import org.openstreetmap.josm.tools.Utils;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * WMS Service Exception, as defined by {@code application/vnd.ogc.se_xml} format:<ul>
|
---|
12 | * <li><a href="http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd">WMS 1.1.0 DTD</a></li>
|
---|
13 | * <li><a href="http://schemas.opengis.net/wms/1.3.0/exception_1_3_0.dtd">WMS 1.3.0 XSD</a></li>
|
---|
14 | * </ul>
|
---|
15 | * @since 7425
|
---|
16 | */
|
---|
17 | public class WMSException extends Exception {
|
---|
18 |
|
---|
19 | private final transient WMSRequest request;
|
---|
20 | private final URL url;
|
---|
21 | private final String[] exceptions;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Constructs a new {@code WMSException}.
|
---|
25 | * @param request the WMS request that lead to this exception
|
---|
26 | * @param url the URL that lead to this exception
|
---|
27 | * @param exceptions the exceptions replied by WMS server
|
---|
28 | */
|
---|
29 | public WMSException(WMSRequest request, URL url, Collection<String> exceptions) {
|
---|
30 | super(Utils.join("\n", exceptions));
|
---|
31 | this.request = request;
|
---|
32 | this.url = url;
|
---|
33 | this.exceptions = exceptions.toArray(new String[0]);
|
---|
34 | }
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Replies the WMS request that lead to this exception.
|
---|
38 | * @return the WMS request
|
---|
39 | */
|
---|
40 | public final WMSRequest getRequest() {
|
---|
41 | return request;
|
---|
42 | }
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Replies the URL that lead to this exception.
|
---|
46 | * @return the URL
|
---|
47 | */
|
---|
48 | public final URL getUrl() {
|
---|
49 | return url;
|
---|
50 | }
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Replies the WMS Service exceptions.
|
---|
54 | * @return the exceptions
|
---|
55 | */
|
---|
56 | public final Collection<String> getExceptions() {
|
---|
57 | return Arrays.asList(exceptions);
|
---|
58 | }
|
---|
59 | }
|
---|