You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2009/04/29 00:52:08 UTC
svn commit: r769578 - in /maven/plugins/trunk/maven-changelog-plugin/src:
it/minimal-pom-output-encoding/ it/minimal-pom-output-encoding/pom.xml
it/minimal-pom-output-encoding/verify.bsh
main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
Author: olamy
Date: Tue Apr 28 22:52:07 2009
New Revision: 769578
URL: http://svn.apache.org/viewvc?rev=769578&view=rev
Log:
[MCHANGELOG-86] Error with outputEncoding parameter set to UTF-8
Added:
maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/
maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/pom.xml (with props)
maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/verify.bsh (with props)
Modified:
maven/plugins/trunk/maven-changelog-plugin/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
Added: maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/pom.xml?rev=769578&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/pom.xml (added)
+++ maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/pom.xml Tue Apr 28 22:52:07 2009
@@ -0,0 +1,65 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.changelog</groupId>
+ <artifactId>minimal-pom-output-encoding</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <url>http://maven.apache.org/</url>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-changelog-plugin/</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-changelog-plugin/</developerConnection>
+ <url>http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changelog-plugin/</url>
+ </scm>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changelog-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <outputEncoding>UTF-8</outputEncoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Propchange: maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/verify.bsh?rev=769578&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/verify.bsh (added)
+++ maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/verify.bsh Tue Apr 28 22:52:07 2009
@@ -0,0 +1,33 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+try
+{
+ File siteDir = new File( basedir, "target/site" );
+ System.out.println( "Checking for existence of site directory: " + siteDir );
+ if ( !siteDir.isDirectory() )
+ {
+ System.out.println( "FAILED" );
+ return false;
+ }
+
+ String[] reports = { "changelog", "dev-activity", "file-activity" };
+ for ( String report : reports )
+ {
+ File reportFile = new File( siteDir, report + ".html" );
+ System.out.println( "Checking for existence of report: " + reportFile );
+ if ( !reportFile.isFile() )
+ {
+ System.out.println( "FAILED" );
+ return false;
+ }
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changelog-plugin/src/it/minimal-pom-output-encoding/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-changelog-plugin/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changelog-plugin/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java?rev=769578&r1=769577&r2=769578&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changelog-plugin/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java (original)
+++ maven/plugins/trunk/maven-changelog-plugin/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java Tue Apr 28 22:52:07 2009
@@ -43,6 +43,7 @@
import org.codehaus.doxia.sink.Sink;
import org.codehaus.doxia.site.renderer.SiteRenderer;
import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
@@ -53,6 +54,8 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -396,13 +399,21 @@
{
throw new MavenReportException( "Can't create " + outputXML.getAbsolutePath(), e );
}
+ catch ( UnsupportedEncodingException e )
+ {
+ throw new MavenReportException( "Can't create " + outputXML.getAbsolutePath(), e );
+ }
+ catch ( IOException e )
+ {
+ throw new MavenReportException( "Can't create " + outputXML.getAbsolutePath(), e );
+ }
}
return changelogList;
}
private void writeChangelogXml( List changelogList )
- throws FileNotFoundException
+ throws FileNotFoundException, UnsupportedEncodingException, IOException
{
StringBuffer changelogXml = new StringBuffer();
@@ -429,11 +440,16 @@
changelogXml.append( "\n</changelog>" );
outputXML.getParentFile().mkdirs();
-
- PrintWriter pw = new PrintWriter( new BufferedOutputStream( new FileOutputStream( outputXML ) ) );
- pw.write( changelogXml.toString() );
- pw.flush();
- pw.close();
+
+ //PrintWriter pw = new PrintWriter( new BufferedOutputStream( new FileOutputStream( outputXML ) ) );
+ //pw.write( changelogXml.toString() );
+ //pw.flush();
+ //pw.close();
+ // MCHANGELOG-86
+ Writer writer = WriterFactory.newWriter( new BufferedOutputStream( new FileOutputStream( outputXML ) ), outputEncoding );
+ writer.write( changelogXml.toString() );
+ writer.flush();
+ writer.close();
}
/**