Commit ae570f69 authored by Ludovic Dubost's avatar Ludovic Dubost

Fix in case of empty licence file

parent b80773e0
<?xml version="1.0" encoding="UTF-8"?>
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc version="1.3" reference="GitLab.Code.GitLabGroovy" locale="">
<web>GitLab.Code</web>
<name>GitLabGroovy</name>
......@@ -1004,7 +984,11 @@ public class XWikiXMLWriter extends XMLWriter
def result = baos.toString();
// Adding licence header
def xmlHeader = """&lt;?xml version="${this.xmlVersion}" encoding="UTF-8"?&gt;"""
result = result.replaceAll("(&lt;.xml .*&gt;)", xmlHeader + "\n\n" + xwiki.getDocument("GitLab.Code.LicenceFile").getContent())
def licenceContent = xwiki.getDocument("GitLab.Code.LicenceFile").getContent()
if (licenceContent!="")
result = result.replaceAll("(&lt;.xml .*&gt;)", xmlHeader + "\n\n" + licenceContent)
else
result = result.replaceAll("(&lt;.xml .*&gt;)", xmlHeader )
return result.replaceAll("\r","");
}
}</content>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment