You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/04/12 13:47:23 UTC

[GitHub] [maven-war-plugin] dennisl opened a new pull request, #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

dennisl opened a new pull request, #22:
URL: https://github.com/apache/maven-war-plugin/pull/22

   …ltered.
   
   https://issues.apache.org/jira/browse/MWAR-450
   
   The fix for this issue is similar to MRESOURCES-171. We have added a configuration parameter called propertiesEncoding to the Mojo. If it is not specified it will not be used. Under the hood maven-filtering has been updated to 3.2.0 to be able to use the propertiesEncoding feature in it. maven-shared-utils is also updated to match the version in maven-filtering.
   
   An integration test MWAR-450 has been added to cover the use case described in JIRA. There is already another integration test called web-resources-filtering that covers the behavior prior to this patch.
   
   [ X ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
   [ X ] I am a commiter for the Apache Software Foundation


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] michael-o commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r853251454


##########
pom.xml:
##########
@@ -118,7 +118,7 @@
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-shared-utils</artifactId>
-      <version>3.2.1</version>
+      <version>3.3.3</version>

Review Comment:
   3.3.4



##########
src/it/MWAR-450/pom.xml:
##########
@@ -0,0 +1,55 @@
+<?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.war</groupId>
+  <artifactId>mwar450</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>war</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <finalName>mwar450</finalName>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <!-- Without this configuration the test fails -->
+          <propertiesEncoding>ISO-8859-1</propertiesEncoding>
+          <webResources>
+            <resource>
+              <targetPath>WEB-INF/classes</targetPath>
+              <filtering>true</filtering>
+              <directory>src/main/webapp/WEB-INF/classes</directory>

Review Comment:
   Aren't they in `src/main/resources`?



##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );

Review Comment:
   This output will be mangled if run on non-UTF-8. 



##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );
+    int indexOf = paramContent.indexOf( "This file is encoded in UTF-8 and should remain so after filtering - åäö" );
+    if ( indexOf < 0 )
+    {
+      System.err.println( "Non-ascii characters changed encoding during filtering" );
+      return false;
+    }
+
+    // Load and check my.properties
+    File myProperties = new File( target, "my.properties" );
+    if ( !myProperties.exists() || myProperties.isDirectory() )
+    {
+        System.err.println( "my.properties is missing or is a directory." );
+        return false;
+    }
+    Properties properties = new Properties();
+    FileInputStream fis = new FileInputStream( myProperties );
+    properties.load( fis );
+    fis.close();
+    String property = properties.get( "my.property" );
+    System.out.println( "my.property='" + property + "'" );
+    if ( !"Characters that should be encoded in ISO-8859-1: åäö".equals( property ) )
+    {
+        System.err.println( "Non-ascii characters has wrong encoding after filtering" );
+        return false;
+    }
+
+    File myfile = new File( target, "myfile.txt" );
+    if ( !myfile.exists() || myfile.isDirectory() )
+    {
+        System.err.println( "myfile.txt is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( myfile );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );

Review Comment:
   And here



##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );
+    int indexOf = paramContent.indexOf( "This file is encoded in UTF-8 and should remain so after filtering - åäö" );
+    if ( indexOf < 0 )
+    {
+      System.err.println( "Non-ascii characters changed encoding during filtering" );
+      return false;
+    }
+
+    // Load and check my.properties
+    File myProperties = new File( target, "my.properties" );
+    if ( !myProperties.exists() || myProperties.isDirectory() )
+    {
+        System.err.println( "my.properties is missing or is a directory." );
+        return false;
+    }
+    Properties properties = new Properties();
+    FileInputStream fis = new FileInputStream( myProperties );
+    properties.load( fis );
+    fis.close();
+    String property = properties.get( "my.property" );
+    System.out.println( "my.property='" + property + "'" );

Review Comment:
   same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] michael-o commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r850709295


##########
src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java:
##########
@@ -257,8 +258,16 @@ protected boolean copyFilteredFile( String sourceId, final WarPackagingContext c
                 }
                 else
                 {
-                    // For all others we use the configured encoding
-                    encoding = context.getResourceEncoding();
+                    // Fix for MWAR-450
+                    if ( isPropertiesFile( file ) && StringUtils.isNotEmpty( context.getPropertiesEncoding() ) )

Review Comment:
   Why not put it in an `else if`? This looks like unnecessary nesting...



##########
src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java:
##########
@@ -257,8 +258,16 @@ protected boolean copyFilteredFile( String sourceId, final WarPackagingContext c
                 }
                 else
                 {
-                    // For all others we use the configured encoding
-                    encoding = context.getResourceEncoding();
+                    // Fix for MWAR-450

Review Comment:
   This line is redundant, we have `git blame`



##########
src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java:
##########
@@ -477,6 +486,18 @@ protected String getArtifactFinalName( WarPackagingContext context, Artifact art
 
     }
 
+    /**
+     * Determine whether a file is a properties file or not.
+     *
+     * @param file The file to check
+     * @return <code>true</code> if the file is a properties file, otherwise <code>false</code>
+     * @since 3.4.0
+     */
+    private boolean isPropertiesFile( File file )
+    {
+        return file != null && file.isFile() && file.getName().endsWith( ".properties" );

Review Comment:
   This now bacially duplicates `isXmlFile(File)`. Why refactor to a single method and pass two args to that new method?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#issuecomment-1108618869

   Sorry, I messed up. I wanted to apply the pull requests in order, but there was a conflict between the PR for MWAR-444 and MWAR-450 that I was unable to resolve at github. Also I wanted to make sure that the failed checks for MWAR-444 had been resolved in master, so I decided to merge the PR for MWAR-444 into our fork. That was apparently one too many remote references for me to handle. I really hate those merge commits...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r857600052


##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );
+    int indexOf = paramContent.indexOf( "This file is encoded in UTF-8 and should remain so after filtering - åäö" );
+    if ( indexOf < 0 )
+    {
+      System.err.println( "Non-ascii characters changed encoding during filtering" );
+      return false;
+    }
+
+    // Load and check my.properties
+    File myProperties = new File( target, "my.properties" );
+    if ( !myProperties.exists() || myProperties.isDirectory() )
+    {
+        System.err.println( "my.properties is missing or is a directory." );
+        return false;
+    }
+    Properties properties = new Properties();

Review Comment:
   It is true that changes were made in Java 9. From what I understand the changes were made with regards to internationalization in PropertyResourceBundle, but not to regular Properties. https://docs.oracle.com/javase/9/docs/api/java/util/Properties.html
   
   The assertions that are in place should work fine regardless of Java version since we specify the encoding to use when reading the files, in the plugin's code. The only exception som that rule is when reading the properties file in the verify.bsh file in the integration test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r853879086


##########
src/it/MWAR-450/pom.xml:
##########
@@ -0,0 +1,55 @@
+<?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.war</groupId>
+  <artifactId>mwar450</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>war</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <finalName>mwar450</finalName>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <!-- Without this configuration the test fails -->
+          <propertiesEncoding>ISO-8859-1</propertiesEncoding>
+          <webResources>
+            <resource>
+              <targetPath>WEB-INF/classes</targetPath>
+              <filtering>true</filtering>
+              <directory>src/main/webapp/WEB-INF/classes</directory>

Review Comment:
   No they don't in our use case. We like to separate our config files from our resources. This way the config files end up readable in the exploded war, instead of being packaged in the jar file of the project.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r853881671


##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );

Review Comment:
   We have tried this on both Windows (CP-1252) and Linux (UTF-8), and the output from the integration test looks fine for us, without mangled characters. Which platform did you have problems on?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r853882133


##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );
+    int indexOf = paramContent.indexOf( "This file is encoded in UTF-8 and should remain so after filtering - åäö" );
+    if ( indexOf < 0 )
+    {
+      System.err.println( "Non-ascii characters changed encoding during filtering" );
+      return false;
+    }
+
+    // Load and check my.properties
+    File myProperties = new File( target, "my.properties" );
+    if ( !myProperties.exists() || myProperties.isDirectory() )
+    {
+        System.err.println( "my.properties is missing or is a directory." );
+        return false;
+    }
+    Properties properties = new Properties();
+    FileInputStream fis = new FileInputStream( myProperties );
+    properties.load( fis );
+    fis.close();
+    String property = properties.get( "my.property" );
+    System.out.println( "my.property='" + property + "'" );
+    if ( !"Characters that should be encoded in ISO-8859-1: åäö".equals( property ) )
+    {
+        System.err.println( "Non-ascii characters has wrong encoding after filtering" );
+        return false;
+    }
+
+    File myfile = new File( target, "myfile.txt" );
+    if ( !myfile.exists() || myfile.isDirectory() )
+    {
+        System.err.println( "myfile.txt is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( myfile );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );

Review Comment:
   Same as above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r853881940


##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );
+    int indexOf = paramContent.indexOf( "This file is encoded in UTF-8 and should remain so after filtering - åäö" );
+    if ( indexOf < 0 )
+    {
+      System.err.println( "Non-ascii characters changed encoding during filtering" );
+      return false;
+    }
+
+    // Load and check my.properties
+    File myProperties = new File( target, "my.properties" );
+    if ( !myProperties.exists() || myProperties.isDirectory() )
+    {
+        System.err.println( "my.properties is missing or is a directory." );
+        return false;
+    }
+    Properties properties = new Properties();
+    FileInputStream fis = new FileInputStream( myProperties );
+    properties.load( fis );
+    fis.close();
+    String property = properties.get( "my.property" );
+    System.out.println( "my.property='" + property + "'" );

Review Comment:
   Same as above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] slawekjaranowski commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r853930705


##########
src/it/MWAR-450/verify.bsh:
##########
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target/mwar450/WEB-INF/classes" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target/mwar450/WEB-INF/classes is missing or is not a directory." );
+        return false;
+    }
+
+    // Load and check log4j.xml
+    File log4jxml = new File( target, "log4j.xml" );
+    if ( !log4jxml.exists() || log4jxml.isDirectory() )
+    {
+        System.err.println( "log4j.xml is missing or is a directory." );
+        return false;
+    }
+    FileInputStream fis = new FileInputStream ( log4jxml );
+    String paramContent = IOUtil.toString ( fis, "UTF-8" );
+    System.out.println( "content='" + paramContent + "'" );
+    int indexOf = paramContent.indexOf( "This file is encoded in UTF-8 and should remain so after filtering - åäö" );
+    if ( indexOf < 0 )
+    {
+      System.err.println( "Non-ascii characters changed encoding during filtering" );
+      return false;
+    }
+
+    // Load and check my.properties
+    File myProperties = new File( target, "my.properties" );
+    if ( !myProperties.exists() || myProperties.isDirectory() )
+    {
+        System.err.println( "my.properties is missing or is a directory." );
+        return false;
+    }
+    Properties properties = new Properties();

Review Comment:
   In jdk9 encoding of properties was changed.
   https://docs.oracle.com/javase/9/intl/internationalization-enhancements-jdk-9.htm
   
   Maybe good assertions will be length of file?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl merged pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl merged PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#issuecomment-1102738911

   Thanks for the review Michael! I have made changes based on your suggestions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] michael-o commented on pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
michael-o commented on PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#issuecomment-1108594277

   Oh c'mon, really why didn't you rebase first? Now we have those useless merge commits on master.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-war-plugin] dennisl commented on a diff in pull request #22: [MWAR-450] ISO-8859-1 properties files get changed into UTF-8 when fi…

Posted by GitBox <gi...@apache.org>.
dennisl commented on code in PR #22:
URL: https://github.com/apache/maven-war-plugin/pull/22#discussion_r853876360


##########
pom.xml:
##########
@@ -118,7 +118,7 @@
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-shared-utils</artifactId>
-      <version>3.2.1</version>
+      <version>3.3.3</version>

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org