commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r554746 - in /jakarta/commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/HierarchicalConfiguration.java xdocs/changes.xml
Date Mon, 09 Jul 2007 19:37:38 GMT
Author: oheger
Date: Mon Jul  9 12:37:37 2007
New Revision: 554746

URL: http://svn.apache.org/viewvc?view=rev&rev=554746
Log:
CONFIGURATION-282: Initialize default expression engine for HierarchicalConfiguration lazily
if it is null. This should avoid NPEs after redeployment.

Modified:
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalConfiguration.java
    jakarta/commons/proper/configuration/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalConfiguration.java?view=diff&rev=554746&r1=554745&r2=554746
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalConfiguration.java
Mon Jul  9 12:37:37 2007
@@ -151,7 +151,7 @@
     private static final long serialVersionUID = 3373812230395363192L;
 
     /** Stores the default expression engine to be used for new objects.*/
-    private static ExpressionEngine defaultExpressionEngine = new DefaultExpressionEngine();
+    private static ExpressionEngine defaultExpressionEngine;
 
     /** Stores the root node of this configuration. This field is required for
      * backwards compatibility only.
@@ -258,8 +258,12 @@
      * @return the default expression engine
      * @since 1.3
      */
-    public static ExpressionEngine getDefaultExpressionEngine()
+    public static synchronized ExpressionEngine getDefaultExpressionEngine()
     {
+        if (defaultExpressionEngine == null)
+        {
+            defaultExpressionEngine = new DefaultExpressionEngine();
+        }
         return defaultExpressionEngine;
     }
 
@@ -272,7 +276,7 @@
      * @param engine the new default expression engine
      * @since 1.3
      */
-    public static void setDefaultExpressionEngine(ExpressionEngine engine)
+    public static synchronized void setDefaultExpressionEngine(ExpressionEngine engine)
     {
         if (engine == null)
         {

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?view=diff&rev=554746&r1=554745&r2=554746
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Mon Jul  9 12:37:37 2007
@@ -23,6 +23,11 @@
 
   <body>
     <release version="1.5-SNAPSHOT" date="in SVN" description="">
+      <action dev="oheger" type="fix" issue="CONFIGURATION-282">
+        The default expression engine used by HierarchicalConfiguration
+        instances is now lazily initialized. This avoids NullPointerExceptions
+        in certain server environments after a redeploy.
+      </action>
       <action dev="oheger" type="fix" issue="CONFIGURATION-281">
         Cycles in the JNDI tree no longer cause a stack overflow in
         JNDIConfiguration.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message