[Suiviobsmer-commits] r477 - in trunk: . wao-business/src/main/java/fr/ifremer/wao wao-business/src/main/java/fr/ifremer/wao/service
Author: fdesbois Date: 2010-05-03 20:05:40 +0000 (Mon, 03 May 2010) New Revision: 477 Log: Ano #2287 : fix to avoid saving contacts with null observer (can't reproduce when it's appear) Modified: trunk/changelog.txt trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java Modified: trunk/changelog.txt =================================================================== --- trunk/changelog.txt 2010-05-03 19:57:42 UTC (rev 476) +++ trunk/changelog.txt 2010-05-03 20:05:40 UTC (rev 477) @@ -9,6 +9,8 @@ Anomalies +++++++++ +- [fdesbois] Ano #2286 : Filtre sur les observateurs de la page contact ne + fonctionne pas. - [fdesbois] Ano #2287 : Problème de sauvegarde de l'observateur sur un contact. - [fdesbois] Ano #2282 : Doublon sur les navires éligibles pour une ligne. Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java 2010-05-03 19:57:42 UTC (rev 476) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoContextImpl.java 2010-05-03 20:05:40 UTC (rev 477) @@ -323,7 +323,7 @@ if (log.isDebugEnabled()) { log.debug(_(message, args),eee); } -// if (!(eee instanceof WaoException)) { + if (!(eee instanceof WaoException)) { //if (!(eee instanceof TopiaException)) { try { if (transaction != null && !transaction.isClosed()) { @@ -338,12 +338,13 @@ } //} if (eee instanceof SQLGrammarException && log.isErrorEnabled()) { - log.error("SQL executed with error : " + ((SQLGrammarException)eee).getSQL()); + log.error("SQL executed with error : " + + ((SQLGrammarException)eee).getSQL()); } throw new WaoException(eee, message, args); -// } else { -// throw (WaoException)eee; -// } + } else { + throw (WaoException)eee; + } } @Override Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2010-05-03 19:57:42 UTC (rev 476) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2010-05-03 20:05:40 UTC (rev 477) @@ -172,10 +172,20 @@ throws TopiaException, NullSampleMonthException { // Ano #2287 Temporary fix to avoid saving a null observer -// if (contact.getObserver() == null) { -// throw new NullPointerException("L'observateur n'a pas été" + -// " renseigné correctement pour la sauvegarde du contact"); -// } + if (contact.getObserver() == null) { + // Throw a NullPointerException to avoid saving null observer + Throwable exception = + new NullPointerException("observer can't be null to save" + + " the contact"); + + if (log.isWarnEnabled()) { + log.warn("observer null when saving contact", exception); + } + // This message will be displayed to Client + throw new WaoException(exception, + "L'observateur n'a pas été renseigné correctement pour " + + "la sauvegarde du contact"); + } ContactDAO dao = WaoDAOHelper.getContactDAO(transaction);
participants (1)
-
fdesbois@users.labs.libre-entreprise.org