diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-15 14:43:35 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-16 08:15:48 +0200 |
commit | 973eb2f6db60c0939299a968a3121e3310e6d1f5 (patch) | |
tree | 9eece355c20bc4d930e7e58943fc2d33bedfcfd0 /odk | |
parent | fa652cdd2314f485359119a8ff081a7afd1c01b0 (diff) |
java: reduce the depth of some deeply nested if blocks
Change-Id: I3c0c7f08d4d8ea594e72fc0d9b93d085d4ab4bf5
Diffstat (limited to 'odk')
-rw-r--r-- | odk/source/com/sun/star/lib/loader/InstallationFinder.java | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/odk/source/com/sun/star/lib/loader/InstallationFinder.java b/odk/source/com/sun/star/lib/loader/InstallationFinder.java index c8894435608e..eb1c78c412b2 100644 --- a/odk/source/com/sun/star/lib/loader/InstallationFinder.java +++ b/odk/source/com/sun/star/lib/loader/InstallationFinder.java @@ -80,41 +80,46 @@ final class InstallationFinder { // com.sun.star.lib.loader.unopath // (all platforms) path = getPathFromProperty( SYSPROP_NAME ); - if ( path == null ) { - // get the installation path from the UNO_PATH environment variable - // (all platforms, not working for Java 1.3.1 and Java 1.4) - path = getPathFromEnvVar( ENVVAR_NAME ); + if ( path != null ) { + return path; + } + // get the installation path from the UNO_PATH environment variable + // (all platforms, not working for Java 1.3.1 and Java 1.4) + path = getPathFromEnvVar( ENVVAR_NAME ); + if ( path != null ) { + return path; + } + + String osname = null; + try { + osname = System.getProperty( "os.name" ); + } catch ( SecurityException e ) { + // if a SecurityException was thrown, + // return <code>null</code> + return null; + } + if ( osname == null ) { + return null; + } + + if ( osname.startsWith( "Windows" ) ) { + // get the installation path from the Windows Registry + // (Windows platform only) + path = getPathFromWindowsRegistry(); + } else { + // get the installation path from the PATH environment + // variable (Unix/Linux platforms only, not working for + // Java 1.3.1 and Java 1.4) + path = getPathFromPathEnvVar(); if ( path == null ) { - String osname = null; - try { - osname = System.getProperty( "os.name" ); - } catch ( SecurityException e ) { - // if a SecurityException was thrown, - // return <code>null</code> - return null; - } - if ( osname != null ) { - if ( osname.startsWith( "Windows" ) ) { - // get the installation path from the Windows Registry - // (Windows platform only) - path = getPathFromWindowsRegistry(); - } else { - // get the installation path from the PATH environment - // variable (Unix/Linux platforms only, not working for - // Java 1.3.1 and Java 1.4) - path = getPathFromPathEnvVar(); - if ( path == null ) { - // get the installation path from the 'which' - // command (Unix/Linux platforms only) - path = getPathFromWhich(); - if ( path == null ) { - // get the installation path from the - // .sversionrc file (Unix/Linux platforms only, - // for older versions than OOo 2.0) - path = getPathFromSVersionFile(); - } - } - } + // get the installation path from the 'which' + // command (Unix/Linux platforms only) + path = getPathFromWhich(); + if ( path == null ) { + // get the installation path from the + // .sversionrc file (Unix/Linux platforms only, + // for older versions than OOo 2.0) + path = getPathFromSVersionFile(); } } } |