sylvain     2003/09/24 13:38:09

  Modified:    src/java/org/apache/cocoon/components/flow/javascript
                        JavaScriptInterpreter.java
               src/java/org/apache/cocoon/components/flow/javascript/fom
                        FOM_JavaScriptInterpreter.java
  Log:
  Always close script sources
  
  Revision  Changes    Path
  1.21      +10 -6     
cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptInterpreter.java
  
  Index: JavaScriptInterpreter.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptInterpreter.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- JavaScriptInterpreter.java        18 May 2003 16:36:40 -0000      1.20
  +++ JavaScriptInterpreter.java        24 Sep 2003 20:38:09 -0000      1.21
  @@ -524,11 +524,15 @@
           if (is == null) {
               throw new ResourceNotFoundException(src.getURI() + ": not 
found");
           }
  -        Reader reader = new BufferedReader(new InputStreamReader(is));
  -        Script compiledScript = cx.compileReader(scope, reader,
  -                                                 src.getURI(),
  -                                                 1, null);
  -        return compiledScript;
  +        try {
  +            Reader reader = new BufferedReader(new InputStreamReader(is));
  +            Script compiledScript = cx.compileReader(scope, reader,
  +                                                     src.getURI(),
  +                                                     1, null);
  +            return compiledScript;
  +        } finally {
  +            is.close();
  +        }
       }
   
       /**
  
  
  
  1.9       +10 -6     
cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java
  
  Index: FOM_JavaScriptInterpreter.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FOM_JavaScriptInterpreter.java    23 Sep 2003 22:46:44 -0000      1.8
  +++ FOM_JavaScriptInterpreter.java    24 Sep 2003 20:38:09 -0000      1.9
  @@ -493,11 +493,15 @@
           if (is == null) {
               throw new ResourceNotFoundException(src.getURI() + ": not 
found");
           }
  -        Reader reader = new BufferedReader(new InputStreamReader(is));
  -        Script compiledScript = cx.compileReader(scope, reader,
  -                                                 src.getURI(),
  -                                                 1, null);
  -        return compiledScript;
  +        try {
  +            Reader reader = new BufferedReader(new InputStreamReader(is));
  +            Script compiledScript = cx.compileReader(scope, reader,
  +                                                     src.getURI(),
  +                                                     1, null);
  +            return compiledScript;
  +        } finally {
  +            is.close();
  +        }
       }
   
       /**
  
  
  

Reply via email to