Serialization of empty vector over a socket

Bryce McKinlay bryce@waitaki.otago.ac.nz
Thu Jul 25 20:31:00 GMT 2002


Mark Wielaard wrote:

>Linking with -static shows a completely different problem then you
>have. The SHA implementation class is not linked with the program since
>it is only referenced indirectly through Class.forName(String). I made a
>patch for the Gnu security provider 
>  
>
>     // Message Digests
>-    put("MessageDigest.SHA", "gnu.java.security.provider.SHA");
>-    put("MessageDigest.MD5", "gnu.java.security.provider.MD5");
>+    put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName());
>+    put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName());
>

Its worth considering a side-effect of this change: All of the Gnu 
provider's cryptography classes will now be initialized upon creation of 
the provider, which will increase memory consumption and startup time 
slightly. In this case it probibly isn't significant enough to worry 
about, but in general I'm not a fan of these hacks to support static 
linking. We need to come up with a real, general solution (such as 
runtime feedback of used classes) rather than putting these workarounds 
everywhere.

regards

Bryce.




More information about the Java mailing list