diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-14 10:01:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-14 12:02:46 +0000 |
commit | 6abcd7fe9bf7fd3b4a1d68b1480f61e6d3651fd0 (patch) | |
tree | c61122f912434862150f28429ca8f197b46b5716 /jvmfwk | |
parent | 70d810faa876245a3d76c22c0cbc12ad62376e6d (diff) |
coverity#1247641 Uncaught exception
Change-Id: I35e1eed91a23d2b993398fb39e47e21ca9c0a055
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx index bec224ec614a..806fcf94c69d 100644 --- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx +++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx @@ -44,69 +44,67 @@ static bool findAndSelect(JavaInfo**); SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { - if( hasOption("--help",argc, argv) || hasOption("-h", argc, argv)) - { - fprintf(stdout, HELP_TEXT);// default - return 0; - } - javaFrameworkError errcode = JFW_E_NONE; - sal_Bool bEnabled = sal_False; - errcode = jfw_getEnabled( & bEnabled); - if (errcode == JFW_E_NONE && bEnabled == sal_False) - { - //Do not do any preparation because that may only slow startup time. - return 0; - } - else if (errcode != JFW_E_NONE && errcode != JFW_E_DIRECT_MODE) - { - fprintf(stderr,"javaldx failed!\n"); - return -1; - } - - - JavaInfo * pInfo = NULL; - try { - errcode = jfw_getSelectedJRE( & pInfo); - } - catch (const std::exception&) - { - fprintf(stderr,"javaldx failed!\n"); - return -1; - } + if( hasOption("--help",argc, argv) || hasOption("-h", argc, argv)) + { + fprintf(stdout, HELP_TEXT);// default + return 0; + } + javaFrameworkError errcode = JFW_E_NONE; + sal_Bool bEnabled = sal_False; + errcode = jfw_getEnabled( & bEnabled); + if (errcode == JFW_E_NONE && bEnabled == sal_False) + { + //Do not do any preparation because that may only slow startup time. + return 0; + } + else if (errcode != JFW_E_NONE && errcode != JFW_E_DIRECT_MODE) + { + fprintf(stderr,"javaldx failed!\n"); + return -1; + } - if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS) - { - fprintf(stderr,"javaldx failed!\n"); - return -1; - } + JavaInfo * pInfo = NULL; + errcode = jfw_getSelectedJRE( & pInfo); - if (pInfo == NULL) - { - if (false == findAndSelect(&pInfo)) + if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS) + { + fprintf(stderr,"javaldx failed!\n"); return -1; - } - else - { - //check if the JRE was not uninstalled - sal_Bool bExist = sal_False; - errcode = jfw_existJRE(pInfo, &bExist); - if (errcode == JFW_E_NONE) + } + + if (pInfo == NULL) { - if (!bExist && !findAndSelect(&pInfo)) + if (false == findAndSelect(&pInfo)) return -1; } else { - fprintf(stderr, "javaldx: Could not determine if JRE still exist\n"); - return -1; + //check if the JRE was not uninstalled + sal_Bool bExist = sal_False; + errcode = jfw_existJRE(pInfo, &bExist); + if (errcode == JFW_E_NONE) + { + if (!bExist && !findAndSelect(&pInfo)) + return -1; + } + else + { + fprintf(stderr, "javaldx: Could not determine if JRE still exist\n"); + return -1; + } } - } - OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData); - fprintf(stdout, "%s\n", sPaths.getStr()); - jfw_freeJavaInfo(pInfo); + OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData); + fprintf(stdout, "%s\n", sPaths.getStr()); + jfw_freeJavaInfo(pInfo); + } + catch (const std::exception&) + { + fprintf(stderr,"javaldx failed!\n"); + return -1; + } return 0; } |