diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-11 21:13:31 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-11 21:13:31 +0200 |
commit | 1c1d29027bee64177ec3b14cb8e10df03e2ce8d2 (patch) | |
tree | e72398d04c7038fc486a3ff67a8f356eac63ef8f /jvmfwk/plugins | |
parent | 54a4121f2040bd11f3d6056767f2d7ad6c7745ac (diff) |
Assert obvious preconditions instead of returning javaPluginError:InvalidArg
Change-Id: I93bb3aaa0106bce98995f843ee036c9570f6aaf0
Diffstat (limited to 'jvmfwk/plugins')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 84e60a9cf254..d237de95451a 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -306,16 +306,12 @@ javaPluginError jfw_plugin_getAllJavaInfos( sal_Int32 *nLenInfoList, std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos) { - OSL_ASSERT(parJavaInfo); - OSL_ASSERT(nLenInfoList); - if (!parJavaInfo || !nLenInfoList) - return javaPluginError::InvalidArg; + assert(parJavaInfo); + assert(nLenInfoList); //nLenlist contains the number of elements in arExcludeList. //If no exclude list is provided then nLenList must be 0 - OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0)); - if (arExcludeList == nullptr && nLenList > 0) - return javaPluginError::InvalidArg; + assert( ! (arExcludeList == nullptr && nLenList > 0)); OSL_ASSERT(!sVendor.isEmpty()); if (sVendor.isEmpty()) @@ -371,17 +367,14 @@ javaPluginError jfw_plugin_getJavaInfoByPath( sal_Int32 nLenList, JavaInfo ** ppInfo) { - if (!ppInfo) - return javaPluginError::InvalidArg; + assert(ppInfo != nullptr); OSL_ASSERT(!sPath.isEmpty()); if (sPath.isEmpty()) return javaPluginError::InvalidArg; //nLenlist contains the number of elements in arExcludeList. //If no exclude list is provided then nLenList must be 0 - OSL_ASSERT( ! (arExcludeList == nullptr && nLenList > 0)); - if (arExcludeList == nullptr && nLenList > 0) - return javaPluginError::InvalidArg; + assert( ! (arExcludeList == nullptr && nLenList > 0)); OSL_ASSERT(!sVendor.isEmpty()); if (sVendor.isEmpty()) @@ -407,8 +400,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome( std::vector<pair<OUString, jfw::VersionInfo>> const& vecVendorInfos, JavaInfo ** ppInfo, std::vector<rtl::Reference<VendorBase>> & infos) { - if (!ppInfo) - return javaPluginError::InvalidArg; + assert(ppInfo); std::vector<rtl::Reference<VendorBase>> infoJavaHome; addJavaInfoFromJavaHome(infos, infoJavaHome); |