Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330895 - org.eclipse.persistence.platform.database.oracle.converters.JGeometryConverter is not thred-safe
Summary: org.eclipse.persistence.platform.database.oracle.converters.JGeometryConverte...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-23 04:31 EST by Magnus Heino CLA
Modified: 2022-06-09 10:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Heino CLA 2010-11-23 04:31:20 EST
Build Identifier: 2.1.0

The call to JGeometry.store is not thread safe, you should be using the store method that has a StructDescriptor as a parameter.

Something like:

public Struct convertToStruct(Object geometry, Connection connection) throws SQLException {
        if (geometry == null){
            return null;
        }
        StructDescriptor structDescriptor = StructDescriptor.createDescriptor(this.getStructName(), connection);

        try {
            return JGeometry.store(connection, geometry, structDescriptor);
        } catch (Exception e) {
            throw new SQLException("JGeometry.store(..) failed", e);
        }
    }

instead of the current

public Struct convertToStruct(Object geometry, Connection connection) throws SQLException {
        if (geometry == null){
            return null;
        }
        return JGeometry.store((JGeometry)geometry, connection);
    }

If you don't do this, the call to store will use a static cached StructDescriptor that, in a multithreaded app, might come from some other thread being associated some other connection.

AFAIK the new store(..) signature is available starting with oracle 10.2

Reproducible: Always
Comment 1 Tom Ware CLA 2010-12-09 09:01:39 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:24:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink