stephan     2002/08/14 02:27:50

  Modified:    src/scratchpad/src/org/apache/cocoon/components/source/impl
                        SlideSource.java
  Log:
  The Source checks the permissions with the false principal.
  
  Revision  Changes    Path
  1.15      +20 -8     
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java
  
  Index: SlideSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SlideSource.java  5 Aug 2002 09:05:42 -0000       1.14
  +++ SlideSource.java  14 Aug 2002 09:27:49 -0000      1.15
  @@ -64,6 +64,8 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.logger.LogEnabled;
  +import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.thread.ThreadSafe;
   
   import org.apache.cocoon.Constants;
  @@ -361,8 +363,10 @@
        * @return a stream to write to
        */
       public OutputStream getOutputStream() throws IOException, SourceException {
  -        if (outputstream==null)
  +        if (outputstream==null) {
               outputstream = new SlideSourceOutputStream();
  +            outputstream.enableLogging(getLogger());
  +        }
           return outputstream;
       }
   
  @@ -395,8 +399,18 @@
       /**
        * A helper can the getOutputStream() method
        */
  -    public class SlideSourceOutputStream extends ByteArrayOutputStream {
  +    public class SlideSourceOutputStream extends ByteArrayOutputStream implements 
LogEnabled {
           private boolean isClosed = false;
  +        private Logger logger = null;
  +
  +        /**
  +         * Provide component with a logger.
  +         *
  +         * @param logger the logger
  +         */
  +        public void enableLogging(Logger logger) {
  +            this.logger = logger;
  +        }
   
           public void close() throws IOException {
               super.close();
  @@ -486,14 +500,12 @@
                       content.create(slideToken, config.getFilesPath()+uri, 
revisionDescriptor,
                                      revisionContent);
                   } catch (SlideException se) {
  -                    // FIXME correct exception handling
  -                    e.printStackTrace();
  +                    this.logger.error("Could not create source", se);
                       throw new IOException(se.getMessage());
                   }
   
               } catch (Exception e) {
  -                // FIXME correct exception handling
  -                e.printStackTrace();
  +                this.logger.error("Could not create source", e);
                   throw new IOException(e.getMessage());
               } finally {
                   this.isClosed = true;
  @@ -665,7 +677,7 @@
               return;
   
           this.sourcecredential = sourcecredential;
  -        this.credToken = new 
CredentialsToken(config.getUsersPath()+"/"+this.sourcecredential.getPrincipal());
  +        this.credToken = new CredentialsToken(this.sourcecredential.getPrincipal());
           this.slideToken = new SlideTokenImpl(credToken);
       }
   
  
  
  

----------------------------------------------------------------------
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