diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-01 11:02:34 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-01 11:02:34 +0000 |
commit | 68a12b55fca0e79e51b7c10c444cd926d5ff7a33 (patch) | |
tree | e890e8181d44868f0fc0472c26e0b22cd75d40fa /lib/soap | |
parent | 86203a88aee76517c3c8862057e3315e0d479489 (diff) |
* lib/soap/mapping/{factory.rb,registry.rb}: fixed illegal mapped URI
object with soap/marshal.
added URIFactory class for URI mapping. BasetypeFactory checks
instance_variables when original mapping is not allowed (ivar must
be empty). Instance of URI have instance_variables but it must be
llowed whenever original mapping is allowed or not.
* lib/xsd/datatypes.rb: check the smallest positive non-zero
single-precision float exactly instead of packing with "f".
[ruby-talk:88822]
* lib/soap/mapping/rubytypeFactory.rb: should not dump singleton class.
[ruby-dev:22588]
c = class << Object.new; class C; self; end; end; SOAPMarshal.dump(c)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/soap')
-rw-r--r-- | lib/soap/mapping/factory.rb | 14 | ||||
-rw-r--r-- | lib/soap/mapping/registry.rb | 5 | ||||
-rw-r--r-- | lib/soap/mapping/rubytypeFactory.rb | 4 |
3 files changed, 19 insertions, 4 deletions
diff --git a/lib/soap/mapping/factory.rb b/lib/soap/mapping/factory.rb index bf68701229..fe6a6de7ae 100644 --- a/lib/soap/mapping/factory.rb +++ b/lib/soap/mapping/factory.rb @@ -220,6 +220,20 @@ class Base64Factory_ < Factory end end +class URIFactory_ < Factory + def obj2soap(soap_class, obj, info, map) + soap_obj = soap_class.new(obj) + mark_marshalled_obj(obj, soap_obj) if soap_obj + soap_obj + end + + def soap2obj(obj_class, node, info, map) + obj = node.data + mark_unmarshalled_obj(node, obj) + return true, obj + end +end + class ArrayFactory_ < Factory def initialize(allow_original_mapping = false) super() diff --git a/lib/soap/mapping/registry.rb b/lib/soap/mapping/registry.rb index 46a04e368f..8142047724 100644 --- a/lib/soap/mapping/registry.rb +++ b/lib/soap/mapping/registry.rb @@ -186,6 +186,7 @@ class Registry DateTimeFactory = DateTimeFactory_.new ArrayFactory = ArrayFactory_.new Base64Factory = Base64Factory_.new + URIFactory = URIFactory_.new TypedArrayFactory = TypedArrayFactory_.new TypedStructFactory = TypedStructFactory_.new @@ -213,7 +214,7 @@ class Registry {:derived_class => true}], [::Integer, ::SOAP::SOAPShort, BasetypeFactory, {:derived_class => true}], - [::URI::Generic, ::SOAP::SOAPAnyURI, BasetypeFactory, + [::URI::Generic, ::SOAP::SOAPAnyURI, URIFactory, {:derived_class => true}], [::String, ::SOAP::SOAPBase64, Base64Factory], [::String, ::SOAP::SOAPHexBinary, Base64Factory], @@ -259,7 +260,7 @@ class Registry {:derived_class => true}], [::Integer, ::SOAP::SOAPShort, BasetypeFactory, {:derived_class => true}], - [::URI::Generic, ::SOAP::SOAPAnyURI, BasetypeFactory, + [::URI::Generic, ::SOAP::SOAPAnyURI, URIFactory, {:derived_class => true}], [::String, ::SOAP::SOAPBase64, Base64Factory], [::String, ::SOAP::SOAPHexBinary, Base64Factory], diff --git a/lib/soap/mapping/rubytypeFactory.rb b/lib/soap/mapping/rubytypeFactory.rb index a447715add..f79bc78cc7 100644 --- a/lib/soap/mapping/rubytypeFactory.rb +++ b/lib/soap/mapping/rubytypeFactory.rb @@ -167,7 +167,7 @@ class RubytypeFactory < Factory unless @allow_original_mapping return nil end - if obj.name.empty? + if obj.to_s[0] == ?# raise TypeError.new("Can't dump anonymous class #{ obj }.") end param = SOAPStruct.new(TYPE_CLASS) @@ -178,7 +178,7 @@ class RubytypeFactory < Factory unless @allow_original_mapping return nil end - if obj.name.empty? + if obj.to_s[0] == ?# raise TypeError.new("Can't dump anonymous module #{ obj }.") end param = SOAPStruct.new(TYPE_MODULE) |