You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2002/06/12 14:28:16 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/source/impl FileSource.java

cziegeler    2002/06/12 05:28:16

  Modified:    src/java/org/apache/cocoon/components/source/impl
                        FileSource.java
  Log:
  Fixed FileSource
  
  Revision  Changes    Path
  1.3       +12 -10    xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/FileSource.java
  
  Index: FileSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/FileSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileSource.java	4 Jun 2002 07:11:27 -0000	1.2
  +++ FileSource.java	12 Jun 2002 12:28:16 -0000	1.3
  @@ -103,14 +103,12 @@
   
           private File tmpFile;
           private boolean isClosed = false;
  +        private FileSource source;
   
  -        public FileSourceOutputStream(File tmpFile) throws IOException {
  +        public FileSourceOutputStream(File tmpFile, FileSource source) throws IOException {
               super(tmpFile);
               this.tmpFile = tmpFile;
  -        }
  -
  -        public FileSource getSource() {
  -            return FileSource.this;
  +            this.source = source;
           }
   
           public void close() throws IOException {
  @@ -118,11 +116,11 @@
   
               try {
                   // Delete destination file
  -                if (FileSource.this.file.exists()) {
  -                    FileSource.this.file.delete();
  +                if (this.source.file.exists()) {
  +                    this.source.file.delete();
                   }
                   // Rename temp file to destination file
  -                tmpFile.renameTo(FileSource.this.file);
  +                tmpFile.renameTo(this.source.file);
   
               } finally {
                   // Ensure temp file is deleted, ie lock is released.
  @@ -154,6 +152,10 @@
                   tmpFile.delete();
               }
           }
  +
  +        public FileSource getSource() {
  +            return this.source;
  +        }
       }
   
       /**
  @@ -200,7 +202,7 @@
           }
   
           // Return a stream that will rename the temp file on close.
  -        return new FileSourceOutputStream(tmpFile);
  +        return new FileSourceOutputStream(tmpFile, this);
       }
   
       /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org