Merge pull request #351 from mikeprimm/master

Avoid trap in regions when 'basenode' in region file cannot be found or is bad
This commit is contained in:
mikeprimm 2011-07-31 09:16:47 -07:00
commit e792bcc7a1

View File

@ -11,6 +11,7 @@ import java.util.HashSet;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.util.config.Configuration; import org.bukkit.util.config.Configuration;
import org.dynmap.ConfigurationNode; import org.dynmap.ConfigurationNode;
import org.dynmap.Log;
import org.dynmap.web.HttpRequest; import org.dynmap.web.HttpRequest;
import org.dynmap.web.HttpResponse; import org.dynmap.web.HttpResponse;
import org.dynmap.web.Json; import org.dynmap.web.Json;
@ -62,7 +63,12 @@ public class RegionHandler extends FileHandler {
return null; return null;
regionConfig.load(); regionConfig.load();
/* Parse region data and store in MemoryInputStream */ /* Parse region data and store in MemoryInputStream */
Map<?, ?> regionData = (Map<?, ?>) regionConfig.getProperty(regions.getString("basenode", "regions")); String bnode = regions.getString("basenode", "regions");
Map<?, ?> regionData = (Map<?, ?>) regionConfig.getProperty(bnode);
if(regionData == null) {
Log.severe("Region data from " + infile.getPath() + " does not include basenode '" + bnode + "'");
return null;
}
/* See if we have explicit list of regions to report - limit to this list if we do */ /* See if we have explicit list of regions to report - limit to this list if we do */
List<String> idlist = regions.getStrings("visibleregions", null); List<String> idlist = regions.getStrings("visibleregions", null);
if(idlist != null) { if(idlist != null) {