You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2013/03/01 12:00:32 UTC

svn commit: r1451564 - in /syncope/trunk: ./ archetype/src/main/resources/archetype-resources/console/ archetype/src/main/resources/archetype-resources/core/ console/ core/ core/src/main/java/org/apache/syncope/core/init/ core/src/main/java/org/apache/...

Author: ilgrosso
Date: Fri Mar  1 11:00:32 2013
New Revision: 1451564

URL: http://svn.apache.org/r1451564
Log:
[SYNCOPE-327] Fixing messages related to Groovy and FOP by upgrading their respective versions + enabling known ThreadLocal cleanup via ServletRequestListener

Added:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java   (with props)
Modified:
    syncope/trunk/archetype/src/main/resources/archetype-resources/console/pom.xml
    syncope/trunk/archetype/src/main/resources/archetype-resources/core/pom.xml
    syncope/trunk/console/pom.xml
    syncope/trunk/core/pom.xml
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/DataFormat.java
    syncope/trunk/core/src/main/webapp/WEB-INF/web.xml
    syncope/trunk/pom.xml

Modified: syncope/trunk/archetype/src/main/resources/archetype-resources/console/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/archetype/src/main/resources/archetype-resources/console/pom.xml?rev=1451564&r1=1451563&r2=1451564&view=diff
==============================================================================
--- syncope/trunk/archetype/src/main/resources/archetype-resources/console/pom.xml (original)
+++ syncope/trunk/archetype/src/main/resources/archetype-resources/console/pom.xml Fri Mar  1 11:00:32 2013
@@ -139,26 +139,6 @@ under the License.
     <plugins>
       
       <plugin>
-        <groupId>org.codehaus.gmaven</groupId>
-        <artifactId>gmaven-plugin</artifactId>
-        <inherited>true</inherited>
-        <executions>
-          <execution>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>execute</goal>
-            </goals>
-            <configuration>
-              <source>
-                project.properties['urlencoded.csvdir.path'] = java.net.URLEncoder.encode(project.properties['test.csvdir.path'])
-                project.properties['licenseUrl'] = project.parent.licenses[0].url
-              </source>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <inherited>true</inherited>

Modified: syncope/trunk/archetype/src/main/resources/archetype-resources/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/archetype/src/main/resources/archetype-resources/core/pom.xml?rev=1451564&r1=1451563&r2=1451564&view=diff
==============================================================================
--- syncope/trunk/archetype/src/main/resources/archetype-resources/core/pom.xml (original)
+++ syncope/trunk/archetype/src/main/resources/archetype-resources/core/pom.xml Fri Mar  1 11:00:32 2013
@@ -133,25 +133,6 @@ under the License.
 
     <plugins>
 
-      <plugin> 
-        <groupId>org.codehaus.gmaven</groupId> 
-        <artifactId>gmaven-plugin</artifactId> 
-        <inherited>true</inherited> 
-        <executions> 
-          <execution> 
-            <phase>generate-resources</phase> 
-            <goals> 
-              <goal>execute</goal> 
-            </goals> 
-            <configuration> 
-              <source> 
-                project.properties['urlencoded.csvdir.path'] = java.net.URLEncoder.encode(project.properties['test.csvdir.path']) 
-              </source> 
-            </configuration> 
-          </execution> 
-        </executions> 
-      </plugin>
-      
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>

Modified: syncope/trunk/console/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/console/pom.xml?rev=1451564&r1=1451563&r2=1451564&view=diff
==============================================================================
--- syncope/trunk/console/pom.xml (original)
+++ syncope/trunk/console/pom.xml Fri Mar  1 11:00:32 2013
@@ -184,26 +184,6 @@ under the License.
     <plugins>
 
       <plugin>
-        <groupId>org.codehaus.gmaven</groupId>
-        <artifactId>gmaven-plugin</artifactId>
-        <inherited>true</inherited>
-        <executions>
-          <execution>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>execute</goal>
-            </goals>
-            <configuration>
-              <source>
-                project.properties['urlencoded.csvdir.path'] = java.net.URLEncoder.encode(project.properties['test.csvdir.path'])
-                project.properties['licenseUrl'] = project.parent.licenses[0].url
-              </source>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <inherited>true</inherited>

Modified: syncope/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/pom.xml?rev=1451564&r1=1451563&r2=1451564&view=diff
==============================================================================
--- syncope/trunk/core/pom.xml (original)
+++ syncope/trunk/core/pom.xml Fri Mar  1 11:00:32 2013
@@ -226,6 +226,14 @@ under the License.
       <groupId>org.apache.xmlgraphics</groupId>
       <artifactId>fop</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.avalon.framework</groupId>
+      <artifactId>avalon-framework-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.avalon.framework</groupId>
+      <artifactId>avalon-framework-impl</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId> 
@@ -381,25 +389,6 @@ under the License.
       </plugin>
 
       <plugin>
-        <groupId>org.codehaus.gmaven</groupId>
-        <artifactId>gmaven-plugin</artifactId>
-        <inherited>true</inherited>
-        <executions>
-          <execution>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>execute</goal>
-            </goals>
-            <configuration>
-              <source>
-                project.properties['urlencoded.csvdir.path'] = java.net.URLEncoder.encode(project.properties['test.csvdir.path'])
-              </source>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <inherited>true</inherited>

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java?rev=1451564&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java Fri Mar  1 11:00:32 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.init;
+
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+import org.apache.syncope.core.util.DataFormat;
+import org.identityconnectors.common.l10n.CurrentLocale;
+import org.identityconnectors.framework.impl.api.local.ThreadClassLoaderManager;
+
+/**
+ * Remove any known thread-local variable when the servlet request is destroyed.
+ */
+public class ThreadLocalCleanupListener implements ServletRequestListener {
+
+    @Override
+    public void requestInitialized(final ServletRequestEvent sre) {
+        // nothing to do while setting up this request (and thread)
+    }
+
+    @Override
+    public void requestDestroyed(final ServletRequestEvent sre) {
+        DataFormat.clear();
+
+        ThreadClassLoaderManager.clearInstance();
+        CurrentLocale.clear();
+    }
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ThreadLocalCleanupListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/DataFormat.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/DataFormat.java?rev=1451564&r1=1451563&r2=1451564&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/DataFormat.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/DataFormat.java Fri Mar  1 11:00:32 2013
@@ -57,16 +57,12 @@ public final class DataFormat {
     }
 
     public static String format(final Date date, final boolean lenient, final String conversionPattern) {
-        try {
-            SimpleDateFormat sdf = DATE_FORMAT.get();
-            if (conversionPattern != null) {
-                sdf.applyPattern(conversionPattern);
-            }
-            sdf.setLenient(lenient);
-            return sdf.format(date);
-        } finally {
-            DATE_FORMAT.remove();
+        SimpleDateFormat sdf = DATE_FORMAT.get();
+        if (conversionPattern != null) {
+            sdf.applyPattern(conversionPattern);
         }
+        sdf.setLenient(lenient);
+        return sdf.format(date);
     }
 
     public static String format(final long number) {
@@ -74,15 +70,11 @@ public final class DataFormat {
     }
 
     public static String format(final long number, final String conversionPattern) {
-        try {
-            DecimalFormat df = DECIMAL_FORMAT.get();
-            if (conversionPattern != null) {
-                df.applyPattern(conversionPattern);
-            }
-            return df.format(number);
-        } finally {
-            DECIMAL_FORMAT.remove();
+        DecimalFormat df = DECIMAL_FORMAT.get();
+        if (conversionPattern != null) {
+            df.applyPattern(conversionPattern);
         }
+        return df.format(number);
     }
 
     public static String format(final double number) {
@@ -90,15 +82,11 @@ public final class DataFormat {
     }
 
     public static String format(final double number, final String conversionPattern) {
-        try {
-            DecimalFormat df = DECIMAL_FORMAT.get();
-            if (conversionPattern != null) {
-                df.applyPattern(conversionPattern);
-            }
-            return df.format(number);
-        } finally {
-            DECIMAL_FORMAT.remove();
+        DecimalFormat df = DECIMAL_FORMAT.get();
+        if (conversionPattern != null) {
+            df.applyPattern(conversionPattern);
         }
+        return df.format(number);
     }
 
     public static Date parseDate(final String source) throws ParseException {
@@ -106,24 +94,21 @@ public final class DataFormat {
     }
 
     public static Date parseDate(final String source, final String conversionPattern) throws ParseException {
-        try {
-            SimpleDateFormat sdf = DATE_FORMAT.get();
-            sdf.applyPattern(conversionPattern);
-            sdf.setLenient(false);
-            return sdf.parse(source);
-        } finally {
-            DATE_FORMAT.remove();
-        }
+        SimpleDateFormat sdf = DATE_FORMAT.get();
+        sdf.applyPattern(conversionPattern);
+        sdf.setLenient(false);
+        return sdf.parse(source);
     }
 
     public static Number parseNumber(final String source, final String conversionPattern) throws ParseException {
-        try {
-            DecimalFormat df = DECIMAL_FORMAT.get();
-            df.applyPattern(conversionPattern);
-            return df.parse(source);
-        } finally {
-            DECIMAL_FORMAT.remove();
-        }
+        DecimalFormat df = DECIMAL_FORMAT.get();
+        df.applyPattern(conversionPattern);
+        return df.parse(source);
+    }
+
+    public static void clear() {
+        DATE_FORMAT.remove();
+        DECIMAL_FORMAT.remove();
     }
 
     private DataFormat() {

Modified: syncope/trunk/core/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/webapp/WEB-INF/web.xml?rev=1451564&r1=1451563&r2=1451564&view=diff
==============================================================================
--- syncope/trunk/core/src/main/webapp/WEB-INF/web.xml (original)
+++ syncope/trunk/core/src/main/webapp/WEB-INF/web.xml Fri Mar  1 11:00:32 2013
@@ -34,6 +34,9 @@ under the License.
   <listener>
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
+  <listener>
+    <listener-class>org.apache.syncope.core.init.ThreadLocalCleanupListener</listener-class>
+  </listener>
   
   <servlet>
     <servlet-name>CXFServlet</servlet-name>

Modified: syncope/trunk/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/pom.xml?rev=1451564&r1=1451563&r2=1451564&view=diff
==============================================================================
--- syncope/trunk/pom.xml (original)
+++ syncope/trunk/pom.xml Fri Mar  1 11:00:32 2013
@@ -306,7 +306,7 @@ under the License.
 
     <wicket.version>6.6.0</wicket.version>
 
-    <groovy.version>1.6.9</groovy.version>
+    <groovy.version>2.1.1</groovy.version>
 
     <h2.version>1.3.170</h2.version>
 
@@ -655,10 +655,30 @@ under the License.
         <version>${cocoon.version}</version>
       </dependency>
             
-      <dependency>    
+      <dependency>
         <groupId>org.apache.xmlgraphics</groupId>
         <artifactId>fop</artifactId>
-        <version>1.0</version>
+        <version>1.1</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.apache.avalon.framework</groupId>
+            <artifactId>avalon-framework-api</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.avalon.framework</groupId>
+            <artifactId>avalon-framework-impl</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.avalon.framework</groupId>
+        <artifactId>avalon-framework-api</artifactId>
+        <version>4.3.1</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.avalon.framework</groupId>
+        <artifactId>avalon-framework-impl</artifactId>
+        <version>4.3.1</version>
       </dependency>
         
       <!-- Wicket -->
@@ -824,7 +844,7 @@ under the License.
   </repositories>
 
   <build>
-    <defaultGoal>package</defaultGoal>
+    <defaultGoal>clean verify</defaultGoal>
 
     <pluginManagement>
       <plugins>
@@ -841,11 +861,6 @@ under the License.
           </configuration>
         </plugin>
         <plugin>
-          <groupId>org.codehaus.gmaven</groupId>
-          <artifactId>gmaven-plugin</artifactId>
-          <version>1.5</version>
-        </plugin>
-        <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>exec-maven-plugin</artifactId>
           <version>1.2.1</version>
@@ -1089,6 +1104,32 @@ under the License.
         </executions>
       </plugin>
       <plugin>
+        <groupId>org.codehaus.gmaven</groupId>
+        <artifactId>gmaven-plugin</artifactId>
+        <version>1.5</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all</artifactId>
+            <version>1.5.8</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>execute</goal>
+            </goals>
+            <configuration>
+              <source>
+                project.properties['urlencoded.csvdir.path'] = java.net.URLEncoder.encode(project.properties['test.csvdir.path'])
+                project.properties['licenseUrl'] = project.parent.licenses[0].url
+              </source>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
         <inherited>true</inherited>