nullpointerexception - NPE when trying to load a json file in Java -


i working processing 2.1, language built on top of java allows creation of visualizations. experimenting reading in geojson files , displaying information on map.

i coding within ide provided processing.org website. primitive in sense not have ability debug code. return errors cannot go code find out problems.

i getting error: nullpointerexception

that's it, told of nothing else bar line occurs at.

  list<feature> counties = geojsonreader.loaddata(this, "ireland.geo.json"); 

i not understand why getting it. file trying read exists. please me issue?

below complete code:

    unfoldingmap map; list<marker>countymarkers; list<marker>countymarkers2; color c1 = color(204, 153, 0);  void setup() {   size(800, 600);   smooth();    //map   map = new unfoldingmap(this);   maputils.createdefaulteventdispatcher(this, map);   list<feature> counties = geojsonreader.loaddata(this, "ireland.geo.json");   countymarkers = maputils.createsimplemarkers(counties);   map.addmarkers(countymarkers); }  void draw() {   map.draw();    (int = 0; < countymarkers.size(); i++) {       marker county = countymarkers.get(i);                 county.setcolor(c1);        if (county.isinside(map, mousex, mousey)) {         county.draw(map);         hashmap countyprops = county.getproperties();         string countyname = countyprops.get("city").tostring();         println(countyname);       }   }   } 

developer of unfolding here.

this due our json parser handling basics of geo json specification. (see http://unfoldingmaps.org/tutorials/markers-data-geojson.html )

you can work around implementing parsing processing's loadjsonarray , loadjsonobject methods.


addendum: while did not provide json file, found 1 ireland's counties, , because of empty properties in file. please try out version of unfolding handles without throwing npe. https://dl.dropboxusercontent.com/u/599609/unfolding_for_processing_0.9.5.1.zip if not reason please provide json file can check.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -