Bug#798699: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.Class

Markus Koschany apo at gambaru.de
Fri Sep 11 23:30:44 UTC 2015


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
-------------- next part --------------
diff -Nru freecol-0.10.7+dfsg/debian/changelog freecol-0.10.7+dfsg/debian/changelog
--- freecol-0.10.7+dfsg/debian/changelog	2014-12-01 21:31:35.000000000 +0100
+++ freecol-0.10.7+dfsg/debian/changelog	2015-09-12 00:58:29.000000000 +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 <apo at gambaru.de>  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.patch	1970-01-01 01:00:00.000000000 +0100
+++ freecol-0.10.7+dfsg/debian/patches/commons-cli-1.3.patch	2015-09-12 00:58:29.000000000 +0200
@@ -0,0 +1,29 @@
+From: Markus Koschany <apo at gambaru.de>
+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.000000000 +0200
+++ freecol-0.10.7+dfsg/debian/patches/series	2015-09-12 00:58:29.000000000 +0200
@@ -1,2 +1,3 @@
 10-fix-jar-path.diff
 40-manpage.diff
+commons-cli-1.3.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20150912/c00bbb87/attachment-0001.sig>


More information about the Pkg-games-devel mailing list