Index: src/main/java/org/apache/maven/plugin/announcement/AnnouncementMailMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/announcement/AnnouncementMailMojo.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/announcement/AnnouncementMailMojo.java (working copy) @@ -143,7 +143,7 @@ * @parameter expression="${project.build.directory}/announcement" * @required */ - private String templateOutputDirectory; + private File templateOutputDirectory; /** * The Velocity template used to format the announcement. @@ -158,7 +158,7 @@ public void execute() throws MojoExecutionException { - template = templateOutputDirectory + "/" + template; + File templateFile = new File( templateOutputDirectory, template ); ConsoleLogger logger = new ConsoleLogger( 0, "base" ); @@ -186,7 +186,7 @@ getLog().debug( "fromDeveloperId: " + getFromDeveloperId() ); } - if ( isTextFileExisting( template ) ) + if ( templateFile.isFile() ) { getLog().info( "Connecting to Host: " + getSmtpHost() + ":" + getSmtpPort() ); @@ -194,23 +194,7 @@ } else { - if ( template != null ) - { - if ( isTextFileExisting( template ) ) - { - getLog().info( "Connecting to Host: " + getSmtpHost() + " : " + getSmtpPort() ); - - sendMessage(); - } - else - { - throw new MojoExecutionException( "Announcement template " + template + " not found..." ); - } - } - else - { - throw new MojoExecutionException( "Announcement template " + template + " not found..." ); - } + throw new MojoExecutionException( "Announcement template " + templateFile + " not found..." ); } } @@ -222,6 +206,7 @@ protected void sendMessage() throws MojoExecutionException { + File templateFile = new File( templateOutputDirectory, template ); String email = ""; final MailSender ms = getActualMailSender(); final String fromName = ms.getName(); @@ -238,7 +223,7 @@ { email = it.next().toString(); getLog().info( "Sending mail to " + email + "..." ); - mailer.send( getSubject(), IOUtil.toString( readAnnouncement( template ) ), email, "", fromAddress, + mailer.send( getSubject(), IOUtil.toString( readAnnouncement( templateFile ) ), email, "", fromAddress, fromName ); getLog().info( "Sent..." ); } @@ -253,38 +238,24 @@ } } - protected boolean isTextFileExisting( String fileName ) - { - boolean found = false; - - File f = new File( fileName ); - - if ( f.exists() ) - { - found = true; - } - return found; - } - /** * Read the announcement generated file. * - * @param fileName the filename to be read + * @param file the filename to be read * @return fileReader Return the FileReader * @throws MojoExecutionException if the file could not be found */ - protected FileReader readAnnouncement( String fileName ) + protected FileReader readAnnouncement( File file ) throws MojoExecutionException { FileReader fileReader; try { - File file = new File( fileName ); fileReader = new FileReader( file ); } catch ( FileNotFoundException fnfe ) { - throw new MojoExecutionException( "File not found. " + fileName ); + throw new MojoExecutionException( "File not found. " + file ); } return fileReader; } @@ -451,12 +422,12 @@ this.mailSender = mailSender; } - public String getTemplateOutputDirectory() + public File getTemplateOutputDirectory() { return templateOutputDirectory; } - public void setTemplateOutputDirectory( String templateOutputDirectory ) + public void setTemplateOutputDirectory( File templateOutputDirectory ) { this.templateOutputDirectory = templateOutputDirectory; } Index: src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java (working copy) @@ -57,7 +57,7 @@ * @parameter expression="${project.build.directory}/announcement" * @required */ - private String outputDirectory; + private File outputDirectory; /** * @parameter expression="${project.groupId}" @@ -117,7 +117,7 @@ * @parameter expression="${basedir}/src/changes/changes.xml" * @required */ - private String xmlPath; + private File xmlPath; /** * Name of the team that develops the artifact. @@ -215,7 +215,7 @@ * @required * @readonly */ - private String jiraXML; + private File jiraXML; /** * The maximum number of issues to include. @@ -425,7 +425,7 @@ * @param template velocity template which will the context be merged * @throws ResourceNotFoundException, VelocityException, IOException */ - public void processTemplate( Context context, String outputDirectory, String template ) + public void processTemplate( Context context, File outputDirectory, String template ) throws ResourceNotFoundException, VelocityException, MojoExecutionException { File f; @@ -474,7 +474,7 @@ { JiraDownloader jiraDownloader = new JiraDownloader(); - File jiraXMLFile = new File( jiraXML ); + File jiraXMLFile = jiraXML; jiraDownloader.setLog( getLog() ); @@ -515,22 +515,22 @@ * accessors */ - public String getXmlPath() + public File getXmlPath() { return xmlPath; } - public void setXmlPath( String xmlPath ) + public void setXmlPath( File xmlPath ) { this.xmlPath = xmlPath; } - public String getOutputDirectory() + public File getOutputDirectory() { return outputDirectory; } - public void setOutputDirectory( String outputDirectory ) + public void setOutputDirectory( File outputDirectory ) { this.outputDirectory = outputDirectory; } Index: src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java (working copy) @@ -48,7 +48,7 @@ * @required * @readonly */ - private String outputDirectory; + private File outputDirectory; /** * @parameter expression="${component.org.apache.maven.doxia.siterenderer.Renderer}" @@ -70,7 +70,7 @@ * @parameter expression="${basedir}/src/changes/changes.xml" * @required */ - private String xmlPath; + private File xmlPath; /** * Template string that is used to discover the URL to use to display an issue report. @@ -95,8 +95,7 @@ public boolean canGenerateReport() { - File xmlFile = new File( xmlPath ); - return xmlFile.exists(); + return xmlPath.isFile(); } private void copyStaticResources() @@ -171,7 +170,7 @@ protected String getOutputDirectory() { - return outputDirectory; + return outputDirectory.getAbsolutePath(); } private ResourceBundle getBundle( Locale locale ) Index: src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java =================================================================== --- src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java (working copy) @@ -19,6 +19,8 @@ * under the License. */ +import java.io.File; + import java.util.List; import java.util.ResourceBundle; @@ -45,7 +47,7 @@ { } - public ChangesReportGenerator( String xmlPath, Log log ) + public ChangesReportGenerator( File xmlPath, Log log ) { report = new ChangesXML( xmlPath, log ); } Index: src/main/java/org/apache/maven/plugin/changes/ChangesXML.java =================================================================== --- src/main/java/org/apache/maven/plugin/changes/ChangesXML.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/changes/ChangesXML.java (working copy) @@ -57,7 +57,7 @@ private String title; - public ChangesXML( String xmlPath, Log log ) + public ChangesXML( File xmlPath, Log log ) { SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -65,7 +65,7 @@ { SAXParser saxParser = factory.newSAXParser(); - saxParser.parse( new File( xmlPath ), this ); + saxParser.parse( xmlPath, this ); } catch ( Throwable t ) { Index: src/main/java/org/apache/maven/plugin/jira/JiraMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/jira/JiraMojo.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/jira/JiraMojo.java (working copy) @@ -46,7 +46,7 @@ * @required * @readonly */ - private String outputDirectory; + private File outputDirectory; /** * Path to the JIRA XML file, which will be parsed. @@ -55,7 +55,7 @@ * @required * @readonly */ - private String jiraXmlPath; + private File jiraXmlPath; /** * Doxia Site Renderer. @@ -247,7 +247,7 @@ { jiraDownloader.doExecute(); - if ( new File( jiraXmlPath ).exists() ) + if ( jiraXmlPath.isFile() ) { report = new JiraReportGenerator( jiraXmlPath, columnNames ); @@ -299,7 +299,7 @@ protected String getOutputDirectory() { - return outputDirectory; + return outputDirectory.getAbsolutePath(); } private ResourceBundle getBundle( Locale locale ) @@ -313,7 +313,7 @@ jira.setMavenProject( project ); - jira.setOutput( new File( jiraXmlPath ) ); + jira.setOutput( jiraXmlPath ); jira.setNbEntries( maxEntries ); Index: src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java =================================================================== --- src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/jira/JiraReportGenerator.java (working copy) @@ -19,6 +19,8 @@ * under the License. */ +import java.io.File; + import java.util.List; import java.util.ResourceBundle; @@ -67,7 +69,7 @@ } - public JiraReportGenerator( String xmlPath, String columnNames ) + public JiraReportGenerator( File xmlPath, String columnNames ) throws MavenReportException { jira = new JiraXML( xmlPath ); Index: src/main/java/org/apache/maven/plugin/jira/JiraXML.java =================================================================== --- src/main/java/org/apache/maven/plugin/jira/JiraXML.java (revision 614320) +++ src/main/java/org/apache/maven/plugin/jira/JiraXML.java (working copy) @@ -48,7 +48,7 @@ private JiraIssue issue; - public JiraXML( String xmlPath ) + public JiraXML( File xmlPath ) { SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -58,7 +58,7 @@ { SAXParser saxParser = factory.newSAXParser(); - saxParser.parse( new File( xmlPath ), this ); + saxParser.parse( xmlPath, this ); } catch ( Throwable t ) {