[json-simple] 03/04: Fixed a test failure with Java 8 (Closes: #770317)

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Thu Nov 20 16:46:18 GMT 2014


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository json-simple.

commit 0cc335f3360c6d86418402e330479aefe89333a7
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Thu Nov 20 16:41:56 2014 +0100

    Fixed a test failure with Java 8 (Closes: #770317)
---
 debian/changelog                         |  1 +
 debian/patches/java8-compatibility.patch | 77 ++++++++++++++++++++++++++++++++
 debian/patches/series                    |  1 +
 3 files changed, 79 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index f543c5a..0ce0113 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 json-simple (1.1.1-3) UNRELEASED; urgency=medium
 
   * Team upload.
+  * Fixed a test failure with Java 8 (Closes: #770317)
   * debian/control:
     - Standards-Version updated to 3.9.6 (no changes)
     - Changed the package priority from extra to optional
diff --git a/debian/patches/java8-compatibility.patch b/debian/patches/java8-compatibility.patch
new file mode 100644
index 0000000..fee5239
--- /dev/null
+++ b/debian/patches/java8-compatibility.patch
@@ -0,0 +1,77 @@
+Description: Fix a test failure with Java 8
+Origin: backport, https://code.google.com/p/json-simple/source/detail?r=220
+--- a/src/test/java/org/json/simple/Test.java
++++ b/src/test/java/org/json/simple/Test.java
+@@ -309,22 +309,18 @@
+ 		assertEquals("[\"abc\\u0010a\\/\",123,222.123,true]",array1.toString());
+ 		
+ 		JSONObject obj1=new JSONObject();
+-		obj1.put("name","fang");
+-		obj1.put("age",new Integer(27));
+-		obj1.put("is_developer",new Boolean(true));
+-		obj1.put("weight",new Double(60.21));
+ 		obj1.put("array1",array1);
+ 		System.out.println("======obj1 with array1===========");
+ 		System.out.println(obj1);
+ 		System.out.println();
+-		assertEquals("{\"array1\":[\"abc\\u0010a\\/\",123,222.123,true],\"weight\":60.21,\"age\":27,\"name\":\"fang\",\"is_developer\":true}",obj1.toString());
++		assertEquals("{\"array1\":[\"abc\\u0010a\\/\",123,222.123,true]}",obj1.toString());
+ 		
+ 		obj1.remove("array1");
+ 		array1.add(obj1);
+ 		System.out.println("======array1 with obj1========");
+ 		System.out.println(array1);
+ 		System.out.println();
+-		assertEquals("[\"abc\\u0010a\\/\",123,222.123,true,{\"weight\":60.21,\"age\":27,\"name\":\"fang\",\"is_developer\":true}]",array1.toString());
++		assertEquals("[\"abc\\u0010a\\/\",123,222.123,true,{}]",array1.toString());
+ 	
+ 		List list = new ArrayList();
+ 		list.add("abc\u0010a/");
+@@ -336,20 +332,16 @@
+ 		System.out.println(JSONArray.toJSONString(list));
+ 		System.out.println();
+ 		assertEquals("[\"abc\\u0010a\\/\",123,222.123,true,null]",JSONArray.toJSONString(list));
+-		
++
+ 		Map map = new HashMap();
+-		map.put("name","fang");
+-		map.put("age",new Integer(27));
+-		map.put("is_developer",new Boolean(true));
+-		map.put("weight",new Double(60.21));
+ 		map.put("array1",list);
+ 		System.out.println("======map with list===========");
+ 		System.out.println(map);
+ 		System.out.println();
+-		assertEquals("{\"array1\":[\"abc\\u0010a\\/\",123,222.123,true,null],\"weight\":60.21,\"age\":27,\"name\":\"fang\",\"is_developer\":true}",JSONObject.toJSONString(map));		
++		assertEquals("{\"array1\":[\"abc\\u0010a\\/\",123,222.123,true,null]}",JSONObject.toJSONString(map));		
+ 		
+         Map m1 = new LinkedHashMap();
+-        Map m2 = new HashMap();
++        Map m2 = new LinkedHashMap();
+         List  l1 = new LinkedList();
+ 
+         m1.put("k11","v11");
+@@ -362,13 +354,13 @@
+         l1.add(m2);
+         String jsonString = JSONValue.toJSONString(l1);
+         System.out.println(jsonString);
+-        assertEquals("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\"},{\"k22\":\"v22\",\"k21\":\"v21\",\"k23\":\"v23\"}]", jsonString);
++        assertEquals("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\"},{\"k21\":\"v21\",\"k22\":\"v22\",\"k23\":\"v23\"}]", jsonString);
+     
+         StringWriter out = new StringWriter();
+         JSONValue.writeJSONString(l1, out);
+         jsonString = out.toString();
+         System.out.println(jsonString);
+-        assertEquals("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\"},{\"k22\":\"v22\",\"k21\":\"v21\",\"k23\":\"v23\"}]", jsonString);
++        assertEquals("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\"},{\"k21\":\"v21\",\"k22\":\"v22\",\"k23\":\"v23\"}]", jsonString);
+         
+         List l2 = new LinkedList();
+         Map m3 = new LinkedHashMap();
+@@ -386,6 +378,6 @@
+         JSONValue.writeJSONString(l1, out);
+         jsonString = out.toString();
+         System.out.println(jsonString);
+-        assertEquals("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\",\"k14\":{\"k31\":\"v3\",\"k32\":123.45,\"k33\":false,\"k34\":null,\"k35\":[\"vvv\",\"1.23456789123456789\",true,null]}},{\"k22\":\"v22\",\"k21\":\"v21\",\"k23\":\"v23\"}]",jsonString);
++        assertEquals("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\",\"k14\":{\"k31\":\"v3\",\"k32\":123.45,\"k33\":false,\"k34\":null,\"k35\":[\"vvv\",\"1.23456789123456789\",true,null]}},{\"k21\":\"v21\",\"k22\":\"v22\",\"k23\":\"v23\"}]",jsonString);
+     }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 4505433..44c936e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 junit-scope-test.patch
+java8-compatibility.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/json-simple.git



More information about the pkg-java-commits mailing list