xref: /trunk/main/connectivity/source/drivers/hsqldb/HStorageMap.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir #include "hsqldb/HStorageMap.hxx"
27cdf0e10cSrcweir #include <comphelper/types.hxx>
28cdf0e10cSrcweir #include <com/sun/star/embed/XTransactionBroadcaster.hpp>
29cdf0e10cSrcweir #include <com/sun/star/embed/XTransactedObject.hpp>
30cdf0e10cSrcweir #include <com/sun/star/embed/ElementModes.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
32cdf0e10cSrcweir #include "diagnose_ex.h"
33cdf0e10cSrcweir #include <osl/thread.h>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //........................................................................
36cdf0e10cSrcweir namespace connectivity
37cdf0e10cSrcweir {
38cdf0e10cSrcweir //........................................................................
39cdf0e10cSrcweir     namespace hsqldb
40cdf0e10cSrcweir     {
41cdf0e10cSrcweir     //........................................................................
42cdf0e10cSrcweir         using namespace ::com::sun::star::uno;
43cdf0e10cSrcweir         using namespace ::com::sun::star::lang;
44cdf0e10cSrcweir         using namespace ::com::sun::star::embed;
45cdf0e10cSrcweir         using namespace ::com::sun::star::io;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #define ThrowException(env, type, msg) { \
48cdf0e10cSrcweir     env->ThrowNew(env->FindClass(type), msg); }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 
StreamHelper(const Reference<XStream> & _xStream)51cdf0e10cSrcweir         StreamHelper::StreamHelper(const Reference< XStream>& _xStream)
52cdf0e10cSrcweir             : m_xStream(_xStream)
53cdf0e10cSrcweir         {
54cdf0e10cSrcweir         }
55cdf0e10cSrcweir         // -----------------------------------------------------------------------------
~StreamHelper()56cdf0e10cSrcweir         StreamHelper::~StreamHelper()
57cdf0e10cSrcweir         {
58cdf0e10cSrcweir             try
59cdf0e10cSrcweir             {
60cdf0e10cSrcweir                 m_xStream.clear();
61cdf0e10cSrcweir                 m_xSeek.clear();
62cdf0e10cSrcweir                 if ( m_xInputStream.is() )
63cdf0e10cSrcweir                 {
64cdf0e10cSrcweir                     m_xInputStream->closeInput();
65cdf0e10cSrcweir                     m_xInputStream.clear();
66cdf0e10cSrcweir                 }
67cdf0e10cSrcweir                 // this is done implicity by the closing of the input stream
68cdf0e10cSrcweir                 else if ( m_xOutputStream.is() )
69cdf0e10cSrcweir                 {
70cdf0e10cSrcweir                     m_xOutputStream->closeOutput();
71cdf0e10cSrcweir                     try
72cdf0e10cSrcweir                     {
73cdf0e10cSrcweir                         ::comphelper::disposeComponent(m_xOutputStream);
74cdf0e10cSrcweir                     }
75cdf0e10cSrcweir                     catch(DisposedException&)
76cdf0e10cSrcweir                     {
77cdf0e10cSrcweir                     }
78cdf0e10cSrcweir                     catch(const Exception& e)
79cdf0e10cSrcweir                     {
80cdf0e10cSrcweir                         OSL_UNUSED( e );
81cdf0e10cSrcweir                         OSL_ENSURE(0,"Could not dispose OutputStream");
82cdf0e10cSrcweir                     }
83cdf0e10cSrcweir                     m_xOutputStream.clear();
84cdf0e10cSrcweir                 }
85cdf0e10cSrcweir             }
86cdf0e10cSrcweir             catch(Exception& ex)
87cdf0e10cSrcweir             {
88cdf0e10cSrcweir                 OSL_UNUSED( ex );
89cdf0e10cSrcweir                 OSL_ENSURE(0,"Exception catched!");
90cdf0e10cSrcweir             }
91cdf0e10cSrcweir         }
92cdf0e10cSrcweir         // -----------------------------------------------------------------------------
getInputStream()93cdf0e10cSrcweir         Reference< XInputStream> StreamHelper::getInputStream()
94cdf0e10cSrcweir         {
95cdf0e10cSrcweir             if ( !m_xInputStream.is() )
96cdf0e10cSrcweir                 m_xInputStream = m_xStream->getInputStream();
97cdf0e10cSrcweir             return m_xInputStream;
98cdf0e10cSrcweir         }
99cdf0e10cSrcweir         // -----------------------------------------------------------------------------
getOutputStream()100cdf0e10cSrcweir         Reference< XOutputStream> StreamHelper::getOutputStream()
101cdf0e10cSrcweir         {
102cdf0e10cSrcweir             if ( !m_xOutputStream.is() )
103cdf0e10cSrcweir                 m_xOutputStream = m_xStream->getOutputStream();
104cdf0e10cSrcweir             return m_xOutputStream;
105cdf0e10cSrcweir         }
106cdf0e10cSrcweir         // -----------------------------------------------------------------------------
getSeek()107cdf0e10cSrcweir         Reference< XSeekable> StreamHelper::getSeek()
108cdf0e10cSrcweir         {
109cdf0e10cSrcweir             if ( !m_xSeek.is() )
110cdf0e10cSrcweir                 m_xSeek.set(m_xStream,UNO_QUERY);
111cdf0e10cSrcweir             return m_xSeek;
112cdf0e10cSrcweir         }
113cdf0e10cSrcweir         // -----------------------------------------------------------------------------
lcl_getStorageMap()114cdf0e10cSrcweir         TStorages& lcl_getStorageMap()
115cdf0e10cSrcweir         {
116cdf0e10cSrcweir             static TStorages s_aMap;
117cdf0e10cSrcweir             return s_aMap;
118cdf0e10cSrcweir         }
119cdf0e10cSrcweir         // -----------------------------------------------------------------------------
lcl_getNextCount()120cdf0e10cSrcweir         ::rtl::OUString lcl_getNextCount()
121cdf0e10cSrcweir         {
122cdf0e10cSrcweir             static sal_Int32 s_nCount = 0;
123cdf0e10cSrcweir             return ::rtl::OUString::valueOf(s_nCount++);
124cdf0e10cSrcweir         }
125cdf0e10cSrcweir         // -----------------------------------------------------------------------------
removeURLPrefix(const::rtl::OUString & _sURL,const::rtl::OUString & _sFileURL)126cdf0e10cSrcweir         ::rtl::OUString StorageContainer::removeURLPrefix(const ::rtl::OUString& _sURL,const ::rtl::OUString& _sFileURL)
127cdf0e10cSrcweir         {
128cdf0e10cSrcweir             return _sURL.copy(_sFileURL.getLength()+1);
129cdf0e10cSrcweir         }
130cdf0e10cSrcweir         // -----------------------------------------------------------------------------
removeOldURLPrefix(const::rtl::OUString & _sURL)131cdf0e10cSrcweir         ::rtl::OUString StorageContainer::removeOldURLPrefix(const ::rtl::OUString& _sURL)
132cdf0e10cSrcweir         {
133cdf0e10cSrcweir             ::rtl::OUString sRet = _sURL;
134cdf0e10cSrcweir #if defined(WNT)
135cdf0e10cSrcweir             sal_Int32 nIndex = sRet.lastIndexOf('\\');
136cdf0e10cSrcweir #else
137cdf0e10cSrcweir             sal_Int32 nIndex = sRet.lastIndexOf('/');
138cdf0e10cSrcweir #endif
139cdf0e10cSrcweir             if ( nIndex != -1 )
140cdf0e10cSrcweir             {
141cdf0e10cSrcweir                 sRet = _sURL.copy(nIndex+1);
142cdf0e10cSrcweir             }
143cdf0e10cSrcweir             return sRet;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         }
146cdf0e10cSrcweir         /*****************************************************************************/
147cdf0e10cSrcweir         /* convert jstring to rtl_uString */
148cdf0e10cSrcweir 
jstring2ustring(JNIEnv * env,jstring jstr)149cdf0e10cSrcweir         ::rtl::OUString StorageContainer::jstring2ustring(JNIEnv * env, jstring jstr)
150cdf0e10cSrcweir         {
151cdf0e10cSrcweir             if (JNI_FALSE != env->ExceptionCheck())
152cdf0e10cSrcweir             {
153cdf0e10cSrcweir                 env->ExceptionClear();
154cdf0e10cSrcweir                 OSL_ENSURE(0,"ExceptionClear");
155cdf0e10cSrcweir             }
156cdf0e10cSrcweir             ::rtl::OUString aStr;
157cdf0e10cSrcweir             if ( jstr )
158cdf0e10cSrcweir             {
159cdf0e10cSrcweir                 jboolean bCopy(sal_True);
160cdf0e10cSrcweir                 const jchar* pChar = env->GetStringChars(jstr,&bCopy);
161cdf0e10cSrcweir                 jsize len = env->GetStringLength(jstr);
162cdf0e10cSrcweir                 aStr = ::rtl::OUString(pChar,len);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir                 if(bCopy)
165cdf0e10cSrcweir                     env->ReleaseStringChars(jstr,pChar);
166cdf0e10cSrcweir             }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir             if (JNI_FALSE != env->ExceptionCheck())
169cdf0e10cSrcweir             {
170cdf0e10cSrcweir                 env->ExceptionClear();
171cdf0e10cSrcweir                 OSL_ENSURE(0,"ExceptionClear");
172cdf0e10cSrcweir             }
173cdf0e10cSrcweir             return aStr;
174cdf0e10cSrcweir         }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir         // -----------------------------------------------------------------------------
registerStorage(const Reference<XStorage> & _xStorage,const::rtl::OUString & _sURL)177cdf0e10cSrcweir         ::rtl::OUString StorageContainer::registerStorage(const Reference< XStorage>& _xStorage,const ::rtl::OUString& _sURL)
178cdf0e10cSrcweir         {
179cdf0e10cSrcweir             OSL_ENSURE(_xStorage.is(),"Storage is NULL!");
180cdf0e10cSrcweir             TStorages& rMap = lcl_getStorageMap();
181cdf0e10cSrcweir             // check if the storage is already in our map
182cdf0e10cSrcweir             TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
183cdf0e10cSrcweir                                         ::std::compose1(
184cdf0e10cSrcweir                                             ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage)
185cdf0e10cSrcweir                                             ,::std::compose1(::std::select1st<TStorageURLPair>(),::std::compose1(::std::select1st<TStorages::mapped_type>(),::std::select2nd<TStorages::value_type>())))
186cdf0e10cSrcweir                     );
187cdf0e10cSrcweir             if ( aFind == rMap.end() )
188cdf0e10cSrcweir             {
189cdf0e10cSrcweir                 aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(),TStorages::mapped_type(TStorageURLPair(_xStorage,_sURL),TStreamMap()))).first;
190cdf0e10cSrcweir             }
191cdf0e10cSrcweir 
192cdf0e10cSrcweir             return aFind->first;
193cdf0e10cSrcweir         }
194cdf0e10cSrcweir         // -----------------------------------------------------------------------------
getRegisteredStorage(const::rtl::OUString & _sKey)195cdf0e10cSrcweir         TStorages::mapped_type StorageContainer::getRegisteredStorage(const ::rtl::OUString& _sKey)
196cdf0e10cSrcweir         {
197cdf0e10cSrcweir             TStorages::mapped_type aRet;
198cdf0e10cSrcweir             TStorages& rMap = lcl_getStorageMap();
199cdf0e10cSrcweir             TStorages::iterator aFind = rMap.find(_sKey);
200cdf0e10cSrcweir             OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
201cdf0e10cSrcweir             if ( aFind != rMap.end() )
202cdf0e10cSrcweir                 aRet = aFind->second;
203cdf0e10cSrcweir 
204cdf0e10cSrcweir             return aRet;
205cdf0e10cSrcweir         }
206cdf0e10cSrcweir         // -----------------------------------------------------------------------------
getRegisteredKey(const Reference<XStorage> & _xStorage)207cdf0e10cSrcweir         ::rtl::OUString StorageContainer::getRegisteredKey(const Reference< XStorage>& _xStorage)
208cdf0e10cSrcweir         {
209cdf0e10cSrcweir             ::rtl::OUString sKey;
210cdf0e10cSrcweir             OSL_ENSURE(_xStorage.is(),"Storage is NULL!");
211cdf0e10cSrcweir             TStorages& rMap = lcl_getStorageMap();
212cdf0e10cSrcweir             // check if the storage is already in our map
213cdf0e10cSrcweir             TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
214cdf0e10cSrcweir                                         ::std::compose1(
215cdf0e10cSrcweir                                             ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage)
216cdf0e10cSrcweir                                             ,::std::compose1(::std::select1st<TStorageURLPair>(),::std::compose1(::std::select1st<TStorages::mapped_type>(),::std::select2nd<TStorages::value_type>())))
217cdf0e10cSrcweir                     );
218cdf0e10cSrcweir             if ( aFind != rMap.end() )
219cdf0e10cSrcweir                 sKey = aFind->first;
220cdf0e10cSrcweir             return sKey;
221cdf0e10cSrcweir         }
222cdf0e10cSrcweir         // -----------------------------------------------------------------------------
revokeStorage(const::rtl::OUString & _sKey,const Reference<XTransactionListener> & _xListener)223cdf0e10cSrcweir         void StorageContainer::revokeStorage(const ::rtl::OUString& _sKey,const Reference<XTransactionListener>& _xListener)
224cdf0e10cSrcweir         {
225cdf0e10cSrcweir             TStorages& rMap = lcl_getStorageMap();
226cdf0e10cSrcweir             TStorages::iterator aFind = rMap.find(_sKey);
227cdf0e10cSrcweir             if ( aFind != rMap.end() )
228cdf0e10cSrcweir             {
229cdf0e10cSrcweir                 try
230cdf0e10cSrcweir                 {
231cdf0e10cSrcweir                     if ( _xListener.is() )
232cdf0e10cSrcweir                     {
233cdf0e10cSrcweir                         Reference<XTransactionBroadcaster> xBroad(aFind->second.first.first,UNO_QUERY);
234cdf0e10cSrcweir                         if ( xBroad.is() )
235cdf0e10cSrcweir                             xBroad->removeTransactionListener(_xListener);
236cdf0e10cSrcweir                         Reference<XTransactedObject> xTrans(aFind->second.first.first,UNO_QUERY);
237cdf0e10cSrcweir                         if ( xTrans.is() )
238cdf0e10cSrcweir                             xTrans->commit();
239cdf0e10cSrcweir                     }
240cdf0e10cSrcweir                 }
241cdf0e10cSrcweir                 catch(Exception&)
242cdf0e10cSrcweir                 {
243cdf0e10cSrcweir                 }
244cdf0e10cSrcweir                 rMap.erase(aFind);
245cdf0e10cSrcweir             }
246cdf0e10cSrcweir         }
247cdf0e10cSrcweir         // -----------------------------------------------------------------------------
registerStream(JNIEnv * env,jstring name,jstring key,sal_Int32 _nMode)248cdf0e10cSrcweir         TStreamMap::mapped_type StorageContainer::registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode)
249cdf0e10cSrcweir         {
250cdf0e10cSrcweir             TStreamMap::mapped_type pHelper;
251cdf0e10cSrcweir             TStorages& rMap = lcl_getStorageMap();
252cdf0e10cSrcweir             ::rtl::OUString sKey = jstring2ustring(env,key);
253cdf0e10cSrcweir             TStorages::iterator aFind = rMap.find(sKey);
254cdf0e10cSrcweir             OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
255cdf0e10cSrcweir             if ( aFind != rMap.end() )
256cdf0e10cSrcweir             {
257cdf0e10cSrcweir                 TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(sKey);
258cdf0e10cSrcweir                 OSL_ENSURE(aStoragePair.first.first.is(),"No Storage available!");
259cdf0e10cSrcweir                 if ( aStoragePair.first.first.is() )
260cdf0e10cSrcweir                 {
261cdf0e10cSrcweir                     ::rtl::OUString sOrgName = StorageContainer::jstring2ustring(env,name);
262cdf0e10cSrcweir                     ::rtl::OUString sName = removeURLPrefix(sOrgName,aStoragePair.first.second);
263cdf0e10cSrcweir                     TStreamMap::iterator aStreamFind = aFind->second.second.find(sName);
264cdf0e10cSrcweir                     OSL_ENSURE( aStreamFind == aFind->second.second.end(),"A Stream was already registered for this object!");
265cdf0e10cSrcweir                     if ( aStreamFind != aFind->second.second.end() )
266cdf0e10cSrcweir                     {
267cdf0e10cSrcweir                         pHelper = aStreamFind->second;
268cdf0e10cSrcweir                     }
269cdf0e10cSrcweir                     else
270cdf0e10cSrcweir                     {
271cdf0e10cSrcweir                         try
272cdf0e10cSrcweir                         {
273cdf0e10cSrcweir                             try
274cdf0e10cSrcweir                             {
275cdf0e10cSrcweir                                 pHelper.reset(new StreamHelper(aStoragePair.first.first->openStreamElement(sName,_nMode)));
276cdf0e10cSrcweir                             }
277cdf0e10cSrcweir                             catch(Exception& )
278cdf0e10cSrcweir                             {
279cdf0e10cSrcweir                                 ::rtl::OUString sStrippedName = removeOldURLPrefix(sOrgName);
280cdf0e10cSrcweir 
281cdf0e10cSrcweir                                 if ( ((_nMode & ElementModes::WRITE) != ElementModes::WRITE ) )
282cdf0e10cSrcweir                                 {
283cdf0e10cSrcweir                                     sal_Bool bIsStream = sal_True;
284cdf0e10cSrcweir                                     try
285cdf0e10cSrcweir                                     {
286cdf0e10cSrcweir                                        bIsStream = aStoragePair.first.first->isStreamElement(sStrippedName);
287cdf0e10cSrcweir                                     }
288cdf0e10cSrcweir                                     catch(Exception& )
289cdf0e10cSrcweir                                     {
290cdf0e10cSrcweir                                         bIsStream = sal_False;
291cdf0e10cSrcweir                                     }
292cdf0e10cSrcweir                                     if ( !bIsStream )
293cdf0e10cSrcweir                                         return pHelper; // readonly file without data stream
294cdf0e10cSrcweir                                 }
295cdf0e10cSrcweir                                 pHelper.reset( new StreamHelper(aStoragePair.first.first->openStreamElement( sStrippedName, _nMode ) ) );
296cdf0e10cSrcweir                             }
297cdf0e10cSrcweir                             aFind->second.second.insert(TStreamMap::value_type(sName,pHelper));
298cdf0e10cSrcweir                         }
299cdf0e10cSrcweir                         catch(Exception& e)
300cdf0e10cSrcweir                         {
301cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
302cdf0e10cSrcweir                             ::rtl::OString sMessage( "[HSQLDB-SDBC] caught an exception while opening a stream\n" );
303cdf0e10cSrcweir                             sMessage += "Name: ";
304cdf0e10cSrcweir                             sMessage += ::rtl::OString( sName.getStr(), sName.getLength(), osl_getThreadTextEncoding() );
305cdf0e10cSrcweir                             sMessage += "\nMode: 0x";
306cdf0e10cSrcweir                             if ( _nMode < 16 )
307cdf0e10cSrcweir                                 sMessage += "0";
308cdf0e10cSrcweir                             sMessage += ::rtl::OString::valueOf( _nMode, 16 ).toAsciiUpperCase();
309cdf0e10cSrcweir                             OSL_ENSURE( false, sMessage.getStr() );
310cdf0e10cSrcweir #endif
311cdf0e10cSrcweir                             StorageContainer::throwJavaException(e,env);
312cdf0e10cSrcweir                         }
313cdf0e10cSrcweir                     }
314cdf0e10cSrcweir                 }
315cdf0e10cSrcweir             }
316cdf0e10cSrcweir             return pHelper;
317cdf0e10cSrcweir         }
318cdf0e10cSrcweir         // -----------------------------------------------------------------------------
revokeStream(JNIEnv * env,jstring name,jstring key)319cdf0e10cSrcweir         void StorageContainer::revokeStream( JNIEnv * env,jstring name, jstring key)
320cdf0e10cSrcweir         {
321cdf0e10cSrcweir             TStorages& rMap = lcl_getStorageMap();
322cdf0e10cSrcweir             TStorages::iterator aFind = rMap.find(jstring2ustring(env,key));
323cdf0e10cSrcweir             OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
324cdf0e10cSrcweir             if ( aFind != rMap.end() )
325cdf0e10cSrcweir                 aFind->second.second.erase(removeURLPrefix(jstring2ustring(env,name),aFind->second.first.second));
326cdf0e10cSrcweir         }
327cdf0e10cSrcweir         // -----------------------------------------------------------------------------
getRegisteredStream(JNIEnv * env,jstring name,jstring key)328cdf0e10cSrcweir         TStreamMap::mapped_type StorageContainer::getRegisteredStream( JNIEnv * env,jstring name, jstring key)
329cdf0e10cSrcweir         {
330cdf0e10cSrcweir             TStreamMap::mapped_type  pRet;
331cdf0e10cSrcweir             TStorages& rMap = lcl_getStorageMap();
332cdf0e10cSrcweir             TStorages::iterator aFind = rMap.find(jstring2ustring(env,key));
333cdf0e10cSrcweir             OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
334cdf0e10cSrcweir             if ( aFind != rMap.end() )
335cdf0e10cSrcweir             {
336cdf0e10cSrcweir                 TStreamMap::iterator aStreamFind = aFind->second.second.find(removeURLPrefix(jstring2ustring(env,name),aFind->second.first.second));
337cdf0e10cSrcweir                 if ( aStreamFind != aFind->second.second.end() )
338cdf0e10cSrcweir                     pRet = aStreamFind->second;
339cdf0e10cSrcweir             }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir             return pRet;
342cdf0e10cSrcweir         }
343cdf0e10cSrcweir         // -----------------------------------------------------------------------------
throwJavaException(const Exception & _aException,JNIEnv * env)344cdf0e10cSrcweir         void StorageContainer::throwJavaException(const Exception& _aException,JNIEnv * env)
345cdf0e10cSrcweir         {
346cdf0e10cSrcweir             if (JNI_FALSE != env->ExceptionCheck())
347cdf0e10cSrcweir                 env->ExceptionClear();
348cdf0e10cSrcweir             ::rtl::OString cstr( ::rtl::OUStringToOString(_aException.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
349cdf0e10cSrcweir             OSL_TRACE( __FILE__": forwarding Exception: %s", cstr.getStr() );
350cdf0e10cSrcweir             env->ThrowNew(env->FindClass("java/io/IOException"), cstr.getStr());
351cdf0e10cSrcweir         }
352cdf0e10cSrcweir     //........................................................................
353cdf0e10cSrcweir     }   // namespace hsqldb
354cdf0e10cSrcweir     //........................................................................
355cdf0e10cSrcweir //........................................................................
356cdf0e10cSrcweir }
357cdf0e10cSrcweir // namespace connectivity
358cdf0e10cSrcweir //........................................................................
359