[Libreoffice-commits] core.git: unoidl/source
Stephan Bergmann
sbergman at redhat.com
Tue Jul 9 10:48:50 PDT 2013
unoidl/source/legacyprovider.cxx | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
New commits:
commit 87bad231d6f81c611ba145aea483a568623ca42e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jul 9 19:48:21 2013 +0200
fdo#65589: Treat legacy types.rdb w/o /UCR key as empty
...as they are encountered in the wild.
Change-Id: Iae46d3b4b4aca18a09680caabc0e343f8a534989
diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx
index e78dfe5..b92302d 100644
--- a/unoidl/source/legacyprovider.cxx
+++ b/unoidl/source/legacyprovider.cxx
@@ -96,16 +96,18 @@ Cursor::Cursor(
RegistryKey const & key):
manager_(manager), ucr_(ucr), key_(key), index_(0)
{
- prefix_ = key_.getName();
- if (!prefix_.endsWith("/")) {
- prefix_ += "/";
- }
- RegError e = key_.getKeyNames("", names_);
- if (e != REG_NO_ERROR) {
- throw FileFormatException(
- key_.getRegistryName(),
- ("legacy format: cannot get sub-key names of " + key_.getName()
- + ": " + OUString::number(e)));
+ if (ucr_.isValid()) {
+ prefix_ = key_.getName();
+ if (!prefix_.endsWith("/")) {
+ prefix_ += "/";
+ }
+ RegError e = key_.getKeyNames("", names_);
+ if (e != REG_NO_ERROR) {
+ throw FileFormatException(
+ key_.getRegistryName(),
+ ("legacy format: cannot get sub-key names of " + key_.getName()
+ + ": " + OUString::number(e)));
+ }
}
}
@@ -797,7 +799,11 @@ LegacyProvider::LegacyProvider(
uri, "legacy format: cannot open root key: " + OUString::number(e));
}
e = root.openKey("UCR", ucr_);
- if (e != REG_NO_ERROR) {
+ switch (e) {
+ case REG_NO_ERROR:
+ case REG_KEY_NOT_EXISTS: // such effectively empty files exist in the wild
+ break;
+ default:
throw FileFormatException(
uri, "legacy format: cannot open UCR key: " + OUString::number(e));
}
@@ -810,7 +816,9 @@ rtl::Reference< MapCursor > LegacyProvider::createRootCursor() const {
rtl::Reference< Entity > LegacyProvider::findEntity(OUString const & name)
const
{
- return readEntity(manager_, ucr_, ucr_, name.replace('.', '/'), true);
+ return ucr_.isValid()
+ ? readEntity(manager_, ucr_, ucr_, name.replace('.', '/'), true)
+ : rtl::Reference< Entity >();
}
LegacyProvider::~LegacyProvider() throw () {}
More information about the Libreoffice-commits
mailing list