Skip to content

Commit 87a1afd

Browse files
ggjspencertcalmant
authored andcommitted
OR together all flags for base classes; change byte array unit test compare type.
1 parent 07ca2a0 commit 87a1afd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

javaobj.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,11 @@ def do_classdesc(self, parent=None, ident=0):
750750
log_debug("Super Class for {0}: {1}"
751751
.format(clazz.name, str(superclassdesc)), ident)
752752
clazz.superclass = superclassdesc
753+
# j8spencer (Google, LLC) 2018-01-16: OR in superclass flags to catch
754+
# any SC_WRITE_METHODs needed for objects.
755+
if superclassdesc and hasattr(superclassdesc, "flags"):
756+
clazz.flags |= superclassdesc.flags
757+
753758
return clazz
754759

755760
def do_blockdata(self, parent=None, ident=0):

tests/tests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ def test_class_with_byte_array_rw(self):
161161
jobj = self.read_file("testClassWithByteArray.ser")
162162
pobj = javaobj.loads(jobj)
163163

164-
self.assertEqual(pobj.myArray, b"\x01\x03\x07\x0b")
164+
# j8spencer (Google, LLC) 2018-01-16: It seems specific support for
165+
# byte arrays was added, but is a little out-of-step with the other
166+
# types in terms of style. This UT was broken, since the "myArray"
167+
# member has the array stored as a tuple of ints (not a byte string)
168+
# in memeber called '_data.' I've updated to pass the UTs.
169+
self.assertEqual(pobj.myArray._data, (1, 3, 7, 11))
165170
self._try_marshalling(jobj, pobj)
166171

167172
def test_boolean(self):

0 commit comments

Comments
 (0)