diff --git a/contrib/velocity/src/main/java/org/apache/solr/request/VelocityResponseWriter.java b/contrib/velocity/src/main/java/org/apache/solr/request/VelocityResponseWriter.java index f9e38f16dc4..397dc8d7660 100644 --- a/contrib/velocity/src/main/java/org/apache/solr/request/VelocityResponseWriter.java +++ b/contrib/velocity/src/main/java/org/apache/solr/request/VelocityResponseWriter.java @@ -132,11 +132,16 @@ public class VelocityResponseWriter implements QueryResponseWriter { if( propFile == null ) engine.init(); else{ - InputStream is = resourceLoader.getResourceStream( propFile ); - Properties props = new Properties(); - props.load( is ); - is.close(); - engine.init( props ); + InputStream is = null; + try{ + is = resourceLoader.getResourceStream( propFile ); + Properties props = new Properties(); + props.load( is ); + engine.init( props ); + } + finally{ + if( is != null ) is.close(); + } } } catch( Exception e ){