lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/publication DefaultDocumentBuilder.java
Date Tue, 12 Aug 2003 16:27:12 GMT
andreas     2003/08/12 09:27:12

  Modified:    src/java/org/apache/lenya/cms/publication
                        DefaultDocumentBuilder.java
  Log:
  bugfix in isDocument() method
  
  Revision  Changes    Path
  1.10      +14 -7     cocoon-lenya/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java
  
  Index: DefaultDocumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultDocumentBuilder.java	5 Aug 2003 14:53:27 -0000	1.9
  +++ DefaultDocumentBuilder.java	12 Aug 2003 16:27:12 -0000	1.10
  @@ -158,14 +158,21 @@
        * @see org.apache.lenya.cms.publication.DocumentBuilder#isDocument(org.apache.lenya.cms.publication.Publication,
java.lang.String)
        */
       public boolean isDocument(Publication publication, String url) throws DocumentBuildException
{
  -        boolean isDocument = true;
  +        boolean isDocument = false;
           
           String publicationURI = url.substring(("/" + publication.getId()).length());
  -        String area = publicationURI.split("/")[1];
  -        String documentUrl = publicationURI.substring(("/" + area).length());
  -        
  -        if (!documentUrl.startsWith("/")) {
  -            isDocument = false;
  +        if (publicationURI.startsWith("/")) {
  +            publicationURI = publicationURI.substring(1);
  +            
  +            int slashIndex = publicationURI.indexOf("/");
  +            if (slashIndex > -1) {
  +                String area = publicationURI.substring(0, slashIndex);
  +                
  +                String documentUri = publicationURI.substring(slashIndex);
  +                if (documentUri.startsWith("/")) {
  +                    isDocument = true;
  +                }
  +            }
           }
   
           return isDocument;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org


Mime
View raw message