diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-14 12:23:04 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-10-14 12:30:57 +0200 |
commit | 43cbaac5b96897295e3e97d2677e9087dc0fa11c (patch) | |
tree | 6668773c4119a0b98a122efa9a792cc59a4fd1f1 /scripting | |
parent | 62289290415ae46800d703352e87c5b8f7807552 (diff) |
cid#1326361 Data race condition
Change-Id: Ia61737232d816bb05f3aedbe76e7905262906a79
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/container/ParcelContainer.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java index 68db1cfe964c..ddbd46080198 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java @@ -58,14 +58,14 @@ import java.util.StringTokenizer; */ public class ParcelContainer implements XNameAccess { + protected static XSimpleFileAccess m_xSFA; + protected String language; protected String containerUrl; private Collection<Parcel> parcels = new ArrayList<Parcel>(10); - protected static XSimpleFileAccess m_xSFA; protected XComponentContext m_xCtx; private ParcelContainer parent = null; - private final Collection<ParcelContainer> childContainers = new - ArrayList<ParcelContainer>(10); + private final Collection<ParcelContainer> childContainers = new ArrayList<ParcelContainer>(10); private boolean isPkgContainer = false; /** @@ -276,22 +276,24 @@ public class ParcelContainer implements XNameAccess { return this.containerUrl; } - private synchronized void initSimpleFileAccess() { - if (m_xSFA != null) { - return; - } + private void initSimpleFileAccess() { + synchronized (ParcelContainer.class) { + if (m_xSFA != null) { + return; + } - try { + try { - m_xSFA = UnoRuntime.queryInterface( - XSimpleFileAccess.class, - m_xCtx.getServiceManager().createInstanceWithContext( - "com.sun.star.ucb.SimpleFileAccess", m_xCtx)); + m_xSFA = UnoRuntime.queryInterface( + XSimpleFileAccess.class, + m_xCtx.getServiceManager().createInstanceWithContext( + "com.sun.star.ucb.SimpleFileAccess", m_xCtx)); - } catch (Exception e) { - // TODO should throw - LogUtils.DEBUG("Error instantiating simplefile access "); - LogUtils.DEBUG(LogUtils.getTrace(e)); + } catch (Exception e) { + // TODO should throw + LogUtils.DEBUG("Error instantiating simplefile access "); + LogUtils.DEBUG(LogUtils.getTrace(e)); + } } } |