Author: michaelo
Date: Sun Nov 30 17:54:28 2014
New Revision: 1642577
URL: http://svn.apache.org/r1642577
Log:
[MPIR-242] Incorrect translations list for GPL v3 (illegible letters for
Catalan and Arabic)
Appropriate parameter added: licenseFileEncoding. Param is valid for all
license files.
If not encoding is provided, UTF-8 is now assumed. Previous value was
ISO-8859-1.
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/
(with props)
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/LICENSE.txt
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/pom.xml
(with props)
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/
(with props)
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/
(with props)
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/site.xml
(with props)
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/verify.groovy
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/resources/iso-8859-5-encoded.txt
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/LicenseReport.java
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtilsTest.java
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Nov 30 17:54:28 2014
@@ -0,0 +1 @@
+MPIR-\d+
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/
------------------------------------------------------------------------------
bugtraq:url = http://jira.codehaus.org/browse/%BUGID%
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/LICENSE.txt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/LICENSE.txt?rev=1642577&view=auto
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/LICENSE.txt
(added)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/LICENSE.txt
Sun Nov 30 17:54:28 2014
@@ -0,0 +1 @@
+ÁÒÞÑÞÔÐ ÒáÕÜã ÚÞÔã!
\ No newline at end of file
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/pom.xml?rev=1642577&view=auto
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/pom.xml
(added)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/pom.xml
Sun Nov 30 17:54:28 2014
@@ -0,0 +1,76 @@
+<?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 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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.project-info-reports.its</groupId>
+ <artifactId>MPIR-242</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+
<artifacts.url>http://maven.apache.org/plugins/it/${project.artifactId}</artifacts.url>
+ </properties>
+
+ <url>${artifacts.url}</url>
+
+ <licenses>
+ <license>
+ <name>Ð¡Ð²Ð¾Ð±Ð¾Ð´Ð½Ð°Ñ Ð»Ð¸ÑензиÑ</name>
+ <url>LICENSE.txt</url>
+ </license>
+ </licenses>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>@sitePluginVersion@</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <licenseFileEncoding>ISO-8859-5</licenseFileEncoding>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>license</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Nov 30 17:54:28 2014
@@ -0,0 +1 @@
+MPIR-\d+
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/
------------------------------------------------------------------------------
bugtraq:url = http://jira.codehaus.org/browse/%BUGID%
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Nov 30 17:54:28 2014
@@ -0,0 +1 @@
+MPIR-\d+
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/
------------------------------------------------------------------------------
bugtraq:url = http://jira.codehaus.org/browse/%BUGID%
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/site.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/site.xml?rev=1642577&view=auto
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/site.xml
(added)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/site.xml
Sun Nov 30 17:54:28 2014
@@ -0,0 +1,31 @@
+<?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 xmlns="http://maven.apache.org/DECORATION/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0
http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+ <publishDate position="right"/>
+ <body>
+ <breadcrumbs>
+ <item name="MPIR"
href="http://maven.apache.org/plugins/maven-project-info-reports-plugin/index.html"
/>
+ </breadcrumbs>
+ <menu ref="parent" inherit="top"/>
+ <menu ref="reports" inherit="bottom" />
+ </body>
+</project>
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/verify.groovy
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/verify.groovy?rev=1642577&view=auto
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/verify.groovy
(added)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/it/MPIR-242/verify.groovy
Sun Nov 30 17:54:28 2014
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+File licensePage = new File( basedir, 'target/site/license.html' )
+assert licensePage.exists()
+// assert licensePage.text.contains( 'Свобода вÑÐµÐ¼Ñ ÐºÐ¾Ð´Ñ!' )
+// Raw UTF-8 bytes written by Doxia and converted from ISO-8859-5
+assert licensePage.text.contains(
'Свобода
всему коду!' )
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/LicenseReport.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/LicenseReport.java?rev=1642577&r1=1642576&r2=1642577&view=diff
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/LicenseReport.java
(original)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/LicenseReport.java
Sun Nov 30 17:54:28 2014
@@ -42,7 +42,7 @@ import java.util.regex.Pattern;
/**
* Generates the Project License report.
*
- * @author <a href="mailto:[email protected]">Vincent Siveton </a>
+ * @author <a href="mailto:[email protected]">Vincent Siveton</a>
* @version $Id$
* @since 2.0
*/
@@ -70,6 +70,14 @@ public class LicenseReport
@Parameter( defaultValue = "false" )
private boolean linkOnly;
+ /**
+ * Specifies the input encoding of the project's license file(s).
+ *
+ * @since 2.8
+ */
+ @Parameter
+ private String licenseFileEncoding;
+
// ----------------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------------
@@ -78,7 +86,8 @@ public class LicenseReport
public void executeReport( Locale locale )
{
LicenseRenderer r =
- new LicenseRenderer( getSink(), getProject(), getI18N( locale ),
locale, settings, linkOnly );
+ new LicenseRenderer( getSink(), getProject(), getI18N( locale ),
locale, settings,
+ linkOnly, licenseFileEncoding );
r.render();
}
@@ -214,8 +223,10 @@ public class LicenseReport
private final boolean linkOnly;
+ private final String licenseFileEncoding;
+
LicenseRenderer( Sink sink, MavenProject project, I18N i18n, Locale
locale, Settings settings,
- boolean linkOnly )
+ boolean linkOnly, String licenseFileEncoding )
{
super( sink, i18n, locale );
@@ -224,6 +235,8 @@ public class LicenseReport
this.settings = settings;
this.linkOnly = linkOnly;
+
+ this.licenseFileEncoding = licenseFileEncoding;
}
@Override
@@ -335,10 +348,10 @@ public class LicenseReport
try
{
// All licenses are supposed in English...
- String licenseContent = ProjectInfoReportUtils.getContent(
licenseUrl, settings );
+ String licenseContent = ProjectInfoReportUtils.getContent(
licenseUrl, settings, licenseFileEncoding );
// TODO: we should check for a text/html mime type instead,
and possibly use a html parser to do this a bit more cleanly/reliably.
- String licenseContentLC = licenseContent.toLowerCase(
Locale.ENGLISH );
+ String licenseContentLC = licenseContent.toLowerCase(
Locale.ROOT );
int bodyStart = licenseContentLC.indexOf( "<body" );
int bodyEnd = licenseContentLC.indexOf( "</body>" );
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java?rev=1642577&r1=1642576&r2=1642577&view=diff
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
(original)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtils.java
Sun Nov 30 17:54:28 2014
@@ -74,28 +74,31 @@ public class ProjectInfoReportUtils
/** The timeout when getting the url input stream */
private static final int TIMEOUT = 1000 * 5;
+ /** The default encoding used to transform bytes to characters */
+ private static final String DEFAULT_ENCODING = "UTF-8";
+
/**
- * Get the input stream using ISO-8859-1 as charset from an URL.
+ * Get the input stream using UTF-8 as character encoding from a URL.
*
* @param url not null
* @param settings not null to handle proxy settings
- * @return the ISO-8859-1 inputstream found.
+ * @return the UTF-8 decoded input stream as string
* @throws IOException if any
* @see #getContent(URL, Settings, String)
*/
public static String getContent( URL url, Settings settings )
throws IOException
{
- return getContent( url, settings, "ISO-8859-1" );
+ return getContent( url, settings, DEFAULT_ENCODING );
}
/**
- * Get the input stream from an URL.
+ * Get the input stream from a URL.
*
* @param url not null
* @param settings not null to handle proxy settings
- * @param encoding the wanted encoding for the inputstream. If null,
encoding will be "ISO-8859-1".
- * @return the inputstream found depending the wanted encoding.
+ * @param encoding the wanted encoding for the URL input stream. If null,
UTF-8 will be used.
+ * @return the input stream decoded with the wanted encoding as string
* @throws IOException if any
*/
public static String getContent( URL url, Settings settings, String
encoding )
@@ -105,13 +108,13 @@ public class ProjectInfoReportUtils
}
/**
- * Get the input stream from an URL.
+ * Get the input stream from a URL.
*
* @param url not null
* @param project could be null
* @param settings not null to handle proxy settings
- * @param encoding the wanted encoding for the inputstream. If empty,
encoding will be "ISO-8859-1".
- * @return the inputstream found depending the wanted encoding.
+ * @param encoding the wanted encoding for the URL input stream. If null,
UTF-8 will be used.
+ * @return the input stream decoded with the wanted encoding as string
* @throws IOException if any
* @since 2.3
*/
@@ -122,7 +125,7 @@ public class ProjectInfoReportUtils
if ( StringUtils.isEmpty( encoding ) )
{
- encoding = "ISO-8859-1";
+ encoding = DEFAULT_ENCODING;
}
if ( "file".equals( scheme ) )
@@ -291,12 +294,12 @@ public class ProjectInfoReportUtils
&& !settings.getServers().isEmpty()
&& project != null
&& project.getDistributionManagement() != null
- && (
- project.getDistributionManagement().getRepository() !=
null
- ||
project.getDistributionManagement().getSnapshotRepository() != null
+ && (
+ project.getDistributionManagement().getRepository() != null
+ ||
project.getDistributionManagement().getSnapshotRepository() != null
)
- && ( StringUtils.isNotEmpty(
project.getDistributionManagement().getRepository().getUrl() )
- || StringUtils.isNotEmpty(
project.getDistributionManagement().getSnapshotRepository().getUrl() ) )
+ && ( StringUtils.isNotEmpty(
project.getDistributionManagement().getRepository().getUrl() )
+ || StringUtils.isNotEmpty(
project.getDistributionManagement().getSnapshotRepository().getUrl() ) )
)
//@formatter:on
{
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtilsTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtilsTest.java?rev=1642577&r1=1642576&r2=1642577&view=diff
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtilsTest.java
(original)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ProjectInfoReportUtilsTest.java
Sun Nov 30 17:54:28 2014
@@ -129,16 +129,26 @@ public class ProjectInfoReportUtilsTest
// file
URL url = new File( getBasedir(),
"/target/classes/project-info-report.properties" ).toURI().toURL();
- String content = ProjectInfoReportUtils.getContent( url,
getMavenProjectStub( false ), settingsStub, null );
+ String content = ProjectInfoReportUtils.getContent( url,
getMavenProjectStub( false ), settingsStub,
+ "ISO-8859-1" );
Assert.assertNotNull( content );
Assert.assertTrue( content.contains( "Licensed to the Apache Software
Foundation" ) );
+ // file
+ url = new File( getBasedir(),
"/src/test/resources/iso-8859-5-encoded.txt" ).toURI().toURL();
+
+ content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
false ), settingsStub,
+ "ISO-8859-5" );
+ Assert.assertNotNull( content );
+ Assert.assertTrue( content.contains( "Свобода вÑем
наÑодам!" ) );
+
// http + no auth
startJetty( false, false );
url = new URL( "http://localhost:" + port +
"/project-info-report.properties" );
- content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
false ), settingsStub, null );
+ content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
false ), settingsStub,
+ "ISO-8859-1" );
Assert.assertNotNull( content );
Assert.assertTrue( content.contains( "Licensed to the Apache Software
Foundation" ) );
@@ -149,7 +159,8 @@ public class ProjectInfoReportUtilsTest
url = new URL( "http://localhost:" + port +
"/project-info-report.properties" );
- content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
false ), settingsStub, null );
+ content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
false ), settingsStub,
+ "ISO-8859-1" );
Assert.assertNotNull( content );
Assert.assertTrue( content.contains( "Licensed to the Apache Software
Foundation" ) );
@@ -160,7 +171,8 @@ public class ProjectInfoReportUtilsTest
url = new URL( "https://localhost:" + port +
"/project-info-report.properties" );
- content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
true ), settingsStub, null );
+ content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
true ), settingsStub,
+ "ISO-8859-1" );
Assert.assertNotNull( content );
Assert.assertTrue( content.contains( "Licensed to the Apache Software
Foundation" ) );
@@ -171,7 +183,8 @@ public class ProjectInfoReportUtilsTest
url = new URL( "https://localhost:" + port +
"/project-info-report.properties" );
- content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
true ), settingsStub, null );
+ content = ProjectInfoReportUtils.getContent( url, getMavenProjectStub(
true ), settingsStub,
+ "ISO-8859-1" );
Assert.assertNotNull( content );
Assert.assertTrue( content.contains( "Licensed to the Apache Software
Foundation" ) );
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/resources/iso-8859-5-encoded.txt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/test/resources/iso-8859-5-encoded.txt?rev=1642577&view=auto
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/resources/iso-8859-5-encoded.txt
(added)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/test/resources/iso-8859-5-encoded.txt
Sun Nov 30 17:54:28 2014
@@ -0,0 +1,18 @@
+# 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.
+
+ÁÒÞÑÞÔÐ ÒáÕÜ ÝÐàÞÔÐÜ!