[Git][java-team/plm][master] 3 commits: Apply the patch provided to fix #960632

Martin Quinson gitlab at salsa.debian.org
Sun May 17 14:43:58 BST 2020



Martin Quinson pushed to branch master at Debian Java Maintainers / plm


Commits:
402c61e6 by Martin Quinson at 2020-05-17T08:26:11+02:00
Apply the patch provided to fix #960632

- - - - -
dde610c4 by Martin Quinson at 2020-05-17T08:40:46+02:00
Acknoledge Gilles' patch, and update Vcs-Git: and Homepage:

- - - - -
8bf44cb7 by Martin Quinson at 2020-05-17T08:55:01+02:00
Do not hardcode Java 7 in the helper script

openjdk-7 was removed from testing and unstable since 2016-04-15 and I
guess that this package was broken for new installs since then :(

- - - - -


6 changed files:

- debian/changelog
- debian/control
- + debian/patches/json-simple-3.patch
- debian/patches/series
- debian/plm.sh
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,15 @@
+plm (2.6+repack-4) UNRELEASED; urgency=medium
+
+  [ Gilles Filippini ]
+  * Build against json-simple 2 or 3, depending on what's available.
+    (Closes: #960632).
+
+  [ Martin Quinson ]
+  * Point vcs-git to salsa, and update upstream homepage.
+  * Java 7 was hardcoded in the launcher script :(
+
+ -- Martin Quinson <mquinson at debian.org>  Sun, 17 May 2020 08:37:53 +0200
+
 plm (2.6+repack-3) unstable; urgency=medium
 
   * Add run-time dependencies on default-jdk, jython and jruby.


=====================================
debian/control
=====================================
@@ -8,9 +8,8 @@ Build-Depends-Indep: default-jdk, scala, libmiglayout-java, librsyntaxtextarea-j
   jython, libgettext-ant-tasks-java, imagemagick,
   libmockito-java
 Standards-Version: 3.9.6
-Vcs-Git: git://anonscm.debian.org/pkg-java/plm.git
-Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/plm.git
-Homepage: http://www.loria.fr/~quinson/Teaching/PLM/
+Vcs-Git: https://salsa.debian.org/java-team/plm.git
+Homepage: http://people.irisa.fr/Martin.Quinson/Teaching/PLM/
 
 Package: plm
 Architecture: all


=====================================
debian/patches/json-simple-3.patch
=====================================
@@ -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 <pini at 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 at .JsonArray;
++import @JSON_SIMPLE_PACKAGE at .JsonObject;
++import @JSON_SIMPLE_PACKAGE at .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 at .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 at .JsonArray;
++import @JSON_SIMPLE_PACKAGE at .JsonObject;
++import @JSON_SIMPLE_PACKAGE at .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 at .JsonObject;
++import @JSON_SIMPLE_PACKAGE at .Jsoner;
++import @JSON_SIMPLE_PACKAGE at .@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 at .JsonObject;
++import @JSON_SIMPLE_PACKAGE at .Jsoner;
++import @JSON_SIMPLE_PACKAGE at .@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 at .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 at .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 at .Jsonable;
++import @JSON_SIMPLE_PACKAGE at .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 at .JsonArray;
++import @JSON_SIMPLE_PACKAGE at .JsonObject;
++import @JSON_SIMPLE_PACKAGE at .Jsoner;
++import @JSON_SIMPLE_PACKAGE at .@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 at .JsonObject;
++import @JSON_SIMPLE_PACKAGE at .Jsoner;
++import @JSON_SIMPLE_PACKAGE at .@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"));


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 system-ant-tasks
 no-github
 jython-fixes
+json-simple-3.patch


=====================================
debian/plm.sh
=====================================
@@ -1,6 +1,9 @@
 #!/bin/sh
 #
 #
+
+set -e
+
 . /usr/lib/java-wrappers/java-wrappers.sh
 
 # Jython compiles java bytecode into python bytecode in advance; it needs a user-writable directory to cache it
@@ -15,7 +18,7 @@ if [ -n "$JAVA_CMD" ] && [ "x$JAVA_CMD" != x. ] ; then
 fi	
 
 # We depend on the openjdk runtime 
-find_java_runtime openjdk7
+find_java_runtime
 
 # Request jython and friends.
 # (I'd like to have it used only if found, but this does not work yet: as we build-dep on jython, jh_build adds it to the depends)


=====================================
debian/rules
=====================================
@@ -13,9 +13,32 @@ langpath=/usr/share/java/json-simple.jar:/usr/share/java/jython.jar:.
 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, at JSON_SIMPLE_PACKAGE@,$(JSON_SIMPLE_PACKAGE),' \
+		    -e 's/@JSON_EXCEPTION@/$(JSON_EXCEPTION)/' \
+		    {} \; -print
+	dh_auto_build
+
 override_dh_auto_install:
 	dh_install
 	



View it on GitLab: https://salsa.debian.org/java-team/plm/-/compare/63a002c1e3550d11c87f9c26036ee924769a1478...8bf44cb71ae16787c323f94f5ed5b5bc6e059f6a

-- 
View it on GitLab: https://salsa.debian.org/java-team/plm/-/compare/63a002c1e3550d11c87f9c26036ee924769a1478...8bf44cb71ae16787c323f94f5ed5b5bc6e059f6a
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20200517/0f6e42cf/attachment.html>


More information about the pkg-java-commits mailing list