Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services
In directory james.mmbase.org:/tmp/cvs-serv6517
Modified Files:
CommunityModuleAdapter.java
Log Message:
CMSC-1097 Opening Newsletter Management first time gives stacktrace
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services
See also: http://www.mmbase.org/jira/browse/CMSC-1097
Index: CommunityModuleAdapter.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services/CommunityModuleAdapter.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- CommunityModuleAdapter.java 14 Oct 2008 11:22:44 -0000 1.15
+++ CommunityModuleAdapter.java 21 Oct 2008 07:25:57 -0000 1.16
@@ -4,8 +4,10 @@
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
+import org.apache.commons.lang.StringUtils;
import org.mmbase.util.logging.Logger;
import org.mmbase.util.logging.Logging;
+import org.springframework.beans.BeansException;
import com.finalist.cmsc.services.community.ApplicationContextFactory;
import com.finalist.cmsc.services.community.person.Person;
@@ -52,9 +54,21 @@
public static Person getUserById(String id) {
+ Person person = null;
+ if(StringUtils.isEmpty(id)) {
+ return person;
+ }
+ try {
PersonService personService = (PersonService)
ApplicationContextFactory.getApplicationContext().getBean("personService");
- Person person =
personService.getPersonByAuthenticationId(Long.decode(id));
+ person =
personService.getPersonByAuthenticationId(Long.parseLong(id));
log.debug("Get user(Person) " + id + " from community module,get " +
person);
+ }
+ catch (BeansException e) {
+ log.error("BeansException when get the instance of PersonService");
+ }
+ catch (NumberFormatException e) {
+ log.error("NumberFormatException ; parse [" + id + "] to Number
exception");
+ }
return person;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs