-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Hi,
When I deserialize AMF3 data, modify it, and then serialize it, I noticed class names in AMF3 Objects is discarded.
For example:
require 'rocketamf'⏎
amf3_object_with_classname = "\x0a\x0b\x13ClassName\x01\x01"⏎
data = RocketAMF.deserialize( amf3_object_with_classname, 3 )⏎
p data.type # => "ClassName"⏎
data = RocketAMF.deserialize( RocketAMF.serialize( data, 3 ), 3 )⏎
p data.type # => ""⏎
I expect the class name "ClassName" is kept on serialization, but RocketAMF.serialize discards the class name and it will be an empty string instead. I know it can be avoided by mapping the class names, but it would be very convenient if class names in AMF3 Object is kept out-of-the-box. Especially, a class name stored in TypedHash should be kept because TypedHash is used to store the AMF3 Object and its class name.
I hope the following spec to be passed.
diff --git a/spec/class_mapping_spec.rb b/spec/class_mapping_spec.rb
index 16ff524..1a674b7 100644
--- a/spec/class_mapping_spec.rb
+++ b/spec/class_mapping_spec.rb
@@ -25,6 +25,10 @@ describe RocketAMF::ClassMapping do
@mapper.get_as_class_name('BadClass').should be_nil
end
+ it "should return the same AS class as of TypedHash" do
+ @mapper.get_as_class_name(RocketAMF::Values::TypedHash.new("UnmappedClass")).should == 'UnmappedClass'
+ end
+
it "should instantiate a ruby class" do
@mapper.get_ruby_obj('ASClass').should be_a(ClassMappingTest)
end
Regards,
Metadata
Metadata
Assignees
Labels
No labels