HHH-9874 Do not leak the configuration resource stream
This commit is contained in:
parent
f593a9c14a
commit
1e54ee3dc1
|
@ -48,6 +48,7 @@ import org.infinispan.AdvancedCache;
|
||||||
import org.infinispan.commands.module.ModuleCommandFactory;
|
import org.infinispan.commands.module.ModuleCommandFactory;
|
||||||
import org.infinispan.commons.util.FileLookup;
|
import org.infinispan.commons.util.FileLookup;
|
||||||
import org.infinispan.commons.util.FileLookupFactory;
|
import org.infinispan.commons.util.FileLookupFactory;
|
||||||
|
import org.infinispan.commons.util.Util;
|
||||||
import org.infinispan.configuration.cache.CacheMode;
|
import org.infinispan.configuration.cache.CacheMode;
|
||||||
import org.infinispan.configuration.cache.Configuration;
|
import org.infinispan.configuration.cache.Configuration;
|
||||||
import org.infinispan.configuration.cache.ConfigurationBuilder;
|
import org.infinispan.configuration.cache.ConfigurationBuilder;
|
||||||
|
@ -434,8 +435,8 @@ public class InfinispanRegionFactory implements RegionFactory {
|
||||||
new ClassLoaderService.Work<EmbeddedCacheManager>() {
|
new ClassLoaderService.Work<EmbeddedCacheManager>() {
|
||||||
@Override
|
@Override
|
||||||
public EmbeddedCacheManager doWork(ClassLoader classLoader) {
|
public EmbeddedCacheManager doWork(ClassLoader classLoader) {
|
||||||
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
InputStream is;
|
|
||||||
is = fileLookup.lookupFile( configLoc, classLoader );
|
is = fileLookup.lookupFile( configLoc, classLoader );
|
||||||
if ( is == null ) {
|
if ( is == null ) {
|
||||||
// when it's not a user-provided configuration file, it might be a default configuration file,
|
// when it's not a user-provided configuration file, it might be a default configuration file,
|
||||||
|
@ -463,6 +464,9 @@ public class InfinispanRegionFactory implements RegionFactory {
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new CacheException( "Unable to create default cache manager", e );
|
throw new CacheException( "Unable to create default cache manager", e );
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
Util.close( is );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue