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-ffa450edef68master
parent
ea424cff87
commit
623ab836c9
|
|
@ -20,8 +20,10 @@ package org.apache.maven.tools.plugin.generator;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -87,10 +89,11 @@ public class PluginXdocGenerator
|
||||||
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, File destinationDirectory )
|
protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, File destinationDirectory )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
FileWriter writer = null;
|
File outputFile = new File( destinationDirectory, getMojoFilename( mojoDescriptor, "xml" ) );
|
||||||
|
OutputStreamWriter writer = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = new FileWriter( new File( destinationDirectory, getMojoFilename( mojoDescriptor, "xml" ) ) );
|
writer = new OutputStreamWriter( new FileOutputStream( outputFile ), "UTF-8" );
|
||||||
|
|
||||||
writeBody( writer, mojoDescriptor );
|
writeBody( writer, mojoDescriptor );
|
||||||
|
|
||||||
|
|
@ -107,9 +110,9 @@ public class PluginXdocGenerator
|
||||||
return mojo.getGoal() + "-mojo." + ext;
|
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" );
|
w.startElement( "document" );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue