shuber      2005/05/26 17:31:36 CEST

  Modified files:        (Branch: JAHIA-4-0-BRANCH)
    src/java/org/jahia/bin JahiaErrorDisplay.java 
  Log:
  Contribution by EU Parliement (Olivier Peltier) to correctly handle parsing 
of 403 error messages. This error was caused by the embedding of the error 
inside another exception, due to the new page generation modifications 
introduced in 4.0.6
  
  Revision  Changes    Path
  1.12.4.3  +10 -7     jahia/src/java/org/jahia/bin/JahiaErrorDisplay.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/bin/JahiaErrorDisplay.java.diff?r1=1.12.4.2&r2=1.12.4.3&f=h
  
  
  
  Index: JahiaErrorDisplay.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/bin/Attic/JahiaErrorDisplay.java,v
  retrieving revision 1.12.4.2
  retrieving revision 1.12.4.3
  diff -u -r1.12.4.2 -r1.12.4.3
  --- JahiaErrorDisplay.java    19 Nov 2004 13:25:57 -0000      1.12.4.2
  +++ JahiaErrorDisplay.java    26 May 2005 15:31:35 -0000      1.12.4.3
  @@ -1,4 +1,4 @@
  -// $Id: JahiaErrorDisplay.java,v 1.12.4.2 2004/11/19 13:25:57 knguyen Exp $
  +// $Id: JahiaErrorDisplay.java,v 1.12.4.3 2005/05/26 15:31:35 shuber Exp $
   //
   //                                   ____.
   //                       __/\ ______|    |__/\.     _______
  @@ -31,6 +31,8 @@
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.Properties;
  +import java.util.regex.Matcher;
  +import java.util.regex.Pattern;
   
   import javax.mail.Message;
   import javax.mail.Session;
  @@ -192,12 +194,13 @@
               } catch (Throwable tho) {}
   
               int              errorint = 0;
  -            try
  -            {
  -                if (errorstring.indexOf(" ")!=-1) {
  -                    errorstring = errorstring.substring (0, 
errorstring.indexOf(" "));
  -                }
  -            } catch (IndexOutOfBoundsException ioobe) {}
  +            
  +            // 2005/05/20 :: uses regexp to extract html error code.
  +             Pattern p = Pattern.compile("\\d\\d\\d");
  +             Matcher m = p.matcher(errorstring);
  +             if (m.find())
  +                     errorstring = m.group();
  +             
               try {
                   errorint = Integer.parseInt(errorstring);
               } catch (NumberFormatException nfe) {}
  

Reply via email to