r2085 - branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service
Author: bleny Date: 2014-06-21 16:04:10 +0200 (Sat, 21 Jun 2014) New Revision: 2085 Url: http://forge.codelutin.com/projects/wao/repository/revisions/2085 Log: fix npe Modified: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java Modified: branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java =================================================================== --- branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-06-21 13:45:48 UTC (rev 2084) +++ branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-06-21 14:04:10 UTC (rev 2085) @@ -446,8 +446,13 @@ List<WaoUser> secondaryObservers = getWaoUserDao().forTopiaIdIn(updateContactCommand.getSecondaryObserverIds()).findAll(); updateContactCommand.getContact().setSecondaryObservers(new HashSet<>(secondaryObservers)); - TerrestrialLocation terrestrialLocation = getTerrestrialLocationDao().forTopiaIdEquals(updateContactCommand.getTerrestrialLocationId()).findUnique(); - updateContactCommand.getContact().setTerrestrialLocation(terrestrialLocation); + String terrestrialLocationId = updateContactCommand.getTerrestrialLocationId(); + if (StringUtils.isBlank(terrestrialLocationId)) { + updateContactCommand.getContact().setTerrestrialLocation(null); + } else { + TerrestrialLocation terrestrialLocation = getTerrestrialLocationDao().forTopiaIdEquals(terrestrialLocationId).findUnique(); + updateContactCommand.getContact().setTerrestrialLocation(terrestrialLocation); + } }
participants (1)
-
bleny@users.forge.codelutin.com