commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Small, Michael" <>
Subject RE: [fileupload] DefaultFileItem.getUniqueId and multiple class l oaders
Date Wed, 28 Sep 2005 14:53:46 GMT

Thanks Alexey,

That would give us uniqueness across class loaders, and we could create the
UID just once.

To avoid creating a UID object every time a file is uploaded, in the
defaultFileItem class we would initialize a static String variable (call it
thisJvmId) with the UID method.  We would concatenate thisJvmId with the
existing static counter variable to have a unique ID across class loaders.

Although we are using the FileUpload 1.0 binary release (2003) - as yet
unmodified - we'd be happy to share our modification to defaultFileItem.  It
may save others from the strange, sporadic errors we encountered.  I'll
continue to lurk on the list to see how to best go about that.


Mike S wrote:

> Are there any suggestions as to the best way to modify the getUniqueId 
> method to return a unique ID across class loaders? We are thinking 
> along the lines of injecting a random number to concatenate with the 
> static counter in the DefaultFileItem, (or grabbing the start 
> timestamp off the jvm) to create unique names.

return new java.rmi.server.UID().toString().replace(':','-');

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message