vgritsenko    02/02/09 21:07:16

  Modified:    src/java/org/apache/cocoon/components/language/programming
                        CompiledProgrammingLanguage.java
  Log:
  cleanup
  
  Revision  Changes    Path
  1.8       +6 -13     
xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java
  
  Index: CompiledProgrammingLanguage.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CompiledProgrammingLanguage.java  8 Feb 2002 21:36:54 -0000       1.7
  +++ CompiledProgrammingLanguage.java  10 Feb 2002 05:07:16 -0000      1.8
  @@ -73,7 +73,7 @@
    * A compiled programming language. This class extends 
<code>AbstractProgrammingLanguage</code> adding support for compilation
    * and object program files
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ricardo Rocha</a>
  - * @version CVS $Id: CompiledProgrammingLanguage.java,v 1.7 2002/02/08 21:36:54 
dims Exp $
  + * @version CVS $Id: CompiledProgrammingLanguage.java,v 1.8 2002/02/10 05:07:16 
vgritsenko Exp $
    */
   public abstract class CompiledProgrammingLanguage extends 
AbstractProgrammingLanguage implements Contextualizable {
   
  @@ -179,22 +179,17 @@
       public Program load(String filename, File baseDirectory, String encoding) 
throws LanguageException {
   
           // Used for preload/precompile option.
  -        // Don't need to test for existence of the Source code.
  +        // Don't need to test for existence of the object code as it might be 
bundled into the WAR.
           try {
               Class program = this.loadProgram(filename, baseDirectory);
               Object testInstance = program.newInstance();
               return new JavaProgram(program);
           } catch (Throwable t) {
  -            //Ignore errors if any.
  +            // Ignore errors if any, try to compile.
           }
   
  -        // Does object file exist? Load and return instance
  -        File objectFile = new File(baseDirectory, new 
StringBuffer(filename).append(".").append(this.getObjectExtension()).toString());
  -        if (objectFile.exists() && objectFile.isFile() && objectFile.canRead()) {
  -            return new JavaProgram(this.loadProgram(filename, baseDirectory));
  -        }
           // Does source file exist?
  -        File sourceFile = new File(baseDirectory, new 
StringBuffer(filename).append(".").append(this.getSourceExtension()).toString());
  +        File sourceFile = new File(baseDirectory, filename + "." + 
this.getSourceExtension());
           if (!sourceFile.exists()) {
               throw new LanguageException("Can't load program - File doesn't exist: " 
+ IOUtils.getFullFilename(sourceFile));
           }
  @@ -213,18 +208,16 @@
           // Try to instantiate once to ensure there are no exceptions thrown in the 
constructor
           try {
               Object testInstance = program.newInstance();
  -
           } catch(IllegalAccessException iae) {
               getLogger().debug("No public constructor for class " + 
program.getName());
  -
           } catch(Exception e) {
               // Unload class and delete the object file, or it won't be recompiled
               // (leave the source file to allow examination).
               this.doUnload(program);
  -            objectFile.delete();
  +            new File(baseDirectory, filename + "." + 
this.getObjectExtension()).delete();
   
               String message = "Error while instantiating " + filename;
  -            getLogger().warn(message, e);
  +            getLogger().debug(message, e);
               throw new LanguageException(message, e);
           }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to