diff Lib/IMPL/Serialization.pm @ 202:5146e17a7b76

IMPL::Web::Application::RestResource fixes, documentation
author sergey
date Wed, 25 Apr 2012 02:49:23 +0400
parents e743a8481327
children f534a60d5b01
line wrap: on
line diff
--- a/Lib/IMPL/Serialization.pm	Tue Apr 24 19:52:07 2012 +0400
+++ b/Lib/IMPL/Serialization.pm	Wed Apr 25 02:49:23 2012 +0400
@@ -242,7 +242,7 @@
       return 1;
     }
     
-    my $refObj = $this->{$ObjectFactory} ?$this->{$ObjectFactory}->($rhObject->{'Type'},$rhObject->{'Data'},$rhObject->{'Id'} ? $this->{$Context}->{$rhObject->{'Id'}} : undef) : DefaultFactory($rhObject->{'Type'},$rhObject->{'Data'} || [],$rhObject->{'Id'} ? $this->{$Context}->{$rhObject->{'Id'}} : undef);
+    my $refObj = $this->{$ObjectFactory} ?$this->{$ObjectFactory}->($rhObject->{'Type'},$rhObject->{'Data'},$rhObject->{'Id'} ? $this->{$Context}->{$rhObject->{'Id'}} : undef) : DefaultFactory($rhObject->{'Type'},$rhObject->{'Data'},$rhObject->{'Id'} ? $this->{$Context}->{$rhObject->{'Id'}} : undef);
       
     die new Exception("Trying to close a non existing oject") if not $rhObject;
   
@@ -329,6 +329,7 @@
       return \$Data;
     }
   } elsif ($Type eq 'ARRAY') {
+  	$Data ||= [];
     die new Exception("Invalid a deserialization context when deserializing ARRAY") if not ref $Data and defined $Data;
     if (not ref $refSurogate) {
       my @Array;
@@ -339,6 +340,7 @@
     }
     return $refSurogate;
   } elsif ($Type eq 'HASH') {
+  	$Data ||= [];
     die new Exception("Invalid a deserialization context when deserializing HASH") if not ref $Data and defined $Data;
     if (not ref $refSurogate) {
       $refSurogate = {};
@@ -348,6 +350,7 @@
     }
     return $refSurogate;
   } elsif ($Type eq 'REF') {
+  	$Data ||= [];
     die new Exception("Invalid a deserialization context when deserializing REF") if not ref $Data and defined $Data;
     if (not ref $refSurogate) {
       my $ref = $Data->[1];