Author: epunzalan
Date: Wed Apr 5 18:52:49 2006
New Revision: 391876
URL: http://svn.apache.org/viewcvs?rev=391876&view=rev
Log:
PR: MIDEA-5
Submitted by: Johann Reyes
fixed the bug on new lines inside the xml texts for the copyright idea plugin
Added:
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaXmlWriter.java
Modified:
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java
Modified:
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java?rev=391876&r1=391875&r2=391876&view=diff
==============================================================================
---
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java
(original)
+++
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java
Wed Apr 5 18:52:49 2006
@@ -40,12 +40,10 @@
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
-import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -149,7 +147,7 @@
protected void writeXmlDocument( File file, Document document )
throws IOException
{
- XMLWriter writer = new XMLWriter( new FileWriter( file ),
OutputFormat.createPrettyPrint() );
+ XMLWriter writer = new IdeaXmlWriter( file );
writer.write( document );
writer.close();
}
@@ -317,7 +315,8 @@
scope = Artifact.SCOPE_COMPILE;
}
- Artifact artifact = artifactFactory.createDependencyArtifact(
groupId, artifactId, versionRange, type, classifier, scope, optional ) ;
+ Artifact artifact = artifactFactory.createDependencyArtifact(
groupId, artifactId, versionRange, type,
+
classifier, scope, optional );
if ( scope.equalsIgnoreCase( Artifact.SCOPE_SYSTEM ) )
{
Added:
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaXmlWriter.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaXmlWriter.java?rev=391876&view=auto
==============================================================================
---
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaXmlWriter.java
(added)
+++
maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaXmlWriter.java
Wed Apr 5 18:52:49 2006
@@ -0,0 +1,51 @@
+package org.apache.maven.plugin.idea;
+
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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 org.dom4j.io.XMLWriter;
+import org.dom4j.io.OutputFormat;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Custom implementation of <a
href="http://dom4j.org/apidocs/org/dom4j/io/XMLWriter.html">XMLWriter</a> for
use with
+ * the Idea plugin.
+ */
+public class IdeaXmlWriter
+ extends XMLWriter
+{
+ /**
+ * Default constructor.
+ *
+ * @param file output file to be written
+ */
+ public IdeaXmlWriter( File file )
+ throws IOException
+ {
+ super( new FileWriter( file ), OutputFormat.createPrettyPrint() );
+ }
+
+ protected String escapeAttributeEntities( String text )
+ {
+ String answer = super.escapeAttributeEntities( text );
+ answer = answer.replaceAll( "\n", " " );
+ answer = answer.replaceAll( "\n\r", " " );
+ return answer;
+ }
+}
\ No newline at end of file