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 ju...@apache.org on 2002/09/25 09:51:04 UTC

cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/util PropertyHelper.java

juergen     2002/09/25 00:51:04

  Modified:    src/webdav/server/org/apache/slide/webdav/util
                        PropertyHelper.java
  Log:
  Corrected check for restricted values.
  (ralf)
  
  Revision  Changes    Path
  1.36      +26 -41    jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyHelper.java
  
  Index: PropertyHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyHelper.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- PropertyHelper.java	25 Sep 2002 05:49:42 -0000	1.35
  +++ PropertyHelper.java	25 Sep 2002 07:51:04 -0000	1.36
  @@ -278,67 +278,52 @@
               result = srsv.toString();
           }
           else if( P_AUTO_VERSION.equals(propName) ) {
  -            Element avv = null;
               
  -            if ( (DEFAULT_AUTO_VERSION != null) && (DEFAULT_AUTO_VERSION.length() > 0) ) {
  +            XMLValue xmlValue = new XMLValue();
   
  -            if( AbstractResourceKind.SUPPORTED_AUTO_VERSION_ELEMENTS_LIST.contains(DEFAULT_AUTO_VERSION) ) {
  -                avv = new Element( DEFAULT_AUTO_VERSION, NamespaceCache.DEFAULT_NAMESPACE );
  +            if (DEFAULT_AUTO_VERSION.length() > 0) {
  +                xmlValue.add(new Element(DEFAULT_AUTO_VERSION, NamespaceCache.DEFAULT_NAMESPACE));
               }
  -            else {
  +
  +            if( ! resourceKind.isSupportedPropertyValue(P_AUTO_VERSION, xmlValue) ) {
                   Domain.warn( "Auto-version not configured properly; using "
                                +E_CHECKOUT_CHECKIN );
  -                avv = new Element( E_CHECKOUT_CHECKIN, NamespaceCache.DEFAULT_NAMESPACE );
  +                xmlValue = new XMLValue(new Element(E_CHECKOUT_CHECKIN, NamespaceCache.DEFAULT_NAMESPACE));
               }
               
  -            try {
  -                result = xmlOut.outputString( avv );
  -            }
  -            catch( Exception x ) {
  -                x.printStackTrace();
  -            }
  -        }
  -            else {
  -                result = "";
  -            }
  +            result = xmlValue.toString();
           }
           else if( P_CHECKOUT_FORK.equals(propName) ) {
  -            Element cfv = null;
               
  -            if( AbstractResourceKind.SUPPORTED_CHECKOUT_FORK_ELEMENTS_LIST.contains(DEFAULT_CHECKOUT_FORK) ) {
  -                cfv = new Element( DEFAULT_CHECKOUT_FORK, NamespaceCache.DEFAULT_NAMESPACE );
  +            XMLValue xmlValue = new XMLValue();
  +            
  +            if (DEFAULT_CHECKOUT_FORK.length() > 0) {
  +                xmlValue.add(new Element(DEFAULT_CHECKOUT_FORK, NamespaceCache.DEFAULT_NAMESPACE));
               }
  -            else {
  +                
  +            if( ! resourceKind.isSupportedPropertyValue(P_CHECKOUT_FORK, xmlValue) ) {
                   Domain.warn( "Checkout-fork not configured properly; using "
                                +E_FORBIDDEN );
  -                cfv = new Element( E_FORBIDDEN, NamespaceCache.DEFAULT_NAMESPACE );
  +                xmlValue = new XMLValue(new Element(E_FORBIDDEN, NamespaceCache.DEFAULT_NAMESPACE));
               }
               
  -            try {
  -                result = xmlOut.outputString( cfv );
  -            }
  -            catch( Exception x ) {
  -                x.printStackTrace();
  -            }
  +            result = xmlValue.toString();
           }
           else if( P_CHECKIN_FORK.equals(propName) ) {
  -            Element cfv = null;
               
  -            if( AbstractResourceKind.SUPPORTED_CHECKIN_FORK_ELEMENTS_LIST.contains(DEFAULT_CHECKIN_FORK) ) {
  -                cfv = new Element( DEFAULT_CHECKIN_FORK, NamespaceCache.DEFAULT_NAMESPACE );
  +            XMLValue xmlValue = new XMLValue();
  +            
  +            if (DEFAULT_CHECKIN_FORK.length() > 0) {
  +                xmlValue.add(new Element(DEFAULT_CHECKIN_FORK, NamespaceCache.DEFAULT_NAMESPACE));
               }
  -            else {
  +
  +            if( ! resourceKind.isSupportedPropertyValue(P_CHECKIN_FORK, xmlValue) ) {
                   Domain.warn( "Checkin-fork not configured properly; using "
                                +E_FORBIDDEN );
  -                cfv = new Element( E_FORBIDDEN, NamespaceCache.DEFAULT_NAMESPACE );
  +                xmlValue = new XMLValue(new Element(E_FORBIDDEN, NamespaceCache.DEFAULT_NAMESPACE));
               }
               
  -            try {
  -                result = xmlOut.outputString( cfv );
  -            }
  -            catch( Exception x ) {
  -                x.printStackTrace();
  -            }
  +            result = xmlValue.toString();
           }
           else if( P_GETCONTENTLANGUAGE.equals(propName) ) {
               result = "en";
  
  
  

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