HDFS-12221. Replace xcerces in XmlEditsVisitor. (Ajay Kumar via lei)
This commit is contained in:
parent
d8f74c3964
commit
ce797a1706
@ -628,12 +628,6 @@
|
||||
<exclude>**/*.class</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>xerces:xercesImpl</artifact>
|
||||
<excludes>
|
||||
<exclude>**/*</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.apache.hadoop:hadoop-mapreduce-client-jobclient:*</artifact>
|
||||
<excludes>
|
||||
|
@ -174,13 +174,6 @@
|
||||
<exclude>org/apache/jasper/compiler/Localizer.class</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
<!-- We only have xerces as a dependency for XML output for the fsimage edits, we don't need anything specific to it for javax xml support -->
|
||||
<filter>
|
||||
<artifact>xerces:xercesImpl</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/services/*</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
<!-- We rely on jersey for our web interfaces. We want to use its java services stuff only internal to jersey -->
|
||||
<filter>
|
||||
<artifact>com.sun.jersey:*</artifact>
|
||||
|
@ -173,11 +173,6 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<artifactId>netty-all</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.htrace</groupId>
|
||||
<artifactId>htrace-core4</artifactId>
|
||||
|
@ -20,17 +20,21 @@
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.sax.SAXTransformerFactory;
|
||||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
import org.apache.hadoop.hdfs.util.XMLUtils;
|
||||
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
import org.apache.xml.serialize.OutputFormat;
|
||||
import org.apache.xml.serialize.XMLSerializer;
|
||||
|
||||
/**
|
||||
* An XmlEditsVisitor walks over an EditLog structure and writes out
|
||||
@ -41,26 +45,37 @@
|
||||
public class XmlEditsVisitor implements OfflineEditsVisitor {
|
||||
private final OutputStream out;
|
||||
private ContentHandler contentHandler;
|
||||
private final SAXTransformerFactory factory;
|
||||
private final static String XML_INDENTATION_PROP ="{http://xml.apache.org/" +
|
||||
"xslt}indent-amount";
|
||||
private final static String XML_INDENTATION_NUM ="2";
|
||||
|
||||
/**
|
||||
* Create a processor that writes to the file named and may or may not
|
||||
* also output to the screen, as specified.
|
||||
*
|
||||
* @param filename Name of file to write output to
|
||||
* @param printToScreen Mirror output to screen?
|
||||
* @param out output stream to write
|
||||
* @throws IOException on any error
|
||||
*/
|
||||
public XmlEditsVisitor(OutputStream out)
|
||||
throws IOException {
|
||||
this.out = out;
|
||||
OutputFormat outFormat = new OutputFormat("XML", "UTF-8", true);
|
||||
outFormat.setIndenting(true);
|
||||
outFormat.setIndent(2);
|
||||
outFormat.setDoctype(null, null);
|
||||
XMLSerializer serializer = new XMLSerializer(out, outFormat);
|
||||
contentHandler = serializer.asContentHandler();
|
||||
factory =(SAXTransformerFactory)SAXTransformerFactory.newInstance();
|
||||
try {
|
||||
TransformerHandler handler = factory.newTransformerHandler();
|
||||
handler.getTransformer().setOutputProperty(OutputKeys.METHOD, "xml");
|
||||
handler.getTransformer().setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
||||
handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
handler.getTransformer().setOutputProperty(XML_INDENTATION_PROP,
|
||||
XML_INDENTATION_NUM);
|
||||
handler.getTransformer().setOutputProperty(OutputKeys.STANDALONE, "yes");
|
||||
handler.setResult(new StreamResult(out));
|
||||
contentHandler = handler;
|
||||
|
||||
contentHandler.startDocument();
|
||||
contentHandler.startElement("", "", "EDITS", new AttributesImpl());
|
||||
} catch (TransformerConfigurationException e) {
|
||||
throw new IOException("SAXTransformer error: " + e.getMessage());
|
||||
} catch (SAXException e) {
|
||||
throw new IOException("SAX error: " + e.getMessage());
|
||||
}
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<EDITS>
|
||||
<EDITS_VERSION>-63</EDITS_VERSION>
|
||||
<EDITS_VERSION>-64</EDITS_VERSION>
|
||||
<RECORD>
|
||||
<OPCODE>OP_START_LOG_SEGMENT</OPCODE>
|
||||
<DATA>
|
||||
@ -63,8 +63,8 @@
|
||||
<MTIME>1422406380369</MTIME>
|
||||
<ATIME>1422406380345</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<PERMISSION_STATUS>
|
||||
<USERNAME>xyao</USERNAME>
|
||||
@ -96,8 +96,8 @@
|
||||
<MTIME>1422406380376</MTIME>
|
||||
<ATIME>1422406380345</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<PERMISSION_STATUS>
|
||||
<USERNAME>xyao</USERNAME>
|
||||
@ -238,8 +238,8 @@
|
||||
<MTIME>1422406380425</MTIME>
|
||||
<ATIME>1422406380423</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<PERMISSION_STATUS>
|
||||
<USERNAME>xyao</USERNAME>
|
||||
@ -360,7 +360,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1001</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -393,7 +393,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1002</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -426,7 +426,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1003</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -441,8 +441,8 @@
|
||||
<MTIME>1422406380534</MTIME>
|
||||
<ATIME>1422406380446</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<BLOCK>
|
||||
<BLOCK_ID>1073741825</BLOCK_ID>
|
||||
@ -513,7 +513,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1004</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -546,7 +546,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1005</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -579,7 +579,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1006</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -594,8 +594,8 @@
|
||||
<MTIME>1422406380558</MTIME>
|
||||
<ATIME>1422406380537</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<BLOCK>
|
||||
<BLOCK_ID>1073741828</BLOCK_ID>
|
||||
@ -666,7 +666,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1007</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -699,7 +699,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1008</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -732,7 +732,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1009</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -747,8 +747,8 @@
|
||||
<MTIME>1422406380579</MTIME>
|
||||
<ATIME>1422406380560</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<BLOCK>
|
||||
<BLOCK_ID>1073741831</BLOCK_ID>
|
||||
@ -834,7 +834,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1010</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -867,7 +867,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1011</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -882,8 +882,8 @@
|
||||
<MTIME>1422406380599</MTIME>
|
||||
<ATIME>1422406380586</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<BLOCK>
|
||||
<BLOCK_ID>1073741834</BLOCK_ID>
|
||||
@ -979,7 +979,7 @@
|
||||
<NUM_BYTES>0</NUM_BYTES>
|
||||
<GENSTAMP>1012</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -993,7 +993,7 @@
|
||||
<NUM_BYTES>11</NUM_BYTES>
|
||||
<GENSTAMP>1012</GENSTAMP>
|
||||
</BLOCK>
|
||||
<RPC_CLIENTID></RPC_CLIENTID>
|
||||
<RPC_CLIENTID/>
|
||||
<RPC_CALLID>-2</RPC_CALLID>
|
||||
</DATA>
|
||||
</RECORD>
|
||||
@ -1024,8 +1024,8 @@
|
||||
<MTIME>1422406383261</MTIME>
|
||||
<ATIME>1422406380608</ATIME>
|
||||
<BLOCKSIZE>512</BLOCKSIZE>
|
||||
<CLIENT_NAME></CLIENT_NAME>
|
||||
<CLIENT_MACHINE></CLIENT_MACHINE>
|
||||
<CLIENT_NAME/>
|
||||
<CLIENT_MACHINE/>
|
||||
<OVERWRITE>false</OVERWRITE>
|
||||
<BLOCK>
|
||||
<BLOCK_ID>1073741836</BLOCK_ID>
|
||||
|
@ -238,14 +238,6 @@
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>hadoop-annotations.jar</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>${xerces.version.jdiff}</version>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>xerces.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
@ -283,7 +275,7 @@
|
||||
sourceFiles="${dev-support.relative.dir}/jdiff/Null.java"
|
||||
maxmemory="${jdiff.javadoc.maxmemory}">
|
||||
<doclet name="org.apache.hadoop.classification.tools.IncludePublicAnnotationsJDiffDoclet"
|
||||
path="${project.build.directory}/hadoop-annotations.jar:${project.build.directory}/jdiff.jar:${project.build.directory}/xerces.jar">
|
||||
path="${project.build.directory}/hadoop-annotations.jar:${project.build.directory}/jdiff.jar">
|
||||
<param name="-oldapi" value="${project.name} ${jdiff.stable.api}"/>
|
||||
<param name="-newapi" value="${project.name} ${project.version}"/>
|
||||
<param name="-oldapidir" value="${basedir}/${dev-support.relative.dir}/jdiff"/>
|
||||
|
@ -194,14 +194,6 @@
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>hadoop-annotations.jar</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>${xerces.jdiff.version}</version>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>xerces.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
@ -267,7 +259,7 @@
|
||||
sourceFiles="${basedir}/dev-support/jdiff/Null.java"
|
||||
maxmemory="${jdiff.javadoc.maxmemory}">
|
||||
<doclet name="org.apache.hadoop.classification.tools.IncludePublicAnnotationsJDiffDoclet"
|
||||
path="${project.build.directory}/hadoop-annotations.jar:${project.build.directory}/jdiff.jar:${project.build.directory}/xerces.jar">
|
||||
path="${project.build.directory}/hadoop-annotations.jar:${project.build.directory}/jdiff.jar">
|
||||
<param name="-oldapi" value="${project.name} ${jdiff.stable.api}"/>
|
||||
<param name="-newapi" value="${project.name} ${project.version}"/>
|
||||
<param name="-oldapidir" value="${basedir}/dev-support/jdiff"/>
|
||||
|
@ -45,8 +45,6 @@
|
||||
<!-- These 2 versions are defined here because they are used -->
|
||||
<!-- JDIFF generation from embedded ant in the antrun plugin -->
|
||||
<jdiff.version>1.0.9</jdiff.version>
|
||||
<!-- Version number for xerces used by JDiff -->
|
||||
<xerces.jdiff.version>2.11.0</xerces.jdiff.version>
|
||||
|
||||
<kafka.version>0.8.2.1</kafka.version>
|
||||
<hbase.version>1.2.6</hbase.version>
|
||||
@ -1155,12 +1153,6 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.9.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-recipes</artifactId>
|
||||
|
@ -155,14 +155,6 @@
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>hadoop-annotations.jar</destFileName>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>${xerces.version.jdiff}</version>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<destFileName>xerces.jar</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
@ -201,7 +193,7 @@
|
||||
sourceFiles="${dev-support.relative.dir}/jdiff/Null.java"
|
||||
maxmemory="${jdiff.javadoc.maxmemory}">
|
||||
<doclet name="org.apache.hadoop.classification.tools.IncludePublicAnnotationsJDiffDoclet"
|
||||
path="${project.build.directory}/hadoop-annotations.jar:${project.build.directory}/jdiff.jar:${project.build.directory}/xerces.jar">
|
||||
path="${project.build.directory}/hadoop-annotations.jar:${project.build.directory}/jdiff.jar">
|
||||
<param name="-oldapi" value="${project.name} ${jdiff.stable.api}"/>
|
||||
<param name="-newapi" value="${project.name} ${project.version}"/>
|
||||
<param name="-oldapidir" value="${basedir}/${dev-support.relative.dir}/jdiff"/>
|
||||
|
Loading…
Reference in New Issue
Block a user