Project

General

Profile

« Previous | Next » 

Revision 2990

Added by berkley over 18 years ago

modified the client so it will work consistently with the web service

View differences:

src/edu/ucsb/nceas/metacat/client/MetacatClient.java
184 184
        prop.put("action", "read");
185 185
        prop.put("qformat", "xml");
186 186
        prop.put("docid", docid);
187

  
188 187
        InputStream response = null;
189 188
        try {
190 189
            response = sendData(prop, null, null, 0);
191 190
        } catch (Exception e) {
192 191
            throw new MetacatInaccessibleException(e.getMessage());
193 192
        }
194

  
195 193
        pbr = new PushbackReader(new InputStreamReader(response), 512);
196 194
        try {
197 195
            char[] characters = new char[512];
......
201 199
            String message = sw.toString();
202 200
            sw.close();
203 201
            pbr.unread(characters, 0, len);
204

  
205 202
            if (message.indexOf("<error>") != -1) {
206 203
                if (message.indexOf("does not have permission") != -1) {
207 204
                    throw new InsufficientKarmaException(message);
......
216 213
                    "MetacatClient: Error converting Reader to String."
217 214
                    + ioe.getMessage());
218 215
        }
219

  
220 216
        return pbr;
221 217
    }
222 218

  
......
781 777
        throws Exception
782 778
    {
783 779
        InputStream returnStream = null;
784

  
785 780
        /*
786 781
            Note:  The reason that there are three try statements all executing
787 782
            the same code is that there is a problem with the initial connection

Also available in: Unified diff