You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by pn...@apache.org on 2002/08/12 14:55:03 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/util/resources messages.properties

pnever      2002/08/12 05:55:03

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        PropFindMethod.java PropPatchMethod.java
                        PutMethod.java MoveMethod.java ReportMethod.java
                        CopyMethod.java LockMethod.java GetMethod.java
                        OptionsMethod.java
                        AbstractMultistatusResponseMethod.java
                        AclMethod.java DeleteMethod.java MkcolMethod.java
                        UnlockMethod.java CheckoutMethod.java
                        VersionControlMethod.java CheckinMethod.java
                        UpdateMethod.java LabelMethod.java
                        UncheckoutMethod.java PostMethod.java
                        MkworkspaceMethod.java AbstractWebdavMethod.java
               src/share/org/apache/slide/util/resources
                        messages.properties
  Log:
  Uniform error handling.
  
  Revision  Changes    Path
  1.81      +16 -27    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java
  
  Index: PropFindMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- PropFindMethod.java	8 Aug 2002 09:17:33 -0000	1.80
  +++ PropFindMethod.java	12 Aug 2002 12:55:02 -0000	1.81
  @@ -244,9 +244,8 @@
                   
                   Element element = parseRequestContent().getRootElement();
                   if ( (element == null) ||  ! element.getName().equalsIgnoreCase(E_PROPFIND)) {
  -//                    Domain.warn( "Root element must be "+E_PROPFIND );
                       int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                    try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                    sendError( statusCode, getClass().getName()+".missingRootElement", new Object[]{"DAV:"+E_PROPFIND} );
                       throw new WebdavException( statusCode );
                   }
                   
  @@ -254,10 +253,8 @@
                   element = (Element)element.getChildren().get(0);
                   }
                   catch (Exception e) {
  -//                    Domain.warn( "Missing children of root element "+E_PROPFIND );
                       int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                    printStackTrace( e, statusCode );
  -                    try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                    sendError( statusCode, getClass().getName()+".missingRootElementChildren", new Object[]{"DAV:"+E_PROPFIND} );
                       throw new WebdavException( statusCode );
                   }
                   
  @@ -274,27 +271,24 @@
                   }
                   else {
                       int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                    try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                    sendError( statusCode, getClass().getName()+".invalidChildOfRootElement", new Object[]{element.getNamespace()+":"+element.getName(),"DAV:"+E_PROPFIND} );
                       throw new WebdavException( statusCode );
                   }
                   
               }
               catch (JDOMException  e){
                   int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
               catch (PropertyParseException  e){
                   int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
               catch (IOException  e){
                   int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
           }
  @@ -351,13 +345,11 @@
               resource = structure.retrieve(slideToken, resourcePath);
           } catch (StructureException e) {
               int statusCode = WebdavStatus.SC_NOT_FOUND;
  -            printStackTrace( e, statusCode );
  -            resp.sendError( statusCode );
  +            sendError( statusCode, e );
               throw new WebdavException( statusCode );
           } catch (Exception e) {
               int statusCode = getErrorCode( e );
  -            printStackTrace( e, statusCode );
  -            resp.sendError( statusCode );
  +            sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
           
  @@ -428,8 +420,7 @@
                               enum = structure.getChildren(slideToken, cur);
                           } catch (Exception e) {
                               int statusCode = getErrorCode( e );
  -                            printStackTrace( e, statusCode );
  -                            resp.sendError( statusCode );
  +                            sendError( statusCode, e );
                               throw new WebdavException( statusCode );
                           }
                           
  @@ -584,18 +575,16 @@
                       }
                   } catch (AccessDeniedException e) {
                       int statusCode = WebdavStatus.SC_FORBIDDEN;
  -                    printStackTrace( e, statusCode );
  -                    try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                    sendError( statusCode, e );
                       throw new WebdavException( statusCode );
                   } catch (ServiceAccessException e) {
                       int statusCode = WebdavStatus.SC_FORBIDDEN;
  -                    printStackTrace( e, statusCode );
  -                    try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                    sendError( statusCode, e );
                       throw new WebdavException( statusCode );
                   } catch (Exception e) {
                       int statusCode = getErrorCode( e );
  -                    printStackTrace( e, statusCode );
  -                    responseElement = getErrorResponse(object.getUri(), statusCode, null);
  +                    sendError( statusCode, e );
  +                    throw new WebdavException( statusCode );
                   }
                   break;
               case FIND_PROPERTY_NAMES :
  
  
  
  1.61      +7 -10     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java
  
  Index: PropPatchMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- PropPatchMethod.java	9 Aug 2002 09:16:43 -0000	1.60
  +++ PropPatchMethod.java	12 Aug 2002 12:55:02 -0000	1.61
  @@ -212,14 +212,13 @@
               }
               catch( Exception e ) {
                   int statusCode = getErrorCode( e );
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
           }
           else {
               int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -            try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +            sendError( statusCode, getClass().getName()+".missingRequestBody" );
               throw new WebdavException( statusCode );
           }
           
  @@ -356,8 +355,7 @@
           }
           catch (Exception e) {
               int statusCode = getErrorCode( e );
  -            printStackTrace( e, statusCode );
  -            resp.sendError( statusCode );
  +            sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
           
  @@ -467,8 +465,7 @@
               writer.flush();
           } catch (Exception e) {
               int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  -            printStackTrace( e, statusCode );
  -            try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +            sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
           
  
  
  
  1.55      +15 -22    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java
  
  Index: PutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- PutMethod.java	2 Aug 2002 13:56:02 -0000	1.54
  +++ PutMethod.java	12 Aug 2002 12:55:02 -0000	1.55
  @@ -170,8 +170,9 @@
           // check destination URI
           UriHandler destinationUriHandler = UriHandler.getUriHandler(resourcePath);
           if (destinationUriHandler.isRestrictedUri()) {
  -            resp.sendError(WebdavStatus.SC_FORBIDDEN, "Destination URI is restricted by server");
  -            return;
  +            int statusCode = WebdavStatus.SC_FORBIDDEN;
  +            sendError( statusCode, getClass().getName()+".restrictedDestinationUri", new Object[]{resourcePath} );
  +            throw new WebdavException( statusCode );
           }
           
           try {
  @@ -191,8 +192,9 @@
                       }
                   }
                   if (WebdavUtils.isCollection(oldRevisionDescriptor)) {
  -                    resp.setStatus(WebdavStatus.SC_CONFLICT);
  -                    return;
  +                    int statusCode = WebdavStatus.SC_CONFLICT;
  +                    sendError( statusCode, getClass().getName()+".mustNotBeCollection" );
  +                    throw new WebdavException( statusCode );
                   }
                   
                   NodeRevisionDescriptor revisionDescriptor = null;
  @@ -276,14 +278,9 @@
                   resp.setStatus(WebdavStatus.SC_NO_CONTENT);
                   
               } catch (LinkedObjectNotFoundException e) {
  -                // Nothing we can do here ...
  -                e.printStackTrace();
  -                //
  -                // make sure the transaction is aborted
  -                // throw any WebDAV exception to indicate
  -                // the transaction wants to be aborted
  -                //
  -                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +                int statusCode = getErrorCode( e );
  +                sendError( statusCode, e );
  +                throw new WebdavException( statusCode );
               } catch (ObjectNotFoundException e) {
                   
                   // Todo : Check to see if parent exists
  @@ -386,14 +383,10 @@
               sendPreconditionViolation(e);
               throw e;
           }
  -        catch (SlideException e) {
  -            resp.setStatus(getErrorCode(e));  // special handling needed
  -            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false); // abort the TA
  -        }
           catch (Exception e) {
  -            e.printStackTrace();
  -            resp.setStatus(getErrorCode(e));  // special handling needed
  -            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false); // abort the TA
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
       }
       
  
  
  
  1.49      +18 -12    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java
  
  Index: MoveMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- MoveMethod.java	13 Jul 2002 16:59:30 -0000	1.48
  +++ MoveMethod.java	12 Aug 2002 12:55:02 -0000	1.49
  @@ -200,8 +200,9 @@
           // check destination URI
           UriHandler destinationUriHandler = UriHandler.getUriHandler(destinationUri);
           if (destinationUriHandler.isRestrictedUri()) {
  -            resp.sendError(WebdavStatus.SC_FORBIDDEN, "Destination URI is restricted by server");
  -            return;
  +            int statusCode = WebdavStatus.SC_FORBIDDEN;
  +            sendError( statusCode, getClass().getName()+".restrictedDestinationUri", new Object[]{destinationUri} );
  +            throw new WebdavException( statusCode );
           }
           
           UriHandler sourceUriHandler = UriHandler.getUriHandler(sourceUri);
  @@ -230,25 +231,30 @@
                       resp.getWriter().write(errorMessage);
                   } catch(IOException ex) {
                       // Critical error ... Servlet container is dead or something
  -                    ex.printStackTrace();
  -                    throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                    int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                    sendError( statusCode, e );
  +                    throw new WebdavException( statusCode );
                   }
               } else {
                   // Returning 207 on non-collection requests is generally
                   // considered bad. So let's not do it, since this way
                   // makes clients generally behave better.
                   SlideException exception = (SlideException)e.enumerateExceptions().nextElement();
  -                resp.setStatus(getErrorCode(exception));
                   if (exception instanceof PreconditionViolationException) {
                       try {
                           sendPreconditionViolation((PreconditionViolationException)exception);
                       } catch(IOException ex) {
                           // Critical error ... Servlet container is dead or something
  -                        ex.printStackTrace();
  -                        throw new WebdavException
  -                            (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                        int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                        sendError( statusCode, e );
  +                        throw new WebdavException( statusCode );
                       }
                   }
  +                else {
  +                    int statusCode = getErrorCode( exception );
  +                    sendError( statusCode, exception );
  +                    throw new WebdavException( statusCode );
  +                }
               }
               //
               // make sure the transaction is aborted
  @@ -258,7 +264,7 @@
           }
           catch (SlideException e) {
               int statusCode = getErrorCode(e);
  -            resp.setStatus(statusCode);
  +            sendError( statusCode, e );
               throw new WebdavException(statusCode);
           }
       }
  
  
  
  1.45      +109 -84   jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java
  
  Index: ReportMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- ReportMethod.java	5 Aug 2002 08:28:53 -0000	1.44
  +++ ReportMethod.java	12 Aug 2002 12:55:02 -0000	1.45
  @@ -301,8 +301,9 @@
               Element element = content.getRootElement();
               
               if (element == null) {
  -                resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, getClass().getName()+".missingRootElement" );
  +                throw new WebdavException( statusCode );
               }
               
               if (element.getName().equalsIgnoreCase(R_VERSION_TREE)){
  @@ -333,29 +334,28 @@
                   parseLocateByHistoryRequest(element);
               }
               else{
  -                resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, getClass().getName()+".invalidRootElement", new Object[]{element} );
  +                throw new WebdavException( statusCode );
               }
           }
           catch (JDOMException  e){
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           catch (PropertyParseException  e){
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           catch (IOException  e){
  -            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           catch (WebdavException e) {
  +            // what is this for ... ??????
               e.printStackTrace();
               String statusText = getStatusText(e);
               try {
  @@ -385,7 +385,9 @@
           
           List childrenList = versionTreeElement.getChildren();
           if (childrenList.size() == 0) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingRootElementChildren", new Object[]{versionTreeElement.getNamespace()+":"+versionTreeElement.getName()} );
  +            throw new WebdavException( statusCode );
           }
           
           Element element = (Element)childrenList.get(0);
  @@ -394,7 +396,10 @@
               requestedProperties = new RequestedPropertiesImpl(element);
           }
           else {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".invalidChildOfRootElement", new Object[]{
  +                element.getNamespace()+":"+element.getName(),versionTreeElement.getNamespace()+":"+versionTreeElement.getName()} );
  +            throw new WebdavException( statusCode );
           }
       }
       
  @@ -411,7 +416,9 @@
           
           List childrenList = aclElement.getChildren();
           if (childrenList.size() == 0) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingRootElementChildren", new Object[]{aclElement.getNamespace()+":"+aclElement.getName()} );
  +            throw new WebdavException( statusCode );
           }
           
           Element element = (Element)childrenList.get(0);
  @@ -420,7 +427,9 @@
               requestedProperties = new RequestedPropertiesImpl(element);
           }
           else {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".invalidChildOfRootElement", new Object[]{aclElement.getNamespace()+":"+aclElement.getName(),element.getNamespace()+":"+element.getName()} );
  +            throw new WebdavException( statusCode );
           }
       }
       
  @@ -438,7 +447,9 @@
           List childrenList = aclElement.getChildren();
           Iterator childListIter = null;
           if (childrenList.size() == 0) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingRootElementChildren", new Object[]{aclElement.getNamespace()+":"+aclElement.getName()} );
  +            throw new WebdavException( statusCode );
           }
           
           childListIter = childrenList.iterator();
  @@ -449,7 +460,9 @@
               if ((E_PRINCIPAL_PROPERTY.equals(element.getName())) && (principalProperty == null)) {
                   List props = element.getChildren();
                   if (props.size() != 1) {
  -                    throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                    int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                    sendError( statusCode, getClass().getName()+".invalidNumberOfChildren", new Object[]{element.getNamespace()+":"+element.getName(),"1"} );
  +                    throw new WebdavException( statusCode );
                   }
                   principalProperty = (Element) props.get(0);
               }
  @@ -460,11 +473,15 @@
                   requestedProperties = new RequestedPropertiesImpl(element);
               }
               else {
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, getClass().getName()+".invalidChildOfRootElement", new Object[]{aclElement.getNamespace()+":"+aclElement.getName(),element.getNamespace()+":"+element.getName()} );
  +                throw new WebdavException( statusCode );
               }
           }
           if (principalProperty == null) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingPrincipalProperty" );
  +            throw new WebdavException( statusCode );
           }
       }
       
  @@ -482,7 +499,9 @@
           List childrenList = aclElement.getChildren();
           Iterator childListIter = null;
           if (childrenList.size() == 0) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingRootElementChildren", new Object[]{aclElement.getNamespace()+":"+aclElement.getName()} );
  +            throw new WebdavException( statusCode );
           }
           
           childListIter = childrenList.iterator();
  @@ -497,12 +516,16 @@
               } else if ((E_ALLPROP.equals(element.getName()) || E_PROP.equals(element.getName())) && (requestedProperties == null)) {
                   requestedProperties = new RequestedPropertiesImpl(element);
               } else {
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, getClass().getName()+".invalidChildOfRootElement", new Object[]{aclElement.getNamespace()+":"+aclElement.getName(),element.getNamespace()+":"+element.getName()} );
  +                throw new WebdavException( statusCode );
               }
           }
   //      if ((propertySearchSet == null)||(requestedProperties == null)) {
           if (propertySearchSet == null) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingPropertySearchSet" );
  +            throw new WebdavException( statusCode );
           }
       }
   
  @@ -532,7 +555,9 @@
           
           List childrenList = locateByHistoryElement.getChildren();
           if (childrenList.size() != 2) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".invalidNumberOfChildren", new Object[]{locateByHistoryElement.getNamespace()+":"+locateByHistoryElement.getName(),"2"} );
  +            throw new WebdavException( statusCode );
           }
           
           Element versionHistorySetElement = null;
  @@ -548,7 +573,9 @@
               versionHistorySetElement = (Element)childrenList.get(1);
           }
           else {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".invalidChildOfRootElement", new Object[]{childrenList,locateByHistoryElement.getNamespace()+":"+locateByHistoryElement.getName()} );
  +            throw new WebdavException( statusCode );
           }
           
           childrenList = versionHistorySetElement.getChildren();
  @@ -556,7 +583,9 @@
           Iterator iterator = versionHistorySet.iterator();
           while (iterator.hasNext()) {
               if ( ! E_HREF.equals(((Element)iterator.next()).getName()) ) {
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, getClass().getName()+".invalidChildOfElement", new Object[]{childrenList,versionHistorySetElement.getNamespace()+":"+versionHistorySetElement.getName()} );
  +                throw new WebdavException( statusCode );
               }
           }
           
  @@ -570,7 +599,7 @@
        *
        * @throws     WebdavException  if processing the request fails.
        */
  -    protected void executeRequest() throws WebdavException {
  +    protected void executeRequest() throws WebdavException, IOException {
           
           // content type must be set BEFORE calling getWriter()
           getResponse().setContentType(TEXT_XML_UTF_8);
  @@ -617,28 +646,13 @@
                   output(new Document(resultElement), getResponse().getWriter());
           }
           catch (PreconditionViolationException e) {
  -            try {
               sendPreconditionViolation(e);
  -            } catch (IOException ioe) {
  -                resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            }
               throw e;
           }
           catch (Exception e) {
  -            if( !(e instanceof SlideException) )
  -            e.printStackTrace();
  -            try {
  -            String statusText = getStatusText(e);
  -            if (statusText != null) {
  -                resp.sendError(getErrorCode(e), statusText);
  -            }
  -            else {
  -                resp.sendError(getErrorCode(e));
  -            }
  -            } catch (IOException ioe) {
  -                resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            }
  -            throw new WebdavException(getErrorCode(e));
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
       }
       
  @@ -679,7 +693,9 @@
               }
           }
           catch (SlideException e) {
  -            throw new WebdavException(getErrorCode(e));
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           
       }
  @@ -880,7 +896,9 @@
               reqProperties = new RequestedPropertiesImpl(prop);
           }
           catch (PropertyParseException e) {
  -            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           
           // get NodeRevisionDescriptor
  @@ -909,29 +927,27 @@
                   revisionDescriptor = new NodeRevisionDescriptor(0);
               }
           } catch (ObjectNotFoundException e) {
  -            resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  -            WebdavException we = new WebdavException
  -                (WebdavStatus.SC_NOT_FOUND);
  -//            we.writeErrorPage(resp);
  -            throw we;
  +            int statusCode = WebdavStatus.SC_NOT_FOUND;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           } catch (Exception e) {
  -            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            throw new WebdavException
  -                (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           
           // get the ACL of the current resource
           try {
               propstatList = retriever.getPropertiesOfObject(reqProperties, revisionDescriptors, revisionDescriptor, req.getContextPath(), serverURL, true);
           }catch (SlideException e) {
  -            resp.setStatus(getErrorCode(e));
  -            throw new WebdavException
  -                (getErrorCode(e));
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           if (propstatList.size() != 1) {
  -            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            throw new WebdavException
  -                (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".invalidNumberOfElements", new Object[]{propstatList,"2"} );
  +            throw new WebdavException( statusCode );
           }
   
           Iterator iterator = propstatList.iterator();
  @@ -1002,12 +1018,9 @@
               searchQuery = searchHelper.createSearchQuery
                   (grammarNamespace, queryElement, slideToken, depth, req.getRequestURI());
           } catch (BadQueryException e) {
  -            e.printStackTrace();
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           queryResult = searchHelper.search (slideToken, searchQuery);
           // Search for Principals
  @@ -1180,7 +1193,9 @@
                               principalCollectionSet.add(C_FROM_SCOPE_OPEN + currentHref.getText() + C_FROM_SCOPE_CLOSE);
                           }
                       } else {
  -                        throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                        int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                        sendError( statusCode, getClass().getName()+".invalidNumberOfElements", new Object[]{currentCollectioSets,"1"} );
  +                        throw new WebdavException( statusCode );
                       }
                   }
               }
  @@ -1203,7 +1218,9 @@
                   if ((E_PROP.equals(element.getName())) && (currentSearchPropertyName == null)) {
                       List props = element.getChildren();
                       if (props.size() != 1) {
  -                        throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                        int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                        sendError( statusCode, getClass().getName()+".invalidNumberOfChildren", new Object[]{element.getNamespace()+":"+element.getName(),"1"} );
  +                        throw new WebdavException( statusCode );
                       }
                       Element currentPropertyElement = (Element) props.get(0);
                       currentSearchPropertyNamespace = (currentPropertyElement.getNamespace()).getURI();
  @@ -1231,17 +1248,22 @@
                       currentSearchLiteral = C_LITERAL_OPEN + element.getText() + C_LITERAL_CLOSE;
                   }
                   else if (E_SUBSTRING.equals(element.getName())) {
  -                    resp.setStatus(WebdavStatus.SC_NOT_IMPLEMENTED);
  -                    throw new WebdavException(WebdavStatus.SC_NOT_IMPLEMENTED);
  +                    int statusCode = WebdavStatus.SC_NOT_IMPLEMENTED;
  +                    sendError( statusCode );
  +                    throw new WebdavException( statusCode );
                   }
                   else {
  -                    throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                    int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                    sendError( statusCode, getClass().getName()+".invalidChildOfElement", new Object[]{element.getNamespace()+":"+element.getName(),currentSearchProperty.getNamespace()+":"+currentSearchProperty.getName()} );
  +                    throw new WebdavException( statusCode );
                   }
               }
               
               // test if the search requirements for the property are complete
               if ((currentSearchLiteral == null) || (currentSearchPropertyName == null)) {
  -                    throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, getClass().getName()+".searchRequirementsIncomplete", new Object[]{currentSearchProperty} );
  +                throw new WebdavException( statusCode );
               } else {
                   whereElement = whereElement + C_PROPCONTAINS_OPEN + currentSearchPropertyName + currentSearchLiteral + C_PROPCONTAINS_CLOSE;
               }
  @@ -1336,8 +1358,9 @@
                                                                           true);
                               
                           } catch (LockTokenNotFoundException e) {
  -                            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -                            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
                           }
           return propList;
       }
  @@ -1478,7 +1501,9 @@
           
           // <locate-by-history> report can only be applied to collection
           if ( ! WebdavUtils.isCollection(token, slideToken, requestUri) ) {
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".mustBeCollection" );
  +            throw new WebdavException( statusCode );
           }
           
           // check DAV:must-be-version-history
  
  
  
  1.44      +17 -16    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java
  
  Index: CopyMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- CopyMethod.java	1 Aug 2002 12:06:50 -0000	1.43
  +++ CopyMethod.java	12 Aug 2002 12:55:02 -0000	1.44
  @@ -182,8 +182,9 @@
           // check destination URI
           UriHandler destinationUriHandler = UriHandler.getUriHandler(destinationUri);
           if (destinationUriHandler.isRestrictedUri()) {
  -            resp.sendError(WebdavStatus.SC_FORBIDDEN, "Destination URI is restricted by server");
  -            return;
  +            int statusCode = WebdavStatus.SC_FORBIDDEN;
  +            sendError( statusCode, getClass().getName()+".restrictedDestinationUri", new Object[]{destinationUri} );
  +            throw new WebdavException( statusCode );
           }
           
           try {
  @@ -203,25 +204,30 @@
                       resp.getWriter().write(errorMessage);
                   } catch(IOException ex) {
                       // Critical error ... Servlet container is dead or something
  -                    ex.printStackTrace();
  -                    throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                    int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                    sendError( statusCode, e );
  +                    throw new WebdavException( statusCode );
                   }
               } else {
                   // Returning 207 on non-collection requests is generally
                   // considered bad. So let's not do it, since this way
                   // makes clients generally behave better.
                   SlideException exception = (SlideException)e.enumerateExceptions().nextElement();
  -                resp.setStatus(getErrorCode(exception));
                   if (exception instanceof PreconditionViolationException) {
                       try {
                           sendPreconditionViolation((PreconditionViolationException)exception);
                       } catch(IOException ex) {
                           // Critical error ... Servlet container is dead or something
  -                        ex.printStackTrace();
  -                        throw new WebdavException
  -                            (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                        int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                        sendError( statusCode, e );
  +                        throw new WebdavException( statusCode );
                       }
                   }
  +                else {
  +                    int statusCode = getErrorCode( exception );
  +                    sendError( statusCode, exception );
  +                    throw new WebdavException( statusCode );
  +                }
               }
               //
               // make sure the transaction is aborted
  @@ -557,11 +563,6 @@
                       }
                       catch (JDOMException e) {
                           throw new SlideException("Checkout failed: " + e.getMessage());
  -                    }
  -                    catch (PreconditionViolationException e) {
  -                        e.printStackTrace();
  -                        System.out.println(e.getViolatedPrecondition());
  -                        throw e;
                       }
                   }
                   
  
  
  
  1.42      +22 -25    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java
  
  Index: LockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- LockMethod.java	6 Aug 2002 06:53:24 -0000	1.41
  +++ LockMethod.java	12 Aug 2002 12:55:02 -0000	1.42
  @@ -331,16 +331,14 @@
               parseOwner(lockOwnerElement);
                           }
           catch (JDOMException e) {
  -            e.printStackTrace();
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
                       }
           catch (IOException e) {
  -            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
                   }
               }
               
  @@ -403,8 +401,8 @@
           
           if (ownerElement == null) {
               lockInfo_lockOwner = DEFAULT_LOCK_OWNER;
  -//          throw new JDOMException("Expected <"+E_OWNER+"> element");
               return;
  +            //          throw new JDOMException("Expected <"+E_OWNER+"> element");
           }
               
           StringWriter stringWriter = new StringWriter();
  @@ -589,8 +587,9 @@
                           resp.getWriter().write(errorMessage);
                       } catch(IOException ex) {
                           // Critical error ... Servlet container is dead or something
  -                        ex.printStackTrace();
  -                        throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                            sendError( statusCode, e );
  +                            throw new WebdavException( statusCode );
                       }
                   } else {
                       // Returning 207 on non-collection requests is generally
  @@ -604,8 +603,9 @@
                   //
                   throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               } catch (Exception e) {
  -                resp.setStatus(getErrorCode(e));
  -                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +                    int statusCode = getErrorCode( e );
  +                    sendError( statusCode, e );
  +                    throw new WebdavException( statusCode );
               }
               
               break;
  @@ -629,13 +629,9 @@
                   showLockDiscoveryInfo(currentLockToken);
                   
               } catch (SlideException e) {
  -                resp.setStatus(WebdavStatus.SC_PRECONDITION_FAILED);
  -                e.printStackTrace();
  -                //
  -                // make sure the transaction is aborted
  -                // throw any WebDAV exception to indicate the transaction wants to be aborted
  -                //
  -                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +                    int statusCode = WebdavStatus.SC_PRECONDITION_FAILED;
  +                    sendError( statusCode, e );
  +                    throw new WebdavException( statusCode );
               }
               
               break;
  @@ -690,8 +686,9 @@
               new org.jdom.output.XMLOutputter(XML_REPONSE_INDENT, true).output(new org.jdom.Document(prop), writer);
               writer.flush();
           } catch (Exception e) {
  -            e.printStackTrace();
  -            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           
           
  
  
  
  1.32      +7 -13     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java
  
  Index: GetMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- GetMethod.java	2 Aug 2002 16:13:13 -0000	1.31
  +++ GetMethod.java	12 Aug 2002 12:55:02 -0000	1.32
  @@ -199,14 +199,11 @@
                   sendPreconditionViolation(new PreconditionViolationException(violatedPrecondition,
                                                                                resourcePath));
                   } catch (IOException ioe) {}
  -                throw new WebdavException(getErrorCode((Exception)e));
  +                throw new WebdavException( WebdavStatus.SC_CONFLICT );
               }
               catch (SlideException e) {
                   int statusCode = getErrorCode((Exception)e);
  -                try {
  -                    resp.sendError( statusCode );
  -                }
  -                catch (IOException ioe) {}
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
           }
  @@ -329,11 +326,8 @@
               
           } catch (Exception e) {
               int statusCode = getErrorCode(e);
  -            try {
  -                resp.sendError( statusCode );  // special handling needed
  -            }
  -            catch( IOException ioe ) {};
  -            throw new WebdavException( statusCode ); // abort the TA
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           
       }
  
  
  
  1.30      +18 -17    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java
  
  Index: OptionsMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- OptionsMethod.java	17 Jul 2002 12:24:38 -0000	1.29
  +++ OptionsMethod.java	12 Aug 2002 12:55:02 -0000	1.30
  @@ -132,8 +132,9 @@
               try {
                   Element oe = parseRequestContent().getRootElement();
                   if( oe == null || !oe.getName().equals(E_OPTIONS) ) {
  -                    Domain.warn( "Root element must be "+E_OPTIONS );
  -                    throw new JDOMException("Root element must be <"+E_OPTIONS+">");
  +                    int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                    sendError( statusCode, getClass().getName()+".missingRootElement", new Object[]{"DAV:"+E_OPTIONS} );
  +                    throw new WebdavException( statusCode );
                   }
                   Iterator i = oe.getChildren().iterator();
                   while( i.hasNext() ) {
  @@ -146,16 +147,15 @@
                   if( versionHistoryCollectionSetRequested || workspaceCollectionSetRequested )
                       responseBodyNeeded = true;
               }
  -            catch(JDOMException x ){
  -                resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -                try {
  -                    resp.sendError(WebdavStatus.SC_BAD_REQUEST, x.getMessage());
  -                } catch (IOException ioe) {}
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -            }
  -            catch( IOException x ){
  -                resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -                throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            catch(JDOMException e ){
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, e );
  +                throw new WebdavException( statusCode );
  +            }
  +            catch( IOException e ){
  +                int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                sendError( statusCode, e );
  +                throw new WebdavException( statusCode );
               }
           }
       }
  @@ -301,10 +301,11 @@
               try {
                   xmlOut.output(new Document(ore), resp.getWriter());
               }
  -            catch( IOException x ) {
  -                resp.setStatus( WebdavStatus.SC_INTERNAL_SERVER_ERROR );
  +            catch( IOException e ) {
  +                int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                sendError( statusCode, e );
  +                throw new WebdavException( statusCode );
               }
           }
       }
  -    
   }
  
  
  
  1.27      +6 -5      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java
  
  Index: AbstractMultistatusResponseMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- AbstractMultistatusResponseMethod.java	14 Jun 2002 12:24:05 -0000	1.26
  +++ AbstractMultistatusResponseMethod.java	12 Aug 2002 12:55:02 -0000	1.27
  @@ -154,8 +154,9 @@
           destinationUri = req.getHeader("Destination");
   
           if (destinationUri == null) {
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST); // that's it
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingDestinationHeader" );
  +            throw new WebdavException( statusCode );
           }
               
           int protocolIndex = destinationUri.indexOf("://");
  
  
  
  1.26      +18 -17    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java
  
  Index: AclMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AclMethod.java	29 Jul 2002 11:23:01 -0000	1.25
  +++ AclMethod.java	12 Aug 2002 12:55:02 -0000	1.26
  @@ -341,9 +341,9 @@
                                   addPermission (principal, config.getRevokePermissionAction().getUri(), negative, inheritable);
                                   break;
                               default:
  -                                System.out.println("Error: Unknown internal privilege code !!!");
  -                                resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -                                throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                            sendError( statusCode, getClass().getName()+".invalidPrivilegeElement", new Object[]{privilegeElement.getNamespace()+":"+privilegeElement.getName()} );
  +                            throw new WebdavException( statusCode );
                           }
                       }
                   }
  @@ -352,21 +352,21 @@
                   System.err.println("that doesn't provide Element::getElementsByTagNameNS");
                   System.err.println("consult the documentation for a list of valid parsers.");
   //                e.printStackTrace();
  -                resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -                throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           } catch (JDOMException e) {
                   System.err.println("Error parsing requestBody:");
                   System.err.println(requestBody);
   //                e.printStackTrace();
  -                resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -//              try {
  -//                    resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -//                } catch (IOException ioe) {}
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
               } catch (IOException e) {
   //                e.printStackTrace();
  -                resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
               }
           
       }
  @@ -388,8 +388,9 @@
                                       permissions.elements());
               
           } catch (Exception e) {
  -            resp.setStatus(getErrorCode(e)); // the default handling was good enough
  -            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false); // abort the TA
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           
       }
  
  
  
  1.26      +14 -10    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java
  
  Index: DeleteMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DeleteMethod.java	14 Jun 2002 12:24:05 -0000	1.25
  +++ DeleteMethod.java	12 Aug 2002 12:55:02 -0000	1.26
  @@ -195,25 +195,29 @@
                       resp.getWriter().write(errorMessage);
                   } catch(IOException ex) {
                       // Critical error ... Servlet container is dead or something
  -                    ex.printStackTrace();
  -                    throw new WebdavException
  -                        (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                    int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                    sendError( statusCode, ex );
  +                    throw new WebdavException( statusCode );
                   }
               } else {
                   // Returning 207 on non-collection requests is generally
                   // considered bad. So let's not do it, since this way
                   // makes clients generally behave better.
                   SlideException exception = (SlideException)dme.enumerateExceptions().nextElement();
  -                resp.setStatus(getErrorCode(exception));
                   if (exception instanceof PreconditionViolationException) {
                       try {
                           sendPreconditionViolation((PreconditionViolationException)exception);
                       } catch(IOException ex) {
                           // Critical error ... Servlet container is dead or something
  -                        ex.printStackTrace();
  -                        throw new WebdavException
  -                            (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                        int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                        sendError( statusCode, ex );
  +                        throw new WebdavException( statusCode );
                       }
  +                }
  +                else {
  +                    int statusCode = getErrorCode( exception );
  +                    sendError( statusCode, exception );
  +                    throw new WebdavException( statusCode );
                   }
               }
               //
  
  
  
  1.25      +12 -9     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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- MkcolMethod.java	14 Jun 2002 12:24:05 -0000	1.24
  +++ MkcolMethod.java	12 Aug 2002 12:55:02 -0000	1.25
  @@ -124,8 +124,9 @@
           throws WebdavException {
           
           if (req.getContentLength() > 0) {
  -            resp.setStatus(WebdavStatus.SC_UNSUPPORTED_MEDIA_TYPE);
  -            throw new WebdavException(WebdavStatus.SC_UNSUPPORTED_MEDIA_TYPE);
  +            int statusCode = WebdavStatus.SC_UNSUPPORTED_MEDIA_TYPE;
  +            sendError( statusCode, getClass().getName()+".requestBodyMustBeEmpty" );
  +            throw new WebdavException( statusCode );
           }
           
           colName = requestUri;
  @@ -148,8 +149,9 @@
           // check destination URI
           UriHandler destinationUriHandler = UriHandler.getUriHandler(colName);
           if (destinationUriHandler.isRestrictedUri()) {
  -            resp.sendError(WebdavStatus.SC_FORBIDDEN, "Destination URI is restricted by server");
  -            return;
  +            int statusCode = WebdavStatus.SC_FORBIDDEN;
  +            sendError( statusCode, getClass().getName()+".restrictedDestinationUri", new Object[]{colName} );
  +            throw new WebdavException( statusCode );
           }
           
           
  @@ -237,8 +239,9 @@
               structure.create(slideToken, collection, colName);
               content.create(slideToken, colName, revisionDescriptor, null);
           } catch (Exception e) {
  -            resp.setStatus(getErrorCode(e));  // special handling needed
  -            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false); // abort the TA
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           
           // 415 - Unsupported Media Type
  
  
  
  1.24      +6 -5      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java
  
  Index: UnlockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- UnlockMethod.java	14 Jun 2002 12:24:06 -0000	1.23
  +++ UnlockMethod.java	12 Aug 2002 12:55:02 -0000	1.24
  @@ -216,8 +216,9 @@
                   resp.setStatus(WebdavStatus.SC_NO_CONTENT);
                   
           } catch (Exception e) {
  -            resp.setStatus(getErrorCode(e));  // special handling needed
  -            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false); // abort the TA
  +                int statusCode = getErrorCode( e );
  +                sendError( statusCode, e );
  +                throw new WebdavException( statusCode );
           }
               
           }
  
  
  
  1.19      +7 -11     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java
  
  Index: CheckoutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CheckoutMethod.java	8 Aug 2002 09:17:33 -0000	1.18
  +++ CheckoutMethod.java	12 Aug 2002 12:55:02 -0000	1.19
  @@ -156,8 +156,7 @@
               }
               catch (SlideException e) {
                   int statusCode = getErrorCode( e );
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
           }
  @@ -192,14 +191,12 @@
               }
               catch (IOException  e){
                   int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
               catch (JDOMException  e){
                   int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
           }
  @@ -226,8 +223,7 @@
           }
           catch (Exception e) {
               int statusCode = getErrorCode(e);
  -            printStackTrace( e, statusCode );
  -            resp.sendError( statusCode );
  +            sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
           finally {
  
  
  
  1.19      +13 -21    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java
  
  Index: VersionControlMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- VersionControlMethod.java	27 Jun 2002 10:49:59 -0000	1.18
  +++ VersionControlMethod.java	12 Aug 2002 12:55:02 -0000	1.19
  @@ -171,15 +171,14 @@
                   }
               }
               catch (JDOMException  e){
  -                resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -                try {
  -                    resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -                } catch (IOException ioe) {}
  -                throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +                int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +                sendError( statusCode, e );
  +                throw new WebdavException( statusCode );
               }
  -            catch( IOException x ){
  -                resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -                throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            catch( IOException e ){
  +                int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                sendError( statusCode, e );
  +                throw new WebdavException( statusCode );
               }
           }
       }
  @@ -206,19 +205,12 @@
               sendPreconditionViolation(e);
               throw e;
           }
  -        catch (SlideException e) {
  -            resp.setStatus( getErrorCode(e) );  // special handling needed
  -            throw new WebdavException( WebdavStatus.SC_ACCEPTED, false ); // abort the TA
  -        }
           catch (Exception e) {
  -            e.printStackTrace();
  -            resp.setStatus( getErrorCode(e) );  // special handling needed
  -            throw new WebdavException( WebdavStatus.SC_ACCEPTED, false ); // abort the TA
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
  -        
       }
  -    
  -    
   }
   
   
  
  
  
  1.16      +6 -9      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckinMethod.java
  
  Index: CheckinMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckinMethod.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- CheckinMethod.java	8 Aug 2002 09:17:33 -0000	1.15
  +++ CheckinMethod.java	12 Aug 2002 12:55:02 -0000	1.16
  @@ -147,14 +147,12 @@
               }
               catch (IOException  e){
                   int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
               catch (JDOMException  e){
                   int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                printStackTrace( e, statusCode );
  -                try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +                sendError( statusCode, e );
                   throw new WebdavException( statusCode );
               }
           }
  @@ -183,8 +181,7 @@
           }
           catch (Exception e) {
               int statusCode = getErrorCode(e);
  -            printStackTrace( e, statusCode );
  -            resp.sendError( statusCode );
  +            sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
           finally {
  
  
  
  1.13      +24 -27    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java
  
  Index: UpdateMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- UpdateMethod.java	2 Aug 2002 12:17:48 -0000	1.12
  +++ UpdateMethod.java	12 Aug 2002 12:55:02 -0000	1.13
  @@ -181,32 +181,28 @@
           }
           
           if( req.getContentLength() == 0 ) {
  -            try {
  -            resp.sendError(WebdavStatus.SC_BAD_REQUEST, "Request body required");
  -            } catch (IOException e) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, getClass().getName()+".missingRequestBody" );
  +            throw new WebdavException( statusCode );
           }
           
           try{
               parseUpdateRequestContent();
           }
           catch (JDOMException  e){
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           catch (PropertyParseException  e){
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  -        }
  -        catch( IOException x ){
  -            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
  +        }
  +        catch( IOException e ){
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
       }
       
  @@ -288,11 +284,11 @@
                   if (exception instanceof PreconditionViolationException) {
                       try {
                           sendPreconditionViolation((PreconditionViolationException)exception);
  -                    } catch(IOException ex) {
  +                    } catch(IOException e) {
                           // Critical error ... Servlet container is dead or something
  -                        ex.printStackTrace();
  -                        throw new WebdavException
  -                            (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                        int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                        sendError( statusCode, e );
  +                        throw new WebdavException( statusCode );
                       }
                   }
                   throw new WebdavException(getErrorCode(exception), false); // abort the TA
  @@ -306,8 +302,9 @@
                   output(new Document(multistatusElement), resp.getWriter());
           }
           catch (Exception e) {
  -            resp.setStatus( getErrorCode(e) );  // special handling needed
  -            throw new WebdavException(getErrorCode(e), false); // abort the TA
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
       }
       
  
  
  
  1.12      +21 -18    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java
  
  Index: LabelMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- LabelMethod.java	27 Jun 2002 10:49:58 -0000	1.11
  +++ LabelMethod.java	12 Aug 2002 12:55:02 -0000	1.12
  @@ -255,15 +255,14 @@
               label = labelName.getText();
           }
           catch (IOException  e){
  -            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           catch (JDOMException  e){
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
       }
       
  @@ -294,25 +293,29 @@
                       resp.getWriter().write(errorMessage);
                   } catch(IOException ex) {
                       // Critical error ... Servlet container is dead or something
  -                    ex.printStackTrace();
  -                    throw new WebdavException
  -                        (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                    int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                    sendError( statusCode, ex );
  +                    throw new WebdavException( statusCode );
                   }
               } else {
                   // Returning 207 on non-collection requests is generally
                   // considered bad. So let's not do it, since this way
                   // makes clients generally behave better.
                   SlideException exception = (SlideException)nestedSlideException.enumerateExceptions().nextElement();
  -                resp.setStatus(getErrorCode(exception));
                   if (exception instanceof PreconditionViolationException) {
                       try {
                           sendPreconditionViolation((PreconditionViolationException)exception);
                       } catch(IOException ex) {
                           // Critical error ... Servlet container is dead or something
  -                        ex.printStackTrace();
  -                        throw new WebdavException
  -                            (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                        int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +                        sendError( statusCode, ex );
  +                        throw new WebdavException( statusCode );
                       }
  +                    }
  +                else {
  +                    int statusCode = getErrorCode( exception );
  +                    sendError( statusCode, exception );
  +                    throw new WebdavException( statusCode );
                   }
               }
               //
  
  
  
  1.10      +11 -14    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UncheckoutMethod.java
  
  Index: UncheckoutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UncheckoutMethod.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- UncheckoutMethod.java	5 Aug 2002 08:28:53 -0000	1.9
  +++ UncheckoutMethod.java	12 Aug 2002 12:55:02 -0000	1.10
  @@ -130,15 +130,14 @@
               parseRequestContent();
           }
           catch (JDOMException  e){
  -            resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
  -            try {
  -                resp.sendError(WebdavStatus.SC_BAD_REQUEST, e.getMessage());
  -            } catch (IOException ioe) {}
  -            throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  +            int statusCode = WebdavStatus.SC_BAD_REQUEST;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           catch (IOException  e){
  -            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
       }
   
  @@ -163,11 +162,9 @@
               throw e;
           }
           catch (Exception e) {
  -            if( !(e instanceof SlideException) )
  -            e.printStackTrace();
               int statusCode = getErrorCode(e);
  -            resp.sendError( statusCode );  // special handling needed
  -            throw new WebdavException( statusCode, false ); // abort the TA
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           finally {
               resp.setHeader(H_CACHE_CONTROL, NO_CACHE);
  
  
  
  1.9       +6 -4      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PostMethod.java
  
  Index: PostMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PostMethod.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PostMethod.java	14 Jun 2002 12:24:05 -0000	1.8
  +++ PostMethod.java	12 Aug 2002 12:55:02 -0000	1.9
  @@ -101,7 +101,9 @@
               super.executeRequest();
           }
           else {
  -            resp.setStatus(WebdavStatus.SC_CONFLICT);
  +            int statusCode = WebdavStatus.SC_CONFLICT;
  +            sendError( statusCode, getClass().getName()+".mustNotBeCollection" );
  +            throw new WebdavException( statusCode );
           }
   
       }
  
  
  
  1.7       +6 -6      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkworkspaceMethod.java
  
  Index: MkworkspaceMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkworkspaceMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MkworkspaceMethod.java	14 Jun 2002 12:24:05 -0000	1.6
  +++ MkworkspaceMethod.java	12 Aug 2002 12:55:02 -0000	1.7
  @@ -159,9 +159,9 @@
               throw e;
           }
           catch (Exception e) {
  -            e.printStackTrace();
  -            resp.setStatus( getErrorCode(e) );  // special handling needed
  -            throw new WebdavException( WebdavStatus.SC_ACCEPTED, false ); // abort the TA
  +            int statusCode = getErrorCode( e );
  +            sendError( statusCode, e );
  +            throw new WebdavException( statusCode );
           }
           finally {
               resp.setHeader(H_CACHE_CONTROL, NO_CACHE);
  
  
  
  1.3       +43 -6     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
  
  Index: AbstractWebdavMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractWebdavMethod.java	7 Aug 2002 14:41:18 -0000	1.2
  +++ AbstractWebdavMethod.java	12 Aug 2002 12:55:02 -0000	1.3
  @@ -85,6 +85,7 @@
   import org.apache.slide.search.*;
   import org.apache.slide.macro.*;
   import org.apache.slide.security.*;
  +import org.apache.slide.util.Messages;
   import org.apache.slide.webdav.*;
   import org.apache.slide.webdav.util.WebdavUtils;
   import org.apache.slide.webdav.util.PreconditionViolationException;
  @@ -331,8 +332,7 @@
           } catch (Exception ex) {
               token.getLogger().log(ex,LOG_CHANNEL,Logger.ERROR);
               int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
  -            printStackTrace( ex, statusCode );
  -            try { resp.sendError( statusCode, ex.getMessage() ); } catch( Throwable x ) {};
  +            sendError( statusCode, ex );
               throw new WebdavException( statusCode );
           } finally {
               if (transactionIsStarted && methodNeedsTransactionSupport()) {
  @@ -753,6 +753,44 @@
           return result;
       }
   
  +    /**
  +     * Error handling routine
  +     */
  +    protected void sendError( int statusCode ) {
  +        try { resp.sendError( statusCode ); } catch( Throwable x ) {};
  +    }
  +    
  +    /**
  +     * Error handling routine
  +     */
  +    protected void sendError( int statusCode, String message ) {
  +        String statusText =
  +            WebdavStatus.getStatusText(statusCode)+": "+
  +            Messages.format( message, (Object)null );
  +        try { resp.sendError( statusCode, statusText ); } catch( Throwable x ) {};
  +    }
  +    
  +    /**
  +     * Error handling routine
  +     */
  +    protected void sendError( int statusCode, String message, Object[] args ) {
  +        String statusText =
  +            WebdavStatus.getStatusText(statusCode)+": "+
  +            Messages.format( message, args );
  +        try { resp.sendError( statusCode, statusText ); } catch( Throwable x ) {};
  +    }
  +    
  +    /**
  +     * Error handling routine
  +     */
  +    protected void sendError( int statusCode, Throwable t ) {
  +        printStackTrace( t, statusCode );
  +        String statusText =
  +            WebdavStatus.getStatusText(statusCode)+": "+
  +            Messages.format( t.getClass().getName(), (Object)null )+" - "+
  +            t.getMessage();
  +        try { resp.sendError( statusCode, statusText ); } catch( Throwable x ) {};
  +    }
       
       /**
        * Prints the stack trace of the given exception if the specified status code
  @@ -767,7 +805,6 @@
           if( statusCode >= printStackTraceFrom )
               x.printStackTrace();
       }
  -
   }
   
   
  
  
  
  1.17      +63 -3     jakarta-slide/src/share/org/apache/slide/util/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/resources/messages.properties,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- messages.properties	10 Oct 2001 16:18:16 -0000	1.16
  +++ messages.properties	12 Aug 2002 12:55:03 -0000	1.17
  @@ -181,7 +181,7 @@
   
   
   #
  -# Messages produced by webdav
  +# Strings needed for directory listings
   #
   org.apache.slide.webdav.GetMethod.directorylistingfor=\
           Directory listing for {0}
  @@ -265,3 +265,63 @@
   org.apache.slide.transaction.SlideTransaction.prepareFail=\
       Prepare failure: Resource manager {0} Error code {1} in {2}
   
  +
  +#
  +# Messages produced by WebDAV
  +#
  +org.apache.slide.webdav.method.AbstractWebdavMethod.preconditionViolation=\
  +    Precondition violation
  +org.apache.slide.webdav.method.PropFindMethod.missingRootElement=\
  +    Root element must be {0}
  +org.apache.slide.webdav.method.PropFindMethod.missingRootElementChildren=\
  +    Missing children of root element {0}
  +org.apache.slide.webdav.method.PropFindMethod.invalidChildOfRootElement=\
  +    Invalid child {0} of root element {1}
  +org.apache.slide.webdav.method.PropPatchMethod.missingRequestBody=\
  +    Missing request body
  +org.apache.slide.webdav.method.AbstractMultistatusResponseMethod.missingDestinationHeader=\
  +    Missing Destination: header
  +org.apache.slide.webdav.method.CopyMethod.restrictedDestinationUri=\
  +    Destination URI {0} is restricted
  +org.apache.slide.webdav.method.MoveMethod.restrictedDestinationUri=\
  +    Destination URI {0} is restricted
  +org.apache.slide.webdav.method.PostMethod.mustNotBeCollection=\
  +    Must not be collection
  +org.apache.slide.webdav.method.PutMethod.mustNotBeCollection=\
  +    Must not be collection
  +org.apache.slide.webdav.method.PutMethod.restrictedDestinationUri=\
  +    Destination URI {0} is restricted
  +org.apache.slide.webdav.method.MkcolMethod.requestBodyMustBeEmpty=\
  +    The request body must be empty
  +org.apache.slide.webdav.method.MkColMethod.restrictedDestinationUri=\
  +    Destination URI {0} is restricted
  +org.apache.slide.webdav.method.OptionsMethod.missingRootElement=\
  +    Root element must be {0}
  +org.apache.slide.webdav.method.AclMethod.invalidPrivilegeElement=\
  +    Invalid privilege element {0}
  +org.apache.slide.webdav.method.ReportMethod.missingRootElement=\
  +    Missing root element
  +org.apache.slide.webdav.method.ReportMethod.invalidRootElement=\
  +    Invalid root element
  +org.apache.slide.webdav.method.ReportMethod.missingRootElementChildren=\
  +    Missing children of root element {0}
  +org.apache.slide.webdav.method.ReportMethod.invalidChildOfRootElement=\
  +    Invalid child {0} of root element {1}
  +org.apache.slide.webdav.method.ReportMethod.invalidChildOfElement=\
  +    Invalid child {0} of element {1}
  +org.apache.slide.webdav.method.ReportMethod.invalidNumberOfChildren=\
  +    Invalid number of children of {0}: must be {1}
  +org.apache.slide.webdav.method.ReportMethod.invalidNumberOfElements=\
  +    Invalid number of elements in {0}: must be {1}
  +org.apache.slide.webdav.method.ReportMethod.missingPrincipalProperty=\
  +    Missing principal property
  +org.apache.slide.webdav.method.ReportMethod.missingPropertySearchSet=\
  +    Missing property search set
  +org.apache.slide.webdav.method.ReportMethod.searchRequirementsIncomplete=\
  +    Search requirements of property {0} incomplete
  +org.apache.slide.webdav.method.ReportMethod.mustBeCollection=\
  +    Must be collection
  +org.apache.slide.webdav.method.UpdateMethod.missingRequestBody=\
  +    Missing request body
  +
  +    
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>