Skip to content

Commit 58ef19c

Browse files
committed
Use caching writers when writing xsd / xdoc
1 parent 447e717 commit 58ef19c

File tree

2 files changed

+6
-4
lines changed
  • modello-plugins

2 files changed

+6
-4
lines changed

modello-plugins/modello-plugin-xdoc/src/main/java/org/codehaus/modello/plugin/xdoc/XdocGenerator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.io.File;
2929
import java.io.IOException;
3030
import java.io.Writer;
31+
import java.nio.charset.StandardCharsets;
3132
import java.util.*;
3233
import java.util.stream.Collectors;
3334

@@ -56,9 +57,9 @@
5657
import org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata;
5758
import org.codehaus.modello.plugins.xml.metadata.XmlModelMetadata;
5859
import org.codehaus.plexus.util.StringUtils;
60+
import org.codehaus.plexus.util.io.CachingWriter;
5961
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
6062
import org.codehaus.plexus.util.xml.XMLWriter;
61-
import org.codehaus.plexus.util.xml.XmlStreamWriter;
6263
import org.jsoup.Jsoup;
6364
import org.jsoup.nodes.Document;
6465

@@ -115,7 +116,7 @@ private void generateXdoc(Properties parameters) throws IOException {
115116
f = new File(directory, xdocFileName);
116117
}
117118

118-
Writer writer = new XmlStreamWriter(f);
119+
Writer writer = new CachingWriter(f, StandardCharsets.UTF_8);
119120

120121
XMLWriter w = new PrettyPrintXMLWriter(writer);
121122

modello-plugins/modello-plugin-xsd/src/main/java/org/codehaus/modello/plugin/xsd/XsdGenerator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.File;
2828
import java.io.IOException;
2929
import java.io.Writer;
30+
import java.nio.charset.StandardCharsets;
3031
import java.util.HashSet;
3132
import java.util.List;
3233
import java.util.Properties;
@@ -43,9 +44,9 @@
4344
import org.codehaus.modello.plugins.xml.metadata.XmlAssociationMetadata;
4445
import org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata;
4546
import org.codehaus.plexus.util.StringUtils;
47+
import org.codehaus.plexus.util.io.CachingWriter;
4648
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
4749
import org.codehaus.plexus.util.xml.XMLWriter;
48-
import org.codehaus.plexus.util.xml.XmlStreamWriter;
4950

5051
/**
5152
* @author <a href="mailto:[email protected]">Brett Porter</a>
@@ -93,7 +94,7 @@ private void generateXsd(Properties parameters) throws IOException, ModelloExcep
9394
f = new File(directory, xsdFileName);
9495
}
9596

96-
Writer writer = new XmlStreamWriter(f);
97+
Writer writer = new CachingWriter(f, StandardCharsets.UTF_8);
9798

9899
try {
99100
XMLWriter w = new PrettyPrintXMLWriter(writer);

0 commit comments

Comments
 (0)