Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saveDefaultConfig raises a "zip file closed" error. #14

Open
gdude2002 opened this issue Jan 5, 2014 · 1 comment
Open

saveDefaultConfig raises a "zip file closed" error. #14

gdude2002 opened this issue Jan 5, 2014 · 1 comment

Comments

@gdude2002
Copy link

Here's my traceback..

16:47:17 [INFO] [PythonLoader] Enabling PythonLoader v0.3.4
16:47:17 [INFO] saveDefaultConfig
16:47:17 [SEVERE] Error occurred while enabling ArchUtilities v0.1 (Is it up to date?): zip file closed
java.lang.IllegalStateException: zip file closed
        at java.util.zip.ZipFile.ensureOpen(Unknown Source)
        at java.util.zip.ZipFile.getEntry(Unknown Source)
        at net.lahwran.bukkit.jython.PluginPythonZip.getStream(PluginPythonZip.java:43)
        at net.lahwran.bukkit.jython.PythonPlugin.getResource(PythonPlugin.java:331)
        at net.lahwran.bukkit.jython.PythonPlugin.saveResource(PythonPlugin.java:346)
        at net.lahwran.bukkit.jython.PythonPlugin.saveDefaultConfig(PythonPlugin.java:397)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
        at org.python.core.PyObject.__call__(PyObject.java:403)
        at org.python.core.PyObject.__call__(PyObject.java:407)
        at org.python.core.PyMethod.__call__(PyMethod.java:121)
        at org.python.pycode._pyx5.onEnable$2(<iostream>:39)
        at org.python.pycode._pyx5.call_function(<iostream>)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:194)
        at org.python.core.PyFunction.__call__(PyFunction.java:417)
        at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:232)
        at org.python.core.PyMethod.__call__(PyMethod.java:223)
        at org.python.core.PyMethod.__call__(PyMethod.java:213)
        at org.python.core.PyMethod.__call__(PyMethod.java:208)
        at org.python.core.PyObject._jcallexc(PyObject.java:3555)
        at org.python.core.PyObject._jcall(PyObject.java:3587)
        at org.python.proxies.__main__$UtilsPlugin$0.onEnable(Unknown Source)
        at net.lahwran.bukkit.jython.PythonPlugin.setEnabled(PythonPlugin.java:163)
        at org.python.proxies.__main__$UtilsPlugin$0.setEnabled(Unknown Source)
        at net.lahwran.bukkit.jython.PythonPluginLoader.enablePlugin(PythonPluginLoader.java:388)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugin(CraftServer.java:284)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.enablePlugins(CraftServer.java:266)
        at net.minecraft.server.v1_6_R3.MinecraftServer.l(MinecraftServer.java:315)
        at net.minecraft.server.v1_6_R3.MinecraftServer.f(MinecraftServer.java:292)
        at net.minecraft.server.v1_6_R3.MinecraftServer.a(MinecraftServer.java:252)
        at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:152)
        at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393)
        at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)

Here's my code..

# coding=utf-8
__author__ = "Gareth Coles"

import org.bukkit as bukkit
from java.util.logging import Level
from java.util.logging import Logger

log = Logger.getLogger("Utils")


class UtilsPlugin(PythonPlugin):

    perms = None
    irc = None

    sign_change_listener = None
    command_listener = None
    command_executor = None

    db = None
    server_name = None

    def onEnable(self):
        print "saveDefaultConfig"
        self.saveDefaultConfig()
        print "getConfig"
        config = self.getConfig()
        print "getString"
        self.server_name = config.getString("server")

        if self.server_name == "server":
            print "Default server name"
            log.severe("Server name hasn't been set in the config. "
                       "Fix this and try again.")
            print "disablePlugin"
            self.getServer().getPluginManager().disablePlugin(self)
        else:
            print "Enabled"
            log.info("Enabled, I hope.")

    def onDisable(self):
        pass

..my file structure..

Screenshot

..and my plugin.yml..

name: ArchUtilities
main: UtilsPlugin
version: 0.1

Any ideas on this?

EDIT: Using CraftBukkit version git-Bukkit-1.6.4-R2.0-b2918jnks (MC: 1.6.4) (Implementing API version 1.6.4-R2.0) and this version of the plugin.

@gdude2002
Copy link
Author

I attempted to fix this myself, however I haven't submitted a pull request as I feel like there's probably a better way to do this.

gdude2002@7e937fe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant