You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/01/25 14:30:19 UTC

svn commit: r737508 - in /maven/plugins/trunk/maven-ear-plugin: ./ src/it/basic/ src/it/descriptor-encoding/ src/it/descriptor-encoding/latin-1/ src/it/descriptor-encoding/utf-8/ src/main/java/org/apache/maven/plugin/ear/

Author: bentmann
Date: Sun Jan 25 13:30:18 2009
New Revision: 737508

URL: http://svn.apache.org/viewvc?rev=737508&view=rev
Log:
[MEAR-99] Corrupted deployment descriptor if configured encoding does not match platform encoding

Added:
    maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/
    maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/
    maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/pom.xml   (with props)
    maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/pom.xml   (with props)
    maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/
    maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/pom.xml   (with props)
    maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/verify.groovy   (with props)
Modified:
    maven/plugins/trunk/maven-ear-plugin/pom.xml
    maven/plugins/trunk/maven-ear-plugin/src/it/basic/pom.xml
    maven/plugins/trunk/maven-ear-plugin/src/it/basic/verify.bsh
    maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java

Modified: maven/plugins/trunk/maven-ear-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/pom.xml?rev=737508&r1=737507&r2=737508&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/pom.xml Sun Jan 25 13:30:18 2009
@@ -73,7 +73,7 @@
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
-      <version>1.2</version>
+      <version>1.5.7</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>

Modified: maven/plugins/trunk/maven-ear-plugin/src/it/basic/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/basic/pom.xml?rev=737508&r1=737507&r2=737508&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/basic/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/basic/pom.xml Sun Jan 25 13:30:18 2009
@@ -22,8 +22,8 @@
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.it0033</groupId>
-  <artifactId>maven-it-it0033</artifactId>
+  <groupId>org.apache.maven.its.ear.basic</groupId>
+  <artifactId>test</artifactId>
   <version>1.0</version>
   <packaging>ear</packaging>
 

Modified: maven/plugins/trunk/maven-ear-plugin/src/it/basic/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/basic/verify.bsh?rev=737508&r1=737507&r2=737508&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/basic/verify.bsh (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/basic/verify.bsh Sun Jan 25 13:30:18 2009
@@ -3,38 +3,28 @@
 import java.util.jar.*;
 import java.util.regex.*;
 
-try
+File jarFile = new File( basedir, "target/test-1.0.ear" );
+System.out.println( "Checking for existence of " + jarFile );
+if ( !jarFile.isFile() )
 {
-    File jarFile = new File( basedir, "target/maven-it-it0033-1.0.ear" );
-    System.out.println( "Checking for existence of " + jarFile );
-    if ( !jarFile.isFile() )
-    {
-        System.out.println( "FAILURE!" );
-        return false;
-    }
+    throw new IllegalStateException( "Missing file: " + jarFile );
+}
 
-    JarFile jar = new JarFile( jarFile );
+JarFile jar = new JarFile( jarFile );
 
-    String[] includedEntries = {
-        "META-INF/application.xml",
-        "META-INF/appserver-application.xml",
-    };
-    for ( String included : includedEntries )
+String[] includedEntries = {
+    "META-INF/application.xml",
+    "META-INF/appserver-application.xml",
+};
+for ( String included : includedEntries )
+{
+    System.out.println( "Checking for existence of " + included );
+    if ( jar.getEntry( included ) == null )
     {
-        System.out.println( "Checking for existence of " + included );
-        if ( jar.getEntry( included ) == null )
-        {
-            System.out.println( "FAILURE!" );
-            return false;
-        }
+        throw new IllegalStateException( "Missing archive entry: " + included );
     }
-
-    jar.close();
-}
-catch( Throwable t )
-{
-    t.printStackTrace();
-    return false;
 }
 
+jar.close();
+
 return true;

Added: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/pom.xml?rev=737508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/pom.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/pom.xml Sun Jan 25 13:30:18 2009
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF 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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.dde</groupId>
+  <artifactId>latin-1</artifactId>
+  <version>1.0</version>
+  <packaging>ear</packaging>
+
+  <name>MEAR-99 - Latin-1</name> 
+  <description>TEST-CHARS: &#196;&#214;&#220;&#228;&#246;&#252;&#223;</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-ear-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <encoding>ISO-8859-1</encoding>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/latin-1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/pom.xml?rev=737508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/pom.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/pom.xml Sun Jan 25 13:30:18 2009
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF 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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.dde</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <name>MEAR-99 - Aggregator</name> 
+  <description>
+    Test proper encoding handling when writing the deployment descriptors.
+  </description>
+
+  <modules>
+    <module>utf-8</module>
+    <module>latin-1</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-ear-plugin</artifactId>
+          <version>@project.version@</version>
+          <configuration>
+            <generateApplicationXml>true</generateApplicationXml>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/pom.xml?rev=737508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/pom.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/pom.xml Sun Jan 25 13:30:18 2009
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF 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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.dde</groupId>
+  <artifactId>utf-8</artifactId>
+  <version>1.0</version>
+  <packaging>ear</packaging>
+
+  <name>MEAR-99 - UTF-8</name> 
+  <description>TEST-CHARS: &#196;&#214;&#220;&#228;&#246;&#252;&#223;</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-ear-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/utf-8/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/verify.groovy?rev=737508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/verify.groovy (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/verify.groovy Sun Jan 25 13:30:18 2009
@@ -0,0 +1,13 @@
+def latin1File = new File( basedir, "latin-1/target/application.xml" )
+assert latin1File.exists()
+def latin1Chars = new XmlParser().parse( latin1File ).description.text()
+println "Latin-1: " + latin1Chars
+assert "TEST-CHARS: \u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF".equals( latin1Chars )
+
+def utf8File = new File( basedir, "utf-8/target/application.xml" )
+assert utf8File.exists()
+def utf8Chars = new XmlParser().parse( utf8File ).description.text()
+println "UTF-8: " + utf8Chars
+assert "TEST-CHARS: \u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF".equals( utf8Chars )
+
+return true;

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ear-plugin/src/it/descriptor-encoding/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java?rev=737508&r1=737507&r2=737508&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java Sun Jan 25 13:30:18 2009
@@ -19,11 +19,11 @@
  * under the License.
  */
 
+import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Writer;
 
@@ -52,7 +52,7 @@
     {
         try
         {
-            return new FileWriter( destinationFile );
+            return WriterFactory.newXmlWriter( destinationFile );
         }
         catch ( IOException ex )
         {