This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit de09f794d3dbbd7a283573a5e81dc42fcc4158fc Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:58:37 2020 +0100 Clean code --- .../echobase/entities/data/TransitImpl.java | 10 +- .../ifremer/echobase/entities/data/VoyageImpl.java | 11 +- .../echobase/services/csv/CellValueParser.java | 5 +- .../service/atlantos/ExportAtlantosService.java | 25 +- .../service/atlantos/xml/VocabularyExport.java | 16 +- .../services/service/spatial/LizmapRepository.java | 28 +- .../fr/ifremer/echobase/services/FixCellsIT.java | 283 --------------------- .../atlantos/ExportAtlantosServiceTest.java | 40 ++- .../service/importdb/ImportDbServiceTest.java | 2 +- .../resources/echobase-importDb-referentiel.zip | Bin 51131 -> 50973 bytes .../echobase/ui/EchoBaseStaticContentLoader.java | 3 +- .../src/main/webapp/WEB-INF/includes/footer.jsp | 3 +- 12 files changed, 71 insertions(+), 355 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java index 6e5a2e18..fb0893f3 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java @@ -21,21 +21,23 @@ package fr.ifremer.echobase.entities.data; import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; import fr.ifremer.echobase.entities.references.Vessel; +import java.util.Collection; + public class TransitImpl extends TransitAbstract { private static final long serialVersionUID = 3775200869632533299L; @Override - public Transect getTransect(Vessel vessel) { + public Collection<Transect> getTransects(Vessel vessel) { Preconditions.checkNotNull(vessel); - Transect result = null; + Collection<Transect> result = Lists.newArrayList(); if (!isTransectEmpty()) { for (Transect t : transect) { if (vessel.equals(t.getVessel())) { - result = t; - break; + result.add(t); } } } diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java index 4626ec32..f10193f7 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java @@ -30,6 +30,7 @@ import fr.ifremer.echobase.entities.references.Vessel; import java.util.Collection; import java.util.Date; +import java.util.List; import java.util.Set; /** @@ -136,10 +137,12 @@ public class VoyageImpl extends VoyageAbstract { if (!isTransitEmpty()) { for (Transit t : transit) { - Transect transect = t.getTransect(vessel); - if (transect != null) { - Collection<Operation> operations = transect.getOperation(); - result.addAll(operations); + Collection<Transect> transects = t.getTransects(vessel); + for (Transect transect:transects) { + if (transect != null) { + Collection<Operation> operations = transect.getOperation(); + result.addAll(operations); + } } } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java index 577b197d..b0e808d0 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java @@ -28,7 +28,6 @@ import org.nuiton.csv.ImportRuntimeException; import org.nuiton.csv.ValueParser; import org.nuiton.topia.persistence.TopiaException; -import java.text.ParseException; import java.util.List; import java.util.Map; @@ -48,7 +47,7 @@ public class CellValueParser implements ValueParser<Cell> { } @Override - public Cell parse(String cellId) throws ParseException { + public Cell parse(String cellId) { // get esdu cell Cell result = getCell(cellId); @@ -59,7 +58,7 @@ public class CellValueParser implements ValueParser<Cell> { return result; } - protected Cell getCell(String cellId) throws ParseException { + protected Cell getCell(String cellId) { Cell result = esduCellMap.get(cellId); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java index 11224c22..2b79dd20 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java @@ -102,15 +102,12 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { fileAccousticVoca.close(); fileAccousticCruise.close(); - FileChannel outAccoustic = new FileOutputStream(outputAccousticHead.toFile(), true).getChannel(); - FileChannel inAccousticVoca = new FileInputStream(outputAccousticVoca.toFile()).getChannel(); - FileChannel inAccousticCruise = new FileInputStream(outputAccousticCruise.toFile()).getChannel(); - outAccoustic.transferFrom(inAccousticVoca, 0, inAccousticVoca.size()); - outAccoustic.transferFrom(inAccousticCruise, 0, inAccousticCruise.size()); - - outAccoustic.close(); - inAccousticVoca.close(); - inAccousticCruise.close(); + try (FileChannel outAccoustic = new FileOutputStream(outputAccousticHead.toFile(), true).getChannel(); + FileChannel inAccousticVoca = new FileInputStream(outputAccousticVoca.toFile()).getChannel(); + FileChannel inAccousticCruise = new FileInputStream(outputAccousticCruise.toFile()).getChannel()) { + outAccoustic.transferFrom(inAccousticVoca, 0, inAccousticVoca.size()); + outAccoustic.transferFrom(inAccousticCruise, 0, inAccousticCruise.size()); + } outputAccousticHead.toFile().deleteOnExit(); outputAccousticVoca.toFile().delete(); @@ -131,12 +128,10 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { fileBioticVoca.close(); fileBioticCruise.close(); - FileChannel outBiotic = new FileOutputStream(outputBioticVoca.toFile(), true).getChannel(); - FileChannel inBioticCruise = new FileInputStream(outputBioticCruise.toFile()).getChannel(); - outBiotic.transferFrom(inBioticCruise, 0, inBioticCruise.size()); - - outBiotic.close(); - inBioticCruise.close(); + try (FileChannel outBiotic = new FileOutputStream(outputBioticVoca.toFile(), true).getChannel(); + FileChannel inBioticCruise = new FileInputStream(outputBioticCruise.toFile()).getChannel()) { + outBiotic.transferFrom(inBioticCruise, 0, inBioticCruise.size()); + } outputBioticVoca.toFile().deleteOnExit(); outputBioticCruise.toFile().delete(); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java index 9ed58ff9..0c050920 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java @@ -23,12 +23,9 @@ package fr.ifremer.echobase.services.service.atlantos.xml; import fr.ifremer.echobase.entities.data.Category; import fr.ifremer.echobase.entities.data.Echotype; -import fr.ifremer.echobase.entities.references.SizeCategory; import fr.ifremer.echobase.entities.references.Species; -import fr.ifremer.echobase.entities.references.SpeciesCategory; import fr.ifremer.echobase.services.EchoBaseService; import fr.ifremer.echobase.services.service.UserDbPersistenceService; -import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.util.HashMap; @@ -44,7 +41,9 @@ import javax.inject.Inject; * @author julien */ public class VocabularyExport implements EchoBaseService { - + + public static final String VOCABULARY_PATTERN = "^(((AC_)|(ISO_)|(ICES_)|(Gear))?[^_]+)_(.+)"; + @Inject private UserDbPersistenceService persistenceService; @@ -58,8 +57,8 @@ public class VocabularyExport implements EchoBaseService { protected XmlWriter writer; protected Pattern pattern; - public void init(XmlWriter writer) throws IOException { - this.pattern = Pattern.compile("^(((AC_)|(ISO_)|(ICES_))?[^_]+)_(.+)"); + public void init(XmlWriter writer) { + this.pattern = Pattern.compile(VOCABULARY_PATTERN); this.writer = writer; @@ -137,7 +136,7 @@ public class VocabularyExport implements EchoBaseService { Matcher matcher = this.pattern.matcher(code); matcher.find(); String prefix = matcher.group(1); - String value = matcher.group(6); + String value = matcher.group(7); this.writer.create("Code", "ID", code, @@ -223,7 +222,8 @@ public class VocabularyExport implements EchoBaseService { this.writer.open("Species"); this.writer.create("SpeciesCode", "IDREF", getVocabularyCode("SpecWoRMS_" + species.getWormsCode())); - this.writer.create("SpeciesCategory", speciesCategoryName); + //this.writer.create("SpeciesCategory", speciesCategoryName); + this.writer.create("SpeciesCategory", "IDREF", getVocabularyCode(speciesCategoryName,"AC_CatchCategory_1")); this.writer.close("Species"); } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java index b07733a0..4965cc1e 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java @@ -255,10 +255,8 @@ public class LizmapRepository { protected void updateLizmapAuthorizations() { - Connection connection = null; + try (Connection connection = DriverManager.getConnection(configuration.getLizmapApplicationJdbcUrl())) { - try { - connection = DriverManager.getConnection(configuration.getLizmapApplicationJdbcUrl()); connection.setAutoCommit(false); String repoName = getRepositoryName(); @@ -279,19 +277,8 @@ public class LizmapRepository { connection.commit(); - connection.close(); - } catch (SQLException e) { throw new EchoBaseTechnicalException("Could not create rights in lizmap", e); - } finally { - try { - if (connection != null && !connection.isClosed()) { - connection.close(); - } - } catch (SQLException e) { - //FIXME We should never throw an exception in finally block - throw new EchoBaseTechnicalException("Could not create rights in lizmap", e); - } } } @@ -301,19 +288,8 @@ public class LizmapRepository { log.debug("Execute sql query to lizmap: " + query); } - Statement statement = connection.createStatement(); - - try { + try (Statement statement = connection.createStatement()){ statement.execute(query); - - statement.close(); - - } finally { - - if (statement != null) { - statement.close(); - } - } } diff --git a/echobase-services/src/test/java/fr/ifremer/echobase/services/FixCellsIT.java b/echobase-services/src/test/java/fr/ifremer/echobase/services/FixCellsIT.java deleted file mode 100644 index 304f35a6..00000000 --- a/echobase-services/src/test/java/fr/ifremer/echobase/services/FixCellsIT.java +++ /dev/null @@ -1,283 +0,0 @@ -package fr.ifremer.echobase.services; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2012 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -import com.google.common.collect.Sets; -import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; -import fr.ifremer.echobase.entities.data.Cell; -import fr.ifremer.echobase.entities.data.Data; -import fr.ifremer.echobase.entities.data.Voyage; -import fr.ifremer.echobase.services.service.UserDbPersistenceService; -import fr.ifremer.echobase.services.service.importdata.configurations.VoyageAcousticsImportConfiguration; -import fr.ifremer.echobase.services.service.importdata.CellPositionReference; -import fr.ifremer.echobase.services.service.importdata.ImportDataService; -import fr.ifremer.echobase.services.service.importdata.ImportException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Test; -import org.nuiton.topia.persistence.TopiaDao; -import org.nuiton.topia.persistence.TopiaException; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Set; - -/** - * To fix cells and datas. - * - * see http://forge.codelutin.com/issues/1592 - * see http://forge.codelutin.com/issues/1593 - * - * @author Tony Chemit - chemit@codelutin.com - * @since 1.4 - */ -public class FixCellsIT extends EchoBaseTestServiceSupport { - - /** Logger. */ - private static final Log log = LogFactory.getLog(FixCellsIT.class); - - public static int[] YEARS = { - 1998, - 2000, - 2001, - 2002, - 2003, - 2004, - 2005, - 2006, - 2007, - 2008, - 2009, - 2010 - }; - /* - 1998 :: 10017 - 2000 :: 12075 - 2001 :: 18000 - 2002 :: 15303 - 2003 :: 27315 - 2004 :: 23955 - 2005 :: 14805 - 2006 :: 12825 - 2007 :: 16005 - 2008 :: 20595 - 2009 :: 24690 - 2010 :: 15150 - - */ - - @Override - protected FakeEchoBaseServiceContext initContext() { -// return new FakeEchoBaseServiceContext(null); - return new FakeEchoBaseServiceContext("/fixcells.h2.db.gz"); - } - - Set<String> positionDatas = Sets.newHashSet("LatitudeStart", "LongitudeStart"); - - Set<String> timeStartData = Sets.newHashSet("TimeStart"); - - DateFormat dateInstance = new SimpleDateFormat("EEE MMM d HH:mm:ss 'CEST' yyyy"); - - DateFormat dateInstance2 = new SimpleDateFormat("EEE MMM d HH:mm:ss 'CET' yyyy"); - - DateFormat isoDateFormat = new SimpleDateFormat(EchoBaseCsvUtil.CELLULE_DATE_FORMAT); - - @Test - public void lissage() throws Exception { - -// importdb(ImportDbMode.FREE, "/fixcells.echobase"); - -// importMissingEsduCells(); - -// fixCellDatas(); - - exportDatabase(); - } - - protected void importMissingEsduCells() throws IOException, ImportException { - - VoyageAcousticsImportConfiguration conf = new VoyageAcousticsImportConfiguration(getLocale()); - prepareInputFile(conf.getMoviesFile(), "/missingEsduCells.csv.gz"); - conf.setCellPositionReference(CellPositionReference.START); - -// doImport(conf, -// 1998, -// 2000, -// 2001, -// 2002, -// 2003, -// 2004); - /* -Seens years 1998 :: 10017 -Seens years 2000 :: 12075 -Seens years 2001 :: 18000 -Seens years 2002 :: 15303 -Seens years 2003 :: 26595 - - */ - - doImport(conf, - 2005, - 2006, - 2007, - 2008, - 2009, - 2010); - - /* -2005 :: 14805 -2006 :: 12825 -2007 :: 16005 -2008 :: 20595 -2009 :: 24690 -2010 :: 15150 - - */ - - } - - protected void doImport(VoyageAcousticsImportConfiguration conf, int... years) throws ImportException { - - System.gc(); - - ImportDataService service = newService(ImportDataService.class); - - service.doImportVoyageAcoustics(conf, createFakeUser()); - - System.gc(); - } - - protected void fixCellDatas() throws TopiaException, ParseException { - - int nb = 0; - TopiaDao<Cell> cellDAO = serviceContext.getEchoBaseUserPersistenceContext().getCellDao(); - - UserDbPersistenceService persistenceService = serviceContext.newService(UserDbPersistenceService.class); - - long nbCells = cellDAO.count(); - for (Cell cell : cellDAO) { - - if (log.isDebugEnabled()) { - log.debug("treat cell " + cell.getName() + " - " + - cell.getCellType().getName()); - } - - if (!cell.isDataEmpty()) { - for (Data data : cell.getData()) { - String name = data.getDataMetadata().getName(); - if (timeStartData.contains(name)) { - fixDateFormat(cell, data); - } else if (positionDatas.contains(name)) { - fixDataPosition(data); - } - } - } - - if (++nb % 10000 == 0) { - if (log.isInfoEnabled()) { - log.info("Flush at " + nb + "/" + nbCells); - } - persistenceService.flush(); - } - } - - persistenceService.commit(); - } - - private void exportDatabase() throws TopiaException, IOException { - - TopiaDao<Voyage> voyageDAO = serviceContext.getEchoBaseUserPersistenceContext().getVoyageDao(); - - UserDbPersistenceService persistenceService = serviceContext.newService(UserDbPersistenceService.class); - long nbVoyages = persistenceService.countVoyage(); - - Voyage voyage; - if (nbVoyages == 0) { - - // crate voyage - - - voyage = voyageDAO.create(Voyage.PROPERTY_MISSION, serviceContext.getEchoBaseUserPersistenceContext().getMissionDao().findAll().get(0), - Voyage.PROPERTY_NAME, "name", - Voyage.PROPERTY_START_DATE, newDate(), - Voyage.PROPERTY_END_DATE, newDate(), - Voyage.PROPERTY_START_PORT, "ici", - Voyage.PROPERTY_END_PORT, "labas", - Voyage.PROPERTY_DESCRIPTION, "description", - Voyage.PROPERTY_DATUM, "datum" - ); - - persistenceService.commit(); - } else { - voyage = voyageDAO.findAll().get(0); - } - - persistenceService.commit(); - - exportDb(voyage, "fixCells"); - - } - - private void fixDateFormat(Cell cell, Data data) throws ParseException { - - String dataValue = data.getDataValue(); - Date oldDate; - try { - oldDate = dateInstance.parse(dataValue); - } catch (ParseException e) { - oldDate = dateInstance2.parse(dataValue); - } - - String newDate = isoDateFormat.format(oldDate); - - if (log.isInfoEnabled()) { - log.info("Treat date " + dataValue + " - to " + newDate); - } - data.setDataValue(newDate); - cell.setName(newDate); - } - - - private void fixDataPosition(Data data) { - - String dataValue = data.getDataValue(); - - double sign = dataValue.endsWith("W") ? -1 : 1; - - double x = Float.valueOf(dataValue.substring(0, dataValue.length() - 1)); - - double x1 = Math.floor(x / 100); - double x2 = Math.floor(x - x1 * 100) / 60; - double x3 = ((x - x1 * 100) - x2 * 60) / 100; - double newValue = sign * (x1 + x2 + x3); - - if (log.isInfoEnabled()) { - log.info("Treat data position " + x + " to " + newValue); - } - - data.setDataValue(String.valueOf(newValue)); - } - -} diff --git a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java index 398be502..727aa8da 100644 --- a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java +++ b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java @@ -24,11 +24,14 @@ package fr.ifremer.echobase.services.service.atlantos; import fr.ifremer.echobase.services.EchoBaseTestServiceSupport; import fr.ifremer.echobase.services.FakeEchoBaseServiceContext; import fr.ifremer.echobase.services.ImportDataFixtures; +import fr.ifremer.echobase.services.service.atlantos.xml.VocabularyExport; +import org.junit.Assert; import org.junit.Test; import org.nuiton.util.FileUtil; import javax.inject.Inject; import java.io.File; +import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,8 +50,7 @@ public class ExportAtlantosServiceTest extends EchoBaseTestServiceSupport { @Inject private ExportAtlantosService exportService; -// @Test -//fixture data not valid for CIEM export + @Test public void testXmlExport() throws Exception { File workingDirectory = new File(getTestDir(), "testAtlantos"); @@ -60,19 +62,41 @@ public class ExportAtlantosServiceTest extends EchoBaseTestServiceSupport { model.setWorkingDirectory(workingDirectory); exportService.doXmlExport(model); + + Assert.assertEquals(3, workingDirectory.list().length); + + boolean oneZipFile = Arrays.stream(workingDirectory.list()) + .anyMatch(filename -> new File(workingDirectory, filename).isFile() && + filename.endsWith(".zip") && filename.startsWith("ICES_")); + + Assert.assertTrue(oneZipFile); + + boolean bioticFile = Arrays.stream(workingDirectory.list()) + .anyMatch(filename -> new File(workingDirectory, filename).isFile() && + filename.endsWith(".xml") && filename.startsWith("Biotic_") && + !filename.endsWith("-voca.xml") && !filename.endsWith("-cruise.xml")); + + Assert.assertTrue(bioticFile); + + boolean acousticFile = Arrays.stream(workingDirectory.list()) + .anyMatch(filename -> new File(workingDirectory, filename).isFile() && + filename.endsWith(".xml") && filename.startsWith("Acoustic_") && + !filename.endsWith("-voca.xml") && !filename.endsWith("-cruise.xml")); + + Assert.assertTrue(acousticFile); } -// @Test + @Test public void testPattern() { - Pattern pattern = Pattern.compile("^(((AC_)|(ISO_)|(ICES_))?[^_]+)_(.+)"); + Pattern pattern = Pattern.compile(VocabularyExport.VOCABULARY_PATTERN); + Matcher matcher = pattern.matcher("Gear_PMT_57x52"); - matcher.find(); + Assert.assertTrue(matcher.find()); matcher = pattern.matcher("SHIPC_35HT"); - matcher.find(); + Assert.assertTrue(matcher.find()); matcher = pattern.matcher("AC_SaCategory_D1-1"); - matcher.find(); + Assert.assertTrue(matcher.find()); } - } diff --git a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java index 88bd70c9..58540145 100644 --- a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java +++ b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java @@ -51,7 +51,7 @@ public class ImportDbServiceTest extends EchoBaseTestServiceSupport { return new FakeEchoBaseServiceContext(null); } -// @Test + @Test //Fix import data public void importDb() throws IOException, ImportException { diff --git a/echobase-services/src/test/resources/echobase-importDb-referentiel.zip b/echobase-services/src/test/resources/echobase-importDb-referentiel.zip index 5139a33a..8f188b7e 100644 Binary files a/echobase-services/src/test/resources/echobase-importDb-referentiel.zip and b/echobase-services/src/test/resources/echobase-importDb-referentiel.zip differ diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java index 9d752d5b..7250a648 100644 --- a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java @@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.Charset; import java.util.Calendar; @@ -113,7 +114,7 @@ public class EchoBaseStaticContentLoader extends DefaultStaticContentLoader { String path) throws IOException { if (path.contains(".js")) { - String content = IOUtils.toString(input); + String content = IOUtils.toString(input, Charset.defaultCharset()); if (content.indexOf("/") == 1) { // fix nasty first strange caracter for ckeditor (only on firefox :() content = content.substring(1); diff --git a/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp b/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp index 03774334..6e08c01a 100644 --- a/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp +++ b/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp @@ -32,8 +32,7 @@ © 2011-2017 </span> <a href="http://www.ifremer.fr">Ifremer</a> - <a href="http://www.codelutin.com" title="Code Lutin" target="_blank">Code - Lutin</a> + <a href="http://www.codelutin.com" title="Code Lutin" target="_blank" rel="noopener noreferrer">Code Lutin</a> </li> <li> <s:a href="http://www.gnu.org/licenses/agpl.html" target='license'> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.