Author: bfitzpat
Date: 2010-10-11 16:05:29 -0400 (Mon, 11 Oct 2010)
New Revision: 25738
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/template/SmooksFreemarkerTemplateGraphicalEditor.java
Log:
JBIDE-7310: Smooks Editor throws NPE when trying to process a null template builder
object
https://jira.jboss.org/browse/JBIDE-7310
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/template/SmooksFreemarkerTemplateGraphicalEditor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/template/SmooksFreemarkerTemplateGraphicalEditor.java 2010-10-11
18:53:57 UTC (rev 25737)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/template/SmooksFreemarkerTemplateGraphicalEditor.java 2010-10-11
20:05:29 UTC (rev 25738)
@@ -104,27 +104,28 @@
if(abstractSmooksGraphicalModel instanceof FreemarkerTemplateGraphicalModel) {
FreemarkerTemplateGraphicalModel freemarkerModel =
(FreemarkerTemplateGraphicalModel) abstractSmooksGraphicalModel;
TemplateBuilder templateBuilder = freemarkerModel.getTemplateBuilder();
- List<Mapping> mappings = templateBuilder.getMappings();
- List<TreeNodeConnection> connections = new
ArrayList<TreeNodeConnection>();
-
- for(Mapping mapping : mappings) {
- TreeNodeModel connectionSource =
inputModel.getModelNode(templateBuilder.resolveMappingSrcPath(mapping));
- TreeNodeModel connectionTarget =
freemarkerModel.getModelNode(mapping.getMappingNode());
+ if (templateBuilder != null) {
+ List<Mapping> mappings = templateBuilder.getMappings();
+ List<TreeNodeConnection> connections = new
ArrayList<TreeNodeConnection>();
- if(connectionSource != null && connectionTarget != null) {
- TreeNodeConnection connection = new TreeNodeConnection(connectionSource,
connectionTarget);
+ for(Mapping mapping : mappings) {
+ TreeNodeModel connectionSource =
inputModel.getModelNode(templateBuilder.resolveMappingSrcPath(mapping));
+ TreeNodeModel connectionTarget =
freemarkerModel.getModelNode(mapping.getMappingNode());
- connectionSource.getSourceConnections().add(connection);
- connectionSource.fireConnectionChanged();
- connectionTarget.getTargetConnections().add(connection);
- connectionTarget.fireConnectionChanged();
-
- connection.setData(mapping);
- connections.add(connection);
+ if(connectionSource != null && connectionTarget != null) {
+ TreeNodeConnection connection = new TreeNodeConnection(connectionSource,
connectionTarget);
+
+ connectionSource.getSourceConnections().add(connection);
+ connectionSource.fireConnectionChanged();
+ connectionTarget.getTargetConnections().add(connection);
+ connectionTarget.fireConnectionChanged();
+
+ connection.setData(mapping);
+ connections.add(connection);
+ }
}
+ return connections;
}
-
- return connections;
}
}
}