Author: chatellier Date: 2010-01-19 10:57:45 +0000 (Tue, 19 Jan 2010) New Revision: 2922 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationProperties.java Log: Remove a possible huge preScript string. Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationProperties.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationProperties.java 2010-01-19 09:52:51 UTC (rev 2921) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationProperties.java 2010-01-19 10:57:45 UTC (rev 2922) @@ -1,3 +1,21 @@ +/* *##% + * Copyright (C) 2007 Ifremer, Code Lutin, Benjamin Poussin + * + * 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 2 + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package fr.ifremer.isisfish.simulator; import static org.nuiton.i18n.I18n._; @@ -6,6 +24,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.io.Reader; import java.util.Properties; import org.apache.commons.io.IOUtils; @@ -15,7 +34,7 @@ import fr.ifremer.isisfish.datastore.SimulationStorage; /** - * this class contains all usefull informations about a simulation. + * This class contains all usefull informations about a simulation. * <p/> * This is used for filter or search a simulation. * <p/> @@ -43,15 +62,20 @@ loadProperties(SimulationStorage.getSimulationInformationFile(simulationDirectory)); } - private void loadProperties(File file) { if (file.exists()) { - BufferedReader reader = null; + Reader reader = null; try { reader = new BufferedReader(new FileReader(file)); - this.data.load(reader); + data.load(reader); + + // FIXME fix a memory leak with huge prescript + data.remove("preScript"); + } catch (IOException e) { - log.warn(_("isisfish.error.load.file", file)); + if (log.isWarnEnabled()) { + log.warn(_("isisfish.error.load.file", file)); + } } finally { IOUtils.closeQuietly(reader); }