Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 659 by mario.fu...@gmail.com: Use of Class.forName without specifying the ClassLoader is not OSGi friendly
http://code.google.com/p/protobuf/issues/detail?id=659

This statement http://code.google.com/p/protobuf/source/browse/trunk/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java#920 can cause a ClassNotFoundException when deserializing a protobuf message in an OSGi environment.

More in general, using Class.forName without specifying the ClassLoader is not OSGi friendly. Replacing that statement with the following one is enough to fix this problem.

Class messageClass = Class.forName(messageClassName, true, Thread.currentThread().getContextClassLoader());

Nevertheless it would be even better if it was possible to pass to protobuf a specific ClassLoader when performing a deserialization.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to