aboutsummaryrefslogtreecommitdiffstats
path: root/templates/projects
diff options
context:
space:
mode:
authorScott Barta <sbarta@google.com>2013-07-01 16:33:44 -0700
committerScott Barta <sbarta@google.com>2013-07-01 16:35:22 -0700
commit474e48bbd2b45e3c40734ffa7f2f1b557ef4e5d5 (patch)
treebb361e68a4fd5f20bf62fc56325789a157db4cab /templates/projects
parentf77612d75aa609a26a741b4b6b5cd62b4de2fd82 (diff)
downloadsdk-474e48bbd2b45e3c40734ffa7f2f1b557ef4e5d5.zip
sdk-474e48bbd2b45e3c40734ffa7f2f1b557ef4e5d5.tar.gz
sdk-474e48bbd2b45e3c40734ffa7f2f1b557ef4e5d5.tar.bz2
Escaping for pathnames in template XML files
Does proper XML escaping in Freemarker XML templates to avoid problems with pathnames that contain XML-sensitive characters. Change-Id: I1f191ccabd0c81af821c7bbdf88bbb23ba42ff9c
Diffstat (limited to 'templates/projects')
-rw-r--r--templates/projects/NewAndroidApplication/recipe.xml.ftl20
-rw-r--r--templates/projects/NewAndroidLibrary/recipe.xml.ftl20
-rw-r--r--templates/projects/NewJavaLibrary/recipe.xml.ftl6
3 files changed, 23 insertions, 23 deletions
diff --git a/templates/projects/NewAndroidApplication/recipe.xml.ftl b/templates/projects/NewAndroidApplication/recipe.xml.ftl
index 79210a9..2734b32 100644
--- a/templates/projects/NewAndroidApplication/recipe.xml.ftl
+++ b/templates/projects/NewAndroidApplication/recipe.xml.ftl
@@ -2,32 +2,32 @@
<recipe>
<#if isGradle == "true">
<merge from="settings.gradle.ftl"
- to="${topOut}/settings.gradle" />
+ to="${escapeXmlAttribute(topOut)}/settings.gradle" />
<instantiate from="build.gradle.ftl"
- to="${projectOut}/build.gradle" />
+ to="${escapeXmlAttribute(projectOut)}/build.gradle" />
</#if>
<instantiate from="AndroidManifest.xml.ftl"
- to="${manifestOut}/AndroidManifest.xml" />
+ to="${escapeXmlAttribute(manifestOut)}/AndroidManifest.xml" />
<#if copyIcons>
<copy from="res/drawable-hdpi"
- to="${resOut}/drawable-hdpi" />
+ to="${escapeXmlAttribute(resOut)}/drawable-hdpi" />
<copy from="res/drawable-mdpi"
- to="${resOut}/drawable-mdpi" />
+ to="${escapeXmlAttribute(resOut)}/drawable-mdpi" />
<copy from="res/drawable-xhdpi"
- to="${resOut}/drawable-xhdpi" />
+ to="${escapeXmlAttribute(resOut)}/drawable-xhdpi" />
</#if>
<instantiate from="res/values/styles.xml.ftl"
- to="${resOut}/values/styles.xml" />
+ to="${escapeXmlAttribute(resOut)}/values/styles.xml" />
<#if buildApi gte 11 && baseTheme != "none">
<instantiate from="res/values-v11/styles_hc.xml.ftl"
- to="${resOut}/values-v11/styles.xml" />
+ to="${escapeXmlAttribute(resOut)}/values-v11/styles.xml" />
</#if>
<#if buildApi gte 14 && baseTheme?contains("darkactionbar")>
<copy from="res/values-v14/styles_ics.xml"
- to="${resOut}/values-v14/styles.xml" />
+ to="${escapeXmlAttribute(resOut)}/values-v14/styles.xml" />
</#if>
<instantiate from="res/values/strings.xml.ftl"
- to="${resOut}/values/strings.xml" />
+ to="${escapeXmlAttribute(resOut)}/values/strings.xml" />
</recipe>
diff --git a/templates/projects/NewAndroidLibrary/recipe.xml.ftl b/templates/projects/NewAndroidLibrary/recipe.xml.ftl
index 79210a9..2734b32 100644
--- a/templates/projects/NewAndroidLibrary/recipe.xml.ftl
+++ b/templates/projects/NewAndroidLibrary/recipe.xml.ftl
@@ -2,32 +2,32 @@
<recipe>
<#if isGradle == "true">
<merge from="settings.gradle.ftl"
- to="${topOut}/settings.gradle" />
+ to="${escapeXmlAttribute(topOut)}/settings.gradle" />
<instantiate from="build.gradle.ftl"
- to="${projectOut}/build.gradle" />
+ to="${escapeXmlAttribute(projectOut)}/build.gradle" />
</#if>
<instantiate from="AndroidManifest.xml.ftl"
- to="${manifestOut}/AndroidManifest.xml" />
+ to="${escapeXmlAttribute(manifestOut)}/AndroidManifest.xml" />
<#if copyIcons>
<copy from="res/drawable-hdpi"
- to="${resOut}/drawable-hdpi" />
+ to="${escapeXmlAttribute(resOut)}/drawable-hdpi" />
<copy from="res/drawable-mdpi"
- to="${resOut}/drawable-mdpi" />
+ to="${escapeXmlAttribute(resOut)}/drawable-mdpi" />
<copy from="res/drawable-xhdpi"
- to="${resOut}/drawable-xhdpi" />
+ to="${escapeXmlAttribute(resOut)}/drawable-xhdpi" />
</#if>
<instantiate from="res/values/styles.xml.ftl"
- to="${resOut}/values/styles.xml" />
+ to="${escapeXmlAttribute(resOut)}/values/styles.xml" />
<#if buildApi gte 11 && baseTheme != "none">
<instantiate from="res/values-v11/styles_hc.xml.ftl"
- to="${resOut}/values-v11/styles.xml" />
+ to="${escapeXmlAttribute(resOut)}/values-v11/styles.xml" />
</#if>
<#if buildApi gte 14 && baseTheme?contains("darkactionbar")>
<copy from="res/values-v14/styles_ics.xml"
- to="${resOut}/values-v14/styles.xml" />
+ to="${escapeXmlAttribute(resOut)}/values-v14/styles.xml" />
</#if>
<instantiate from="res/values/strings.xml.ftl"
- to="${resOut}/values/strings.xml" />
+ to="${escapeXmlAttribute(resOut)}/values/strings.xml" />
</recipe>
diff --git a/templates/projects/NewJavaLibrary/recipe.xml.ftl b/templates/projects/NewJavaLibrary/recipe.xml.ftl
index 29e5e4f..b9dd28d 100644
--- a/templates/projects/NewJavaLibrary/recipe.xml.ftl
+++ b/templates/projects/NewJavaLibrary/recipe.xml.ftl
@@ -2,10 +2,10 @@
<recipe>
<#if isGradle == "true">
<merge from="settings.gradle.ftl"
- to="${topOut}/settings.gradle" />
+ to="${escapeXmlAttribute(topOut)}/settings.gradle" />
<instantiate from="build.gradle.ftl"
- to="${projectOut}/build.gradle" />
+ to="${escapeXmlAttribute(projectOut)}/build.gradle" />
</#if>
<instantiate from="/src/library_package/Placeholder.java.ftl"
- to="${srcOut}/${className}.java" />
+ to="${escapeXmlAttribute(srcOut)}/${className}.java" />
</recipe>