Permalink
Browse files

[#1572] play.mvc.Mailer setSubject() fails on Messages.get with % - n…

…ow only does fomrat if it receives args
  • Loading branch information...
Notalifeform committed Feb 8, 2013
1 parent e9c745b commit 932da8f4099a512f151a8eba965dcab0615cae93
@@ -33,7 +33,10 @@ public static void setSubject(String subject, Object... args) {
if (map == null) {
throw new UnexpectedException("Mailer not instrumented ?");
}
- map.put("subject", String.format(subject, args));
+ if(args.length != 0){
+ subject = String.format(subject, args);
+ }
+ map.put("subject", subject);
infos.set(map);
}
@@ -224,6 +224,12 @@ public static void mail5() throws EmailException {
renderText("OK5");
}
+
+ public static void mailwithpercentinsubject() {
+ notifiers.Welcome.subjectwithpercent();
+ renderText("OKPCT");
+ }
+
public static void mailWithUrls() {
notifiers.Welcome.welcome_mailWithUrls(false);
renderText("OK_mailWithUrls");
@@ -30,6 +30,13 @@ public static void welcome3() {
send(msg);
}
+ public static void subjectwithpercent() {
+ String msg = "Welcome";
+ setFrom("x@x.com");
+ setSubject("Yop4 % o");
+ addRecipient("toto@localhost");
+ send(msg);
+ }
public static void seleniumTest() {
String msg = "Selenium";
setFrom("x@x.com");
@@ -34,6 +34,12 @@
store('javascript{/name:\s+(.*)\s*/.exec(storedVars["email5"])[1]}', 'body')
assertEquals('fond2.png', '$[body]')
+ // show that
+ // https://play.lighthouseapp.com/projects/57987/tickets/1572-playmvcmailer-setsubject-fails-on-messagesget-with
+ // is fixed
+ open('@{Application.mailwithpercentinsubject()}')
+ assertTextPresent('OKPCT')
+
open('@{Application.mailWithUrls()}')
assertTextPresent('OK_mailWithUrls')
storeLastReceivedEmailBy('mailWithUrls@localhost', 'mailWithUrls')

0 comments on commit 932da8f

Please sign in to comment.