diff --git a/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java b/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java
index 12b014e42a..dc1a8a407b 100644
--- a/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java
+++ b/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java
@@ -93,7 +93,7 @@ public class AddAvmContentDialog extends AddContentDialog
String parent = this.avmBrowseBean.getCurrentPath();
// create the file
- this.getAvmService().createFile(parent, this.fileName);
+ this.getAvmService().createFile(parent, this.fileName).close();
this.path = parent + '/' + this.fileName;
NodeRef fileNodeRef = AVMNodeConverter.ToNodeRef(-1, this.path);
diff --git a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java
index cbe0f0955a..fa95f516d1 100644
--- a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java
+++ b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java
@@ -1,19 +1,19 @@
/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco 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 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco 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
+ * Copyright (C) 2005-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco 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 Alfresco. If not, see .
*/
package org.alfresco.web.forms;
@@ -274,10 +274,10 @@ public class RenderingEngineTemplateImpl
AVMUtil.PathRelation.SANDBOX_RELATIVE);
if (logger.isDebugEnabled())
- {
- logger.debug("processed pattern " + outputPathPattern + " as " + result);
+ {
+ logger.debug("processed pattern " + outputPathPattern + " as " + result);
}
-
+
return result;
}
@@ -304,8 +304,8 @@ public class RenderingEngineTemplateImpl
final String parentAVMPath = AVMNodeConverter.SplitBase(renditionAvmPath)[0];
AVMUtil.makeAllDirectories(parentAVMPath);
avmService.createFile(parentAVMPath,
- AVMNodeConverter.SplitBase(renditionAvmPath)[1]);
-
+ AVMNodeConverter.SplitBase(renditionAvmPath)[1]).close();
+
if (logger.isDebugEnabled())
{
logger.debug("Created file node for file: " + renditionAvmPath);
@@ -432,13 +432,13 @@ public class RenderingEngineTemplateImpl
final NodeRef parentNodeRef =
nodeService.getPrimaryParent(RenderingEngineTemplateImpl.this.getNodeRef()).getParentRef();
- if (logger.isDebugEnabled())
- {
- logger.debug("request to resolve resource " + name +
- " webapp url is " + webappUrl +
- " and data dictionary workspace is " + parentNodeRef);
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("request to resolve resource " + name +
+ " webapp url is " + webappUrl +
+ " and data dictionary workspace is " + parentNodeRef);
}
-
+
final NodeRef result = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, name);
if (result != null)
{
@@ -447,10 +447,10 @@ public class RenderingEngineTemplateImpl
try
{
if (logger.isDebugEnabled())
- {
- logger.debug("found " + name + " in data dictonary: " + result);
+ {
+ logger.debug("found " + name + " in data dictonary: " + result);
}
-
+
return contentService.getReader(result, ContentModel.PROP_CONTENT).getContentInputStream();
}
catch (Exception e)
@@ -527,17 +527,17 @@ public class RenderingEngineTemplateImpl
}
final URI uri = new URI(webappUrl + '/' + StringUtils.join(path, '/'));
-
+
if (logger.isDebugEnabled())
{
logger.debug("loading " + uri);
}
-
+
return uri.toURL().openStream();
}
catch (Exception e)
{
- logger.warn(e);
+ logger.warn(e);
return null;
}
}
@@ -562,41 +562,41 @@ public class RenderingEngineTemplateImpl
// add methods
final FormDataFunctions fdf = this.getFormDataFunctions();
-
+
model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
- "encodeQuotes",
- namespacePrefixResolver),
- new RenderingEngine.TemplateProcessorMethod()
- {
- public Object exec(final Object[] arguments)
- throws IOException,
- SAXException
- {
- if (arguments.length != 1)
- {
- throw new IllegalArgumentException("expected 1 argument to encodeQuotes. got " +
- arguments.length);
-
- }
- if (! (arguments[0] instanceof String))
- {
- throw new ClassCastException("expected arguments[0] to be a " + String.class.getName() +
- ". got a " + arguments[0].getClass().getName() + ".");
- }
- String text = (String)arguments[0];
-
- if (logger.isDebugEnabled())
- {
- logger.debug("tpm_encodeQuotes('" + text + "'), parentPath = " + parentPath);
+ "encodeQuotes",
+ namespacePrefixResolver),
+ new RenderingEngine.TemplateProcessorMethod()
+ {
+ public Object exec(final Object[] arguments)
+ throws IOException,
+ SAXException
+ {
+ if (arguments.length != 1)
+ {
+ throw new IllegalArgumentException("expected 1 argument to encodeQuotes. got " +
+ arguments.length);
+
}
-
- final String result = fdf.encodeQuotes(text);
- return result;
- }
- });
-
-
- model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
+ if (! (arguments[0] instanceof String))
+ {
+ throw new ClassCastException("expected arguments[0] to be a " + String.class.getName() +
+ ". got a " + arguments[0].getClass().getName() + ".");
+ }
+ String text = (String)arguments[0];
+
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("tpm_encodeQuotes('" + text + "'), parentPath = " + parentPath);
+ }
+
+ final String result = fdf.encodeQuotes(text);
+ return result;
+ }
+ });
+
+
+ model.put(QName.createQName(NamespaceService.ALFRESCO_PREFIX,
"parseXMLDocument",
namespacePrefixResolver),
new RenderingEngine.TemplateProcessorMethod()
@@ -620,12 +620,12 @@ public class RenderingEngineTemplateImpl
path = AVMUtil.buildPath(parentPath,
path,
AVMUtil.PathRelation.WEBAPP_RELATIVE);
-
+
if (logger.isDebugEnabled())
- {
- logger.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath);
+ {
+ logger.debug("tpm_parseXMLDocument('" + path + "'), parentPath = " + parentPath);
}
-
+
final Document d = fdf.parseXMLDocument(path);
return d != null ? d.getDocumentElement() : null;
}
@@ -661,20 +661,20 @@ public class RenderingEngineTemplateImpl
path,
AVMUtil.PathRelation.WEBAPP_RELATIVE);
final String formName = (String)arguments[0];
-
+
if (logger.isDebugEnabled())
- {
- logger.debug("tpm_parseXMLDocuments('" + formName + "','" + path +
- "'), parentPath = " + parentPath);
+ {
+ logger.debug("tpm_parseXMLDocuments('" + formName + "','" + path +
+ "'), parentPath = " + parentPath);
}
-
+
final Map resultMap = fdf.parseXMLDocuments(formName, path);
-
+
if (logger.isDebugEnabled())
- {
- logger.debug("received " + resultMap.size() +
- " documents in " + path +
- " with form name " + formName);
+ {
+ logger.debug("received " + resultMap.size() +
+ " documents in " + path +
+ " with form name " + formName);
}
// create a root document for rooting all the results. we do this
@@ -723,12 +723,12 @@ public class RenderingEngineTemplateImpl
}
final String path = (String)arguments[0];
-
+
if (logger.isDebugEnabled())
- {
+ {
logger.debug("tpm_getAVMPAth('" + path + "'), parentPath = " + parentPath);
- }
-
+ }
+
return AVMUtil.buildPath(parentPath,
path,
AVMUtil.PathRelation.WEBAPP_RELATIVE);