Update of /var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher In directory james.mmbase.org:/tmp/cvs-serv7335
Modified Files: Tag: b1_5 NewsletterGenerator.java Log Message: CMSC-1084, Newsletter: sending test email contains empty body,add error messages to print out it uses the system live-path variable See also: http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher See also: http://www.mmbase.org/jira/browse/CMSC-1084 Index: NewsletterGenerator.java =================================================================== RCS file: /var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/NewsletterGenerator.java,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -u -b -r1.11.2.1 -r1.11.2.2 --- NewsletterGenerator.java 14 Oct 2008 07:46:13 -0000 1.11.2.1 +++ NewsletterGenerator.java 23 Oct 2008 08:54:15 -0000 1.11.2.2 @@ -4,6 +4,7 @@ import java.io.Reader; import java.net.HttpURLConnection; import java.net.URL; +import java.util.regex.Pattern; import javax.mail.MessagingException; @@ -25,11 +26,15 @@ log.debug("generate newsletter from url:" + urlPath); String inputString = ""; + String errorInfo="please check the system live-path variable, "; try { log.debug("Try to get content from URL:" + urlPath); URL url = new URL(urlPath); + if (!Pattern.matches("http://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\ ?\\S*)?$", urlPath)) { + errorInfo += "the path does not start with http:// "; + } HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); @@ -57,7 +62,7 @@ return (inputString); } catch (Exception e) { - log.error("Error when try to get content from" + urlPath, e); + log.error("Error when try to get content from" + urlPath+errorInfo, e); } return inputString; _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs