Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1011 / libraries / libRemoteServices / src / org / gvsig / remoteClient / wms / wms_1_1_1 / WMSProtocolHandler1_1_1.java @ 12904

History | View | Annotate | Download (15.8 KB)

1 3323 ldiaz
2
package org.gvsig.remoteClient.wms.wms_1_1_1;
3
4 4500 jaume
import java.io.BufferedReader;
5 3516 jaume
import java.io.ByteArrayInputStream;
6 3323 ldiaz
import java.io.File;
7 4500 jaume
import java.io.FileInputStream;
8 3323 ldiaz
import java.io.FileNotFoundException;
9
import java.io.FileReader;
10
import java.io.IOException;
11 11382 jaume
import java.io.StringReader;
12 3516 jaume
import java.util.ArrayList;
13 3323 ldiaz
import java.util.TreeMap;
14
15
import org.gvsig.remoteClient.utils.CapabilitiesTags;
16 12484 jorpiell
import org.gvsig.remoteClient.utils.EncodingXMLParser;
17 3516 jaume
import org.gvsig.remoteClient.utils.ExceptionTags;
18
import org.kxml2.io.KXmlParser;
19 3323 ldiaz
import org.xmlpull.v1.XmlPullParserException;
20
21
/**
22
 * <p>
23
 * Describes the handler to comunicate to a WMS 1.1.1
24
 * </p>
25
 */
26
public class WMSProtocolHandler1_1_1 extends org.gvsig.remoteClient.wms.WMSProtocolHandler {
27 3592 jaume
        private WMSLayer1_1_1 fakeRootLayer;
28 11382 jaume
29 3323 ldiaz
        public WMSProtocolHandler1_1_1()
30
        {
31 3341 ldiaz
                this.version = "1.1.1";
32
                this.name = "WMS1.1.1";
33 11382 jaume
                this.serviceInfo = new ServiceInformation();
34 3341 ldiaz
                this.layers = new TreeMap();
35 3323 ldiaz
        }
36 11382 jaume
37 3323 ldiaz
//------------------------------------------------------------------------------
38 11382 jaume
// Parsing methods....
39
//------------------------------------------------------------------------------
40 3323 ldiaz
/**
41
 * <p>Parse the xml data retrieved from the WMS, it will parse the WMS Capabilities</p>
42 11382 jaume
 *
43 3323 ldiaz
 */
44
    public void parse(File f)
45 11382 jaume
    {
46 5539 jaume
            rootLayer = null;
47 12484 jorpiell
48 3323 ldiaz
            int tag;
49 12484 jorpiell
              EncodingXMLParser kxmlParser = null;
50
            kxmlParser = new EncodingXMLParser();
51 3323 ldiaz
            try
52
            {
53 12484 jorpiell
                       kxmlParser.setInput(f);
54 3323 ldiaz
                        kxmlParser.nextTag();
55 12484 jorpiell
                        if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT )
56 11382 jaume
                    {
57
                            kxmlParser.require(KXmlParser.START_TAG, null, CapabilitiesTags.CAPABILITIES_ROOT1_1_1);
58 3323 ldiaz
                            tag = kxmlParser.nextTag();
59
                                 while(tag != KXmlParser.END_DOCUMENT)
60
                                 {
61 3655 jaume
                     switch(tag)
62 3323 ldiaz
                                         {
63 11382 jaume
64 3323 ldiaz
                                                case KXmlParser.START_TAG:
65
                                                        if (kxmlParser.getName().compareTo(CapabilitiesTags.SERVICE )==0)
66
                                                        {
67
                                                                parseServiceTag(kxmlParser);
68 11382 jaume
                                                        }
69 3323 ldiaz
                                                        else if (kxmlParser.getName().compareTo(CapabilitiesTags.CAPABILITY)==0)
70
                                                        {
71
                                                                parseCapabilityTag(kxmlParser);
72
                                                        }
73
                                                        break;
74 11382 jaume
                                                case KXmlParser.END_TAG:
75 3323 ldiaz
                                                        break;
76
                                                case KXmlParser.TEXT:
77 11382 jaume
                                                        //System.out.println("[TEXT]["+kxmlParser.getText()+"]");
78 3323 ldiaz
                                                break;
79
                                         }
80
                                     tag = kxmlParser.next();
81
                             }
82 3516 jaume
                            kxmlParser.require(KXmlParser.END_DOCUMENT, null, null);
83 3323 ldiaz
                    }
84
            }
85
            catch(XmlPullParserException parser_ex){
86 3404 jaume
                    parser_ex.printStackTrace();
87 3323 ldiaz
            }
88 11382 jaume
                   catch (IOException ioe) {
89 3404 jaume
                           ioe.printStackTrace();
90 3592 jaume
                } finally {
91 11382 jaume
92 3592 jaume
        }
93 11382 jaume
                   // In the parsing process the layer has been filled
94
    }
95
96 3323 ldiaz
    /**
97
     * <p>Parses the Service Information </p>
98 11382 jaume
     */
99
    private void parseServiceTag(KXmlParser parser) throws IOException, XmlPullParserException
100 3323 ldiaz
    {
101
            int currentTag;
102
            boolean end = false;
103 11382 jaume
104 3323 ldiaz
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.SERVICE);
105
            currentTag = parser.next();
106 11382 jaume
107
            while (!end)
108 3323 ldiaz
            {
109
                         switch(currentTag)
110
                         {
111
                                case KXmlParser.START_TAG:
112
                                        if (parser.getName().compareTo(CapabilitiesTags.NAME)==0)
113
                                        {
114 11382 jaume
                                                serviceInfo.name = parser.nextText();
115
                                        }
116 3323 ldiaz
                                        else if (parser.getName().compareTo(CapabilitiesTags.TITLE)==0)
117
                                        {
118 11382 jaume
                                                serviceInfo.title = parser.nextText();
119 3323 ldiaz
                                        }
120
                                        else if (parser.getName().compareTo(CapabilitiesTags.ABSTRACT)==0)
121
                                        {
122 11382 jaume
                                                serviceInfo.abstr = parser.nextText();
123 3323 ldiaz
                                        }
124 4222 jaume
                                        else if (parser.getName().compareTo(CapabilitiesTags.ONLINERESOURCE)==0)
125
                                        {
126
                                            String value = new String();
127
                                        value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF);
128
                                        if (value != null){
129
                                                serviceInfo.online_resource = value;
130
                                        }
131
                                        }
132 3323 ldiaz
                                        else if ((parser.getName().compareTo(CapabilitiesTags.KEYWORDLIST)==0) ||
133
                                                        (parser.getName().compareTo(CapabilitiesTags.CONTACTINFORMATION)==0))
134
                                        {
135
                                                parser.skipSubTree();
136 11382 jaume
                                        }
137 3323 ldiaz
                                        break;
138
                                case KXmlParser.END_TAG:
139
                                        if (parser.getName().compareTo(CapabilitiesTags.SERVICE) == 0)
140
                                                end = true;
141
                                        break;
142 11382 jaume
                                case KXmlParser.TEXT:
143 3323 ldiaz
                                break;
144
                         }
145 3655 jaume
             if (!end)
146
                 currentTag = parser.next();
147 3323 ldiaz
            }
148 3655 jaume
            parser.require(KXmlParser.END_TAG, null, CapabilitiesTags.SERVICE);
149 3323 ldiaz
    }
150
    /**
151
     * <p>Parses the Capability Tag </p>
152 11382 jaume
     */
153 3323 ldiaz
    private void parseCapabilityTag(KXmlParser parser) throws IOException, XmlPullParserException
154 11382 jaume
    {
155 3323 ldiaz
            int currentTag;
156
            boolean end = false;
157 11382 jaume
158 3323 ldiaz
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.CAPABILITY);
159
            currentTag = parser.next();
160 11382 jaume
161
            while (!end)
162 3323 ldiaz
            {
163
                         switch(currentTag)
164
                         {
165
                                case KXmlParser.START_TAG:
166
                                        if (parser.getName().compareTo(CapabilitiesTags.REQUEST)==0)
167
                                        {
168 11382 jaume
                                                parseRequestTag(parser);
169
                                        }
170 3323 ldiaz
                                        else if (parser.getName().compareTo(CapabilitiesTags.EXCEPTION)==0)
171
                                        {
172 4222 jaume
                                                //TODO:
173
                                                //Add to serviceInfo the supported formats for the exceptions????
174 3323 ldiaz
                                        }
175
                                        else if (parser.getName().compareTo(CapabilitiesTags.LAYER)==0)
176
                                        {
177
                                                WMSLayer1_1_1 lyr = new WMSLayer1_1_1();
178 4222 jaume
                                                lyr.parse(parser, layers);
179 11382 jaume
180 3592 jaume
                        if (rootLayer == null)
181
                            rootLayer = lyr;
182
                        else {
183
                            // Handles when there is no general root layer, will use
184
                            // a fake non-queryable one.
185
                            if (!rootLayer.equals(getFakeRootLayer())){
186
                                WMSLayer1_1_1 aux = (WMSLayer1_1_1) rootLayer;
187
                                rootLayer  = getFakeRootLayer();
188
                                rootLayer.getChildren().add(aux);
189
                            }
190
                            rootLayer.getChildren().add(lyr);
191
                        }
192 11382 jaume
193 3483 jaume
                        if (lyr.getName()!=null)
194 11382 jaume
                                                    layers.put(lyr.getName(), lyr);
195
196
//                        Collection layerCollection = layers.values();
197 4222 jaume
//                        Iterator iter = layerCollection.iterator();
198
//                        while (iter.hasNext())
199
//                        {
200 11382 jaume
//                                WMSLayer1_1_1 layer = (WMSLayer1_1_1)iter.next();
201 4222 jaume
//                                                    //Add all the SRS that the layer supports to the WMSProtocolHandler if they dont exist already
202
//                                                    for (i=0;i<layer.getAllSrs().size();i++)
203 11382 jaume
//                                                    {
204 4222 jaume
////                                                        if (!layer.srs.contains(layer.getAllSrs().elementAt(i)))
205
////                                                        {
206
////                                                            this.srs.add(layer.getAllSrs().elementAt(i));
207
////                                                        }
208 11382 jaume
//                                                    }
209
//                        }
210 3323 ldiaz
                                        }
211
                                        else if ((parser.getName().compareTo(CapabilitiesTags.VENDORSPECIFICCAPABILITIES)==0) ||
212
                                                        (parser.getName().compareTo(CapabilitiesTags.USERDEFINEDSYMBOLIZATION )==0))
213 11382 jaume
214 3323 ldiaz
                                        {
215
                                                parser.skipSubTree();
216 11382 jaume
                                        }
217 3323 ldiaz
                                        break;
218
                                case KXmlParser.END_TAG:
219
                                        if (parser.getName().compareTo(CapabilitiesTags.CAPABILITY) == 0)
220
                                                end = true;
221
                                        break;
222 11382 jaume
                                case KXmlParser.TEXT:
223 3323 ldiaz
                                break;
224
                         }
225 4222 jaume
                         if (!end)
226
                                 currentTag = parser.next();
227 3323 ldiaz
            }
228 11382 jaume
            //parser.require(KXmlParser.END_TAG, null, CapabilitiesTags.CAPABILITY);
229 3323 ldiaz
    }
230 11382 jaume
231 3323 ldiaz
    /**
232
     * <p>Parses the Request tag </p>
233 11382 jaume
     */
234 3323 ldiaz
    private void parseRequestTag(KXmlParser parser) throws IOException, XmlPullParserException
235 11382 jaume
    {
236 3323 ldiaz
            int currentTag;
237
            boolean end = false;
238 11382 jaume
239 3323 ldiaz
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.REQUEST);
240
            currentTag = parser.next();
241 11382 jaume
242
            while (!end)
243 3323 ldiaz
            {
244
                         switch(currentTag)
245
                         {
246
                                case KXmlParser.START_TAG:
247
                                        if (parser.getName().compareTo(CapabilitiesTags.GETCAPABILITIES)==0)
248
                                        {
249 11382 jaume
                                                serviceInfo.operations.put(CapabilitiesTags.GETCAPABILITIES, null);
250
                                        }
251 3323 ldiaz
                                        else if (parser.getName().compareTo(CapabilitiesTags.GETMAP)==0)
252
                                        {
253 4222 jaume
                                                // put a null to this key?
254
                                                // or leave it like it was with a CODE in a vector specifying this operation.
255 11382 jaume
                                                // WMSProtocolHandler.GETMAP_OPERATION
256
                                                serviceInfo.operations.put(CapabilitiesTags.GETMAP, null);
257 4222 jaume
                                                parseGetMapTag(parser);
258 3323 ldiaz
                                        }
259
                                        else if (parser.getName().compareTo(CapabilitiesTags.GETFEATUREINFO)==0)
260
                                        {
261 4222 jaume
                                                //serviceInfo.operations.put(WMSProtocolHandler.GETFEATUREINFO_OPERATION)
262
                                                serviceInfo.operations.put(CapabilitiesTags.GETFEATUREINFO, null);
263
                                                parseGetFeatureInfoTag(parser);
264 11382 jaume
                                        }
265 3687 ldiaz
                                        else if (parser.getName().compareTo(CapabilitiesTags.DESCRIBELAYER)==0)
266
                                        {
267 4222 jaume
                                                //serviceInfo.operations.put(WMSProtocolHandler.DESCRIBELAYER_OPERATION)
268 11382 jaume
                                                serviceInfo.operations.put(CapabilitiesTags.DESCRIBELAYER, null);
269
                                        }
270 8765 jjdelcerro
                                        else if (parser.getName().compareTo(CapabilitiesTags.GETLEGENDGRAPHIC)==0)
271
                                        {
272
                                                serviceInfo.operations.put(CapabilitiesTags.GETLEGENDGRAPHIC, null);
273
                                                parseGetLegendGraphicTag(parser);
274
                                        }
275 3323 ldiaz
                                        break;
276
                                case KXmlParser.END_TAG:
277
                                        if (parser.getName().compareTo(CapabilitiesTags.REQUEST) == 0)
278
                                                end = true;
279
                                        break;
280 11382 jaume
                                case KXmlParser.TEXT:
281 3323 ldiaz
                                break;
282
                         }
283 4222 jaume
                         if(!end)
284
                                 currentTag = parser.next();
285 3323 ldiaz
            }
286
            // TODO: does not get such a tag when arrives here!!!!!!
287 11382 jaume
            //parser.require(KXmlParser.END_TAG, null, CapabilitiesTags.REQUEST);
288 3323 ldiaz
    }
289 11382 jaume
290 4222 jaume
    /**
291
     * <p>Parses the GetMap tag </p>
292 11382 jaume
     */
293 4222 jaume
    private void parseGetMapTag(KXmlParser parser) throws IOException, XmlPullParserException
294 11382 jaume
    {
295 4222 jaume
            int currentTag;
296
            boolean end = false;
297 11382 jaume
298 4222 jaume
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.GETMAP);
299
            currentTag = parser.next();
300 11382 jaume
301
            while (!end)
302 4222 jaume
            {
303
                         switch(currentTag)
304
                         {
305
                                case KXmlParser.START_TAG:
306
                                        if (parser.getName().compareTo(CapabilitiesTags.FORMAT)==0)
307
                                        {
308
                                                serviceInfo.formats.add(parser.nextText());
309 11382 jaume
                                        }
310 4222 jaume
                                        else if (parser.getName().compareTo(CapabilitiesTags.DCPTYPE)==0)
311 11382 jaume
                                        {
312 4222 jaume
                                                currentTag = parser.nextTag();
313
                                                if(parser.getName().compareTo(CapabilitiesTags.HTTP)==0)
314
                                                {
315
                                                        currentTag = parser.nextTag();
316
                                                        if(parser.getName().compareTo(CapabilitiesTags.GET)==0)
317
                                                        {
318
                                                                currentTag = parser.nextTag();
319
                                                                if (parser.getName().compareTo(CapabilitiesTags.ONLINERESOURCE)==0)
320
                                                                {
321
                                                                        String value = new String();
322
                                                                        value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF);
323
                                                                        if (value != null){
324
                                                                                serviceInfo.operations.put(CapabilitiesTags.GETMAP, value);
325
                                                                        }
326
                                                                }
327
                                                        }
328
                                                }
329 11382 jaume
                                        }
330 4222 jaume
                                        break;
331
                                case KXmlParser.END_TAG:
332
                                        if (parser.getName().compareTo(CapabilitiesTags.GETMAP) == 0)
333
                                                end = true;
334
                                        break;
335 11382 jaume
                                case KXmlParser.TEXT:
336 4222 jaume
                                break;
337
                         }
338
                         if(!end)
339
                                 currentTag = parser.next();
340 11382 jaume
            }
341
    }
342
343 4222 jaume
    /**
344 8765 jjdelcerro
     * <p>Parses the GetFeatureInfoTag tag </p>
345 11382 jaume
     */
346 4222 jaume
    private void parseGetFeatureInfoTag(KXmlParser parser) throws IOException, XmlPullParserException
347 11382 jaume
    {
348 4222 jaume
            int currentTag;
349
            boolean end = false;
350 11382 jaume
351 4222 jaume
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.GETFEATUREINFO);
352
            currentTag = parser.next();
353 11382 jaume
354
            while (!end)
355 4222 jaume
            {
356
                         switch(currentTag)
357
                         {
358
                                case KXmlParser.START_TAG:
359
                                        if (parser.getName().compareTo(CapabilitiesTags.FORMAT)==0)
360
                                        {
361
                                                //TODO:
362
                                                // add the supported formats by the GetFeatureInfo request
363
                                                //serviceInfo.formats.add(parser.nextText());
364 11382 jaume
                                        }
365 4222 jaume
                                        else if (parser.getName().compareTo(CapabilitiesTags.DCPTYPE)==0)
366 11382 jaume
                                        {
367 4222 jaume
                                                currentTag = parser.nextTag();
368
                                                if(parser.getName().compareTo(CapabilitiesTags.HTTP)==0)
369
                                                {
370
                                                        currentTag = parser.nextTag();
371
                                                        if(parser.getName().compareTo(CapabilitiesTags.GET)==0)
372
                                                        {
373
                                                                currentTag = parser.nextTag();
374
                                                                if (parser.getName().compareTo(CapabilitiesTags.ONLINERESOURCE)==0)
375
                                                                {
376
                                                                        String value = new String();
377
                                                                        value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF);
378
                                                                        if (value != null){
379 4623 ldiaz
                                                                                serviceInfo.operations.put(CapabilitiesTags.GETFEATUREINFO, value);
380 4222 jaume
                                                                        }
381
                                                                }
382
                                                        }
383
                                                }
384 11382 jaume
                                        }
385 4222 jaume
                                        break;
386
                                case KXmlParser.END_TAG:
387
                                        if (parser.getName().compareTo(CapabilitiesTags.GETFEATUREINFO) == 0)
388
                                                end = true;
389
                                        break;
390 11382 jaume
                                case KXmlParser.TEXT:
391 4222 jaume
                                break;
392
                         }
393
                         if(!end)
394
                                 currentTag = parser.next();
395 11382 jaume
            }
396
    }
397 3516 jaume
398 8765 jjdelcerro
    /**
399
     * <p>Parses the GetFeatureInfoTag tag </p>
400 11382 jaume
     */
401 8765 jjdelcerro
    private void parseGetLegendGraphicTag(KXmlParser parser) throws IOException, XmlPullParserException
402 11382 jaume
    {
403 8765 jjdelcerro
            int currentTag;
404
            boolean end = false;
405 11382 jaume
406 8765 jjdelcerro
            parser.require(KXmlParser.START_TAG, null, CapabilitiesTags.GETLEGENDGRAPHIC);
407
            currentTag = parser.next();
408 11382 jaume
409
            while (!end)
410 8765 jjdelcerro
            {
411
                         switch(currentTag)
412
                         {
413
                                case KXmlParser.START_TAG:
414
                                        if (parser.getName().compareTo(CapabilitiesTags.FORMAT)==0)
415
                                        {
416
                                                //TODO:
417
                                                // add the supported formats by the GetLegendGraphic request
418
                                                //serviceInfo.formats.add(parser.nextText());
419 11382 jaume
                                        }
420 8765 jjdelcerro
                                        else if (parser.getName().compareTo(CapabilitiesTags.DCPTYPE)==0)
421 11382 jaume
                                        {
422 8765 jjdelcerro
                                                currentTag = parser.nextTag();
423
                                                if(parser.getName().compareTo(CapabilitiesTags.HTTP)==0)
424
                                                {
425
                                                        currentTag = parser.nextTag();
426
                                                        if(parser.getName().compareTo(CapabilitiesTags.GET)==0)
427
                                                        {
428
                                                                currentTag = parser.nextTag();
429
                                                                if (parser.getName().compareTo(CapabilitiesTags.ONLINERESOURCE)==0)
430
                                                                {
431
                                                                        String value = new String();
432
                                                                        value = parser.getAttributeValue("", CapabilitiesTags.XLINK_HREF);
433
                                                                        if (value != null){
434
                                                                                serviceInfo.operations.put(CapabilitiesTags.GETLEGENDGRAPHIC, value);
435
                                                                        }
436
                                                                }
437
                                                        }
438
                                                }
439 11382 jaume
                                        }
440 8765 jjdelcerro
                                        break;
441
                                case KXmlParser.END_TAG:
442
                                        if (parser.getName().compareTo(CapabilitiesTags.GETLEGENDGRAPHIC) == 0)
443
                                                end = true;
444
                                        break;
445 11382 jaume
                                case KXmlParser.TEXT:
446 8765 jjdelcerro
                                break;
447
                         }
448
                         if(!end)
449
                                 currentTag = parser.next();
450 11382 jaume
            }
451
    }
452
453
454 3592 jaume
    private WMSLayer1_1_1 getFakeRootLayer(){
455
        if (fakeRootLayer == null){
456
            fakeRootLayer = new WMSLayer1_1_1();
457
            fakeRootLayer.setTitle(serviceInfo.title);
458
            fakeRootLayer.setQueryable(false);
459
            fakeRootLayer.setName(null);
460
        }
461
        return fakeRootLayer;
462
    }
463 3516 jaume
    /* (non-Javadoc)
464
     * @see org.gvsig.remoteClient.wms.WMSProtocolHandler#parseException(byte[])
465
     */
466
    protected String parseException(byte[] data) {
467
        ArrayList errors = new ArrayList();
468
        KXmlParser kxmlParser = new KXmlParser();
469
        try
470
        {
471 11382 jaume
            kxmlParser.setInput(new ByteArrayInputStream(data), encoding);
472 3516 jaume
            int tag;
473 11382 jaume
474 3824 ldiaz
            boolean end = false;
475
            tag = kxmlParser.nextTag();
476 11382 jaume
477 8765 jjdelcerro
            //Comentar temporalmente para subsanar el hecho de que SimonCit me devuelve las capabilities en un GetLegendGraphic!!!
478 3824 ldiaz
            kxmlParser.require(KXmlParser.START_TAG, null, ExceptionTags.EXCEPTION_ROOT);
479 11382 jaume
480
            while (!end)
481 3824 ldiaz
            {
482
                switch(tag)
483
                {
484
                    case KXmlParser.START_TAG:
485 3516 jaume
                            if (kxmlParser.getName().compareTo(ExceptionTags.SERVICE_EXCEPTION)==0){
486
                                String errorCode = kxmlParser.getAttributeValue("", ExceptionTags.CODE);
487
                                errorCode = (errorCode != null) ? "["+errorCode+"] " : "";
488
                                String errorMessage = kxmlParser.nextText();
489
                                errors.add(errorCode+errorMessage);
490
                            }
491
                            break;
492 11382 jaume
                    case KXmlParser.END_TAG:
493 3824 ldiaz
                            if (kxmlParser.getName().compareTo(ExceptionTags.EXCEPTION_ROOT) == 0)
494
                                end = true;
495 11382 jaume
                            break;
496 3516 jaume
                     }
497 3824 ldiaz
                        if (!end)
498
                        {
499
                                tag = kxmlParser.nextTag();
500
                        }
501 3516 jaume
                 }
502 3824 ldiaz
                }
503 3516 jaume
        catch(XmlPullParserException parser_ex){
504
            System.out.println(parser_ex.getMessage());
505
            parser_ex.printStackTrace();
506
        }
507 11382 jaume
        catch (IOException ioe) {
508
            ioe.printStackTrace();
509 3516 jaume
        }
510
        String message = errors.size()>0? "" : null;
511
        for (int i = 0; i < errors.size(); i++) {
512
            message += (String) errors.get(i)+"\n";
513
        }
514
        return message;
515
    }
516 11382 jaume
517 3323 ldiaz
  }