juergen     01/03/07 10:21:24

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        MkcolMethod.java WebdavMethod.java
               src/webdav/server/org/apache/slide/webdav
                        WebdavException.java
  Log:
  in case of a second mkcol command on the same URL no stack trace is shown any more.
  
  Revision  Changes    Path
  1.7       +40 -39    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java
  
  Index: MkcolMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MkcolMethod.java  2001/03/06 03:19:07     1.6
  +++ MkcolMethod.java  2001/03/07 18:21:15     1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java,v
 1.6 2001/03/06 03:19:07 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/03/06 03:19:07 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java,v
 1.7 2001/03/07 18:21:15 juergen Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/03/07 18:21:15 $
    *
    * ====================================================================
    *
  @@ -110,7 +110,7 @@
        */
       public MkcolMethod(GenericServlet servlet, NamespaceAccessToken token,
                          HttpServletRequest req, HttpServletResponse resp) {
  -     super(servlet, token, req, resp);
  +    super(servlet, token, req, resp);
       }
       
       
  @@ -121,12 +121,12 @@
        * Parse XML request.
        */
       protected void parseRequest()
  -     throws WebdavException {
  -     colName = requestUri;
  -     if (colName == null) {
  -         colName = "/";
  -     }
  +    throws WebdavException {
  +    colName = requestUri;
  +    if (colName == null) {
  +        colName = "/";
       }
  +    }
       
       
       /**
  @@ -208,43 +208,43 @@
           
           // If everything is ok : 201 - Created / OK
           resp.setStatus(WebdavStatus.SC_CREATED);
  -     
  +    
           try {
               structure.create(slideToken, collection, colName);
               content.create(slideToken, colName, revisionDescriptor, null);
           } catch (ObjectNotFoundException e) {
  -         resp.setStatus(WebdavStatus.SC_CONFLICT);
  -         throw new WebdavException(WebdavStatus.SC_CONFLICT);
  -     } catch (ObjectLockedException e) {
  -         resp.setStatus(WebdavStatus.SC_LOCKED);
  -         throw new WebdavException(WebdavStatus.SC_LOCKED);
  -     } catch (RevisionAlreadyExistException e) {
  -         resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -         throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -     } catch (ServiceAccessException e) {
  -         resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -         throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -     } catch (LinkedObjectNotFoundException e) {
  -         resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  -         throw new WebdavException(WebdavStatus.SC_NOT_FOUND);
  -     } catch (ObjectAlreadyExistsException e) {
  +        resp.setStatus(WebdavStatus.SC_CONFLICT);
  +        throw new WebdavException(WebdavStatus.SC_CONFLICT);
  +    } catch (ObjectLockedException e) {
  +        resp.setStatus(WebdavStatus.SC_LOCKED);
  +        throw new WebdavException(WebdavStatus.SC_LOCKED);
  +    } catch (RevisionAlreadyExistException e) {
  +        resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +        throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +    } catch (ServiceAccessException e) {
  +        resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +        throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +    } catch (LinkedObjectNotFoundException e) {
  +        resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +        throw new WebdavException(WebdavStatus.SC_NOT_FOUND);
  +    } catch (ObjectAlreadyExistsException e) {
               resp.setStatus(WebdavStatus.SC_METHOD_NOT_ALLOWED);
  -            throw new WebdavException(WebdavStatus.SC_METHOD_NOT_ALLOWED);
  +            throw new WebdavException(WebdavStatus.SC_METHOD_NOT_ALLOWED, false);
           } catch (AccessDeniedException e) {
  -         resp.setStatus(WebdavStatus.SC_FORBIDDEN);
  -         throw new WebdavException(WebdavStatus.SC_FORBIDDEN);
  -     }
  -     
  -     // 415 - Unsupported Media Type
  -     // TODO : Has something to do with the body of the request ...
  -     // WebDAV RFC is vague on the subject.
  -     
  -     // 507 - Insufficient storage
  -     // Would be returned as a ServiceAccessException, so it would
  +        resp.setStatus(WebdavStatus.SC_FORBIDDEN);
  +        throw new WebdavException(WebdavStatus.SC_FORBIDDEN);
  +    }
  +    
  +    // 415 - Unsupported Media Type
  +    // TODO : Has something to do with the body of the request ...
  +    // WebDAV RFC is vague on the subject.
  +    
  +    // 507 - Insufficient storage
  +    // Would be returned as a ServiceAccessException, so it would
           // return an Internal Server Error, which is probably acceptable.
  -     
  -     // TODO : Initialize and create collection's properties.
  -     
  +    
  +    // TODO : Initialize and create collection's properties.
  +    
       }
       
       
  @@ -257,3 +257,4 @@
       
       
   }
  +
  
  
  
  1.13      +5 -4      
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java
  
  Index: WebdavMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- WebdavMethod.java 2001/02/20 09:24:01     1.12
  +++ WebdavMethod.java 2001/03/07 18:21:16     1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java,v
 1.12 2001/02/20 09:24:01 juergen Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/02/20 09:24:01 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/WebdavMethod.java,v
 1.13 2001/03/07 18:21:16 juergen Exp $
  + * $Revision: 1.13 $
  + * $Date: 2001/03/07 18:21:16 $
    *
    * ====================================================================
    *
  @@ -327,7 +327,8 @@
                   transactionIsStarted = false;
               }
           } catch (WebdavException ex) {
  -            throw ex;
  +//          System.out.println("ERROR");
  +//          throw ex;
           } catch (Exception ex) {
               resp.setStatus(WebdavStatus.SC_METHOD_FAILURE);
               throw new WebdavException(WebdavStatus.SC_METHOD_FAILURE);
  
  
  
  1.2       +24 -14    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavException.java
  
  Index: WebdavException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WebdavException.java      2000/11/22 06:20:45     1.1
  +++ WebdavException.java      2001/03/07 18:21:21     1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavException.java,v
 1.1 2000/11/22 06:20:45 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/11/22 06:20:45 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavException.java,v
 1.2 2001/03/07 18:21:21 juergen Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/03/07 18:21:21 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -15,7 +15,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -23,15 +23,15 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:  
  - *       "This product includes software developed by the 
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
    * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written 
  + *    from this software without prior written permission. For written
    *    permission, please contact [EMAIL PROTECTED]
    *
    * 5. Products derived from this software may not be called "Apache"
  @@ -59,7 +59,7 @@
    *
    * [Additional notices, if required by prior licensing conditions]
    *
  - */ 
  + */
   
   package org.apache.slide.webdav;
   
  @@ -72,7 +72,7 @@
   
   /**
    * Webdav exception class.
  - * 
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
    */
   public class WebdavException extends SlideException {
  @@ -91,13 +91,23 @@
       
       
       /**
  +     * Constructor.
  +     *
  +     * @param statusCode Exception status code
  +     * @param logging true, if the creation is logged via logging
  +     */
  +    public WebdavException(int statusCode, boolean logging) {
  +        super(WebdavStatus.getStatusText(statusCode), logging);
  +        this.statusCode = statusCode;
  +    }
  +    
  +    /**
        * Constructor.
  -     * 
  +     *
        * @param statusCode Exception status code
        */
       public WebdavException(int statusCode) {
  -     super(WebdavStatus.getStatusText(statusCode));
  -     this.statusCode = statusCode;
  +        this(statusCode, true);
       }
       
       
  @@ -106,7 +116,7 @@
       
       /**
        * Returns an HTTP formatted error page.
  -     * 
  +     *
        * @param resp HTTP servlet response
        */
       public void writeErrorPage(HttpServletResponse resp) {
  
  
  

Reply via email to