Fixed the XML decoder

This commit is contained in:
Mirko Caserta 2013-12-04 21:07:25 +01:00 committed by Trustin Lee
parent 2d5a3b5898
commit 086dbd1ba1
7 changed files with 892 additions and 654 deletions

View File

@ -20,7 +20,6 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder; import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.CorruptedFrameException;
import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.TooLongFrameException;
import io.netty.util.CharsetUtil;
import java.util.List; import java.util.List;
@ -99,7 +98,7 @@ public class XmlFrameDecoder extends ByteToMessageDecoder {
final byte readByte = in.getByte(i); final byte readByte = in.getByte(i);
if (!openingBracketFound && Character.isWhitespace(readByte)) { if (!openingBracketFound && Character.isWhitespace(readByte)) {
// xml has not started and whitespace char found // xml has not started and whitespace char found
leadingWhiteSpaceCount ++; leadingWhiteSpaceCount++;
} else if (!openingBracketFound && readByte != '<') { } else if (!openingBracketFound && readByte != '<') {
// garbage found before xml start // garbage found before xml start
fail(ctx); fail(ctx);
@ -148,7 +147,7 @@ public class XmlFrameDecoder extends ByteToMessageDecoder {
} }
} }
if (openingBracketFound && atLeastOneXmlElementFound && openBracketsCount == 0) { if (atLeastOneXmlElementFound && openBracketsCount == 0) {
// xml is balanced, bailing out // xml is balanced, bailing out
break; break;
} }
@ -158,9 +157,11 @@ public class XmlFrameDecoder extends ByteToMessageDecoder {
final int readerIndex = in.readerIndex(); final int readerIndex = in.readerIndex();
if (openBracketsCount == 0 && length > 0) { if (openBracketsCount == 0 && length > 0) {
if (length >= in.writerIndex()) {
length = in.readableBytes();
}
final ByteBuf frame = final ByteBuf frame =
extractFrame(in, readerIndex + leadingWhiteSpaceCount, length - leadingWhiteSpaceCount); extractFrame(in, readerIndex + leadingWhiteSpaceCount, length - leadingWhiteSpaceCount);
System.err.println(in + ", " + frame + ", " + frame.toString(CharsetUtil.UTF_8));
in.skipBytes(length); in.skipBytes(length);
out.add(frame); out.add(frame);
} }

View File

@ -0,0 +1,20 @@
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/**
* Xml specific codecs.
*/
package io.netty.handler.codec.xml;

View File

@ -24,6 +24,13 @@ import io.netty.handler.codec.TooLongFrameException;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
import org.junit.Test; import org.junit.Test;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -34,8 +41,11 @@ import static org.junit.Assert.*;
public class XmlFrameDecoderTest { public class XmlFrameDecoderTest {
private final List<String> xmlSamples = private final List<String> xmlSamples;
Arrays.asList(SAMPLE_01, SAMPLE_02, SAMPLE_03, SAMPLE_04);
public XmlFrameDecoderTest() throws IOException, URISyntaxException {
xmlSamples = Arrays.asList(sample("01"), sample("02"), sample("03"), sample("04"));
}
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testConstructorWithIllegalArgs01() { public void testConstructorWithIllegalArgs01() {
@ -93,14 +103,14 @@ public class XmlFrameDecoderTest {
testDecodeWithXml( testDecodeWithXml(
"<root xmlns=\"http://www.acme.com/acme\" status=\"loginok\" timestamp=\"1362410583776\"/>\n" + "<root xmlns=\"http://www.acme.com/acme\" status=\"loginok\" timestamp=\"1362410583776\"/>\n" +
'\n' + '\n' +
"<root xmlns=\"http://www.acme.com/acme\" status=\"start\" time=\"0\" timestamp=\"1362410584794\">\n" + "<root xmlns=\"http://www.acme.com/acme\" status=\"start\" time=\"0\" " +
"<child active=\"1\" status=\"started\" id=\"935449\" msgnr=\"2\"/>\n" + "timestamp=\"1362410584794\">\n<child active=\"1\" status=\"started\" id=\"935449\" " +
"</root>", "msgnr=\"2\"/>\n</root>",
"<root xmlns=\"http://www.acme.com/acme\" status=\"loginok\" timestamp=\"1362410583776\"/>", "<root xmlns=\"http://www.acme.com/acme\" status=\"loginok\" timestamp=\"1362410583776\"/>",
"<root xmlns=\"http://www.acme.com/acme\" status=\"start\" time=\"0\" timestamp=\"1362410584794\">\n" + "<root xmlns=\"http://www.acme.com/acme\" status=\"start\" time=\"0\" timestamp=\"1362410584794\">\n" +
"<child active=\"1\" status=\"started\" id=\"935449\" msgnr=\"2\"/>\n" + "<child active=\"1\" status=\"started\" id=\"935449\" msgnr=\"2\"/>\n" +
"</root>" "</root>"
); );
} }
@Test @Test
@ -137,649 +147,14 @@ public class XmlFrameDecoderTest {
assertThat(actual, is(expectedList)); assertThat(actual, is(expectedList));
} }
private static final String SAMPLE_01 = "<root xmlns=\"http://www.acme.com/acme\" status=\"loginok\" timestamp=\"1362392496667\"/>"; private String sample(String number) throws IOException, URISyntaxException {
String path = "io/netty/handler/codec/xml/sample-".concat(number).concat(".xml");
private static final String SAMPLE_02 = "<root xmlns=\"http://www.acme.com/acme\" status=\"start\" time=\"0\" timestamp=\"1362392497684\">\n" + URL url = getClass().getClassLoader().getResource(path);
"<child active=\"1\" status=\"started\" id=\"935449\" msgnr=\"2\"/>\n" + if (url == null) {
"</root>"; throw new IllegalArgumentException("file not found: ".concat(path));
}
private static final String SAMPLE_03 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + byte[] buf = Files.readAllBytes(Paths.get(url.toURI()));
"<!--\n" + return StandardCharsets.UTF_8.decode(ByteBuffer.wrap(buf)).toString();
" ~ Copyright 2012 The Netty Project\n" + }
" ~\n" +
" ~ The Netty Project licenses this file to you under the Apache License,\n" +
" ~ version 2.0 (the \"License\"); you may not use this file except in compliance\n" +
" ~ with the License. You may obtain a copy of the License at:\n" +
" ~\n" +
" ~ http://www.apache.org/licenses/LICENSE-2.0\n" +
" ~\n" +
" ~ Unless required by applicable law or agreed to in writing, software\n" +
" ~ distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n" +
" ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n" +
" ~ License for the specific language governing permissions and limitations\n" +
" ~ under the License.\n" +
" -->\n" +
"<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" +
'\n' +
" <modelVersion>4.0.0</modelVersion>\n" +
" <parent>\n" +
" <groupId>org.sonatype.oss</groupId>\n" +
" <artifactId>oss-parent</artifactId>\n" +
" <version>7</version>\n" +
" </parent>\n" +
'\n' +
" <groupId>io.netty</groupId>\n" +
" <artifactId>netty-parent</artifactId>\n" +
" <packaging>pom</packaging>\n" +
" <version>4.0.0.Beta3-SNAPSHOT</version>\n" +
'\n' +
" <name>Netty</name>\n" +
" <url>http://netty.io/</url>\n" +
" <description>\n" +
" Netty is an asynchronous event-driven network application framework for \n" +
" rapid development of maintainable high performance protocol servers and\n" +
" clients.\n" +
" </description>\n" +
'\n' +
" <organization>\n" +
" <name>The Netty Project</name>\n" +
" <url>http://netty.io/</url>\n" +
" </organization>\n" +
'\n' +
" <licenses>\n" +
" <license>\n" +
" <name>Apache License, Version 2.0</name>\n" +
" <url>http://www.apache.org/licenses/LICENSE-2.0</url>\n" +
" </license>\n" +
" </licenses>\n" +
" <inceptionYear>2008</inceptionYear>\n" +
'\n' +
" <scm>\n" +
" <url>https://github.com/netty/netty</url>\n" +
" <connection>scm:git:git://github.com/netty/netty.git</connection>\n" +
" <developerConnection>scm:git:ssh://git@github.com/netty/netty.git</developerConnection>\n" +
" <tag>HEAD</tag>\n" +
" </scm>\n" +
'\n' +
" <developers>\n" +
" <developer>\n" +
" <id>netty.io</id>\n" +
" <name>The Netty Project Contributors</name>\n" +
" <email>netty@googlegroups.com</email>\n" +
" <url>http://netty.io/</url>\n" +
" <organization>The Netty Project</organization>\n" +
" <organizationUrl>http://netty.io/</organizationUrl>\n" +
" </developer>\n" +
" </developers>\n" +
'\n' +
" <properties>\n" +
" <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n" +
" <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n" +
" <jboss.marshalling.version>1.3.14.GA</jboss.marshalling.version>\n" +
" </properties>\n" +
" \n" +
" <modules>\n" +
" <module>common</module>\n" +
" <module>buffer</module>\n" +
" <module>codec</module>\n" +
" <module>codec-http</module>\n" +
" <module>codec-socks</module>\n" +
" <module>transport</module>\n" +
" <module>transport-rxtx</module>\n" +
" <module>transport-sctp</module>\n" +
" <module>transport-udt</module>\n" +
" <module>handler</module>\n" +
" <module>example</module>\n" +
" <module>testsuite</module>\n" +
" <module>testsuite-osgi</module>\n" +
" <module>microbench</module>\n" +
" <module>all</module>\n" +
" <module>tarball</module>\n" +
" </modules>\n" +
'\n' +
" <dependencyManagement>\n" +
" <dependencies>\n" +
" <!-- JBoss Marshalling - completely optional -->\n" +
" <dependency>\n" +
" <groupId>org.jboss.marshalling</groupId>\n" +
" <artifactId>jboss-marshalling</artifactId>\n" +
" <version>${jboss.marshalling.version}</version>\n" +
" <scope>compile</scope>\n" +
" <optional>true</optional>\n" +
" </dependency>\n" +
" \n" +
" <dependency>\n" +
" <groupId>com.google.protobuf</groupId>\n" +
" <artifactId>protobuf-java</artifactId>\n" +
" <version>2.4.1</version>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>com.jcraft</groupId>\n" +
" <artifactId>jzlib</artifactId>\n" +
" <version>1.1.2</version>\n" +
" </dependency>\n" +
'\n' +
" <dependency>\n" +
" <groupId>org.rxtx</groupId>\n" +
" <artifactId>rxtx</artifactId>\n" +
" <version>2.1.7</version>\n" +
" </dependency>\n" +
'\n' +
" <dependency>\n" +
" <groupId>com.barchart.udt</groupId>\n" +
" <artifactId>barchart-udt-bundle</artifactId>\n" +
" <version>2.2.2</version>\n" +
" </dependency>\n" +
'\n' +
" <dependency>\n" +
" <groupId>javax.servlet</groupId>\n" +
" <artifactId>servlet-api</artifactId>\n" +
" <version>2.5</version>\n" +
" </dependency>\n" +
'\n' +
" <dependency>\n" +
" <groupId>org.slf4j</groupId>\n" +
" <artifactId>slf4j-api</artifactId>\n" +
" <version>1.7.2</version>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>commons-logging</groupId>\n" +
" <artifactId>commons-logging</artifactId>\n" +
" <version>1.1.1</version>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>log4j</groupId>\n" +
" <artifactId>log4j</artifactId>\n" +
" <version>1.2.17</version>\n" +
" <exclusions>\n" +
" <exclusion>\n" +
" <artifactId>mail</artifactId>\n" +
" <groupId>javax.mail</groupId>\n" +
" </exclusion>\n" +
" <exclusion>\n" +
" <artifactId>jms</artifactId>\n" +
" <groupId>javax.jms</groupId>\n" +
" </exclusion>\n" +
" <exclusion>\n" +
" <artifactId>jmxtools</artifactId>\n" +
" <groupId>com.sun.jdmk</groupId>\n" +
" </exclusion>\n" +
" <exclusion>\n" +
" <artifactId>jmxri</artifactId>\n" +
" <groupId>com.sun.jmx</groupId>\n" +
" </exclusion>\n" +
" </exclusions>\n" +
" <optional>true</optional>\n" +
" </dependency>\n" +
" \n" +
" <!-- Metrics providers -->\n" +
" <dependency>\n" +
" <groupId>com.yammer.metrics</groupId>\n" +
" <artifactId>metrics-core</artifactId>\n" +
" <version>2.2.0</version>\n" +
" </dependency>\n" +
" \n" +
" <!-- Test dependencies for jboss marshalling encoder/decoder -->\n" +
" <dependency>\n" +
" <groupId>org.jboss.marshalling</groupId>\n" +
" <artifactId>jboss-marshalling-serial</artifactId>\n" +
" <version>${jboss.marshalling.version}</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>org.jboss.marshalling</groupId>\n" +
" <artifactId>jboss-marshalling-river</artifactId>\n" +
" <version>${jboss.marshalling.version}</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
'\n' +
" <!-- Test dependencies for microbench -->\n" +
" <dependency>\n" +
" <groupId>com.google.caliper</groupId>\n" +
" <artifactId>caliper</artifactId>\n" +
" <version>0.5-rc1</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
" </dependencies>\n" +
" </dependencyManagement>\n" +
'\n' +
" <dependencies>\n" +
" <!-- Byte code generator - completely optional -->\n" +
" <dependency>\n" +
" <groupId>org.javassist</groupId>\n" +
" <artifactId>javassist</artifactId>\n" +
" <version>3.17.1-GA</version>\n" +
" <scope>compile</scope>\n" +
" <optional>true</optional>\n" +
" </dependency>\n" +
'\n' +
" <!-- Testing frameworks and related dependencies -->\n" +
" <dependency>\n" +
" <groupId>junit</groupId>\n" +
" <artifactId>junit</artifactId>\n" +
" <version>4.10</version>\n" +
" <scope>test</scope>\n" +
" <exclusions>\n" +
" <!-- JUnit ships an older version of hamcrest. -->\n" +
" <exclusion>\n" +
" <groupId>org.hamcrest</groupId>\n" +
" <artifactId>hamcrest-core</artifactId>\n" +
" </exclusion>\n" +
" </exclusions>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>org.hamcrest</groupId>\n" +
" <artifactId>hamcrest-library</artifactId>\n" +
" <version>1.3</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>org.easymock</groupId>\n" +
" <artifactId>easymock</artifactId>\n" +
" <version>3.1</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>org.easymock</groupId>\n" +
" <artifactId>easymockclassextension</artifactId>\n" +
" <version>3.1</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>org.jmock</groupId>\n" +
" <artifactId>jmock-junit4</artifactId>\n" +
" <version>2.5.1</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <groupId>ch.qos.logback</groupId>\n" +
" <artifactId>logback-classic</artifactId>\n" +
" <version>1.0.9</version>\n" +
" <scope>test</scope>\n" +
" </dependency>\n" +
" </dependencies>\n" +
'\n' +
" <build>\n" +
" <plugins>\n" +
" <plugin>\n" +
" <artifactId>maven-enforcer-plugin</artifactId>\n" +
" <version>1.1</version>\n" +
" <executions>\n" +
" <execution>\n" +
" <id>enforce-tools</id>\n" +
" <goals>\n" +
" <goal>enforce</goal>\n" +
" </goals>\n" +
" <configuration>\n" +
" <rules>\n" +
" <requireJavaVersion>\n" +
" <!-- Enforce java 1.7 as minimum for compiling -->\n" +
" <!-- This is needed because of java.util.zip.Deflater and NIO UDP multicast-->\n" +
" <version>[1.7.0,)</version>\n" +
" </requireJavaVersion>\n" +
" <requireMavenVersion>\n" +
" <version>[3.0.5,)</version>\n" +
" </requireMavenVersion>\n" +
" </rules>\n" +
" </configuration>\n" +
" </execution>\n" +
" </executions>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-compiler-plugin</artifactId>\n" +
" <version>2.5.1</version>\n" +
" <configuration>\n" +
" <compilerVersion>1.7</compilerVersion>\n" +
" <fork>true</fork>\n" +
" <source>1.6</source>\n" +
" <target>1.6</target>\n" +
" <debug>true</debug>\n" +
" <optimize>true</optimize>\n" +
" <showDeprecation>true</showDeprecation>\n" +
" <showWarnings>true</showWarnings>\n" +
" <!-- XXX: maven-release-plugin complains - MRELEASE-715 -->\n" +
" <!--\n" +
" <compilerArguments>\n" +
" <Xlint:-options />\n" +
" <Xlint:unchecked />\n" +
" <Xlint:deprecation />\n" +
" </compilerArguments>\n" +
" -->\n" +
" </configuration>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <!-- ensure that only methods available in java 1.6 can\n" +
" be used even when compiling with java 1.7+ -->\n" +
" <groupId>org.codehaus.mojo</groupId>\n" +
" <artifactId>animal-sniffer-maven-plugin</artifactId>\n" +
" <version>1.8</version>\n" +
" <configuration>\n" +
" <signature>\n" +
" <groupId>org.codehaus.mojo.signature</groupId>\n" +
" <artifactId>java16</artifactId>\n" +
" <version>1.0</version>\n" +
" </signature>\n" +
" <ignores>\n" +
" <ignore>sun.misc.Unsafe</ignore>\n" +
" <ignore>sun.misc.Cleaner</ignore>\n" +
'\n' +
" <ignore>java.util.zip.Deflater</ignore>\n" +
'\n' +
" <!-- Used for NIO UDP multicast -->\n" +
" <ignore>java.nio.channels.DatagramChannel</ignore>\n" +
" <ignore>java.nio.channels.MembershipKey</ignore>\n" +
" <ignore>java.net.StandardProtocolFamily</ignore>\n" +
'\n' +
" <!-- Used for NIO. 2 -->\n" +
" <ignore>java.nio.channels.AsynchronousChannel</ignore>\n" +
" <ignore>java.nio.channels.AsynchronousSocketChannel</ignore>\n" +
" <ignore>java.nio.channels.AsynchronousServerSocketChannel</ignore>\n" +
" <ignore>java.nio.channels.AsynchronousChannelGroup</ignore>\n" +
" <ignore>java.nio.channels.NetworkChannel</ignore>\n" +
" <ignore>java.nio.channels.InterruptedByTimeoutException</ignore>\n" +
" <ignore>java.net.StandardSocketOptions</ignore>\n" +
" <ignore>java.net.SocketOption</ignore>\n" +
" </ignores>\n" +
" </configuration>\n" +
" <executions>\n" +
" <execution>\n" +
" <phase>process-classes</phase>\n" +
" <goals>\n" +
" <goal>check</goal>\n" +
" </goals>\n" +
" </execution>\n" +
" </executions>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-checkstyle-plugin</artifactId>\n" +
" <version>2.9.1</version>\n" +
" <executions>\n" +
" <execution>\n" +
" <id>check-style</id>\n" +
" <goals>\n" +
" <goal>check</goal>\n" +
" </goals>\n" +
" <phase>validate</phase>\n" +
" <configuration>\n" +
" <consoleOutput>true</consoleOutput>\n" +
" <logViolationsToConsole>true</logViolationsToConsole>\n" +
" <failsOnError>true</failsOnError>\n" +
" <failOnViolation>true</failOnViolation>\n" +
" <configLocation>io/netty/checkstyle.xml</configLocation>\n" +
" </configuration>\n" +
" </execution>\n" +
" </executions>\n" +
" <dependencies>\n" +
" <dependency>\n" +
" <groupId>${project.groupId}</groupId>\n" +
" <artifactId>netty-build</artifactId>\n" +
" <version>17</version>\n" +
" </dependency>\n" +
" </dependencies>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-surefire-plugin</artifactId>\n" +
" <configuration>\n" +
" <includes>\n" +
" <include>**/*Test*.java</include>\n" +
" <include>**/*Benchmark*.java</include>\n" +
" </includes>\n" +
" <excludes>\n" +
" <exclude>**/Abstract*</exclude>\n" +
" <exclude>**/TestUtil*</exclude>\n" +
" </excludes>\n" +
" <runOrder>random</runOrder>\n" +
" <argLine>\n" +
" -server \n" +
" -Dio.netty.resourceLeakDetection\n" +
" -dsa -da -ea:io.netty...\n" +
" -XX:+AggressiveOpts\n" +
" -XX:+TieredCompilation\n" +
" -XX:+UseBiasedLocking\n" +
" -XX:+UseFastAccessorMethods\n" +
" -XX:+UseStringCache\n" +
" -XX:+OptimizeStringConcat\n" +
" -XX:+HeapDumpOnOutOfMemoryError\n" +
" </argLine>\n" +
" </configuration>\n" +
" </plugin>\n" +
" <!-- always produce osgi bundles -->\n" +
" <plugin>\n" +
" <groupId>org.apache.felix</groupId>\n" +
" <artifactId>maven-bundle-plugin</artifactId>\n" +
" <version>2.3.7</version>\n" +
" <extensions>true</extensions>\n" +
" </plugin> \n" +
" <plugin>\n" +
" <artifactId>maven-source-plugin</artifactId>\n" +
" <version>2.1.2</version>\n" +
" <executions>\n" +
" <execution>\n" +
" <id>attach-sources</id>\n" +
" <goals>\n" +
" <goal>jar</goal>\n" +
" </goals>\n" +
" </execution>\n" +
" </executions>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-javadoc-plugin</artifactId>\n" +
" <version>2.8.1</version>\n" +
" <configuration>\n" +
" <detectOfflineLinks>false</detectOfflineLinks>\n" +
" <breakiterator>true</breakiterator>\n" +
" <version>false</version>\n" +
" <author>false</author>\n" +
" <keywords>true</keywords>\n" +
" </configuration>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-deploy-plugin</artifactId>\n" +
" <version>2.7</version>\n" +
" <configuration>\n" +
" <retryFailedDeploymentCount>10</retryFailedDeploymentCount>\n" +
" </configuration>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-release-plugin</artifactId>\n" +
" <version>2.3.2</version>\n" +
" <configuration>\n" +
" <useReleaseProfile>false</useReleaseProfile>\n" +
" <arguments>-P release,sonatype-oss-release,full</arguments>\n" +
" <autoVersionSubmodules>true</autoVersionSubmodules>\n" +
" <allowTimestampedSnapshots>true</allowTimestampedSnapshots>\n" +
" <tagNameFormat>netty-@{project.version}</tagNameFormat>\n" +
" </configuration>\n" +
" </plugin>\n" +
" \n" +
" </plugins>\n" +
'\n' +
" <pluginManagement>\n" +
" <plugins>\n" +
" <!-- keep surefire and failsafe in sync -->\n" +
" <plugin>\n" +
" <artifactId>maven-surefire-plugin</artifactId>\n" +
" <version>2.12</version>\n" +
" </plugin>\n" +
" <!-- keep surefire and failsafe in sync -->\n" +
" <plugin>\n" +
" <artifactId>maven-failsafe-plugin</artifactId>\n" +
" <version>2.12</version>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-clean-plugin</artifactId>\n" +
" <version>2.5</version>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-resources-plugin</artifactId>\n" +
" <version>2.5</version>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-jar-plugin</artifactId>\n" +
" <version>2.4</version>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-dependency-plugin</artifactId>\n" +
" <version>2.4</version>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-assembly-plugin</artifactId>\n" +
" <version>2.3</version>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-jxr-plugin</artifactId>\n" +
" <version>2.2</version>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <artifactId>maven-antrun-plugin</artifactId>\n" +
" <version>1.7</version>\n" +
" <dependencies>\n" +
" <dependency>\n" +
" <groupId>ant-contrib</groupId>\n" +
" <artifactId>ant-contrib</artifactId>\n" +
" <version>1.0b3</version>\n" +
" <exclusions>\n" +
" <exclusion>\n" +
" <groupId>ant</groupId>\n" +
" <artifactId>ant</artifactId>\n" +
" </exclusion>\n" +
" </exclusions>\n" +
" </dependency>\n" +
" </dependencies>\n" +
" </plugin>\n" +
" <plugin>\n" +
" <groupId>org.codehaus.mojo</groupId>\n" +
" <artifactId>build-helper-maven-plugin</artifactId>\n" +
" <version>1.7</version>\n" +
" </plugin> \n" +
'\n' +
" <!-- Workaround for the 'M2E plugin execution not covered' problem.\n" +
" See: http://wiki.eclipse.org/M2E_plugin_execution_not_covered -->\n" +
" <plugin>\n" +
" <groupId>org.eclipse.m2e</groupId>\n" +
" <artifactId>lifecycle-mapping</artifactId>\n" +
" <version>1.0.0</version>\n" +
" <configuration>\n" +
" <lifecycleMappingMetadata>\n" +
" <pluginExecutions>\n" +
" <pluginExecution>\n" +
" <pluginExecutionFilter>\n" +
" <groupId>org.apache.maven.plugins</groupId>\n" +
" <artifactId>maven-checkstyle-plugin</artifactId>\n" +
" <versionRange>[1.0,)</versionRange>\n" +
" <goals>\n" +
" <goal>check</goal>\n" +
" </goals>\n" +
" </pluginExecutionFilter>\n" +
" <action>\n" +
" <execute>\n" +
" <runOnIncremental>false</runOnIncremental>\n" +
" </execute>\n" +
" </action>\n" +
" </pluginExecution>\n" +
" <pluginExecution>\n" +
" <pluginExecutionFilter>\n" +
" <groupId>org.apache.maven.plugins</groupId>\n" +
" <artifactId>maven-enforcer-plugin</artifactId>\n" +
" <versionRange>[1.0,)</versionRange>\n" +
" <goals>\n" +
" <goal>enforce</goal>\n" +
" </goals>\n" +
" </pluginExecutionFilter>\n" +
" <action>\n" +
" <execute>\n" +
" <runOnIncremental>false</runOnIncremental>\n" +
" </execute>\n" +
" </action>\n" +
" </pluginExecution>\n" +
" <pluginExecution>\n" +
" <pluginExecutionFilter>\n" +
" <groupId>org.apache.maven.plugins</groupId>\n" +
" <artifactId>maven-clean-plugin</artifactId>\n" +
" <versionRange>[1.0,)</versionRange>\n" +
" <goals>\n" +
" <goal>clean</goal>\n" +
" </goals>\n" +
" </pluginExecutionFilter>\n" +
" <action>\n" +
" <execute>\n" +
" <runOnIncremental>false</runOnIncremental>\n" +
" </execute>\n" +
" </action>\n" +
" </pluginExecution>\n" +
" </pluginExecutions>\n" +
" </lifecycleMappingMetadata>\n" +
" </configuration>\n" +
" </plugin>\n" +
" </plugins>\n" +
" </pluginManagement>\n" +
" </build>\n" +
"</project>";
private static final String SAMPLE_04 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<!--\n" +
" ~ Copyright 2012 The Netty Project\n" +
" ~\n" +
" ~ The Netty Project licenses this file to you under the Apache License,\n" +
" ~ version 2.0 (the \"License\"); you may not use this file except in compliance\n" +
" ~ with the License. You may obtain a copy of the License at:\n" +
" ~\n" +
" ~ http://www.apache.org/licenses/LICENSE-2.0\n" +
" ~\n" +
" ~ Unless required by applicable law or agreed to in writing, software\n" +
" ~ distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n" +
" ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n" +
" ~ License for the specific language governing permissions and limitations\n" +
" ~ under the License.\n" +
" -->\n" +
"<FindBugsFilter>\n" +
" <!-- Tests -->\n" +
" <Match>\n" +
" <Class name=\"~.*Test(\\$[^\\$]+)*\"/>\n" +
" </Match>\n" +
" <!-- Generated code -->\n" +
" <Match>\n" +
" <Class name=\"~.*\\.LocalTimeProtocol(\\$[^\\$]+)*\"/>\n" +
" </Match>\n" +
" <!-- Noise -->\n" +
" <Match>\n" +
" <Bug code=\"Co,SF\"\n" +
" category=\"I18N\"\n" +
" pattern=\"REC_CATCH_EXCEPTION,UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR,DB_DUPLICATE_SWITCH_CLAUSES,VO_VOLATILE_REFERENCE_TO_ARRAY\" />\n" +
" </Match>\n" +
" <!-- Known false positives -->\n" +
" <Match>\n" +
" <Class name=\"~.*Channel(Group)?Future\"/>\n" +
" <Method name=\"~await.*\"/>\n" +
" <Bug pattern=\"PS_PUBLIC_SEMAPHORES\"/>\n" +
" </Match>\n" +
" <Match>\n" +
" <Class name=\"~.*SelectorLoop\"/>\n" +
" <Method name=\"run\"/>\n" +
" <Bug code=\"ESync\"/>\n" +
" </Match>\n" +
" <Match>\n" +
" <Class name=\"~.*Channel\"/>\n" +
" <Or>\n" +
" <Method name=\"setClosed\"/>\n" +
" <Method name=\"setInterestOpsNow\"/>\n" +
" </Or>\n" +
" <Bug pattern=\"USM_USELESS_SUBCLASS_METHOD\"/>\n" +
" </Match>\n" +
" <Match>\n" +
" <Class name=\"~.*HttpTunnelingChannelHandler\"/>\n" +
" <Method name=\"~await.*\"/>\n" +
" <Bug pattern=\"RV_RETURN_VALUE_IGNORED_BAD_PRACTICE,RV_RETURN_VALUE_IGNORED2\"/>\n" +
" </Match>\n" +
" <!-- Known issues that don't matter -->\n" +
" <Match>\n" +
" <Or>\n" +
" <Class name=\"~.*\\.util\\.internal\\.Concurrent[A-Za-z]*HashMap(\\$[^\\$]+)*\"/>\n" +
" <Class name=\"~.*\\.util\\.internal\\..*TransferQueue(\\$[^\\$]+)*\"/>\n" +
" <Class name=\"~.*\\.util\\.internal\\.MapBackedSet\"/>\n" +
" </Or>\n" +
" <Bug pattern=\"SE_TRANSIENT_FIELD_NOT_RESTORED,SE_BAD_FIELD\"/>\n" +
" </Match>\n" +
"</FindBugsFilter>";
} }

View File

@ -0,0 +1 @@
<root xmlns="http://www.acme.com/acme" status="loginok" timestamp="1362392496667"/>

View File

@ -0,0 +1,3 @@
<root xmlns="http://www.acme.com/acme" status="start" time="0" timestamp="1362392497684">
<child active="1" status="started" id="935449" msgnr="2"/>
</root>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2012 The Netty Project
~
~ The Netty Project licenses this file to you under the Apache License,
~ version 2.0 (the "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at:
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
-->
<FindBugsFilter>
<!-- Tests -->
<Match>
<Class name="~.*Test(\$[^\$]+)*"/>
</Match>
<!-- Generated code -->
<Match>
<Class name="~.*\.LocalTimeProtocol(\$[^\$]+)*"/>
</Match>
<!-- Noise -->
<Match>
<Bug code="Co,SF"
category="I18N"
pattern="REC_CATCH_EXCEPTION,UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR,DB_DUPLICATE_SWITCH_CLAUSES,VO_VOLATILE_REFERENCE_TO_ARRAY" />
</Match>
<!-- Known false positives -->
<Match>
<Class name="~.*Channel(Group)?Future"/>
<Method name="~await.*"/>
<Bug pattern="PS_PUBLIC_SEMAPHORES"/>
</Match>
<Match>
<Class name="~.*SelectorLoop"/>
<Method name="run"/>
<Bug code="ESync"/>
</Match>
<Match>
<Class name="~.*Channel"/>
<Or>
<Method name="setClosed"/>
<Method name="setInterestOpsNow"/>
</Or>
<Bug pattern="USM_USELESS_SUBCLASS_METHOD"/>
</Match>
<Match>
<Class name="~.*HttpTunnelingChannelHandler"/>
<Method name="~await.*"/>
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE,RV_RETURN_VALUE_IGNORED2"/>
</Match>
<!-- Known issues that don't matter -->
<Match>
<Or>
<Class name="~.*\.util\.internal\.Concurrent[A-Za-z]*HashMap(\$[^\$]+)*"/>
<Class name="~.*\.util\.internal\..*TransferQueue(\$[^\$]+)*"/>
<Class name="~.*\.util\.internal\.MapBackedSet"/>
</Or>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED,SE_BAD_FIELD"/>
</Match>
</FindBugsFilter>

View File

@ -0,0 +1,773 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2012 The Netty Project
~
~ The Netty Project licenses this file to you under the Apache License,
~ version 2.0 (the "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at:
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>io.netty</groupId>
<artifactId>netty-parent</artifactId>
<packaging>pom</packaging>
<version>4.0.14.Final-SNAPSHOT</version>
<name>Netty</name>
<url>http://netty.io/</url>
<description>
Netty is an asynchronous event-driven network application framework for
rapid development of maintainable high performance protocol servers and
clients.
</description>
<organization>
<name>The Netty Project</name>
<url>http://netty.io/</url>
</organization>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>
<inceptionYear>2008</inceptionYear>
<scm>
<url>https://github.com/netty/netty</url>
<connection>scm:git:git://github.com/netty/netty.git</connection>
<developerConnection>scm:git:ssh://git@github.com/netty/netty.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>netty.io</id>
<name>The Netty Project Contributors</name>
<email>netty@googlegroups.com</email>
<url>http://netty.io/</url>
<organization>The Netty Project</organization>
<organizationUrl>http://netty.io/</organizationUrl>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jboss.marshalling.version>1.3.18.GA</jboss.marshalling.version>
<test.jvm.argLine>
-server
-dsa -da -ea:io.netty...
-XX:+AggressiveOpts
-XX:+TieredCompilation
-XX:+UseBiasedLocking
-XX:+UseFastAccessorMethods
-XX:+UseStringCache
-XX:+OptimizeStringConcat
-XX:+HeapDumpOnOutOfMemoryError
</test.jvm.argLine>
</properties>
<modules>
<module>common</module>
<module>buffer</module>
<module>codec</module>
<module>codec-http</module>
<module>codec-socks</module>
<module>transport</module>
<module>transport-rxtx</module>
<module>transport-sctp</module>
<module>transport-udt</module>
<module>handler</module>
<module>example</module>
<module>testsuite</module>
<module>microbench</module>
<module>all</module>
<module>tarball</module>
</modules>
<dependencyManagement>
<dependencies>
<!-- Byte code generator - completely optional -->
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.0-GA</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- JBoss Marshalling - completely optional -->
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling</artifactId>
<version>${jboss.marshalling.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.rxtx</groupId>
<artifactId>rxtx</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.barchart.udt</groupId>
<artifactId>barchart-udt-bundle</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<exclusions>
<exclusion>
<artifactId>mail</artifactId>
<groupId>javax.mail</groupId>
</exclusion>
<exclusion>
<artifactId>jms</artifactId>
<groupId>javax.jms</groupId>
</exclusion>
<exclusion>
<artifactId>jmxtools</artifactId>
<groupId>com.sun.jdmk</groupId>
</exclusion>
<exclusion>
<artifactId>jmxri</artifactId>
<groupId>com.sun.jmx</groupId>
</exclusion>
</exclusions>
<optional>true</optional>
</dependency>
<!-- Metrics providers -->
<dependency>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>2.2.0</version>
</dependency>
<!-- Test dependencies for jboss marshalling encoder/decoder -->
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-serial</artifactId>
<version>${jboss.marshalling.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-river</artifactId>
<version>${jboss.marshalling.version}</version>
<scope>test</scope>
</dependency>
<!-- Test dependencies for microbench -->
<dependency>
<groupId>com.google.caliper</groupId>
<artifactId>caliper</artifactId>
<version>0.5-rc1</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Enable Javassist support for all test runs -->
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
<!-- Testing frameworks and related dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<version>3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit4</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>enforce-tools</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<!-- Enforce java 1.7 as minimum for compiling -->
<!-- This is needed because of java.util.zip.Deflater and NIO UDP multicast-->
<version>[1.7.0,)</version>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.0.5,3.1)</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerVersion>1.7</compilerVersion>
<fork>true</fork>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
<optimize>true</optimize>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgument>-Xlint:-options</compilerArgument>
<!-- XXX: maven-release-plugin complains - MRELEASE-715 -->
<!--
<compilerArguments>
<Xlint:-options />
<Xlint:unchecked />
<Xlint:deprecation />
</compilerArguments>
-->
<meminitial>256m</meminitial>
<maxmem>1024m</maxmem>
</configuration>
</plugin>
<plugin>
<!-- ensure that only methods available in java 1.6 can
be used even when compiling with java 1.7+ -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.9</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java16</artifactId>
<version>1.0</version>
</signature>
<ignores>
<ignore>sun.misc.Unsafe</ignore>
<ignore>sun.misc.Cleaner</ignore>
<ignore>java.util.zip.Deflater</ignore>
<!-- Used for NIO UDP multicast -->
<ignore>java.nio.channels.DatagramChannel</ignore>
<ignore>java.nio.channels.MembershipKey</ignore>
<ignore>java.net.StandardProtocolFamily</ignore>
<!-- Used for NIO. 2 -->
<ignore>java.nio.channels.AsynchronousChannel</ignore>
<ignore>java.nio.channels.AsynchronousSocketChannel</ignore>
<ignore>java.nio.channels.AsynchronousServerSocketChannel</ignore>
<ignore>java.nio.channels.AsynchronousChannelGroup</ignore>
<ignore>java.nio.channels.NetworkChannel</ignore>
<ignore>java.nio.channels.InterruptedByTimeoutException</ignore>
<ignore>java.net.StandardSocketOptions</ignore>
<ignore>java.net.SocketOption</ignore>
</ignores>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>check-style</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
<configuration>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
<configLocation>io/netty/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-build</artifactId>
<version>19</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test*.java</include>
<include>**/*Benchmark*.java</include>
</includes>
<excludes>
<exclude>**/Abstract*</exclude>
<exclude>**/TestUtil*</exclude>
</excludes>
<runOrder>random</runOrder>
<argLine>${test.jvm.argLine}</argLine>
</configuration>
</plugin>
<!-- always produce osgi bundles -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<id>generate-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<Export-Package>${project.groupId}.*</Export-Package>
<!-- enforce JVM vendor package as optional -->
<Import-Package>sun.misc.*;resolution:=optional,*</Import-Package>
<!-- override "internal" private package convention -->
<Private-Package>!*</Private-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<!--
~ This workaround prevents Maven from executing the 'generate-sources' phase twice.
~ See http://jira.codehaus.org/browse/MSOURCES-13
~ and http://blog.peterlynch.ca/2010/05/maven-how-to-prevent-generate-sources.html
-->
<execution>
<id>attach-sources</id>
<phase>invalid</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>attach-sources-no-fork</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<detectOfflineLinks>false</detectOfflineLinks>
<breakiterator>true</breakiterator>
<version>false</version>
<author>false</author>
<keywords>true</keywords>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<retryFailedDeploymentCount>10</retryFailedDeploymentCount>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<arguments>-P release,sonatype-oss-release,full,no-osgi</arguments>
<autoVersionSubmodules>true</autoVersionSubmodules>
<allowTimestampedSnapshots>false</allowTimestampedSnapshots>
<tagNameFormat>netty-@{project.version}</tagNameFormat>
</configuration>
</plugin>
<!-- Ensure to put maven-antrun-plugin at the end of the plugin list
so that they are run lastly in the same phase. -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<!-- Generate the version properties for all artifacts. -->
<execution>
<id>write-version-properties</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<!-- Get the information about the latest commit -->
<exec executable="git" outputproperty="gitOutput.shortCommitHash" resultproperty="gitExitCode.shortCommitHash" failonerror="false" failifexecutionfails="false">
<arg value="log" />
<arg value="-1" />
<arg value="--format=format:%h" />
</exec>
<if>
<equals arg2="0" arg1="${gitExitCode.shortCommitHash}" />
<then>
<property name="shortCommitHash" value="${gitOutput.shortCommitHash}" />
</then>
<else>
<property name="shortCommitHash" value="0" />
</else>
</if>
<exec executable="git" outputproperty="gitOutput.longCommitHash" resultproperty="gitExitCode.longCommitHash" failonerror="false" failifexecutionfails="false">
<arg value="log" />
<arg value="-1" />
<arg value="--format=format:%H" />
</exec>
<if>
<equals arg2="0" arg1="${gitExitCode.longCommitHash}" />
<then>
<property name="longCommitHash" value="${gitOutput.longCommitHash}" />
</then>
<else>
<property name="longCommitHash" value="0000000000000000000000000000000000000000" />
</else>
</if>
<exec executable="git" outputproperty="gitOutput.commitDate" resultproperty="gitExitCode.commitDate" failonerror="false" failifexecutionfails="false">
<arg value="log" />
<arg value="-1" />
<arg value="--format=format:%cd" />
<arg value="--date=iso" />
</exec>
<if>
<equals arg2="0" arg1="${gitExitCode.commitDate}" />
<then>
<property name="commitDate" value="${gitOutput.commitDate}" />
</then>
<else>
<property name="commitDate" value="1970-01-01 00:00:00 +0000" />
</else>
</if>
<exec executable="git" outputproperty="gitOutput.repoStatus" resultproperty="gitExitCode.repoStatus" failonerror="false" failifexecutionfails="false">
<arg value="status" />
<arg value="--porcelain" />
</exec>
<if>
<equals arg2="0" arg1="${gitExitCode.repoStatus}" />
<then>
<if>
<equals arg2="" arg1="${gitOutput.repoStatus}" />
<then>
<property name="repoStatus" value="clean" />
</then>
<else>
<property name="repoStatus" value="dirty" />
</else>
</if>
</then>
<else>
<property name="repoStatus" value="unknown" />
</else>
</if>
<!-- Print the obtained commit information. -->
<echo>Current commit: ${shortCommitHash} on ${commitDate}</echo>
<!-- Generate the .properties file. -->
<!--
<property name="metaInfDir" value="${project.basedir}/src/main/resources/META-INF" />
-->
<property name="metaInfDir" value="${project.build.outputDirectory}/META-INF" />
<property name="versionPropFile" value="${metaInfDir}/${project.groupId}.versions.properties" />
<mkdir dir="${metaInfDir}" />
<delete file="${versionPropFile}" quiet="true" />
<propertyfile file="${versionPropFile}" comment="Generated by netty-parent/pom.xml">
<entry key="${project.artifactId}.version" value="${project.version}" />
<entry key="${project.artifactId}.buildDate" type="date" value="now" pattern="yyyy-MM-dd HH:mm:ss Z" />
<entry key="${project.artifactId}.commitDate" value="${commitDate}" />
<entry key="${project.artifactId}.shortCommitHash" value="${shortCommitHash}" />
<entry key="${project.artifactId}.longCommitHash" value="${longCommitHash}" />
<entry key="${project.artifactId}.repoStatus" value="${repoStatus}" />
</propertyfile>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!-- keep surefire and failsafe in sync -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
</plugin>
<!-- keep surefire and failsafe in sync -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-jar</id>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<index>true</index>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<!-- Do NOT upgrade -->
<artifactId>maven-jxr-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
</plugin>
<!-- Workaround for the 'M2E plugin execution not covered' problem.
See: http://wiki.eclipse.org/M2E_plugin_execution_not_covered -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.7,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>check</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>enforce</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>clean</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<versionRange>[2.4,)</versionRange>
<goals>
<goal>manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>