summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-17 12:00:13 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-17 12:03:03 +0200
commite8b79f29a66b0528ad9ba2023930d3ba23915022 (patch)
tree89c95556cb7bd77f8126de9501a5a28fc710ea50
parent01cadc8fdbc9eab94833566263e6bd0acb313c3c (diff)
fdo#54858: DocumentDigitalSignatures::initialize can be called with 0 args now
...as the new createDefault service ctor internally calls createInstanceWithArgumentsAndContext, not plain createInstance[WithContext]. Change-Id: Ia3bf8167154a4ae9d64dae271cc23d513e9e77fb
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx39
1 files changed, 21 insertions, 18 deletions
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 3325f11b112a..edf21ab11b92 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -67,29 +67,32 @@ DocumentDigitalSignatures::DocumentDigitalSignatures( const Reference< XComponen
void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments)
throw (css::uno::Exception, css::uno::RuntimeException)
{
- if (aArguments.getLength() == 0 || aArguments.getLength() > 2)
+ if (aArguments.getLength() > 2)
throw css::lang::IllegalArgumentException(
- OUSTR("DocumentDigitalSignatures::initialize requires one or two arguments"),
+ OUSTR("DocumentDigitalSignatures::initialize requires zero, one, or two arguments"),
Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 0);
m_nArgumentsCount = aArguments.getLength();
- if (!(aArguments[0] >>= m_sODFVersion))
- throw css::lang::IllegalArgumentException(
- OUSTR("DocumentDigitalSignatures::initialize: the first arguments must be a string"),
- Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 0);
-
- if (aArguments.getLength() == 2
- && !(aArguments[1] >>= m_bHasDocumentSignature))
- throw css::lang::IllegalArgumentException(
- OUSTR("DocumentDigitalSignatures::initialize: the second arguments must be a bool"),
- Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 1);
-
- //the Version is supported as of ODF1.2, so for and 1.1 document or older we will receive the
- //an empty string. In this case we set it to ODFVER_010_TEXT. Then we can later check easily
- //if initialize was called. Only then m_sODFVersion.getLength() is greater than 0
- if (m_sODFVersion.isEmpty())
- m_sODFVersion = ODFVER_010_TEXT;
+ if (aArguments.getLength() > 0)
+ {
+ if (!(aArguments[0] >>= m_sODFVersion))
+ throw css::lang::IllegalArgumentException(
+ OUSTR("DocumentDigitalSignatures::initialize: the first arguments must be a string"),
+ Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 0);
+
+ if (aArguments.getLength() == 2
+ && !(aArguments[1] >>= m_bHasDocumentSignature))
+ throw css::lang::IllegalArgumentException(
+ OUSTR("DocumentDigitalSignatures::initialize: the second arguments must be a bool"),
+ Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 1);
+
+ //the Version is supported as of ODF1.2, so for and 1.1 document or older we will receive the
+ //an empty string. In this case we set it to ODFVER_010_TEXT. Then we can later check easily
+ //if initialize was called. Only then m_sODFVersion.getLength() is greater than 0
+ if (m_sODFVersion.isEmpty())
+ m_sODFVersion = ODFVER_010_TEXT;
+ }
}
sal_Bool DocumentDigitalSignatures::signDocumentContent(