src/org/sonews/daemon/command/PostCommand.java
changeset 58 b2df305a13ce
parent 42 7f84f4de2893
child 101 d54786065fa3
     1.1 --- a/src/org/sonews/daemon/command/PostCommand.java	Mon Jun 06 20:12:21 2011 +0200
     1.2 +++ b/src/org/sonews/daemon/command/PostCommand.java	Tue Sep 13 23:34:16 2011 +0200
     1.3 @@ -22,6 +22,7 @@
     1.4  import java.io.ByteArrayOutputStream;
     1.5  import java.sql.SQLException;
     1.6  import java.util.Arrays;
     1.7 +import java.util.logging.Level;
     1.8  import javax.mail.MessagingException;
     1.9  import javax.mail.internet.AddressException;
    1.10  import javax.mail.internet.InternetHeaders;
    1.11 @@ -110,8 +111,8 @@
    1.12  
    1.13  						// add the header entries for the article
    1.14  						article.setHeaders(headers);
    1.15 -					} catch (MessagingException e) {
    1.16 -						e.printStackTrace();
    1.17 +					} catch (MessagingException ex) {
    1.18 +						Log.get().log(Level.INFO, ex.getLocalizedMessage(), ex);
    1.19  						conn.println("500 posting failed - invalid header");
    1.20  						state = PostState.Finished;
    1.21  						break;
    1.22 @@ -213,8 +214,7 @@
    1.23  			controlMessage(conn, article);
    1.24  		} else if (article.getHeader(Headers.SUPERSEDES)[0].length() > 0) {
    1.25  			supersedeMessage(conn, article);
    1.26 -		} else // Post the article regularily
    1.27 -		{
    1.28 +		} else { // Post the article regularily
    1.29  			// Circle check; note that Path can already contain the hostname here
    1.30  			String host = Config.inst().get(Config.HOSTNAME, "localhost");
    1.31  			if (article.getHeader(Headers.PATH)[0].indexOf(host + "!", 1) > 0) {
    1.32 @@ -234,8 +234,7 @@
    1.33  						if (group.isMailingList() && !conn.isLocalConnection()) {
    1.34  							// Send to mailing list; the Dispatcher writes
    1.35  							// statistics to database
    1.36 -							Dispatcher.toList(article, group.getName());
    1.37 -							success = true;
    1.38 +							success = Dispatcher.toList(article, group.getName());
    1.39  						} else {
    1.40  							// Store in database
    1.41  							if (!StorageManager.current().isArticleExisting(article.getMessageID())) {
    1.42 @@ -254,7 +253,7 @@
    1.43  					conn.println("240 article posted ok");
    1.44  					FeedManager.queueForPush(article);
    1.45  				} else {
    1.46 -					conn.println("441 newsgroup not found");
    1.47 +					conn.println("441 newsgroup not found or configuration error");
    1.48  				}
    1.49  			} catch (AddressException ex) {
    1.50  				Log.get().warning(ex.getMessage());