mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/DEV/V3.3-BUG-FIX to HEAD:
22328: Merged BRANCHES/V3.3 to BRANCHES/DEV/V3.3-BUG-FIX: 22327: Merged BRANCHES/DEV/BELARUS/V3.3-BUG-FIX-2010_08_11 to BRANCHES/V3.3 (+ additional fix) 22132: ALF-4461: Dictionary code leaks file handles (also fixed other non-test usage - DictionaryModelType) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22330 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -637,7 +639,27 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
|
||||
if (contentReader != null)
|
||||
{
|
||||
// Create a model from the current content
|
||||
M2Model m2Model = M2Model.createModel(contentReader.getContentInputStream());
|
||||
M2Model m2Model = null;
|
||||
InputStream is = null;
|
||||
try
|
||||
{
|
||||
is = contentReader.getContentInputStream();
|
||||
m2Model = M2Model.createModel(is);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
logger.error("Failed to close input stream for " + nodeRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try and compile the model
|
||||
CompiledModel compiledModel= m2Model.compile(dictionaryDAO, namespaceDAO);
|
||||
|
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -474,7 +476,26 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
}
|
||||
else
|
||||
{
|
||||
model = M2Model.createModel(contentReader.getContentInputStream());
|
||||
InputStream is = null;
|
||||
try
|
||||
{
|
||||
is = contentReader.getContentInputStream();
|
||||
model = M2Model.createModel(is);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
logger.error("Failed to close input stream for " + nodeRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO should we inactivate the model node and put the error somewhere??
|
||||
|
Reference in New Issue
Block a user