Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3 Commits: 0b319d95 by Tony CHEMIT at 2018-04-15T15:20:29Z clean code - - - - - 48f2b301 by Tony CHEMIT at 2018-04-16T09:24:23Z [CONNEXION] Traiter l'exception lorsque la base PG accédée n'existe pas (closes #319) - - - - - eddf203a by Tony CHEMIT at 2018-04-16T09:24:54Z update config version - - - - - fec55645 by Tony CHEMIT at 2018-04-16T09:25:16Z Add more logs files - - - - - 12 changed files: - pom.xml - t3-domain/src/main/java/fr/ird/t3/actions/stratum/LevelOutputContext.java - t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java - t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java - t3-domain/src/main/java/fr/ird/t3/models/SpeciesCountModelHelper.java - t3-domain/src/main/java/fr/ird/t3/services/T3InputService.java - t3-domain/src/main/java/fr/ird/t3/services/T3OutputService.java - t3-domain/src/main/resources/t3-log4j.conf - t3-web/src/main/java/fr/ird/t3/web/actions/SelectUserInputDatabaseAction.java - t3-web/src/main/resources/i18n/t3-web_en_GB.properties - t3-web/src/main/resources/i18n/t3-web_fr_FR.properties - t3-web/src/main/webapp/css/screen.css Changes: ===================================== pom.xml ===================================== --- a/pom.xml +++ b/pom.xml @@ -102,7 +102,7 @@ <applicationName>t3</applicationName> <t3-data.version>1.9</t3-data.version> <lib.version.java4all.i18n>4.0-alpha-11</lib.version.java4all.i18n> - <lib.version.java4all.config>1.0.2-SNAPSHOT</lib.version.java4all.config> + <lib.version.java4all.config>1.0.2</lib.version.java4all.config> <env>dev</env> <skipITs>true</skipITs> ===================================== t3-domain/src/main/java/fr/ird/t3/actions/stratum/LevelOutputContext.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/actions/stratum/LevelOutputContext.java +++ b/t3-domain/src/main/java/fr/ird/t3/actions/stratum/LevelOutputContext.java @@ -110,7 +110,7 @@ public abstract class LevelOutputContext<C extends LevelConfigurationWithStratum } List<Integer> result = new ArrayList<>(levels); Collections.reverse(result); - return result.toArray(new Integer[result.size()]); + return result.toArray(new Integer[0]); } public long getTotalCatchActivitiesWithSample() { ===================================== t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java +++ b/t3-domain/src/main/java/fr/ird/t3/io/input/access/AbstractT3InputMSAccess.java @@ -108,12 +108,12 @@ public abstract class AbstractT3InputMSAccess implements T3Input { @Override public String[] getAnalyzeErrors() { - return errors.toArray(new String[errors.size()]); + return errors.toArray(new String[0]); } @Override public String[] getAnalyzeWarnings() { - return warnings.toArray(new String[warnings.size()]); + return warnings.toArray(new String[0]); } @Override ===================================== t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java +++ b/t3-domain/src/main/java/fr/ird/t3/io/input/access/T3AccessDataSource.java @@ -51,7 +51,7 @@ public class T3AccessDataSource extends AbstractAccessDataSource<T3EntityEnum, T @Override protected T3AccessEntityMeta[] newMetaArray(Collection<T3AccessEntityMeta> table) { - return table.toArray(new T3AccessEntityMeta[table.size()]); + return table.toArray(new T3AccessEntityMeta[0]); } @Override @@ -84,7 +84,7 @@ public class T3AccessDataSource extends AbstractAccessDataSource<T3EntityEnum, T Collections.addAll(buffer, meta.getErrors()); } } - return buffer.toArray(new String[buffer.size()]); + return buffer.toArray(new String[0]); } public String[] getWarnings() { @@ -94,7 +94,7 @@ public class T3AccessDataSource extends AbstractAccessDataSource<T3EntityEnum, T Collections.addAll(buffer, meta.getWarnings()); } } - return buffer.toArray(new String[buffer.size()]); + return buffer.toArray(new String[0]); } public void analyzeDb(T3AccessHitModel hits) throws Exception { ===================================== t3-domain/src/main/java/fr/ird/t3/models/SpeciesCountModelHelper.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/models/SpeciesCountModelHelper.java +++ b/t3-domain/src/main/java/fr/ird/t3/models/SpeciesCountModelHelper.java @@ -115,7 +115,7 @@ public class SpeciesCountModelHelper { header.setHeader( String.format( lineFormat.toString(), - (Object[]) headerParams.toArray(new Object[headerParams.size()]))); + (Object[]) headerParams.toArray(new Object[0]))); header.setCategoryFormat("| %1$-" + (totalLength) + "s |\n"); @@ -158,7 +158,7 @@ public class SpeciesCountModelHelper { inResume.append( String.format( lineFormat.toString(), - (Object[]) params.toArray(new Object[params.size()]))); + (Object[]) params.toArray(new Object[0]))); } @@ -176,7 +176,7 @@ public class SpeciesCountModelHelper { inResume.append( String.format( lineFormat.toString(), - (Object[]) params.toArray(new Object[params.size()]))); + (Object[]) params.toArray(new Object[0]))); } @@ -192,7 +192,7 @@ public class SpeciesCountModelHelper { inResume.append( String.format( lineFormat.toString(), - (Object[]) params.toArray(new Object[params.size()]))); + (Object[]) params.toArray(new Object[0]))); inResume.append(header.getBottomSeparatorFormat()); return inResume.toString(); ===================================== t3-domain/src/main/java/fr/ird/t3/services/T3InputService.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/services/T3InputService.java +++ b/t3-domain/src/main/java/fr/ird/t3/services/T3InputService.java @@ -42,7 +42,7 @@ public class T3InputService extends T3ServiceSupport implements T3ServiceSinglet for (T3InputProvider provider : ServiceLoader.load(T3InputProvider.class)) { result.add(provider); } - providers = result.toArray(new T3InputProvider[result.size()]); + providers = result.toArray(new T3InputProvider[0]); } return providers; } ===================================== t3-domain/src/main/java/fr/ird/t3/services/T3OutputService.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/services/T3OutputService.java +++ b/t3-domain/src/main/java/fr/ird/t3/services/T3OutputService.java @@ -44,7 +44,7 @@ public class T3OutputService extends T3ServiceSupport implements T3ServiceSingle for (T3OutputProvider<?, ?> provider : ServiceLoader.load(T3OutputProvider.class)) { result.add(provider); } - providers = result.toArray(new T3OutputProvider[result.size()]); + providers = result.toArray(new T3OutputProvider[0]); } return providers; } ===================================== t3-domain/src/main/resources/t3-log4j.conf ===================================== --- a/t3-domain/src/main/resources/t3-log4j.conf +++ b/t3-domain/src/main/resources/t3-log4j.conf @@ -11,7 +11,7 @@ log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%c:%L) %M - %m%n log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=${user.log.directory}/t3.log log4j.appender.file.MaxFileSize=10MB -log4j.appender.file.MaxBackupIndex=4 +log4j.appender.file.MaxBackupIndex=30 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] (%c:%L) %M - %m%n ===================================== t3-web/src/main/java/fr/ird/t3/web/actions/SelectUserInputDatabaseAction.java ===================================== --- a/t3-web/src/main/java/fr/ird/t3/web/actions/SelectUserInputDatabaseAction.java +++ b/t3-web/src/main/java/fr/ird/t3/web/actions/SelectUserInputDatabaseAction.java @@ -21,6 +21,7 @@ package fr.ird.t3.web.actions; import com.opensymphony.xwork2.Preparable; +import fr.ird.t3.entities.T3EntityHelper; import fr.ird.t3.entities.user.JdbcConfiguration; import fr.ird.t3.entities.user.T3User; import fr.ird.t3.entities.user.UserDatabase; @@ -28,6 +29,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.sql.SQLException; import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -83,6 +85,12 @@ public class SelectUserInputDatabaseAction extends T3ActionSupport implements Pr @Override public String execute() { // set the selected database in session + try { + T3EntityHelper.checkJDBCConnection(getDatabase()); + } catch (SQLException e) { + addActionError(t("t3.message.error.open.database", getDatabase().getUrl(), e.getMessage())); + return ERROR; + } getT3Session().initDatabaseConfiguration(getDatabase()); return SUCCESS; } ===================================== t3-web/src/main/resources/i18n/t3-web_en_GB.properties ===================================== --- a/t3-web/src/main/resources/i18n/t3-web_en_GB.properties +++ b/t3-web/src/main/resources/i18n/t3-web_en_GB.properties @@ -376,6 +376,7 @@ t3.menu.treatment.level3.launch=Start a level 3 treatment t3.message.discovered.trip.to.insert=La marée %s peut être importée dans T3 t3.message.discovered.trip.to.replace=La marée %s existe déjà dans T3 et peut être importée t3.message.discovered.unsafe.trip=La marée %s ne peut pas être importée dans T3 +t3.message.error.open.database=Could not open selected database [%s]\: %s t3.message.missingActionContext=Action could not be done (no action context found), start it from the beginning t3.message.missingLevel1Configuration=No configuration registred for level 1 treatment. t3.message.missingLevel2Configuration=No configuration registred for level 2 treatment. ===================================== t3-web/src/main/resources/i18n/t3-web_fr_FR.properties ===================================== --- a/t3-web/src/main/resources/i18n/t3-web_fr_FR.properties +++ b/t3-web/src/main/resources/i18n/t3-web_fr_FR.properties @@ -376,6 +376,7 @@ t3.menu.treatment.level3.launch=Lancer un traitement de niveau 3 t3.message.discovered.trip.to.insert=La marée %s peut être importée dans T3 t3.message.discovered.trip.to.replace=La marée %s existe déjà dans T3 et peut être importée t3.message.discovered.unsafe.trip=La marée %s ne peut pas être importée dans T3 +t3.message.error.open.database=Impossible d'ouvrir la base sélectionnée [%s] \: %s t3.message.missingActionContext=L'action ne peut pas être réalisée, veuillez la reprendre depuis le début. t3.message.missingLevel1Configuration=Aucune configuration enregistrée pour les traitements du niveau 1. t3.message.missingLevel2Configuration=Aucune configuration enregistrée pour les traitements du niveau 2. ===================================== t3-web/src/main/webapp/css/screen.css ===================================== --- a/t3-web/src/main/webapp/css/screen.css +++ b/t3-web/src/main/webapp/css/screen.css @@ -79,7 +79,7 @@ font-size: 11px; .info_error { background: no-repeat scroll 8px 5px #FFE3E3; border: 2px solid #DD0000; - width: 800px; + /*width: 1000px;*/ margin-bottom: 5px; } .info_error ul{ View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/de2f1e0d68db496af6af2b589e9a7917... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/de2f1e0d68db496af6af2b589e9a7917... You're receiving this email because of your account on gitlab.com.