-3

我重温了我的程序,结果它就炸了。我所做的只是一些 String.format() 返回,并且恢复这些更改并没有使这个错误消失。当我研究错误时,它似乎与 Maven 有关?但我使用 ANT 来构建项目。

Exception in thread "Thread-2" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file InHouseLeague/Workers/BotListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.schwering.irc.moep.MoepIRC.run(MoepIRC.java:831)
at java.lang.Thread.run(Thread.java:722)

它引用的代码(我已经好几周没碰过了)

public void run() {
    updateTab(Util.CONSOLEWINDOWINDEX, "# Trying to connect to "+ host, 
        serverColor);
    enableConnectMenuItem(false);
    username = username.toLowerCase();
    if (!useSSL) {
    conn = new BotConnection(host, portMin, portMax, password, nickname, 
        username, realname);
    } else {
    BotSSLConnection sslconn = new BotSSLConnection(host, portMin, portMax, 
        password, nickname, username, realname);
    if (!autoAcceptSSLCerts)
        sslconn.addTrustManager(new AskTrustManager());
    conn = sslconn;
    }
    conn.addIRCEventListener(new BotListener(this)); //ERROR POINTS TO HERE
    conn.setColors(true); 
    conn.setPong(false); 
    conn.setDaemon(true);
    try {
    conn.connect();
    this.isConnected = conn.isConnected();
    } catch (Exception exc) {
    String reason = "";
    if (exc.getMessage() != null) {
        reason = ": "+ exc.getMessage();
    }
    updateTab(Util.CONSOLEWINDOWINDEX, "# Couldn't connect"+ reason, 
        serverColor);
    enableConnectMenuItem(true);
    exc.printStackTrace();
    this.isConnected = false;
    }
}

在此之前我所做的更改发生:

从:

    @Override
    public String toString() {
        String returnStr = String.format("%s(ELO: %d):", getTeamName(), teamELO);
        for (IPlayer player : roster) {
            returnStr = String.format("%s %s", returnStr, player.getUserName());
        }
        return returnStr;
    }

    public String toString() {
        String returnStr = String.format("%s[%d]:", getTeamName(), teamELO);
        for (IPlayer player : roster) {
            returnStr = String.format("%s %s;", returnStr, player.getUserName());
        }
        return returnStr;
    }
4

1 回答 1

0

诊断是:

类文件 InHouseLeague/Workers/BotListener 中非本机或抽象方法中的缺失代码属性

您没有说代码更改是在 InHouseLeague.Workers.BotListener 类中,还是在库类中。无论如何,通常任何代码更改都不能使编译器生成没有代码属性的方法。类文件以另一种方式被破坏,例如,它是硬件设备错误。

于 2013-01-02T05:10:42.207 回答