Index: lams_admin/src/java/org/lamsfoundation/lams/admin/util/ExcelUserImportFileParser.java =================================================================== diff -u -r714a9041a21f37ffde222e8f6ccac8c5bce9a05b -rbed82e872766866852ecc9422a2540197ebc8977 --- lams_admin/src/java/org/lamsfoundation/lams/admin/util/ExcelUserImportFileParser.java (.../ExcelUserImportFileParser.java) (revision 714a9041a21f37ffde222e8f6ccac8c5bce9a05b) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/util/ExcelUserImportFileParser.java (.../ExcelUserImportFileParser.java) (revision bed82e872766866852ecc9422a2540197ebc8977) @@ -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; }