Code example for JSONException

0
	 */ 
	public void setFeatures(JSONArray features) throws JSONException {
		if(isFeatureCollection()) 
			this.putOpt("features", features);
		else 
			throw new JSONException("GeoJSONObject is not of type FeatureCollection");
	} 
	 
	/** 
	 * @return if the GeoJSON object is of type FeatureCollection, then this will 
	 * be a {@link org.json.JSONArray} 
	 * @throws JSONException 
	 * @see <a href="http://geojson.org/geojson-spec.html#feature-collection-objects"</a> 
	 */ 
	public JSONArray getFeatures() throws JSONException {
		if(isFeatureCollection()) 
			return (JSONArray)this.get("features");
		 
		throw new JSONException("GeoJSONObject is not of type FeatureCollection");
	}