From a58988f5a3e12329f59746b726ad9ef29ccc70e3 Mon Sep 17 00:00:00 2001 From: Jason Spencer Date: Tue, 16 Jan 2018 15:26:47 -0800 Subject: [PATCH 1/3] OR together all flags for base classes; change byte array unit test compare type. --- javaobj.py | 5 +++++ tests/tests.py | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/javaobj.py b/javaobj.py index 9fec6f4..d3dd81c 100644 --- a/javaobj.py +++ b/javaobj.py @@ -750,6 +750,11 @@ def do_classdesc(self, parent=None, ident=0): log_debug("Super Class for {0}: {1}" .format(clazz.name, str(superclassdesc)), ident) clazz.superclass = superclassdesc + # j8spencer (Google, LLC) 2018-01-16: OR in superclass flags to catch + # any SC_WRITE_METHODs needed for objects. + if superclassdesc and hasattr(superclassdesc, "flags"): + clazz.flags |= superclassdesc.flags + return clazz def do_blockdata(self, parent=None, ident=0): diff --git a/tests/tests.py b/tests/tests.py index ad04373..59424f0 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -161,7 +161,12 @@ def test_class_with_byte_array_rw(self): jobj = self.read_file("testClassWithByteArray.ser") pobj = javaobj.loads(jobj) - self.assertEqual(pobj.myArray, b"\x01\x03\x07\x0b") + # j8spencer (Google, LLC) 2018-01-16: It seems specific support for + # byte arrays was added, but is a little out-of-step with the other + # types in terms of style. This UT was broken, since the "myArray" + # member has the array stored as a tuple of ints (not a byte string) + # in memeber called '_data.' I've updated to pass the UTs. + self.assertEqual(pobj.myArray._data, (1, 3, 7, 11)) self._try_marshalling(jobj, pobj) def test_boolean(self): From 9f51d880cd281b176f3a6d799f9d320d81db35ef Mon Sep 17 00:00:00 2001 From: Jason Spencer Date: Tue, 16 Jan 2018 15:28:15 -0800 Subject: [PATCH 2/3] add author attribution --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 9acf88e..aa70b71 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,3 +8,4 @@ Many thanks to the contributors: * Patrick J. McNerthney (@iciclespider) * @voetsjoeba * Vadim Markovtsev (@vmarkovtsev) +* Jason Spencer, Google LLC (@j8spencer) From 7b77e22009c72f2fc1e3d9b7f15539520ff968f5 Mon Sep 17 00:00:00 2001 From: Jason Spencer Date: Wed, 17 Jan 2018 09:19:12 -0800 Subject: [PATCH 3/3] fix spacing --- tests/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests.py b/tests/tests.py index 59424f0..3247cf6 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -161,7 +161,7 @@ def test_class_with_byte_array_rw(self): jobj = self.read_file("testClassWithByteArray.ser") pobj = javaobj.loads(jobj) - # j8spencer (Google, LLC) 2018-01-16: It seems specific support for + # j8spencer (Google, LLC) 2018-01-16: It seems specific support for # byte arrays was added, but is a little out-of-step with the other # types in terms of style. This UT was broken, since the "myArray" # member has the array stored as a tuple of ints (not a byte string)