@@ -291,16 +291,22 @@ def _read_content(self, type_code, block_data, class_desc=None):
291291 raise ValueError ("Got a block data, but not allowed here." )
292292
293293 try :
294+ # Look for a handler for that type code
294295 handler = self .__type_code_handlers [type_code ]
295296 except KeyError :
296- """Looking for an external reader"""
297+ # Look for an external reader
297298 if class_desc and class_desc .data_type == ClassDataType .WRCLASS :
299+ # Return its result immediately
298300 return self ._custom_readObject (class_desc .name )
301+
302+ # No valid custom reader: abandon
299303 raise ValueError ("Unknown type code: 0x{0:x}" .format (type_code ))
300304 else :
301305 try :
306+ # Parse the object
302307 return handler (type_code )
303308 except ExceptionRead as ex :
309+ # We found an exception object: return it (raise later)
304310 return ex .exception_object
305311
306312 def _read_new_string (self , type_code ):
@@ -422,13 +428,22 @@ def _do_classdesc(self, type_code):
422428 raise ValueError ("Expected a valid class description starter" )
423429
424430 def _custom_readObject (self , class_name ):
431+ # type: (str) -> ParsedJavaContent
432+ """
433+ Reads an object with a custom serialization process
434+
435+ :param class_name: Name of the class to load
436+ :return: The parsed object
437+ :raise ValueError: Unknown kind of class
438+ """
425439 self .__fd .seek (- 1 , os .SEEK_CUR )
426440 for transformer in self .__transformers :
427441 class_data = transformer .load_custom_writeObject (
428442 self , self .__reader , class_name
429443 )
430444 if class_data :
431445 return class_data
446+
432447 raise ValueError ("Custom readObject can not be processed" )
433448
434449 def _read_class_annotations (self , class_desc = None ):
@@ -446,13 +461,17 @@ def _read_class_annotations(self, class_desc=None):
446461 # Reset references
447462 self ._reset ()
448463 continue
464+
449465 java_object = self ._read_content (type_code , True , class_desc )
450466
451467 if java_object is not None and java_object .is_exception :
468+ # Found an exception: raise it
452469 raise ExceptionRead (java_object )
453470
454471 contents .append (java_object )
455472
473+ raise Exception ("Class annotation reading stopped before end" )
474+
456475 def _create_instance (self , class_desc ):
457476 # type: (JavaClassDesc) -> JavaInstance
458477 """
0 commit comments