@Test(expected = IOException.class) public void parseError() throws Exception { this.json = ArcGISRestDataStoreFactoryTest.readJSONAsString("test-data/error.json"); GeoJSONParser parser = (new GeoJSONParser( new ByteArrayInputStream(this.json.getBytes()), this.fType, null)); parser.parseFeatureCollection(); }
public IOException parseError() throws IOException { Error_ err = new Error_(); try { this.reader.beginObject(); while (this.reader.hasNext()) { switch (this.reader.nextName()) { case ERROR_CODE: err.setCode(this.reader.nextInt()); break; case ERROR_MESSAGE: err.setMessage(this.reader.nextString()); break; case ERROR_DETAILS: List<String> details = new ArrayList<String>(); this.reader.beginArray(); while (this.reader.hasNext()) { details.add(this.reader.nextString()); } this.reader.endArray(); err.setDetails(details); } } this.reader.endObject(); } catch (IOException | IllegalStateException e) { throw (new NoSuchElementException(e.getMessage())); } this.close(); return new IOException( "ArcGIS ReST API Error: " + err.getCode() + " " + err.getMessage() + " " + String.join(",", err.getDetails())); }
GeoJSONParser implements SimpleFeatureIterator { public IOException parseError() throws IOException { Error_ err = new Error_(); try { this.reader.beginObject(); while (this.reader.hasNext()) { switch (this.reader.nextName()) { case ERROR_CODE: err.setCode(this.reader.nextInt()); break; case ERROR_MESSAGE: err.setMessage(this.reader.nextString()); break; case ERROR_DETAILS: List<String> details = new ArrayList<String>(); this.reader.beginArray(); while (this.reader.hasNext()) { details.add(this.reader.nextString()); } this.reader.endArray(); err.setDetails(details); } } this.reader.endObject(); } catch (IOException | IllegalStateException e) { throw (new NoSuchElementException(e.getMessage())); } this.close(); return new IOException( "ArcGIS ReST API Error: " + err.getCode() + " " + err.getMessage() + " " + String.join(",", err.getDetails())); } }
GeoJSONParser implements SimpleFeatureIterator { public IOException parseError() throws IOException { Error_ err = new Error_(); try { this.reader.beginObject(); while (this.reader.hasNext()) { switch (this.reader.nextName()) { case ERROR_CODE: err.setCode(this.reader.nextInt()); break; case ERROR_MESSAGE: err.setMessage(this.reader.nextString()); break; case ERROR_DETAILS: List<String> details = new ArrayList<String>(); this.reader.beginArray(); while (this.reader.hasNext()) { details.add(this.reader.nextString()); } this.reader.endArray(); err.setDetails(details); } } this.reader.endObject(); } catch (IOException | IllegalStateException e) { throw (new NoSuchElementException(e.getMessage())); } this.close(); return new IOException( "ArcGIS ReST API Error: " + err.getCode() + " " + err.getMessage() + " " + String.join(",", err.getDetails())); } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); }
GeoJSONParser implements SimpleFeatureIterator { public IOException parseError() throws IOException { Error_ err = new Error_(); try { this.reader.beginObject(); while (this.reader.hasNext()) { switch (this.reader.nextName()) { case ERROR_CODE: err.setCode(this.reader.nextInt()); break; case ERROR_MESSAGE: err.setMessage(this.reader.nextString()); break; case ERROR_DETAILS: List<String> details = new ArrayList<String>(); this.reader.beginArray(); while (this.reader.hasNext()) { details.add(this.reader.nextString()); } this.reader.endArray(); err.setDetails(details); } } this.reader.endObject(); } catch (IOException | IllegalStateException e) { throw (new NoSuchElementException(e.getMessage())); } this.close(); return new IOException( "ArcGIS ReST API Error: " + err.getCode() + " " + err.getMessage() + " " + String.join(",", err.getDetails())); } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); @Override void close(); @Override boolean hasNext(); @Override SimpleFeature next(); void parseFeatureCollection(); static double[] listToArray(List<Double> coords); double[] parseCoordinateArray(); double[] parsePointCoordinates(); List<double[]> parseMultiPointCoordinates(); double[] parseLineStringCoordinates(); List<double[]> parseMultiLineStringCoordinates(); List<double[]> parsePolygonCoordinates(); List<List<double[]>> parseMultiPolygonCoordinates(); Geometry parseGeometry(); Map<String, Object> parseProperties(); SimpleFeature parseFeature(); IOException parseError(); }
GeoJSONParser implements SimpleFeatureIterator { public IOException parseError() throws IOException { Error_ err = new Error_(); try { this.reader.beginObject(); while (this.reader.hasNext()) { switch (this.reader.nextName()) { case ERROR_CODE: err.setCode(this.reader.nextInt()); break; case ERROR_MESSAGE: err.setMessage(this.reader.nextString()); break; case ERROR_DETAILS: List<String> details = new ArrayList<String>(); this.reader.beginArray(); while (this.reader.hasNext()) { details.add(this.reader.nextString()); } this.reader.endArray(); err.setDetails(details); } } this.reader.endObject(); } catch (IOException | IllegalStateException e) { throw (new NoSuchElementException(e.getMessage())); } this.close(); return new IOException( "ArcGIS ReST API Error: " + err.getCode() + " " + err.getMessage() + " " + String.join(",", err.getDetails())); } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); @Override void close(); @Override boolean hasNext(); @Override SimpleFeature next(); void parseFeatureCollection(); static double[] listToArray(List<Double> coords); double[] parseCoordinateArray(); double[] parsePointCoordinates(); List<double[]> parseMultiPointCoordinates(); double[] parseLineStringCoordinates(); List<double[]> parseMultiLineStringCoordinates(); List<double[]> parsePolygonCoordinates(); List<List<double[]>> parseMultiPolygonCoordinates(); Geometry parseGeometry(); Map<String, Object> parseProperties(); SimpleFeature parseFeature(); IOException parseError(); static final String ENCODING; static final String DATETIME_FORMAT; static final String ERROR; static final String ERROR_CODE; static final String ERROR_MESSAGE; static final String ERROR_DETAILS; static final String GEOJSON_TYPE; static final String GEOJSON_TYPE_VALUE_FC; static final String GEOJSON_PROPERTIES; static final String GEOJSON_TOTALFEATURES; static final String FEATURES; static final String CRS; static final String CRS_TYPE; static final String CRS_TYPE_VALUE; static final String CRS_PROPERTIES; static final String CRS_PROPERTIES_NAME; static final String FEATURE_TYPE; static final String FEATURE_ID; static final String FEATURE_GEOMETRY; static final String FEATURE_GEOMETRY_TYPE; static final String FEATURE_TYPE_VALUE; static final String FEATURE_GEOMETRY_COORDINATES; static final String FEATURE_PROPERTIES; static final String GEOMETRY_POINT; static final String GEOMETRY_MULTIPOINT; static final String GEOMETRY_LINE; static final String GEOMETRY_MULTILINE; static final String GEOMETRY_POLYGON; static final String GEOMETRY_MULTIPOLYGON; }