Mercurial > mxd2map
diff src/java/de/intevation/mxd/ArcGISInitializer.java @ 180:f4eb506499f5
Done some code styling and removed TODOs.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 11 Jul 2011 12:11:08 +0200 |
parents | 104af51a4717 |
children | df4e0946ef02 |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/ArcGISInitializer.java Fri Jul 08 16:32:05 2011 +0200 +++ b/src/java/de/intevation/mxd/ArcGISInitializer.java Mon Jul 11 12:11:08 2011 +0200 @@ -40,49 +40,53 @@ logger.debug("initArcGIS()"); String engineInstallDir = System.getenv("AGSENGINEJAVA"); - if(engineInstallDir == null) { + if(engineInstallDir == null) { engineInstallDir = System.getenv("AGSDESKTOPJAVA"); - if(engineInstallDir == null) { + if(engineInstallDir == null) { logger.error("Could not find ArcGIS Environment. \n" + "AGSENGINEJAVA or AGSDESKTOPJAVA not set."); - return false; - } - } + return false; + } + } - //Obtain the relative path to the arcobjects.jar file + //Obtain the relative path to the arcobjects.jar file String jarPath = engineInstallDir + "java" + File.separator + "lib" + - File.separator + "arcobjects.jar"; + File.separator + "arcobjects.jar"; //Create a new file File jarFile = new File(jarPath); - + //Test for file existence if(!jarFile.exists()){ - logger.error("The arcobjects.jar was not found in the following location: " + - jarFile.getParent()); - logger.error("Verify that arcobjects.jar can be located in the specified folder."); - logger.error("If not present, try uninstalling your ArcGIS software and reinstalling it."); + logger.error("The arcobjects.jar was not found in the" + + " following location: " + jarFile.getParent()); + logger.error("Verify that arcobjects.jar can" + + " be located in the specified folder."); + logger.error("If not present, try uninstalling your" + + " ArcGIS software and reinstalling it."); System.exit(0); } //Helps load classes and resources from a search path of URLs - URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); + URLClassLoader sysloader = + (URLClassLoader) ClassLoader.getSystemClassLoader(); Class<URLClassLoader> sysclass = URLClassLoader.class; try { - Method method = sysclass.getDeclaredMethod("addURL", new Class[]{URL.class}); + Method method = sysclass.getDeclaredMethod("addURL", + new Class[]{URL.class}); method.setAccessible(true); method.invoke(sysloader, new Object[]{jarFile.toURI().toURL()}); } - catch (Throwable throwable) { + catch (Throwable throwable) { throwable.printStackTrace(); logger.error("Could not add arcobjects.jar to system classloader"); System.exit(0); } - - EngineInitializer.initializeEngine(); - - aoInit = new AoInitialize(); + + EngineInitializer.initializeEngine(); + + aoInit = new AoInitialize(); return true; }