Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
b0a7722e
Kaydet (Commit)
b0a7722e
authored
Şub 09, 2014
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
coverity#1169848 Uncaught exception
Change-Id: I27903e8b6bbf28a33601d793719ac5bcd3309db0
üst
2234f541
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
43 deletions
+53
-43
modulemanager.cxx
framework/source/services/modulemanager.cxx
+53
-43
No files found.
framework/source/services/modulemanager.cxx
Dosyayı görüntüle @
b0a7722e
...
@@ -278,55 +278,65 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName ,
...
@@ -278,55 +278,65 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName ,
css
::
lang
::
WrappedTargetException
,
css
::
lang
::
WrappedTargetException
,
css
::
uno
::
RuntimeException
)
css
::
uno
::
RuntimeException
)
{
{
::
comphelper
::
SequenceAsHashMap
lProps
(
aValue
);
try
if
(
lProps
.
empty
()
)
{
{
throw
css
::
lang
::
IllegalArgumentException
(
::
comphelper
::
SequenceAsHashMap
lProps
(
aValue
);
OUString
(
"No properties given to replace part of module."
),
if
(
lProps
.
empty
()
)
static_cast
<
cppu
::
OWeakObject
*
>
(
this
),
{
2
);
throw
css
::
lang
::
IllegalArgumentException
(
}
OUString
(
"No properties given to replace part of module."
),
static_cast
<
cppu
::
OWeakObject
*
>
(
this
),
2
);
}
// SAFE -> ----------------------------------
// SAFE -> ----------------------------------
ReadGuard
aReadLock
(
m_aLock
);
ReadGuard
aReadLock
(
m_aLock
);
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
xContext
=
m_xContext
;
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
xContext
=
m_xContext
;
aReadLock
.
unlock
();
aReadLock
.
unlock
();
// <- SAFE ----------------------------------
// <- SAFE ----------------------------------
// get access to the element
// Note: Dont use impl_getConfig() method here. Because it creates a readonly access only, further
// it cache it as a member of this module manager instance. If we change some props there ... but dont
// flush changes (because an error occurred) we will read them later. If we use a different config access
// we can close it without a flush ... and our read data wont be affected .-)
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
xCfg
=
::
comphelper
::
ConfigurationHelper
::
openConfig
(
xContext
,
OUString
(
CFGPATH_FACTORIES
),
::
comphelper
::
ConfigurationHelper
::
E_STANDARD
);
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
xModules
(
xCfg
,
css
::
uno
::
UNO_QUERY_THROW
);
css
::
uno
::
Reference
<
css
::
container
::
XNameReplace
>
xModule
;
xModules
->
getByName
(
sName
)
>>=
xModule
;
if
(
!
xModule
.
is
())
{
throw
css
::
uno
::
RuntimeException
(
OUString
(
"Was not able to get write access to the requested module entry inside configuration."
),
static_cast
<
cppu
::
OWeakObject
*
>
(
this
));
}
// get access to the element
::
comphelper
::
SequenceAsHashMap
::
const_iterator
pProp
;
// Note: Dont use impl_getConfig() method here. Because it creates a readonly access only, further
for
(
pProp
=
lProps
.
begin
();
// it cache it as a member of this module manager instance. If we change some props there ... but dont
pProp
!=
lProps
.
end
()
;
// flush changes (because an error occurred) we will read them later. If we use a different config access
++
pProp
)
// we can close it without a flush ... and our read data wont be affected .-)
{
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
xCfg
=
::
comphelper
::
ConfigurationHelper
::
openConfig
(
const
OUString
&
sPropName
=
pProp
->
first
;
xContext
,
const
css
::
uno
::
Any
&
aPropValue
=
pProp
->
second
;
OUString
(
CFGPATH_FACTORIES
),
::
comphelper
::
ConfigurationHelper
::
E_STANDARD
);
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
xModules
(
xCfg
,
css
::
uno
::
UNO_QUERY_THROW
);
css
::
uno
::
Reference
<
css
::
container
::
XNameReplace
>
xModule
;
xModules
->
getByName
(
sName
)
>>=
xModule
;
if
(
!
xModule
.
is
())
{
throw
css
::
uno
::
RuntimeException
(
OUString
(
"Was not able to get write access to the requested module entry inside configuration."
),
static_cast
<
cppu
::
OWeakObject
*
>
(
this
));
}
::
comphelper
::
SequenceAsHashMap
::
const_iterator
pProp
;
// let "NoSuchElementException" out ! We support the same API ...
for
(
pProp
=
lProps
.
begin
();
// and without a flush() at the end all changed data before will be ignored !
pProp
!=
lProps
.
end
()
;
xModule
->
replaceByName
(
sPropName
,
aPropValue
);
++
pProp
)
}
{
const
OUString
&
sPropName
=
pProp
->
first
;
const
css
::
uno
::
Any
&
aPropValue
=
pProp
->
second
;
// let "NoSuchElementException" out ! We support the same API ...
::
comphelper
::
ConfigurationHelper
::
flush
(
xCfg
);
// and without a flush() at the end all changed data before will be ignored !
}
xModule
->
replaceByName
(
sPropName
,
aPropValue
);
catch
(
const
css
::
beans
::
IllegalTypeException
&
e
)
{
css
::
uno
::
Any
a
(
e
);
throw
css
::
lang
::
WrappedTargetException
(
OUString
(
"ModuleManager::replaceByName: IllegalType exception"
),
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
(
*
this
),
a
);
}
}
::
comphelper
::
ConfigurationHelper
::
flush
(
xCfg
);
}
}
css
::
uno
::
Any
SAL_CALL
ModuleManager
::
getByName
(
const
OUString
&
sName
)
css
::
uno
::
Any
SAL_CALL
ModuleManager
::
getByName
(
const
OUString
&
sName
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment