cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/serialization LinkSerializer.java
Date Fri, 11 Jan 2002 18:57:50 GMT
bloritsch    02/01/11 10:57:50

  Modified:    .        run.sh
               src/java/org/apache/cocoon Main.java
               src/java/org/apache/cocoon/serialization LinkSerializer.java
  Log:
  Minor fix to LinkSerializer, and more robust broken link detection
  
  Revision  Changes    Path
  1.2       +9 -2      xml-cocoon2/run.sh
  
  Index: run.sh
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/run.sh,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- run.sh	9 May 2001 20:49:26 -0000	1.1
  +++ run.sh	11 Jan 2002 18:57:49 -0000	1.2
  @@ -2,7 +2,7 @@
   # -----------------------------------------------------------------------------
   # run.sh - Unix Run Script for Apache Cocoon
   #
  -# $Id: run.sh,v 1.1 2001/05/09 20:49:26 giacomo Exp $
  +# $Id: run.sh,v 1.2 2002/01/11 18:57:49 bloritsch Exp $
   # -----------------------------------------------------------------------------
   
   # ----- Verify and Set Required Environment Variables -------------------------
  @@ -14,18 +14,25 @@
   
   # ----- Verify and Set Required Environment Variables -------------------------
   
  +if [ "$TERM" = "cygwin" ] ; then
  +  S=';'
  +else
  +  S=':'
  +fi
  +
   if [ "$COCOON_LIB" = "" ] ; then
     COCOON_LIB=./lib
   fi
   
   if [ "$COCOON_WORK" = "" ] ; then
     COCOON_WORK=./work
  +  rm -rf $COCOON_WORK
     mkdir $COCOON_WORK
   fi
   
   # ----- Set Up The Runtime Classpath ------------------------------------------
   
  -CP=`echo $COCOON_LIB/*.jar | tr ' ' ':'`:$JAVA_HOME/lib/tools.jar:$COCOON_WORK:$CLASSPATH
  +CP=\"`echo $COCOON_LIB/*.jar | tr ' ' $S`$S$JAVA_HOME/lib/tools.jar$S$COCOON_WORK$S$CLASSPATH\"
   
   # ----- Run Cocoon ------------------------------------------------------------
   
  
  
  
  1.8       +25 -17    xml-cocoon2/src/java/org/apache/cocoon/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Main.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Main.java	11 Jan 2002 16:27:53 -0000	1.7
  +++ Main.java	11 Jan 2002 18:57:49 -0000	1.8
  @@ -97,7 +97,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.7 $ $Date: 2002/01/11 16:27:53 $
  + * @version CVS $Revision: 1.8 $ $Date: 2002/01/11 18:57:49 $
    */
   public class Main {
   
  @@ -556,27 +556,35 @@
           }
           while (links.size() > 0) {
               String url = (String)links.get(0);
  -            if (allProcessedLinks.get(url) == null) {
  -                if (xspOnly) {
  -                    this.processXSP(url);
  -                } else if (this.followLinks) {
  -                    i = this.processURI(url).iterator();
  -                    while (i.hasNext() == true) {
  -                        next = (String)i.next();
  -                        if (links.contains(next) == false) {
  -                            links.add(next);
  +
  +            try {
  +                if (allProcessedLinks.get(url) == null) {
  +                    if (xspOnly) {
  +                        this.processXSP(url);
  +                    } else if (this.followLinks) {
  +                        i = this.processURI(url).iterator();
  +                        while (i.hasNext() == true) {
  +                            next = (String)i.next();
  +                            if (links.contains(next) == false) {
  +                                links.add(next);
  +                            }
                           }
  +                    } else {
  +                        this.processURI(url);
                       }
  -                } else {
  -                    this.processURI(url);
  +                }
  +                links.remove(url);
  +                nCount++;
  +            } catch (ResourceNotFoundException rnfe) {
  +                if (log.isWarnEnabled())
  +                {
  +                    log.warn("  +-[ BROKEN LINK ] -> " + url);
                   }
               }
  -            links.remove(url);
  -            nCount++;
   
  -            if (log.isDebugEnabled()) {
  -                log.debug("  Memory used: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
  -                log.debug("  Processed, Translated & Left: " + allProcessedLinks.size()
+ ", "  + allTranslatedLinks.size() + ", " + links.size());
  +            if (log.isInfoEnabled()) {
  +                log.info("  Memory used: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
  +                log.info("  Processed, Translated & Left: " + allProcessedLinks.size()
+ ", "  + allTranslatedLinks.size() + ", " + links.size());
               }
           }
           return nCount;
  
  
  
  1.2       +4 -3      xml-cocoon2/src/java/org/apache/cocoon/serialization/LinkSerializer.java
  
  Index: LinkSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/LinkSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LinkSerializer.java	3 Jan 2002 12:31:19 -0000	1.1
  +++ LinkSerializer.java	11 Jan 2002 18:57:50 -0000	1.2
  @@ -20,7 +20,7 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:19 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/01/11 18:57:50 $
    */
   
   public class LinkSerializer extends ExtendedXLinkPipe implements Serializer, Poolable {
  @@ -55,8 +55,9 @@
       private boolean traversable(String href) {
           if (href.charAt(0) == '#') return false;
           if (href.indexOf("://") != -1) return false;
  -        if (href.startsWith("mailto:") == true) return false;
  -        if (href.startsWith("news:") == true) return false;
  +        if (href.startsWith("mailto:")) return false;
  +        if (href.startsWith("news:")) return false;
  +        if (href.startsWith("javascript:")) return false;
           return true;
       }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message