Index: src/main/groovy/lang/GroovyClassLoader.java =================================================================== --- src/main/groovy/lang/GroovyClassLoader.java (revision 4380) +++ src/main/groovy/lang/GroovyClassLoader.java (working copy) @@ -313,7 +313,8 @@ if (shouldCacheSource) sourceCache.put(codeSource.getName(), answer); } finally { try { - codeSource.getInputStream().close(); + InputStream is = codeSource.getInputStream(); + if(is != null) is.close(); } catch (IOException e) { throw new GroovyRuntimeException("unable to close stream",e); }