Issue 32546

Summary: Java UnoRuntime.getUniqueKey/generateOid do not work reliably
Product: udk Reporter: Stephan Bergmann <stephan.bergmann.secondary>
Component: codeAssignee: AOO issues mailing list <issues>
Status: CLOSED FIXED QA Contact:
Severity: Major    
Priority: P2 CC: damjan, issues
Version: 680m49   
Target Milestone: AOO PleaseHelp   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: 4.1.3
Developer Difficulty: ---

Description Stephan Bergmann 2004-08-04 10:11:29 UTC
The two functions use hashCode to compute unique values, which does not work
(esp. as Sun's HotSpot JVM uses random numbers for Object.hashCode).  A better
approach for getUniqueKey might be Java 1.5's java.util.UUID, a better approach
for generateOid might be similar to getThreadId's WeakHashMap in
jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory.java 1.3.58.1.
Comment 1 Stephan Bergmann 2004-08-04 10:12:01 UTC
accepted
Comment 2 Marcus 2017-05-20 11:30:06 UTC
Reset assigne to the default "issues@openoffice.apache.org".
Comment 3 damjan 2017-08-20 02:42:14 UTC
Definitely not a "Minor" issue. This can still be reproduced even with modest use of the Java UNO bridge: objects returned from Java to C++ change identity, and future method calls are routed to the wrong objects!!! This can have potentially serious consequences.

Stephan any further thoughts on your WeakHashMap idea?
Comment 4 damjan 2017-08-20 06:32:20 UTC
Implemented the WeakHashMap of UUIDs:

"damjan" committed SVN revision 1805538 into trunk:
#i32564# - Java UnoRuntime.getUniqueKey/generateOid do not work reliably

Resolving fixed. Thank you.