MPLUGIN-76: Fixed file encoding employed by PluginXDocGenerator

Submitted by: Benjamin Bentmann
Reviewed by: Vincent Siveton

o applied


git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@629658 13f79535-47bb-0310-9956-ffa450edef68
master
Vincent Siveton 2008-02-21 00:00:28 +00:00
parent ea424cff87
commit 623ab836c9
1 changed files with 8 additions and 5 deletions

View File

@ -20,8 +20,10 @@ package org.apache.maven.tools.plugin.generator;
*/
import java.io.File;
import java.io.FileWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -87,10 +89,11 @@ public class PluginXdocGenerator
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, File destinationDirectory )
throws IOException
{
FileWriter writer = null;
File outputFile = new File( destinationDirectory, getMojoFilename( mojoDescriptor, "xml" ) );
OutputStreamWriter writer = null;
try
{
writer = new FileWriter( new File( destinationDirectory, getMojoFilename( mojoDescriptor, "xml" ) ) );
writer = new OutputStreamWriter( new FileOutputStream( outputFile ), "UTF-8" );
writeBody( writer, mojoDescriptor );
@ -107,9 +110,9 @@ public class PluginXdocGenerator
return mojo.getGoal() + "-mojo." + ext;
}
private void writeBody( FileWriter writer, MojoDescriptor mojoDescriptor )
private void writeBody( OutputStreamWriter writer, MojoDescriptor mojoDescriptor )
{
XMLWriter w = new PrettyPrintXMLWriter( writer );
XMLWriter w = new PrettyPrintXMLWriter( new PrintWriter( writer ), writer.getEncoding(), null );
w.startElement( "document" );