shuber 2005/12/02 15:10:33 CET
Modified files:
core/src/java/org/jahia/bin FacesHelper.java Jahia.java
JahiaErrorDisplay.java
core/src/java/org/jahia/services/search
JahiaSearchBaseService.java
core/src/java/org/jahia/taglibs/faces FacesHelperTag.java
core/src/webapp/WEB-INF/etc/spring
applicationcontext-services.xml
Log:
- Modification on error handling : now for some errors like 403 and 404 we no
longer mail them, and display only a one-line warning in the console in WARN
mode. Detailed error information is still available in DEBUG mode.
- Made indexing thread sleep time configurable through Spring configuration
(for the moment).
Revision Changes Path
1.3 +2 -1 jahia/core/src/java/org/jahia/bin/FacesHelper.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/FacesHelper.java.diff?r1=1.2&r2=1.3&f=h
1.39 +22 -4 jahia/core/src/java/org/jahia/bin/Jahia.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/Jahia.java.diff?r1=1.38&r2=1.39&f=h
1.8 +24 -10 jahia/core/src/java/org/jahia/bin/JahiaErrorDisplay.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/JahiaErrorDisplay.java.diff?r1=1.7&r2=1.8&f=h
1.35 +10 -1
jahia/core/src/java/org/jahia/services/search/JahiaSearchBaseService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/search/JahiaSearchBaseService.java.diff?r1=1.34&r2=1.35&f=h
1.4 +7 -2
jahia/core/src/java/org/jahia/taglibs/faces/FacesHelperTag.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/taglibs/faces/FacesHelperTag.java.diff?r1=1.3&r2=1.4&f=h
1.17 +1 -0
jahia/core/src/webapp/WEB-INF/etc/spring/applicationcontext-services.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/WEB-INF/etc/spring/applicationcontext-services.xml.diff?r1=1.16&r2=1.17&f=h
Index: FacesHelper.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/bin/FacesHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FacesHelper.java 5 Jul 2005 15:45:56 -0000 1.2
+++ FacesHelper.java 2 Dec 2005 14:10:31 -0000 1.3
@@ -16,6 +16,7 @@
import org.jahia.params.ProcessingContext;
import org.jahia.params.ParamBean;
import org.jahia.exceptions.JahiaException;
+import org.jahia.exceptions.JahiaForbiddenAccessException;
/**
* <p>.
@@ -35,7 +36,7 @@
private ProcessingContext jParams;
- public FacesHelper() {
+ public FacesHelper() throws JahiaForbiddenAccessException {
HttpServletRequest request =(HttpServletRequest)
FacesContext.getCurrentInstance()
Index: Jahia.java
===================================================================
RCS file: /home/cvs/repository/jahia/core/src/java/org/jahia/bin/Jahia.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- Jahia.java 1 Dec 2005 07:07:57 -0000 1.38
+++ Jahia.java 2 Dec 2005 14:10:31 -0000 1.39
@@ -1,4 +1,4 @@
-// $Id: Jahia.java,v 1.38 2005/12/01 07:07:57 bpapez Exp $
+// $Id: Jahia.java,v 1.39 2005/12/02 14:10:31 shuber Exp $
//
// ____.
// __/\ ______| |__/\. _______
@@ -769,6 +769,11 @@
// create the parambean (jParams)...
final ParamBean jParams =
createParamBean(request,response,session);
+ if (jParams == null) {
+ logger.warn("ParamBean not available, aborting
processing...");
+ return;
+ }
+
request.setAttribute("org.jahia.params.ParamBean",
jParams);
process(request, response);
@@ -789,6 +794,14 @@
ServicesRegistry.getInstance().getCacheService().syncClusterNow();
+ } catch (JahiaForbiddenAccessException jfae) {
+ // let's log this at debug for maintenance purposes.
+ logger.warn("Access denied for request " +
request.getRequestURI() + " queryString=" + request.getQueryString() + ": " +
jfae.getMessage());
+ logger.debug("Forbidden access exception : ", jfae);
+ JahiaErrorDisplay.DisplayException(request, response,
+ getServletContext(), jSettings,
+ false, false,
+ jfae);
} catch (Throwable t) {
logger.error("Throwable Exception caught in Jahia servlet : " +
t,
t);
@@ -803,7 +816,8 @@
public static ParamBean createParamBean(final HttpServletRequest request,
final HttpServletResponse
response,
- final HttpSession session){
+ final HttpSession session)
+ throws JahiaForbiddenAccessException {
// all is okay, let's continue...
boolean exitAdminMode;
@@ -875,7 +889,8 @@
}
} catch (JahiaPageNotFoundException ex) {
// PAGE NOT FOUND EXCEPTION
- logger.error(ex.getJahiaErrorMsg(), ex);
+ logger.debug(ex.getJahiaErrorMsg(), ex);
+ logger.error(ex.getJahiaErrorMsg());
String requestURI = request.getRequestURI();
JahiaSite site = (JahiaSite)
request.getSession().getAttribute("org.jahia.services.sites.jahiasite");
if (site != null && requestURI.indexOf("/op/edit") > 0) {
@@ -886,7 +901,7 @@
}
} else {
JahiaErrorDisplay.DisplayException(request, response,
-
getStaticServletConfig().getServletContext(), jSettings, ex);
+
getStaticServletConfig().getServletContext(), jSettings, false, false, ex);
}
org.jahia.services.database.ConnectionDispenser.
abortConnection();
@@ -928,6 +943,9 @@
getStaticServletConfig().getServletContext(), jSettings,
snfex);
org.jahia.services.database.ConnectionDispenser.
abortConnection();
+ } catch (JahiaForbiddenAccessException jfae) {
+ // we don't process this here, we treat it higher.
+ throw jfae;
} catch (JahiaException je) {
// ALL OTHER JAHIA EXCEPTIONS
logger.error("Error in " + requestMethod +
Index: JahiaErrorDisplay.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/bin/JahiaErrorDisplay.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JahiaErrorDisplay.java 23 Nov 2005 11:41:23 -0000 1.7
+++ JahiaErrorDisplay.java 2 Dec 2005 14:10:32 -0000 1.8
@@ -1,4 +1,4 @@
-// $Id: JahiaErrorDisplay.java,v 1.7 2005/11/23 11:41:23 mcardle Exp $
+// $Id: JahiaErrorDisplay.java,v 1.8 2005/12/02 14:10:32 shuber Exp $
//
// ____.
// __/\ ______| |__/\. _______
@@ -138,6 +138,14 @@
return DisplayException(request, response, context, null, t);
}
+ public static boolean DisplayException(HttpServletRequest request,
+ HttpServletResponse response,
+ ServletContext context,
+ SettingsBean jSettings,
+ Throwable t) {
+ return DisplayException(request, response, context, jSettings, true,
true, t);
+ }
+
/**
* Displays an exception on a HTML browser using either JSP pages or
* static hardcoded HTML output. Also sends out an email to the
administrator
@@ -148,6 +156,8 @@
HttpServletResponse response,
ServletContext context,
SettingsBean jSettings,
+ boolean sendEmail,
+ boolean displayInConsole,
Throwable t) {
try {
@@ -163,20 +173,22 @@
logger.debug("Can't display exception, not enough
information available...");
return false;
}
- // let's log the exception in Tomcat's log system.
- context.log(throwableToString(t, request, response));
if (response.isCommitted()) {
logger.debug("Response already committed, aborting client
display, exception has been logged...");
return false;
}
- if (t instanceof JahiaException) {
- JahiaException je = (JahiaException) t;
- logger.error ( "ERROR : " + je.getUserErrorMsg() +
- ", " + je.getJahiaErrorMsg(),
getNestedException(t));
- } else if ( t != null ){
- logger.error ( "ERROR : "+t.getMessage(),
getNestedException(t));
+ if (displayInConsole) {
+ // let's log the exception in Tomcat's log system.
+ context.log(throwableToString(t, request, response));
+ if (t instanceof JahiaException) {
+ JahiaException je = (JahiaException) t;
+ logger.error ( "ERROR : " + je.getUserErrorMsg() +
+ ", " + je.getJahiaErrorMsg(),
getNestedException(t));
+ } else if ( t != null ){
+ logger.error ( "ERROR : "+t.getMessage(),
getNestedException(t));
+ }
}
// By default, uses the standard error message
@@ -227,7 +239,9 @@
if (jSettings != null) {
logger.debug("Jahia Settings available, mailing...");
- MailException(t, request, response, jSettings, errorint);
+ if (sendEmail) {
+ MailException(t, request, response, jSettings, errorint);
+ }
} else {
logger.debug("No Jahia Settings, can't mail...");
}
Index: JahiaSearchBaseService.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/search/JahiaSearchBaseService.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- JahiaSearchBaseService.java 1 Dec 2005 11:29:47 -0000 1.34
+++ JahiaSearchBaseService.java 2 Dec 2005 14:10:32 -0000 1.35
@@ -125,6 +125,8 @@
private Thread backgroundIndexingThread;
+ long indexingThreadSleepTime = 2000;
+
//-------------------------------------------------------------------------
//
// Constructors, global start, stop, inits services methods
@@ -290,7 +292,7 @@
while ( !this.disabled && this.localIndexing ){
cachedAdminUsers = new HashMap();
try {
- Thread.sleep(20000);
+ Thread.sleep(indexingThreadSleepTime);
} catch ( InterruptedException inte ){
}
if ( sitesServ == null || !sitesServ.isStarted() ){
@@ -1459,4 +1461,11 @@
return null;
}
+ public long getIndexingThreadSleepTime() {
+ return indexingThreadSleepTime;
+ }
+
+ public void setIndexingThreadSleepTime(long indexingThreadSleepTime) {
+ this.indexingThreadSleepTime = indexingThreadSleepTime;
+ }
}
Index: FacesHelperTag.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/taglibs/faces/FacesHelperTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FacesHelperTag.java 5 Jul 2005 15:46:36 -0000 1.3
+++ FacesHelperTag.java 2 Dec 2005 14:10:32 -0000 1.4
@@ -8,6 +8,7 @@
import javax.servlet.jsp.tagext.TagSupport;
import org.jahia.bin.FacesHelper;
+import org.jahia.exceptions.JahiaForbiddenAccessException;
/**
@@ -38,8 +39,12 @@
public int doStartTag() {
HttpServletRequest request =
(HttpServletRequest)pageContext.getRequest();
- FacesHelper fh = new FacesHelper();
- request.setAttribute(this.FACES_HELPER,fh);
+ try {
+ FacesHelper fh = new FacesHelper();
+ request.setAttribute(this.FACES_HELPER,fh);
+ } catch (JahiaForbiddenAccessException jfae) {
+ logger.warn("Access forbidden, helper not available", jfae);
+ }
return SKIP_BODY;
}
}
Index: applicationcontext-services.xml
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/webapp/WEB-INF/etc/spring/applicationcontext-services.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- applicationcontext-services.xml 24 Nov 2005 10:23:39 -0000 1.16
+++ applicationcontext-services.xml 2 Dec 2005 14:10:32 -0000 1.17
@@ -434,6 +434,7 @@
</property>
<!-- If set to true, no indexation is performed at all -->
<property name="disabled"><value>false</value></property>
+ <property
name="indexingThreadSleepTime"><value>2000</value></property>
</bean>
</property>
</bean>