summaryrefslogtreecommitdiff
path: root/jvmfwk
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-11 21:13:31 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-11 21:13:31 +0200
commit1c1d29027bee64177ec3b14cb8e10df03e2ce8d2 (patch)
treee72398d04c7038fc486a3ff67a8f356eac63ef8f /jvmfwk
parent54a4121f2040bd11f3d6056767f2d7ad6c7745ac (diff)
Assert obvious preconditions instead of returning javaPluginError:InvalidArg
Change-Id: I93bb3aaa0106bce98995f843ee036c9570f6aaf0
Diffstat (limited to 'jvmfwk')
-rw-r--r--jvmfwk/inc/vendorplugin.hxx13
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx20
2 files changed, 8 insertions, 25 deletions
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index 6bae6370c710..d4febd726d18 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -101,9 +101,7 @@ enum class javaPluginError
@return
javaPluginError::NONE the function ran successfully.</br>
javaPluginError::Error an error occurred during execution.</br>
- javaPluginError::InvalidArg an argument was not valid. For example
- <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
- is NULL or NULL pointer were passed for at least on of the strings.</br>
+ javaPluginError::InvalidArg an argument was not valid.</br>
javaPluginError::WrongVersionFormat the version strings in
<code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
version strings.
@@ -148,9 +146,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
@return
javaPluginError::NONE the function ran successfully.</br>
javaPluginError::Error an error occurred during execution.</br>
- javaPluginError::InvalidArg an argument was not valid. For example
- <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
- is NULL, NULL pointer were passed for at least on of the strings, sLocation
+ javaPluginError::InvalidArg an argument was not valid. For example, sLocation
is an empty string.</br>
javaPluginError::WrongVersionFormat the version strings in
<code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
@@ -191,8 +187,6 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
@return
javaPluginError::NONE the function ran successfully.</br>
- javaPluginError::InvalidArg an argument was not valid, for example
- <code>ppInfo</code> is an invalid pointer.
javaPluginError::NoJre no suitable JRE could be detected at the given location. However, that
does not mean necessarily that there is no JRE. There could be a JRE but it has
a vendor which is not supported by this API implementation or it does not
@@ -283,9 +277,6 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
javaPluginError::Error an error occurred during execution.</br>
javaPluginError::WrongVendor the <code>JavaInfo</code> object was not created
in by this library and the VM cannot be started.</br>
- javaPluginError::InvalidArg an argument was not valid. For example
- <code>pInfo</code> or , <code>ppVM</code> or <code>ppEnv</code> are NULL.
- </br>
JFW_PLUGIN_E_VM_CREATION_FAILED a VM could not be created. The error was caused
by the JRE.
*/
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);