compiler-jx: fixed null reference that caused template to fail without root MXML class
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/4f6dea03 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/4f6dea03 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/4f6dea03 Branch: refs/heads/feature-autobuild/maven-archetypes Commit: 4f6dea037ee326cfa5c8f57562368339caace53f Parents: 8c80e2b Author: Josh Tynjala <[email protected]> Authored: Tue Oct 4 16:55:24 2016 -0700 Committer: Josh Tynjala <[email protected]> Committed: Tue Oct 4 16:55:24 2016 -0700 ---------------------------------------------------------------------- .../codegen/mxml/flexjs/MXMLFlexJSPublisher.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4f6dea03/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java index 7f8bc4c..8f5adbe 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java @@ -585,14 +585,25 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher { String input = readCode(template); ITargetAttributes ta = project.computeTargetAttributes(); - Float width = ta.getWidth(); - Float height = ta.getHeight(); + Float width = null; + Float height = null; + String bgcolor = null; + String pageTitle = null; + if(ta != null) + { + width = ta.getWidth(); + height = ta.getHeight(); + bgcolor = ta.getBackgroundColor(); + pageTitle = ta.getPageTitle(); + } String result = input.replaceAll("\\$\\{application\\}", projectName); - result = result.replaceAll("\\$\\{bgcolor\\}", ta.getBackgroundColor()); + if (bgcolor != null) + result = result.replaceAll("\\$\\{bgcolor\\}", bgcolor); //result = result.replaceAll("\\$\\{expressInstallSwf\\}", expressInstallSwf); if (height != null) result = result.replaceAll("\\$\\{height\\}", height.toString()); - result = result.replaceAll("\\$\\{title\\}", ta.getPageTitle()); + if (pageTitle != null) + result = result.replaceAll("\\$\\{title\\}", pageTitle); //result = result.replaceAll("\\$\\{version_major\\}", versionMajor); //result = result.replaceAll("\\$\\{version_minor\\}", versionMinor); //result = result.replaceAll("\\$\\{version_revision\\}", versionRevision);
