Author: tchemit Date: 2008-01-20 14:34:29 +0000 (Sun, 20 Jan 2008) New Revision: 286 Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java Log: utilisation de l'exception SimExplorerRuntimeException Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-01-20 14:21:18 UTC (rev 285) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorer.java 2008-01-20 14:34:29 UTC (rev 286) @@ -156,7 +156,7 @@ protected static void checkInitContext() { if (context == null) { - throw new IllegalStateException("context is null, you must init first the " + SimExplorer.class.getName() + " class via init method"); + throw new SimExplorerRuntimeException("context is null, you must init first the " + SimExplorer.class.getName() + " class via init method"); } } Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java 2008-01-20 14:21:18 UTC (rev 285) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerConfig.java 2008-01-20 14:34:29 UTC (rev 286) @@ -1,6 +1,6 @@ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Tony Chemit +* Tony Chemit, Gabriel Landais * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,12 +43,12 @@ String home = System.getProperty("user.home"); if (home == null) { // this is a serious fatal error - throw new RuntimeException("simexplorer.error.user.home"); + throw new SimExplorerRuntimeException("simexplorer.error.user.home"); } doInit(); } - public void init() throws Exception { + public void init() throws IOException { log.info("start for category [" + category + "] -------------------------"); SimExplorerOptionParser parser = SimExplorer.getContext().getParser(); @@ -90,7 +90,7 @@ try { file.createNewFile(); } catch (IOException e) { - throw new RuntimeException(e); + throw new SimExplorerRuntimeException(e); } } } @@ -104,7 +104,7 @@ I18n.initISO88591(getLanguage().name(), getCountry().name()); } - protected void loadFromOptions(SimExplorerOptionParser parser) throws Exception { + protected void loadFromOptions(SimExplorerOptionParser parser) { if (!parser.isOptionEnabled(SimExplorerOptionParser.CONFIG_OPTION_KEY)) { return; } @@ -114,7 +114,7 @@ ConfigPropertyKey<?> propKey = getPropertyKey(option.getKey()); if (propKey == null) { // fatal error , could not found a matching configuration property - throw new IllegalArgumentException(_("simexplorer.error.unfound.config.property", category, option.getKey())); + throw new SimExplorerRuntimeException(_("simexplorer.error.unfound.config.property", category, option.getKey())); } Object oldVal = propKey.getCurrentValue(); setProperty(propKey, option.getValue()); Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java 2008-01-20 14:21:18 UTC (rev 285) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/SimExplorerContext.java 2008-01-20 14:34:29 UTC (rev 286) @@ -1,6 +1,6 @@ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit +* Tony Chemit, Gabriel Landais * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -133,9 +133,9 @@ try { getParser().doParse(args); } catch (ParserException e) { - throw new RuntimeException(e); + throw new SimExplorerRuntimeException(e); } catch (IOException e) { - throw new RuntimeException(e); + throw new SimExplorerRuntimeException(e); } } Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java 2008-01-20 14:21:18 UTC (rev 285) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerActionManager.java 2008-01-20 14:34:29 UTC (rev 286) @@ -1,6 +1,6 @@ /* -* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit +* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, +* Tony Chemit, Gabriel Landais * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* \#\#% */ +* ##% */ package fr.cemagref.simexplorer.is.ui.swing; import org.apache.commons.logging.Log; @@ -25,13 +25,13 @@ import javax.swing.AbstractButton; import javax.swing.Icon; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.util.Map; import java.util.Properties; import java.util.TreeMap; import jaxx.runtime.JAXXObject; import fr.cemagref.simexplorer.is.ui.swing.action.SimExplorerAbstractAction; +import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException; /** * La classe responsable de l'enregistrement des actions disponibles @@ -73,14 +73,8 @@ SimExplorerAbstractAction result = klazz.getConstructor(String.class).newInstance(actionKey); log.debug(actionKey + " : " + result); return result; - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); + } catch (Exception e) { + throw new SimExplorerRuntimeException(e); } } @@ -94,7 +88,7 @@ properties = new Properties(); properties.load(Class.class.getResourceAsStream(ACTIONS_FILE_PATH)); } catch (IOException e) { - throw new RuntimeException(_("could not load actions.properties file for reason {0} ", e.getMessage())); + throw new SimExplorerRuntimeException(_("could not load actions.properties file for reason {0} ", e.getMessage())); } int prefix = ACTION_KEY_PREFIX.length(); for (Map.Entry<Object, Object> objectObjectEntry : properties.entrySet()) { @@ -107,7 +101,7 @@ cache.put(key.substring(prefix), implCass); } catch (ClassNotFoundException e) { impls = cache; - throw new RuntimeException(_("could not found for action key {0} class {1} ", key, qfn)); + throw new SimExplorerRuntimeException(_("could not found for action key {0} class {1} ", key, qfn)); } } impls = cache; @@ -142,14 +136,14 @@ protected static void checkInit() { if (impls == null) { - throw new IllegalStateException("you must init first the " + SimExplorerActionManager.class.getName() + " class via init method"); + throw new SimExplorerRuntimeException("you must init first the " + SimExplorerActionManager.class.getName() + " class via init method"); } } protected static void checkRegistredAction(String actionKey) { checkInit(); if (!impls.containsKey(actionKey)) { - throw new IllegalStateException(_("can not find a registered action for key {0} ", actionKey)); + throw new SimExplorerRuntimeException(_("can not find a registered action for key {0} ", actionKey)); } } } Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java 2008-01-20 14:21:18 UTC (rev 285) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerMainUI.java 2008-01-20 14:34:29 UTC (rev 286) @@ -18,10 +18,8 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.swing; -import fr.cemagref.simexplorer.is.ui.swing.SimExplorerActionManager; -import fr.cemagref.simexplorer.is.ui.swing.SimExplorerUI; -import fr.cemagref.simexplorer.is.ui.swing.action.common.ChangeI18nAction; import fr.cemagref.simexplorer.is.ui.SimExplorer; +import fr.cemagref.simexplorer.is.ui.swing.action.common.ChangeI18nAction; import org.codelutin.i18n.CountryEnum; import org.codelutin.i18n.LanguageEnum; @@ -30,6 +28,7 @@ /** * L'ui principale de l'application + * * @author chemit */ public class SimExplorerMainUI extends SimExplorerUI { Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java 2008-01-20 14:21:18 UTC (rev 285) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerTabManager.java 2008-01-20 14:34:29 UTC (rev 286) @@ -19,6 +19,7 @@ package fr.cemagref.simexplorer.is.ui.swing; import fr.cemagref.simexplorer.is.ui.SimExplorer; +import fr.cemagref.simexplorer.is.ui.SimExplorerRuntimeException; import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationDetailTab; import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationListTab; import fr.cemagref.simexplorer.is.ui.swing.tab.JApplicationSynchronizeTab; @@ -119,9 +120,9 @@ } } } catch (InstantiationException e) { - throw new RuntimeException(e); + throw new SimExplorerRuntimeException(e); } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new SimExplorerRuntimeException(e); } } return instance; @@ -132,11 +133,11 @@ try { annotation = getClass().getField(name()).getAnnotation(TabContent.class); } catch (NoSuchFieldException e) { - throw new IllegalArgumentException("could not found annotation " + TabContent.class + " on enum " + this); + throw new SimExplorerRuntimeException("could not found annotation " + TabContent.class + " on enum " + this); } } if (annotation == null) { - throw new IllegalStateException("could not found annotation " + TabContent.class + " on enum " + this); + throw new SimExplorerRuntimeException("could not found annotation " + TabContent.class + " on enum " + this); } return annotation; }