mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
(Nathan Sarr)
- One invalid email address no longer aborts whole subscription email process. Error is logged and emailing continues. SF patch #1246158; fixes SF bug #1245223 git-svn-id: http://scm.dspace.org/svn/repo/trunk@1264 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -74,7 +74,7 @@ import org.dspace.storage.rdbms.TableRowIterator;
|
||||
public class Subscribe
|
||||
{
|
||||
/** log4j logger */
|
||||
private static Logger log = Logger.getLogger(Group.class);
|
||||
private static Logger log = Logger.getLogger(Subscribe.class);
|
||||
|
||||
/**
|
||||
* Subscribe an e-person to a collection. An e-mail will be sent every day a
|
||||
@@ -237,7 +237,7 @@ public class Subscribe
|
||||
* DSpace context object
|
||||
*/
|
||||
public static void processDaily(Context context) throws SQLException,
|
||||
MessagingException, IOException
|
||||
IOException
|
||||
{
|
||||
// Grab the subscriptions
|
||||
TableRowIterator tri = DatabaseManager.query(context,
|
||||
@@ -259,7 +259,17 @@ public class Subscribe
|
||||
// New e-person. Send mail for previous e-person
|
||||
if (currentEPerson != null)
|
||||
{
|
||||
sendEmail(context, currentEPerson, collections);
|
||||
|
||||
try
|
||||
{
|
||||
sendEmail(context, currentEPerson, collections);
|
||||
}
|
||||
catch (MessagingException me)
|
||||
{
|
||||
log.error("Failed to send subscription to eperson_id="
|
||||
+ currentEPerson.getID());
|
||||
log.error(me);
|
||||
}
|
||||
}
|
||||
|
||||
currentEPerson = EPerson.find(context, row
|
||||
@@ -274,7 +284,16 @@ public class Subscribe
|
||||
// Process the last person
|
||||
if (currentEPerson != null)
|
||||
{
|
||||
sendEmail(context, currentEPerson, collections);
|
||||
try
|
||||
{
|
||||
sendEmail(context, currentEPerson, collections);
|
||||
}
|
||||
catch (MessagingException me)
|
||||
{
|
||||
log.error("Failed to send subscription to eperson_id="
|
||||
+ currentEPerson.getID());
|
||||
log.error(me);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,12 +420,27 @@ public class Subscribe
|
||||
* @param argv
|
||||
* command-line arguments, none used yet
|
||||
*/
|
||||
public static void main(String[] argv) throws Exception
|
||||
public static void main(String[] argv)
|
||||
{
|
||||
Context context = new Context();
|
||||
processDaily(context);
|
||||
Context context = null;
|
||||
|
||||
// Nothing is actually written
|
||||
context.abort();
|
||||
try
|
||||
{
|
||||
context = new Context();
|
||||
processDaily(context);
|
||||
context.complete();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
log.fatal(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if( context != null && context.isValid() )
|
||||
{
|
||||
// Nothing is actually written
|
||||
context.abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user