Hi Janak I'm sorry, I should have been more precise with my question.
Regards, Etienne -----Original Message----- From: Janak Mulani [mailto:[EMAIL PROTECTED] Sent: Friday, November 03, 2006 7:49 PM To: Etienne Studer Cc: [email protected] Subject: RE: [ULC-developer] Anything.fromObject(value); Hi Etienne, I took serialization of classes like String, Long, etc. as given i.e. the basic types are supported. stream.writeObject(value), after discounting basic types, ultimately searches the registry for a coder. Thanks and regards, Janak >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] Behalf Of Etienne Studer >Sent: Saturday, November 04, 2006 2:18 AM >To: [EMAIL PROTECTED] Com >Subject: RE: [ULC-developer] Anything.fromObject(value); > > >Hi Janak > >Thanks for your quick suggestion! > >I had to modify the code a bit to make it work for String, Long, etc. >as well. See below. > >String providerClassname = >DevelopmentRunner.getServerRegistryProviderClassName(); >CoderRegistry registry = >ServerCoderRegistryProviderFactory.createCoderRegistryProvider(provider >C >lassname).getCoderRegistry(); >UlcObjectOutputStream stream = new UlcObjectOutputStream(new >UlcDataOutputStream(new ByteArrayOutputStream(8)), registry); > >try { > stream.writeObject(value); >} catch (IOException ioe) { > // not serializable > >} > >Of course, I only do this during development time and not in production >;-) > >Thanks and regards, Etienne > > > >-----Original Message----- >From: Janak Mulani [mailto:[EMAIL PROTECTED] >Sent: Friday, November 03, 2006 7:43 AM >To: Etienne Studer >Cc: [email protected] >Subject: RE: [ULC-developer] Anything.fromObject(value); > >Hi Etienne, > >Basically you want to check if a class will be serialised by ULC or not. > >One solution I can think of is search the coder for the class of the >value object. > >If the coder is found it will be serialized else and error will be >thrown. > > String providerClassname = >DevelopmentRunner.getServerRegistryProviderClassName(); > CoderRegistry registry = > >ServerCoderRegistryProviderFactory.createCoderRegistryProvider(provider >C >la >ssname).getCoderRegistry(); > IStreamCoder coder = >registry.getCoder(value.getClass().getName()); > if (coder == null) { > System.err.println("Illegal class type: " + value.getClass()); > .... > } > >You can do the same for the client side registry. > >let me know if this works for you. > >In the meantime I will try to find if there is another solution. > >Thanks and regards, > >Janak > > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] Behalf Of Etienne Studer >Sent: Friday, November 03, 2006 2:20 AM >To: [email protected] >Subject: [ULC-developer] Anything.fromObject(value); > > >Hi > >How can I update the code below to run with ULC 6.1.1? > >This code is used for debugging purposes (in development runner), >detecting values to be sent to the client which are of a type not >supported for serialization. Basically, I want to get an exception if >the value is of a type that cannot be handled by any installed coder. > >try { > Anything.fromObject(value); >} catch (RuntimeException rte) { > System.err.println("Illegal class type: " + value.getClass()); } > >Thanks, Etienne > >_______________________________________________ >ULC-developer mailing list >[email protected] >http://lists.canoo.com/mailman/listinfo/ulc-developer _______________________________________________ ULC-developer mailing list [email protected] http://lists.canoo.com/mailman/listinfo/ulc-developer
