Index: lams_admin/src/java/org/lamsfoundation/lams/admin/util/ExcelUserImportFileParser.java =================================================================== RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/util/Attic/ExcelUserImportFileParser.java,v diff -u -r1.9 -r1.10 --- lams_admin/src/java/org/lamsfoundation/lams/admin/util/ExcelUserImportFileParser.java 29 Nov 2006 01:56:23 -0000 1.9 +++ lams_admin/src/java/org/lamsfoundation/lams/admin/util/ExcelUserImportFileParser.java 29 Nov 2006 03:56:37 -0000 1.10 @@ -350,20 +350,24 @@ while (index != -1) { log.debug("using role name: "+roleDescription.substring(fromIndex, index)); List list = service.findByProperty(Role.class, "name", roleDescription.substring(fromIndex, index)); - Role role = (list==null ? null : (Role)list.get(0)); - if (role!=null) { //ignore wrong spelled role + Role role = (list==null || list.isEmpty() ? null : (Role)list.get(0)); + if (role!=null) { roles.add(role.getRoleId().toString()); log.debug("role: "+role.getName()); + } else { + return null; // if we can't translate the name to a role, return null } fromIndex = index + 1; index = roleDescription.indexOf(SEPARATOR, fromIndex); } log.debug("using rolee name: "+roleDescription.substring(fromIndex, roleDescription.length())); List list = service.findByProperty(Role.class, "name", roleDescription.substring(fromIndex, roleDescription.length())); - Role role = (list==null ? null : (Role)list.get(0)); + Role role = (list==null || list.isEmpty() ? null : (Role)list.get(0)); if (role!=null) { roles.add(role.getRoleId().toString()); log.debug("rolee: "+role.getName()); + } else { + return null; } return roles; }