Assert obvious preconditions instead of returning javaPluginError:InvalidArg

Change-Id: I93bb3aaa0106bce98995f843ee036c9570f6aaf0
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index 6bae637..d4febd7 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 84e60a9..d237de9 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);