r3982 - in trunk/src/main/java/fr/ifremer/isisfish: aspect simulator/launcher
Author: echatellier Date: 2014-05-15 17:31:29 +0200 (Thu, 15 May 2014) New Revision: 3982 Url: http://forge.codelutin.com/projects/isis-fish/repository/revisions/3982 Log: refs #2255: Move enum out of class for aspectization Added: trunk/src/main/java/fr/ifremer/isisfish/aspect/State.java Modified: trunk/src/main/java/fr/ifremer/isisfish/aspect/RuleAspect.java trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java Modified: trunk/src/main/java/fr/ifremer/isisfish/aspect/RuleAspect.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/aspect/RuleAspect.java 2014-05-15 10:09:19 UTC (rev 3981) +++ trunk/src/main/java/fr/ifremer/isisfish/aspect/RuleAspect.java 2014-05-15 15:31:29 UTC (rev 3982) @@ -54,13 +54,6 @@ @Aspect public class RuleAspect { - /** - * State phase to register. - */ - protected static enum State { - INIT, PRE, POST - } - /** Log. */ private static Log log = LogFactory.getLog(RuleAspect.class); Added: trunk/src/main/java/fr/ifremer/isisfish/aspect/State.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/aspect/State.java (rev 0) +++ trunk/src/main/java/fr/ifremer/isisfish/aspect/State.java 2014-05-15 15:31:29 UTC (rev 3982) @@ -0,0 +1,36 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2014 Ifremer, Code Lutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package fr.ifremer.isisfish.aspect; + +/** + * State phase to register. + * + * Avant, cette enum était dans RuleAspect. Mais depuis le passage à aspectj, il y a une erreur + * étrange d'accès: + * java.lang.IllegalAccessError: tried to access class fr.ifremer.isisfish.aspect.RuleAspect$1 from class fr.ifremer.isisfish.aspect.RuleAspect + */ +public enum State { + INIT, PRE, POST +} Property changes on: trunk/src/main/java/fr/ifremer/isisfish/aspect/State.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2014-05-15 10:09:19 UTC (rev 3981) +++ trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2014-05-15 15:31:29 UTC (rev 3982) @@ -34,7 +34,6 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; -import java.util.Enumeration; import java.util.List; import org.apache.commons.io.FileUtils; @@ -71,7 +70,6 @@ import fr.ifremer.isisfish.simulator.Simulator; import fr.ifremer.isisfish.types.Month; import fr.ifremer.isisfish.types.TimeStep; -import fr.ifremer.isisfish.util.CompileHelper; /** * Fait une simulation dans la meme jvm. @@ -280,9 +278,6 @@ * @return le classe loader modifié */ protected AspectJUrlClassLoader changeClassLoader(Thread thread, File directory) { - /* - FIXME echatellier 20140419 : normalement c'est ce code original qui est bon - il fonctionne sur eclipse, mais pas en java -jar ... try { URL[] classpath = new URL[] { directory.toURI().toURL(), // poussin 20080821 : il semble ne plus trouve les formules, @@ -299,37 +294,6 @@ // impossible car on creer l'url a partir d'un File ce qui ne pose // noralement pas de probleme throw new IsisFishRuntimeException(t("isisfish.error.change.classloader", directory), eee); - }*/ - - // FIXME echatellier 20140419 : pour que aspectj fonctionne, on lui construit un urlclassloader - // complet avec toutes les urls - try { - List<URL> urls = new ArrayList<>(); - for (Enumeration<?> e = CompileHelper.class.getClassLoader() - .getResources("META-INF/MANIFEST.MF"); e.hasMoreElements();) { - URL url = (URL) e.nextElement(); - if (log.isDebugEnabled()) { - log.debug("Found manifest : " + url); - } - if ((url != null) && url.getFile().startsWith("file:/")) { - String jarPath = url.getPath().substring(0, - url.getPath().indexOf("!")); - urls.add(new URL(jarPath)); - } - } - urls.add(directory.toURI().toURL()); - urls.add(IsisFish.config.getCompileDirectory().toURI().toURL()); - AspectJUrlClassLoader loader = new AspectJUrlClassLoader(urls.toArray(new URL[urls.size()]), - IsisFish.class.getClassLoader()); - thread.setContextClassLoader(loader); - log.error("Classloader used for simulation: " + loader + " " - + Arrays.toString(loader.getURLs())); - return loader; - } catch (Exception eee) { - // on leve un runtime, car normalement cette erreur est pratiquement - // impossible car on creer l'url a partir d'un File ce qui ne pose - // noralement pas de probleme - throw new IsisFishRuntimeException(t("isisfish.error.change.classloader", directory), eee); } }
participants (1)
-
echatellier@users.forge.codelutin.com