r277 - in trunk: echobase-services/src/main/java/fr/ifremer/echobase/services echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders
Author: tchemit Date: 2012-01-13 18:41:09 +0100 (Fri, 13 Jan 2012) New Revision: 277 Url: http://forge.codelutin.com/repositories/revision/echobase/277 Log: fix more sonar errors Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/SampleLoader.java Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-01-13 17:29:04 UTC (rev 276) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-01-13 17:41:09 UTC (rev 277) @@ -41,7 +41,6 @@ import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.util.TimeLog; import org.nuiton.util.beans.BeanMonitor; import org.nuiton.util.beans.PropertyDiff; import org.nuiton.util.csv.ExportableColumn; @@ -63,8 +62,6 @@ /** Logger. */ private static final Log log = LogFactory.getLog(DbEditorService.class); - public static final TimeLog timeLog = new TimeLog(DbEditorService.class); - protected DecoratorService getDecoratorService() { return getService(DecoratorService.class); } Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java 2012-01-13 17:29:04 UTC (rev 276) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ExportService.java 2012-01-13 17:41:09 UTC (rev 277) @@ -50,7 +50,7 @@ /** Logger. */ private static final Log log = LogFactory.getLog(ExportService.class); - public static final TimeLog timeLog = new TimeLog(ExportService.class); + public static final TimeLog TIME_LOG = new TimeLog(ExportService.class); public <E extends TopiaEntity> ExportModel<E> buildForExport(AssociationMeta associationMeta) { @@ -101,14 +101,14 @@ } long s1 = TimeLog.getTime(); Export<TopiaEntity> export = prepareExport(tableMeta); - timeLog.log(s1, "exportDatas::prepareExport"); + TIME_LOG.log(s1, "exportDatas::prepareExport"); long s2 = TimeLog.getTime(); try { export.exportToFile(file); } catch (Exception eee) { throw new EchoBaseTechnicalException("Can not export datas", eee); } - timeLog.log(s2, "exportDatas::exportToFile"); + TIME_LOG.log(s2, "exportDatas::exportToFile"); } public void exportDatas(AssociationMeta associationMeta, File file) { @@ -118,7 +118,7 @@ } long s1 = TimeLog.getTime(); Export<TopiaEntity> export = prepareExport(associationMeta); - timeLog.log(s1, "exportDatas::prepareExport"); + TIME_LOG.log(s1, "exportDatas::prepareExport"); long s2 = TimeLog.getTime(); try { @@ -126,7 +126,7 @@ } catch (Exception eee) { throw new EchoBaseTechnicalException("Can not export datas", eee); } - timeLog.log(s2, "exportDatas::exportToFile"); + TIME_LOG.log(s2, "exportDatas::exportToFile"); } protected Export<TopiaEntity> prepareExport(TableMeta tableMeta) { Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java 2012-01-13 17:29:04 UTC (rev 276) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ImportDbService.java 2012-01-13 17:41:09 UTC (rev 277) @@ -66,7 +66,7 @@ private static final Log log = LogFactory.getLog(ImportDbService.class); - public static final TimeLog timeLog = new TimeLog(ImportDbService.class); + public static final TimeLog TIME_LOG = new TimeLog(ImportDbService.class); /** * Import a complete db from the given zip file. @@ -153,12 +153,9 @@ result.put(entry, zipEntry); } } - if (!missingEntries.isEmpty()) { - - if (log.isWarnEnabled()) { - log.warn("There is " + missingEntries.size() + " missing files " + - " in import " + file + "\n" + StringUtil.join(missingEntries, "\n", false)); - } + if (!missingEntries.isEmpty() && log.isWarnEnabled()) { + log.warn("There is " + missingEntries.size() + " missing files " + + " in import " + file + "\n" + StringUtil.join(missingEntries, "\n", false)); } return result; @@ -219,13 +216,13 @@ } } - timeLog.log(s0, "importFile::done"); + TIME_LOG.log(s0, "importFile::done"); s0 = TimeLog.getTime(); flushTransaction(); - timeLog.log(s0, "importFile::flushTransaction"); + TIME_LOG.log(s0, "importFile::flushTransaction"); } protected void importEntityFile(TableMeta meta, Modified: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/SampleLoader.java =================================================================== --- trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/SampleLoader.java 2012-01-13 17:29:04 UTC (rev 276) +++ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/SampleLoader.java 2012-01-13 17:41:09 UTC (rev 277) @@ -314,26 +314,18 @@ } } - if (!operationNotFound.isEmpty()) { - if (log.isWarnEnabled()) { - log.warn("operation not found : \n" + StringUtil.join(operationNotFound, "\n", false)); - } + if (!operationNotFound.isEmpty() && log.isWarnEnabled()) { + log.warn("operation not found : \n" + StringUtil.join(operationNotFound, "\n", false)); } - if (!ntotNull.isEmpty()) { - if (log.isWarnEnabled()) { - log.warn("NTOT is null for operation :\n" + StringUtil.join(ntotNull, "\n", false)); - } + if (!ntotNull.isEmpty() && log.isWarnEnabled()) { + log.warn("NTOT is null for operation :\n" + StringUtil.join(ntotNull, "\n", false)); } - if (!pmensNull.isEmpty()) { - if (log.isWarnEnabled()) { - log.warn("PESP_MENS is null for operation\n" + StringUtil.join(pmensNull, "\n", false)); - } + if (!pmensNull.isEmpty() && log.isWarnEnabled()) { + log.warn("PESP_MENS is null for operation\n" + StringUtil.join(pmensNull, "\n", false)); } - if (!valeurBiometryNull.isEmpty()) { - if (log.isWarnEnabled()) { - log.warn("Null value of VALEUR_BIOMETRIE for operationId/Species/Individu/Code param\n" + StringUtil.join(valeurBiometryNull, "\n", false)); - } + if (!valeurBiometryNull.isEmpty() && log.isWarnEnabled()) { + log.warn("Null value of VALEUR_BIOMETRIE for operationId/Species/Individu/Code param\n" + StringUtil.join(valeurBiometryNull, "\n", false)); } if (log.isInfoEnabled()) { log.info("Found " + nbSampleTotal + " 'total' sample(s).");
participants (1)
-
tchemit@users.forge.codelutin.com