Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/services
In directory james.mmbase.org:/tmp/cvs-serv6483
Modified Files:
Tag: b1_5
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.14
retrieving revision 1.14.2.1
diff -u -b -r1.14 -r1.14.2.1
--- CommunityModuleAdapter.java 22 Sep 2008 07:53:42 -0000 1.14
+++ CommunityModuleAdapter.java 21 Oct 2008 07:25:05 -0000 1.14.2.1
@@ -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;
}
@@ -62,7 +76,7 @@
public static String getUserNameByAuthenticationId(int authenticationId) {
AuthenticationService authenticationService = (AuthenticationService)
ApplicationContextFactory.getApplicationContext().getBean("authenticationService");
com.finalist.cmsc.services.community.security.Authentication
authentication = authenticationService.getAuthenticationById(new
Long(authenticationId));
- if(authentication != null) {
+ if (authentication != null) {
return authentication.getUserId();
}
return null;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs