Revision 2989
Added by berkley over 18 years ago
src/edu/ucsb/nceas/metacat/client/DocumentNotFoundException.java | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile$' |
|
3 |
* Copyright: 2000 Regents of the University of California and the |
|
4 |
* National Center for Ecological Analysis and Synthesis |
|
5 |
* |
|
6 |
* '$Author$' |
|
7 |
* '$Date$' |
|
8 |
* '$Revision$' |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or modify |
|
11 |
* it under the terms of the GNU General Public License as published by |
|
12 |
* the Free Software Foundation; either version 2 of the License, or |
|
13 |
* (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
*/ |
|
24 |
|
|
25 |
package edu.ucsb.nceas.metacat.client; |
|
26 |
|
|
27 |
/** |
|
28 |
* Exception thrown when the requested docid does not exist on the server |
|
29 |
*/ |
|
30 |
public class DocumentNotFoundException extends Exception { |
|
31 |
|
|
32 |
/** |
|
33 |
* Create a new InsufficientKarmaException. |
|
34 |
* |
|
35 |
* @param message The error or warning message. |
|
36 |
*/ |
|
37 |
public DocumentNotFoundException(String message) { |
|
38 |
super(message); |
|
39 |
} |
|
40 |
} |
|
0 | 41 |
src/edu/ucsb/nceas/metacat/client/MetacatClient.java | ||
---|---|---|
176 | 176 |
* @throws MetacatException when the metacat server generates another error |
177 | 177 |
*/ |
178 | 178 |
public Reader read(String docid) throws InsufficientKarmaException, |
179 |
MetacatInaccessibleException, MetacatException |
|
179 |
MetacatInaccessibleException, MetacatException, DocumentNotFoundException
|
|
180 | 180 |
{ |
181 | 181 |
PushbackReader pbr = null; |
182 | 182 |
|
... | ... | |
205 | 205 |
if (message.indexOf("<error>") != -1) { |
206 | 206 |
if (message.indexOf("does not have permission") != -1) { |
207 | 207 |
throw new InsufficientKarmaException(message); |
208 |
} else if(message.indexOf("does not exist") != -1) { |
|
209 |
throw new DocumentNotFoundException(message); |
|
208 | 210 |
} else { |
209 | 211 |
throw new MetacatException(message); |
210 | 212 |
} |
src/edu/ucsb/nceas/metacat/client/Metacat.java | ||
---|---|---|
75 | 75 |
* @throws MetacatException when the metacat server generates another error |
76 | 76 |
*/ |
77 | 77 |
public Reader read(String docid) throws InsufficientKarmaException, |
78 |
MetacatInaccessibleException, MetacatException; |
|
78 |
MetacatInaccessibleException, DocumentNotFoundException, MetacatException;
|
|
79 | 79 |
|
80 | 80 |
/** |
81 | 81 |
* Read inline data from the metacat server session, accessed by |
Also available in: Unified diff
updated the client so it throws a DocumentNotFoundException if you attempt to read a docuemnt that doesn't exist