[RESOLVED] NullPointerException thrown when trying to loop through file and put contents in Array???

Discussion in 'Plugin Development' started by Adamki11s, Apr 27, 2011.

Thread Status:
Not open for further replies.
  1. Method:
    Code:
    Properties prop = new Properties();
    public static String[] zoneNames;
    public static String zoneName;
    public static int zoneCount;
    static File Zones = new File(mainDirectory + File.separator + "Zones.dat");
    
    
        public void fillZoneNamesArray() throws IOException{
            int e;
            FileInputStream in = new FileInputStream(Zones);
            prop.load(in);
            for(e=1; e <= zoneCount;e++){
                zoneNames[e - 1] = prop.getProperty("Zone" + e);
            }
            in.close();
        }
    Error thrown :

    Code:
    18:27:31 [SEVERE] null loading Zones v1.0 (Is it up to date?)
    java.lang.NullPointerException
            at me.Adamki11s.Zones.Zones.fillZoneNamesArray(Zones.java:78)
            at me.Adamki11s.Zones.Zones.onEnable(Zones.java:52)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:127)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:632)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:218)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:116)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:94)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:217)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:204)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:144)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:259)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    >
    Config File Example:
    Code:
    #Do NOT edit this config!
    #Wed Apr 27 18:16:41 BST 2011
    ZoneCount=2
    Zone2=second
    Zone1=first
    
    
     
Thread Status:
Not open for further replies.

Share This Page