Package: src:plm Version: 2.6+repack-3 Severity: normal Tags: patch -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hi, I'd like to transition json-simple 3.1.1 to unstable, but plm is a blocker since it builds against libjson-simple-java << 3 only. The json-simple classes used by plm were deprecated in version 2.0.0 [1]. There were removed in versions 3.x [2]. [1] https://github.com/cliftonlabs/json-simple/blob/json-simple-2.0.0/README.txt [2] https://github.com/cliftonlabs/json-simple/blob/json-simple-3.0.1/CHANGELOG Please find attached a patch proposal to use the current json-simple classes. I've tested that the package builds correctly against libjson-simple-java version 2.3.0-1 from unstable and version 3.1.1-1~exp2 currently in experimental. But I don't known how to test the package afterward. Thanks in advance for considering. _g. - -- System Information: Debian Release: buster/sid Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.6.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEoJObzArDE05WtIyR7+hsbH/+z4MFAl69t9gACgkQ7+hsbH/+ z4O/Ogf/TKcl0DykVQuRlbDexYENp672j8+2ux7ztFhFNUhS/zgB30Z1hZxXtRhk QS++/PUSF0KleNtCK+d00Pjs4q9PzYrZhbyCz47fGukncjICF+wPr3cerrEy3w57 5iv5PF9B7u0Jbfjsuf5BOnRTFdCc+FvsqkB3BIg8kMmwJtSU/aAq5sJgw6VijIxU wIJ9/QNUwYvUYlWPb/NQnGXyjX55b9SRNW+VeGB9OXUkRl2qlzpdeKLqBlXi2+bZ d6Sy0p0FR88El+DyiOxFFUj9FO8iiQFrDBS2xhLcU3CknEjEctkJrX9K9fbWtMrr a7Jf8TJl5BSzHrv17bRwZkddpMXwDg== =SniR -----END PGP SIGNATURE-----
diff -Nru plm-2.6+repack/debian/changelog plm-2.6+repack/debian/changelog --- plm-2.6+repack/debian/changelog 2016-09-18 16:39:19.000000000 +0200 +++ plm-2.6+repack/debian/changelog 2020-05-14 18:05:12.000000000 +0200 @@ -1,3 +1,10 @@ +plm (2.6+repack-3.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Tentative patch to build against json-simple 3 + + -- Gilles Filippini <p...@debian.org> Thu, 14 May 2020 18:05:12 +0200 + plm (2.6+repack-3) unstable; urgency=medium * Add run-time dependencies on default-jdk, jython and jruby. diff -Nru plm-2.6+repack/debian/patches/json-simple-3.patch plm-2.6+repack/debian/patches/json-simple-3.patch --- plm-2.6+repack/debian/patches/json-simple-3.patch 1970-01-01 01:00:00.000000000 +0100 +++ plm-2.6+repack/debian/patches/json-simple-3.patch 2020-05-14 18:05:12.000000000 +0200 @@ -0,0 +1,595 @@ +Description: Migrate away from deprecated json-simple 1.x classes + See json-simple 2.0.0 changelog: + > * Deprecated JSONParse and JSONValue in favor of Jsoner. + > * Deprecated JSONStreamAware and JSONAware in favor of Jsonable. + > * Deprecated JSONObject in favor of JsonObject. + > * Deprecated JSONArray in favor of JsonArray. + . + This patch uses the new json-simple Json* classes. It is compatible with + both 2.x and 3.x json-simple releases, with a few ajustments regarding + backward incompatible changes in json-simple 3.x: + - The package name, changed to com.github.cliftonlabs.json_simple + - The exception DeserializationExcetpion renamed as JsonException + These two changes are handled using place-holders @JSON_SIMPLE_PACKAGE@ + and @JSON_EXCETPION@ which are substituted at build time by debian/rules. + . + With these tricks the package is compatible with json-simple 2.x and 3.x. +Author: Gilles Filippini <p...@debian.org> +Index: plm-2.6+repack/src/plm/core/model/Course.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/Course.java ++++ plm-2.6+repack/src/plm/core/model/Course.java +@@ -4,9 +4,9 @@ import java.io.IOException; + import java.util.ArrayList; + import java.util.Map; + +-import org.json.simple.JSONArray; +-import org.json.simple.JSONObject; +-import org.json.simple.JSONValue; ++import @JSON_SIMPLE_PACKAGE@.JsonArray; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; ++import @JSON_SIMPLE_PACKAGE@.Jsoner; + + /** + * Class to manage course data online +@@ -50,7 +50,7 @@ public abstract class Course { + * A user password is set to push data, a teacher password to administrate course + */ + public ServerAnswer create() { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + jsonObject.put("action", "new"); + jsonObject.put("course", courseId); + jsonObject.put("password", password); +@@ -72,7 +72,7 @@ public abstract class Course { + * and by exercise + */ + public String refresh() { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + jsonObject.put("action", "refresh"); + jsonObject.put("course", courseId); + jsonObject.put("teacher_password", teacherPassword); +@@ -99,7 +99,7 @@ public abstract class Course { + * removed + */ + public String delete() { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + jsonObject.put("action", "remove"); + jsonObject.put("course", courseId); + jsonObject.put("teacher_password", teacherPassword); +@@ -120,7 +120,7 @@ public abstract class Course { + public ArrayList<String> getAllCoursesId() { + String response = ""; + ArrayList<String> coursesId = new ArrayList<String>(); +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + jsonObject.put("action", "allids"); + + try { +@@ -130,7 +130,7 @@ public abstract class Course { + } + + if (response != null && !response.isEmpty()) { +- JSONArray arrayResult = (JSONArray) JSONValue.parse(response); ++ JsonArray arrayResult = Jsoner.deserialize(response, (JsonArray) null); + for (Object anArrayResult : arrayResult) { + coursesId.add((String) anArrayResult); + } +@@ -158,7 +158,7 @@ public abstract class Course { + String answer = ""; + ArrayList<String> students = new ArrayList<String>(); + +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + jsonObject.put("action", filter); + jsonObject.put("course", courseId); + jsonObject.put("teacher_password", teacherPassword); +@@ -172,7 +172,7 @@ public abstract class Course { + + try { + if (!answer.isEmpty()) { +- JSONArray arrayResult = (JSONArray) JSONValue.parse(answer); ++ JsonArray arrayResult = Jsoner.deserialize(answer, (JsonArray) null); + for (Object result : arrayResult) + students.add((String) result); + } +Index: plm-2.6+repack/src/plm/core/model/HelpAppEngine.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/HelpAppEngine.java ++++ plm-2.6+repack/src/plm/core/model/HelpAppEngine.java +@@ -8,7 +8,7 @@ import java.net.MalformedURLException; + import java.net.URL; + import java.net.URLConnection; + +-import org.json.simple.JSONObject; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; + + /** + * Implementation of HelpServer that sends requests to an App Engine server +@@ -63,7 +63,7 @@ public class HelpAppEngine extends HelpS + public void setStatus(boolean isRequestingHelp){ + super.setStatus(isRequestingHelp); + +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + jsonObject.put("username", username); + jsonObject.put("action", "help"); + jsonObject.put("course", Game.getInstance().getCourseID()); +Index: plm-2.6+repack/src/plm/core/model/ServerUserData.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/ServerUserData.java ++++ plm-2.6+repack/src/plm/core/model/ServerUserData.java +@@ -6,9 +6,9 @@ import java.util.HashMap; + import java.util.List; + import java.util.Map; + +-import org.json.simple.JSONArray; +-import org.json.simple.JSONObject; +-import org.json.simple.JSONValue; ++import @JSON_SIMPLE_PACKAGE@.JsonArray; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; ++import @JSON_SIMPLE_PACKAGE@.Jsoner; + + /** + * Class that contains the data sent by the server +@@ -78,10 +78,10 @@ public class ServerUserData { + public static Map<String, ServerUserData> parse(String answer) { + Map<String, ServerUserData> data = new HashMap<String, ServerUserData>(); + +- JSONObject dataMap = (JSONObject) JSONValue.parse(answer); ++ JsonObject dataMap = Jsoner.deserialize(answer, (JsonObject) null); + // for each user + for (Object user : dataMap.keySet()) { +- JSONObject userMap = (JSONObject) dataMap.get(user); ++ JsonObject userMap = (JsonObject) dataMap.get(user); + ServerUserData sud = new ServerUserData(); + sud.setUsername((String) userMap.get("username")); + +@@ -94,10 +94,10 @@ public class ServerUserData { + String lastLeaveString = (String)userMap.get("lastLeave"); + sud.setLastLeave(lastLeaveString == null ? null : new Date(lastLeaveString)); + +- JSONArray exercisesArray = (JSONArray) userMap.get("exercises"); ++ JsonArray exercisesArray = (JsonArray) userMap.get("exercises"); + // for each exercise done by the user + for (Object anExercisesArray : exercisesArray) { +- JSONObject exerciseMap = (JSONObject) anExercisesArray; ++ JsonObject exerciseMap = (JsonObject) anExercisesArray; + ServerExerciseData sed = new ServerExerciseData(); + sed.setName((String) exerciseMap.get("name")); + sed.setLang((String) exerciseMap.get("lang")); +Index: plm-2.6+repack/src/plm/core/model/session/SessionDB.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/session/SessionDB.java ++++ plm-2.6+repack/src/plm/core/model/session/SessionDB.java +@@ -4,9 +4,9 @@ import java.util.HashMap; + import java.util.Map; + import java.util.Set; + +-import org.json.simple.JSONObject; +-import org.json.simple.parser.JSONParser; +-import org.json.simple.parser.ParseException; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; ++import @JSON_SIMPLE_PACKAGE@.Jsoner; ++import @JSON_SIMPLE_PACKAGE@.@JSON_EXCEPTION@; + + import plm.core.lang.ProgrammingLanguage; + import plm.core.model.Game; +@@ -154,7 +154,7 @@ public class SessionDB { + + + public String lessonSummary(String lesson) { +- JSONObject result = new JSONObject(); ++ JsonObject result = new JsonObject(); + + Map<ProgrammingLanguage, Integer> possibleL = possibleExercises.get(lesson); + for (ProgrammingLanguage pl: possibleL.keySet()) +@@ -166,15 +166,14 @@ public class SessionDB { + if (passedL.get(pl)!=0) + result.put("passed"+pl.getLang(), passedL.get(pl)); + +- return result.toJSONString(); ++ return result.toJson(); + } + + public void lessonSummaryParse(String lesson, String JSONString) { +- JSONParser parser = new JSONParser(); +- JSONObject data; ++ JsonObject data; + try { +- data = (JSONObject) parser.parse(JSONString); +- } catch (ParseException e) { ++ data = (JsonObject) Jsoner.deserialize(JSONString); ++ } catch (@JSON_EXCEPTION@ e) { + System.out.println("Ignoring invalid lesson summary (parse error: "+e.getLocalizedMessage()+")."); + return; + } +Index: plm-2.6+repack/src/plm/core/model/session/ZipSessionKit.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/session/ZipSessionKit.java ++++ plm-2.6+repack/src/plm/core/model/session/ZipSessionKit.java +@@ -13,9 +13,9 @@ import java.util.zip.ZipOutputStream; + + import javax.swing.JOptionPane; + +-import org.json.simple.JSONObject; +-import org.json.simple.JSONValue; +-import org.json.simple.parser.ParseException; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; ++import @JSON_SIMPLE_PACKAGE@.Jsoner; ++import @JSON_SIMPLE_PACKAGE@.@JSON_EXCEPTION@; + + import plm.core.lang.ProgrammingLanguage; + import plm.core.model.Game; +@@ -50,15 +50,15 @@ public class ZipSessionKit implements IS + storeLesson(path, lesson); + + /* Save the per lesson summaries */ +- JSONObject allLessons = new JSONObject(); ++ JsonObject allLessons = new JsonObject(); + for (String lessonName : this.game.studentWork.getLessonsNames()) { +- JSONObject allLangs = new JSONObject(); ++ JsonObject allLangs = new JsonObject(); + for (ProgrammingLanguage lang: Game.getProgrammingLanguages()) { + int possible = Game.getInstance().studentWork.getPossibleExercises(lessonName, lang); + int passed = Game.getInstance().studentWork.getPassedExercises(lessonName, lang); + + if (possible>0) { +- JSONObject oneLang = new JSONObject(); ++ JsonObject oneLang = new JsonObject(); + oneLang.put("possible",possible); + oneLang.put("passed",passed); + allLangs.put(lang.getLang(),oneLang); +@@ -77,7 +77,7 @@ public class ZipSessionKit implements IS + zos.setLevel(Deflater.BEST_COMPRESSION); + + zos.putNextEntry(new ZipEntry("passed")); +- zos.write(allLessons.toJSONString().getBytes()); ++ zos.write(allLessons.toJson().getBytes()); + zos.closeEntry(); + } catch (IOException ex) { // FileNotFoundException or IOException + // It's ok to loose this data as it will be recomputed when the lessons are actually loaded +@@ -142,25 +142,25 @@ public class ZipSessionKit implements IS + // now parse it + Object value = null; + try { +- value = JSONValue.parseWithException(content); +- } catch (ParseException e) { ++ value = Jsoner.deserialize(content); ++ } catch (@JSON_EXCEPTION@ e) { + System.err.println("Parse error while reading the scores from disk:"); + e.printStackTrace(); + } +- if (! (value instanceof JSONObject)) { +- System.err.println("Retrieved passed-values is not a JSONObject: "+value); ++ if (! (value instanceof JsonObject)) { ++ System.err.println("Retrieved passed-values is not a JsonObject: "+value); + return; + } +- JSONObject allLessons = (JSONObject) value; ++ JsonObject allLessons = (JsonObject) value; + for (Object lessonName: allLessons.keySet()) { +- JSONObject allLangs = (JSONObject) allLessons.get(lessonName); ++ JsonObject allLangs = (JsonObject) allLessons.get(lessonName); + for (Object langName: allLangs.keySet()) { + ProgrammingLanguage lang = null; + for (ProgrammingLanguage l:Game.getProgrammingLanguages()) + if (l.getLang().equals(langName)) + lang = l; + +- JSONObject oneLang = (JSONObject) allLangs.get(langName); ++ JsonObject oneLang = (JsonObject) allLangs.get(langName); + int possible = Integer.parseInt(""+oneLang.get("possible")); + int passed = Integer.parseInt(""+oneLang.get("passed")); + Game.getInstance().studentWork.setPossibleExercises((String) lessonName, lang, possible); +Index: plm-2.6+repack/src/plm/core/model/tracking/GitSpy.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/tracking/GitSpy.java ++++ plm-2.6+repack/src/plm/core/model/tracking/GitSpy.java +@@ -10,7 +10,7 @@ import java.util.List; + import org.eclipse.jgit.api.errors.GitAPIException; + import org.eclipse.jgit.lib.NullProgressMonitor; + import org.eclipse.jgit.lib.ProgressMonitor; +-import org.json.simple.JSONObject; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; + + import plm.core.UserSwitchesListener; + import plm.core.lang.ProgrammingLanguage; +@@ -101,7 +101,7 @@ public class GitSpy implements ProgressS + createFiles(exo); + checkSuccess(exo); + +- String commitMsg = writeCommitMessage(exo, null, "executed", new JSONObject()); ++ String commitMsg = writeCommitMessage(exo, null, "executed", new JsonObject()); + String userUUID = Game.getInstance().getUsers().getCurrentUser().getUserUUIDasString(); + String userBranch = "PLM"+GitUtils.sha1(userUUID); + +@@ -122,7 +122,7 @@ public class GitSpy implements ProgressS + createFiles(lastExo); + + try { +- String commitMsg = writeCommitMessage(lastExo, exo, "switched", new JSONObject()); ++ String commitMsg = writeCommitMessage(lastExo, exo, "switched", new JsonObject()); + String userUUID = Game.getInstance().getUsers().getCurrentUser().getUserUUIDasString(); + String userBranch = "PLM"+GitUtils.sha1(userUUID); + +@@ -138,7 +138,7 @@ public class GitSpy implements ProgressS + try { + deleteFiles(exo); + +- String commitMsg = writeCommitMessage(exo, null, "reverted", new JSONObject()); ++ String commitMsg = writeCommitMessage(exo, null, "reverted", new JsonObject()); + String userUUID = Game.getInstance().getUsers().getCurrentUser().getUserUUIDasString(); + String userBranch = "PLM"+GitUtils.sha1(userUUID); + +@@ -185,7 +185,7 @@ public class GitSpy implements ProgressS + * Helper methods + */ + @SuppressWarnings("unchecked") +- private String writeCommitMessage(Exercise exoFrom, Exercise exoTo, String evt_type, JSONObject logmsg) { ++ private String writeCommitMessage(Exercise exoFrom, Exercise exoTo, String evt_type, JsonObject logmsg) { + + ExecutionProgress lastResult = exoFrom.lastResult; + +@@ -230,7 +230,7 @@ public class GitSpy implements ProgressS + */ + @SuppressWarnings("unchecked") + private String writePLMStartedOrLeavedCommitMessage(String kind) { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + + // Retrieve the feedback informations + jsonObject.put("java", System.getProperty("java.version") + " (VM: " + System.getProperty("java.vm.name") + "; version: " + System.getProperty("java.vm.version") + ")"); +@@ -363,7 +363,7 @@ public class GitSpy implements ProgressS + e.printStackTrace(); + } + +- JSONObject msg = new JSONObject(); ++ JsonObject msg = new JsonObject(); + msg.put("studentInput", studentInput); + String commitMsg = writeCommitMessage(lastExo, null, evt_type, msg); + String userUUID = Game.getInstance().getUsers().getCurrentUser().getUserUUIDasString(); +@@ -396,7 +396,7 @@ public class GitSpy implements ProgressS + e.printStackTrace(); + } + +- JSONObject msg = new JSONObject(); ++ JsonObject msg = new JsonObject(); + msg.put("id", id); + String commitMsg = writeCommitMessage(lastExo, null, "readTip", msg); + String userUUID = Game.getInstance().getUsers().getCurrentUser().getUserUUIDasString(); +Index: plm-2.6+repack/src/plm/core/model/tracking/ServerSpy.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/tracking/ServerSpy.java ++++ plm-2.6+repack/src/plm/core/model/tracking/ServerSpy.java +@@ -1,6 +1,6 @@ + package plm.core.model.tracking; + +-import org.json.simple.JSONObject; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; + + import plm.core.model.Game; + import plm.core.model.lesson.ExecutionProgress; +@@ -32,7 +32,7 @@ public abstract class ServerSpy implemen + @SuppressWarnings("unchecked") + @Override + public void executed(Exercise exo) { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + + Game game = Game.getInstance(); + ExecutionProgress lastResult = exo.lastResult; +@@ -70,7 +70,7 @@ public abstract class ServerSpy implemen + @SuppressWarnings("unchecked") + @Override + public void switched(Exercise exo) { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + + Game game = Game.getInstance(); + ExecutionProgress lastResult = exo.lastResult; +@@ -88,7 +88,7 @@ public abstract class ServerSpy implemen + @SuppressWarnings("unchecked") + @Override + public void reverted(Exercise exo) { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + + Game game = Game.getInstance(); + ExecutionProgress lastResult = exo.lastResult; +@@ -109,7 +109,7 @@ public abstract class ServerSpy implemen + @SuppressWarnings("unchecked") + @Override + public void heartbeat() { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + Game game = Game.getInstance(); + jsonObject.put("username", username); + jsonObject.put("action", "heartbeat"); +@@ -122,7 +122,7 @@ public abstract class ServerSpy implemen + @SuppressWarnings("unchecked") + @Override + public String join() { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + Game game = Game.getInstance(); + jsonObject.put("username", username); + jsonObject.put("action", "join"); +@@ -135,7 +135,7 @@ public abstract class ServerSpy implemen + @SuppressWarnings("unchecked") + @Override + public void leave() { +- JSONObject jsonObject = new JSONObject(); ++ JsonObject jsonObject = new JsonObject(); + Game game = Game.getInstance(); + jsonObject.put("username", username); + jsonObject.put("action", "leave"); +Index: plm-2.6+repack/src/plm/core/model/User.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/User.java ++++ plm-2.6+repack/src/plm/core/model/User.java +@@ -6,10 +6,10 @@ import java.util.LinkedHashMap; + import java.util.Objects; + import java.util.UUID; + +-import org.json.simple.JSONStreamAware; +-import org.json.simple.JSONValue; ++import @JSON_SIMPLE_PACKAGE@.Jsonable; ++import @JSON_SIMPLE_PACKAGE@.Jsoner; + +-public class User implements JSONStreamAware { ++public class User implements Jsonable { + private String username; + private boolean lastUsed; + private UUID userUUID; +@@ -27,12 +27,16 @@ public class User implements JSONStreamA + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) +- public void writeJSONString(Writer out) throws IOException { ++ public void toJson(Writer out) throws IOException { + LinkedHashMap obj = new LinkedHashMap(); + obj.put("username", username); + obj.put("lastUsed", lastUsed); + obj.put("userUUID", String.valueOf(userUUID)); +- JSONValue.writeJSONString(obj, out); ++ Jsoner.serialize(obj, out); ++ } ++ ++ public String toJson() { ++ return toString(); + } + + @Override +Index: plm-2.6+repack/src/plm/core/model/Users.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/model/Users.java ++++ plm-2.6+repack/src/plm/core/model/Users.java +@@ -15,10 +15,10 @@ import java.util.Map; + import java.util.UUID; + import java.util.Vector; + +-import org.json.simple.JSONArray; +-import org.json.simple.parser.ContainerFactory; +-import org.json.simple.parser.JSONParser; +-import org.json.simple.parser.ParseException; ++import @JSON_SIMPLE_PACKAGE@.JsonArray; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; ++import @JSON_SIMPLE_PACKAGE@.Jsoner; ++import @JSON_SIMPLE_PACKAGE@.@JSON_EXCEPTION@; + + import plm.core.UserSwitchesListener; + import plm.core.utils.FileUtils; +@@ -174,42 +174,32 @@ public class Users { + System.err.println(Game.i18n.tr("A new PLM user has been created for you!")); + System.err.println(user); + } else { +- JSONParser parser = new JSONParser(); +- ContainerFactory containerFactory = new ContainerFactory() { +- public List creatArrayContainer() { +- return new LinkedList(); +- } +- +- public Map createObjectContainer() { +- return new LinkedHashMap(); +- } +- }; + try { +- List json = (List) parser.parse(new FileReader(userDBFile), containerFactory); ++ JsonArray json = Jsoner.deserializeMany(new FileReader(userDBFile)); + Iterator iter = json.iterator(); + + while (iter.hasNext()) { +- LinkedHashMap entry = (LinkedHashMap) iter.next(); ++ JsonObject entry = (JsonObject) iter.next(); + String username = (String) entry.get("username"); + boolean lastUsed = (Boolean) entry.get("lastUsed"); + UUID userUUID = UUID.fromString((String) entry.get("userUUID")); + usersList.add(new User(username, lastUsed, userUUID)); + } + +- } catch (ParseException | IOException pe) { ++ } catch (@JSON_EXCEPTION@ | IOException pe) { + System.out.println(pe); + } + } + } + + /** +- * Write the ArrayList of User in the JSONArray users. Doing so means that we update the plm.users file with the ++ * Write the ArrayList of User in the JsonArray users. Doing so means that we update the plm.users file with the + * latest changes. This method should always be called after using a Setter from User. + */ + @SuppressWarnings("unchecked") + public void flushUsersToFile() { + FileWriter fwUser; +- JSONArray users = new JSONArray(); ++ JsonArray users = new JsonArray(); + + try { + fwUser = new FileWriter(userDBFile); +@@ -220,7 +210,7 @@ public class Users { + } + + StringWriter out = new StringWriter(); +- users.writeJSONString(out); ++ users.toJson(out); + // System.out.println(out.toString()); + + bwUser.write(out.toString()); +Index: plm-2.6+repack/src/plm/core/ui/action/HelpMe.java +=================================================================== +--- plm-2.6+repack.orig/src/plm/core/ui/action/HelpMe.java ++++ plm-2.6+repack/src/plm/core/ui/action/HelpMe.java +@@ -19,9 +19,9 @@ import javax.swing.ImageIcon; + import javax.swing.JOptionPane; + import javax.swing.JToggleButton; + +-import org.json.simple.JSONValue; +-import org.json.simple.parser.JSONParser; +-import org.json.simple.parser.ParseException; ++import @JSON_SIMPLE_PACKAGE@.JsonObject; ++import @JSON_SIMPLE_PACKAGE@.Jsoner; ++import @JSON_SIMPLE_PACKAGE@.@JSON_EXCEPTION@; + import org.xnap.commons.i18n.I18n; + import org.xnap.commons.i18n.I18nFactory; + +@@ -49,7 +49,7 @@ public class HelpMe extends AbstractGame + public void actionPerformed(ActionEvent e) { + isRequestingHelp = !isRequestingHelp; + +- LinkedHashMap<String,String> obj = new LinkedHashMap<String,String>(); ++ JsonObject obj = new JsonObject(); + obj.put("uuid", Game.getInstance().getUsers().getCurrentUser().getUserUUIDasString()); + try { + obj.put("hostname", InetAddress.getLocalHost().getHostName()); +@@ -81,7 +81,7 @@ public class HelpMe extends AbstractGame + if (!isRequestingHelp) { + obj.put("callID", lastCallID + ""); + } +- String payload = JSONValue.toJSONString(obj); ++ String payload = obj.toJson(); + String urlStr = Game.getProperty("plm.play.server.url") + "callHelp"; + + String line; +@@ -106,8 +106,7 @@ public class HelpMe extends AbstractGame + br.close(); + connection.disconnect(); + +- JSONParser parser = new JSONParser(); +- Object objResponse = parser.parse(jsonString.toString()); ++ Object objResponse = Jsoner.deserialize(jsonString.toString()); + @SuppressWarnings("unchecked") + Map<String,String> map = (Map<String,String>) objResponse; + +@@ -138,7 +137,7 @@ public class HelpMe extends AbstractGame + break; + } + +- } catch (IOException | ParseException ex) { ++ } catch (IOException | @JSON_EXCEPTION@ ex) { + isRequestingHelp = false; + ((JToggleButton) e.getSource()).setText(isRequestingHelp ? i18n.tr("Cancel call") : i18n.tr("Call for Help")); + ((JToggleButton) e.getSource()).setIcon(ResourcesCache.getIcon("img/btn-alert-" + (isRequestingHelp ? "on" : "off") + ".png")); diff -Nru plm-2.6+repack/debian/patches/series plm-2.6+repack/debian/patches/series --- plm-2.6+repack/debian/patches/series 2016-09-18 16:39:19.000000000 +0200 +++ plm-2.6+repack/debian/patches/series 2020-05-14 18:05:12.000000000 +0200 @@ -1,3 +1,4 @@ system-ant-tasks no-github jython-fixes +json-simple-3.patch diff -Nru plm-2.6+repack/debian/rules plm-2.6+repack/debian/rules --- plm-2.6+repack/debian/rules 2016-09-18 16:39:19.000000000 +0200 +++ plm-2.6+repack/debian/rules 2020-05-14 18:05:12.000000000 +0200 @@ -13,9 +13,32 @@ httppath=/usr/share/java/httpclient.jar:/usr/share/java/httpcore.jar:/usr/share/java/commons-logging.jar:/usr/share/java/httpmime.jar export CLASSPATH=$(depspath):$(gitpath):$(langpath):$(httppath):$(scalapath):. +JSON_SIMPLE_VERSION = $(shell dpkg -l libjson-simple-java | grep '^ii' | awk '{print $$3}') +JSON_SIMPLE_3 = $(shell dpkg --compare-versions '$(JSON_SIMPLE_VERSION)' '>' '3.1.1-1~' && echo yes || echo no) +ifeq (yes,$(JSON_SIMPLE_3)) +JSON_SIMPLE_PACKAGE = com.github.cliftonlabs.json_simple +JSON_EXCEPTION = JsonException +else +JSON_SIMPLE_PACKAGE = org.json.simple +JSON_EXCEPTION = DeserializationException +endif + %: dh $@ --with javahelper --with quilt +override_dh_auto_clean: + dh_auto_clean + find . -type f -name \*.java.json-simple \ + -exec sh -c 'file={} && mv $$file $${file%.json-simple}' \; -print + +override_dh_auto_build: + find . -type f -name \*.java -exec grep -q 'import @JSON_SIMPLE_PACKAGE@' {} \; \ + -exec sed -i.json-simple \ + -e 's,@JSON_SIMPLE_PACKAGE@,$(JSON_SIMPLE_PACKAGE),' \ + -e 's/@JSON_EXCEPTION@/$(JSON_EXCEPTION)/' \ + {} \; -print + dh_auto_build + override_dh_auto_install: dh_install