Bug#798699: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class
Am 19.09.2015 um 10:04 schrieb Vincent Fourmond: > Dear Markus, > > Thanks for looking at the problem and finding the fix. I had somehow > missed the initial report. > > I was planning on packaging the latest release. Hi Vincent, Great! Packaging the new release should be straightforward. The patch will then need a few adjustments but the principal idea should still work. Cheers, Markus signature.asc Description: OpenPGP digital signature
Bug#798699: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class
Dear Markus, Thanks for looking at the problem and finding the fix. I had somehow missed the initial report. I was planning on packaging the latest release. Cheers, Vincent On Sat, Sep 12, 2015 at 1:30 AM, Markus Koschany wrote: > Control: tags -1 patch > > Please find attached a patch that fixes the issue. The recent update of > libcommons-cli-java to version 1.3.1 introduced some changes in > OptionsBuilder.java which caused this FreeCol runtime error. In general > Freecol should move away from OptionsBuilder because this class is > deprecated. I changed the type from File to Class, and so far the game > works again. > > Markus
Bug#798699: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class
Control: tags -1 patch Please find attached a patch that fixes the issue. The recent update of libcommons-cli-java to version 1.3.1 introduced some changes in OptionsBuilder.java which caused this FreeCol runtime error. In general Freecol should move away from OptionsBuilder because this class is deprecated. I changed the type from File to Class, and so far the game works again. Markus diff -Nru freecol-0.10.7+dfsg/debian/changelog freecol-0.10.7+dfsg/debian/changelog --- freecol-0.10.7+dfsg/debian/changelog2014-12-01 21:31:35.0 +0100 +++ freecol-0.10.7+dfsg/debian/changelog2015-09-12 00:58:29.0 +0200 @@ -1,3 +1,12 @@ +freecol (0.10.7+dfsg-4) unstable; urgency=medium + + * Team upload. + * Add commons-cli-1.3.patch and fix java.lang.ClassCastException due to +deprecated and different methods in libcommons-cli-java version 1.3.1. +Thanks to Emmanuel Fleury for the report. (Closes: #798699) + + -- Markus Koschany Sat, 12 Sep 2015 00:54:21 +0200 + freecol (0.10.7+dfsg-3) unstable; urgency=medium * Disable intro video to avoid hanging at startup (closes: #771700) diff -Nru freecol-0.10.7+dfsg/debian/patches/commons-cli-1.3.patch freecol-0.10.7+dfsg/debian/patches/commons-cli-1.3.patch --- freecol-0.10.7+dfsg/debian/patches/commons-cli-1.3.patch1970-01-01 01:00:00.0 +0100 +++ freecol-0.10.7+dfsg/debian/patches/commons-cli-1.3.patch2015-09-12 00:58:29.0 +0200 @@ -0,0 +1,29 @@ +From: Markus Koschany +Date: Sat, 12 Sep 2015 00:53:37 +0200 +Subject: commons cli 1.3 + +--- + src/net/sf/freecol/FreeCol.java | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/net/sf/freecol/FreeCol.java b/src/net/sf/freecol/FreeCol.java +index 3cdf52e..a973298 100644 +--- a/src/net/sf/freecol/FreeCol.java b/src/net/sf/freecol/FreeCol.java +@@ -299,6 +299,7 @@ public final class FreeCol { + private static void handleArgs(String[] args) { + // create the command line parser + CommandLineParser parser = new PosixParser(); ++final Class dummy = null; + + /** + * Ugly hack: try to determine language first, so that usage, +@@ -338,7 +339,7 @@ public final class FreeCol { + options.addOption(OptionBuilder.withLongOpt("home-directory") + .withDescription(Messages.message("cli.home-directory")) + .withArgName(Messages.message("cli.arg.directory")) +- .withType(new File("dummy")) ++ .withType(dummy) + .hasArg() + .create()); + options.addOption(OptionBuilder.withLongOpt("log-console") diff -Nru freecol-0.10.7+dfsg/debian/patches/series freecol-0.10.7+dfsg/debian/patches/series --- freecol-0.10.7+dfsg/debian/patches/series 2013-08-25 13:14:05.0 +0200 +++ freecol-0.10.7+dfsg/debian/patches/series 2015-09-12 00:58:29.0 +0200 @@ -1,2 +1,3 @@ 10-fix-jar-path.diff 40-manpage.diff +commons-cli-1.3.patch signature.asc Description: OpenPGP digital signature
Bug#798699: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class
Control: severity -1 grave Control: tags -1 stretch sid On Fri, 11 Sep 2015 21:04:01 +0200 Emmanuel Fleury wrote: > Package: freecol > Version: 0.10.7+dfsg-3 > Severity: important > > Just running the software leads to the following Java exception: > > $> freecol > Disabling IPV6 network stack to work around bug #560056 on openjdk > If you experience problems with connecting to remote servers, > you can put it back by running Freecol this way: > freecol --enable-ipv6 > Exception in thread "main" java.lang.ClassCastException: java.io.File > cannot be cast to java.lang.Class > at org.apache.commons.cli.OptionBuilder.withType(OptionBuilder.java:298) > at net.sf.freecol.FreeCol.handleArgs(FreeCol.java:338) > at net.sf.freecol.FreeCol.main(FreeCol.java:150) > ^C > > The process still hang afterward, I need to press Ctrl-C to stop it. Thanks for the report. This makes the package basically unusable. Raising the severity accordingly. Jessie is not affected. Regards, Markus signature.asc Description: OpenPGP digital signature
Bug#798699: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class
Control: severity -1 grave Control: tags -1 stretch sid On Fri, 11 Sep 2015 21:04:01 +0200 Emmanuel Fleury wrote: > Package: freecol > Version: 0.10.7+dfsg-3 > Severity: important > > Just running the software leads to the following Java exception: > > $> freecol > Disabling IPV6 network stack to work around bug #560056 on openjdk > If you experience problems with connecting to remote servers, > you can put it back by running Freecol this way: > freecol --enable-ipv6 > Exception in thread "main" java.lang.ClassCastException: java.io.File > cannot be cast to java.lang.Class > at org.apache.commons.cli.OptionBuilder.withType(OptionBuilder.java:298) > at net.sf.freecol.FreeCol.handleArgs(FreeCol.java:338) > at net.sf.freecol.FreeCol.main(FreeCol.java:150) > ^C > > The process still hang afterward, I need to press Ctrl-C to stop it. Thanks for the report. This makes the package basically unusable. Raising the severity accordingly. Jessie is not affected. Regards, Markus signature.asc Description: OpenPGP digital signature
Bug#798699: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class
Package: freecol Version: 0.10.7+dfsg-3 Severity: important Just running the software leads to the following Java exception: $> freecol Disabling IPV6 network stack to work around bug #560056 on openjdk If you experience problems with connecting to remote servers, you can put it back by running Freecol this way: freecol --enable-ipv6 Exception in thread "main" java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class at org.apache.commons.cli.OptionBuilder.withType(OptionBuilder.java:298) at net.sf.freecol.FreeCol.handleArgs(FreeCol.java:338) at net.sf.freecol.FreeCol.main(FreeCol.java:150) ^C The process still hang afterward, I need to press Ctrl-C to stop it. -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.1.6 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages freecol depends on: ii default-jre [java7-runtime]2:1.7-52 ii fonts-liberation 1.07.4-1 ii java-wrappers 0.1.28 ii libcommons-cli-java1.3.1-2 ii libcortado-java0.6.0-2 ii libmiglayout-java 4.2-1 ii openjdk-7-jre [java7-runtime] 7u85-2.6.1-3 ii openjdk-8-jre [java7-runtime] 8u66-b01-3 freecol recommends no packages. freecol suggests no packages. -- no debconf information signature.asc Description: OpenPGP digital signature