https://bz.apache.org/bugzilla/show_bug.cgi?id=68462
Bug ID: 68462 Summary: MailLogger fails when replyto, cc or bcc are empty Product: Ant Version: 1.10.14 Hardware: PC Status: NEW Severity: normal Priority: P2 Component: Core tasks Assignee: notifications@ant.apache.org Reporter: kristjanbja...@gmail.com Target Milestone: --- When using the MailLogger to send build results e-mails it fails when the following properties are empty even if they are marked as not being required properties: MailLogger.replyto MailLogger.success.cc MailLogger.success.bcc MailLogger.failure.cc MailLogger.failure.bcc Using the following build.xml: <?xml version="1.0" encoding="UTF-8" ?> <project name="test" default="test"> <property name="MailLogger.mailhost" value="smtp.gmail.com"/> <property name="MailLogger.port" value="465"/> <property name="MailLogger.ssl" value="true"/> <property name="MailLogger.user" value="exam...@example.com"/> <property name="MailLogger.password" value="redacted"/> <property name="MailLogger.from" value="${MailLogger.user}"/> <property name="MailLogger.success.to" value="${MailLogger.user}"/> <target name="test" > </target> </project> Using the following command line: ant -logger org.apache.tools.ant.listener.MailLogger Results in the following error message: BUILD SUCCESSFUL Total time: 0 seconds MailLogger failed to send e-mail! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48) at java.base/java.lang.String.charAt(String.java:1519) at org.apache.tools.ant.taskdefs.email.EmailAddress.trim(EmailAddress.java:125) at org.apache.tools.ant.taskdefs.email.EmailAddress.<init>(EmailAddress.java:105) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at org.apache.tools.ant.listener.MailLogger.splitEmailAddresses(MailLogger.java:427) at org.apache.tools.ant.listener.MailLogger.sendMimeMail(MailLogger.java:396) at org.apache.tools.ant.listener.MailLogger.buildFinished(MailLogger.java:172) at org.apache.tools.ant.Project.fireBuildFinished(Project.java:2111) at org.apache.tools.ant.Main.runBuild(Main.java:830) at org.apache.tools.ant.Main.startAnt(Main.java:223) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101) The problems seems to be in EmailAddress.trim function which is unable to handle the empty address string. -- You are receiving this mail because: You are the assignee for the bug.