juergen     2002/08/02 05:17:48

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        UpdateMethod.java
  Log:
  Precondition violation was not send at all.
  Check if the href of the version really is a version before calling 
UriHandler.getAssociatedHistoryUri() since otherwise an IllegalStateException  might 
occur.
  (ralf)
  
  Revision  Changes    Path
  1.12      +31 -6     
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- UpdateMethod.java 1 Aug 2002 13:30:08 -0000       1.11
  +++ UpdateMethod.java 2 Aug 2002 12:17:48 -0000       1.12
  @@ -89,6 +89,7 @@
   import org.apache.slide.content.NodeProperty.NamespaceCache;
   import org.apache.slide.content.NodeRevisionContent;
   import org.apache.slide.content.NodeRevisionDescriptor;
  +import org.apache.slide.content.RevisionDescriptorNotFoundException;
   import org.apache.slide.content.NodeRevisionDescriptors;
   import org.apache.slide.content.NodeRevisionNumber;
   import org.apache.slide.webdav.WebdavServletConfig;
  @@ -284,6 +285,16 @@
                   // do not send a 207 multistatus if the depth header is not set
                   SlideException exception = 
(SlideException)nestedSlideException.enumerateExceptions().nextElement();
                   resp.setStatus(getErrorCode(exception));  // special handling needed
  +                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);
  +                    }
  +                }
                   throw new WebdavException(getErrorCode(exception), false); // abort 
the TA
               }
           }
  @@ -380,7 +391,6 @@
           catch (JDOMException e) {
               handleException(e, statusElement, responseElement, 
nestedSlideException);
           }
  -        
           // process children recursivly
           if (childrenEnum != null) {
               while (childrenEnum.hasMoreElements()) {
  @@ -528,8 +538,23 @@
           
           String associatedVrUri = 
versioningHelper.getUriOfAssociatedVR(resourcePath);
           String vcrHistoryUri = 
UriHandler.getUriHandler(associatedVrUri).getAssociatedHistoryUri();
  -        String vrHistoryUri = 
UriHandler.getUriHandler(updateSourcePath).getAssociatedHistoryUri();
  -        if ( ! vcrHistoryUri.equals(vrHistoryUri) ) {
  +        UriHandler vrUriHandler = UriHandler.getUriHandler(updateSourcePath);
  +        boolean isVersionOfVcrHistory = false;
  +        if (vrUriHandler.isVersionUri() &&
  +            vcrHistoryUri.equals(vrUriHandler.getAssociatedHistoryUri()) ) {
  +            
  +            NodeRevisionDescriptors vrDescriptors =
  +                content.retrieve(slideToken, updateSourcePath);
  +            try {
  +                NodeRevisionDescriptor vrDescriptor =
  +                    content.retrieve(slideToken, vrDescriptors);
  +                isVersionOfVcrHistory = true;
  +            }
  +            catch (RevisionDescriptorNotFoundException e) {
  +            }
  +        }
  +        
  +        if ( ! isVersionOfVcrHistory ) {
               return new 
ViolatedPrecondition(DeltavConstants.C_MUST_SELECT_VERSION_IN_HISTORY,
                                               WebdavStatus.SC_CONFLICT);
           }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to