cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1342444 - in /cxf/branches/2.4.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/logging/JDKBugHacks.java
Date Thu, 24 May 2012 21:38:22 GMT
Author: dkulp
Date: Thu May 24 21:38:22 2012
New Revision: 1342444

URL: http://svn.apache.org/viewvc?rev=1342444&view=rev
Log:
Merged revisions 1342366 via  svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

........
  r1342366 | dkulp | 2012-05-24 14:30:21 -0400 (Thu, 24 May 2012) | 9 lines
  
  Merged revisions 1342039 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1342039 | dkulp | 2012-05-23 16:37:41 -0400 (Wed, 23 May 2012) | 2 lines
  
    [CXF-4313] Allow more options to disable various hacks
  
  ........
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/JDKBugHacks.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/JDKBugHacks.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/JDKBugHacks.java?rev=1342444&r1=1342443&r2=1342444&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/JDKBugHacks.java
(original)
+++ cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/JDKBugHacks.java
Thu May 24 21:38:22 2012
@@ -96,34 +96,18 @@ final class JDKBugHacks {
                 
                 try {
                     //Trigger a call to sun.awt.AppContext.getAppContext()
-                    ImageIO.getCacheDirectory();
-                } catch (Throwable t) {
-                    //ignore
-                }
-                try {
-                    // Several components end up opening JarURLConnections without first
-                    // disabling caching. This effectively locks the file.
-                    // JAXB does this and thus affects us pretty badly.
-                    // Doesn't matter that this JAR doesn't exist - just as long as
-                    // the URL is well-formed
-                    boolean skip = skipHack("org.apache.cxf.JDKBugHacks.defaultUsesCaches");
-                    if (!skip) {
-                        URL url = new URL("jar:file://dummy.jar!/");
-                        URLConnection uConn = new URLConnection(url) {
-                            @Override
-                            public void connect() throws IOException {
-                                // NOOP
-                            }
-                        };
-                        uConn.setDefaultUseCaches(false);
+                    if (!skipHack("org.apache.cxf.JDKBugHacks.imageIO")) {
+                        ImageIO.getCacheDirectory();
                     }
-                } catch (Throwable e) {
+                } catch (Throwable t) {
                     //ignore
                 }
                 try {
                     //DocumentBuilderFactory seems to SOMETIMES pin the classloader
-                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-                    factory.newDocumentBuilder();
+                    if (!skipHack("org.apache.cxf.JDKBugHacks.documentBuilderFactory")) {
+                        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                        factory.newDocumentBuilder();
+                    }
                 } catch (Throwable e) {
                     //ignore
                 }
@@ -134,10 +118,12 @@ final class JDKBugHacks {
                 // eventual calls to requestLatency(long) are:
                 // - javax.management.remote.rmi.RMIConnectorServer.start()
                 try {
-                    Class<?> clazz = Class.forName("sun.misc.GC");
-                    Method method = clazz.getDeclaredMethod("requestLatency",
-                            new Class[] {Long.TYPE});
-                    method.invoke(null, Long.valueOf(3600000));
+                    if (!skipHack("org.apache.cxf.JDKBugHacks.gcRequestLatency")) {
+                        Class<?> clazz = Class.forName("sun.misc.GC");
+                        Method method = clazz.getDeclaredMethod("requestLatency",
+                                new Class[] {Long.TYPE});
+                        method.invoke(null, Long.valueOf(36000000));
+                    }                    
                 } catch (Throwable e) {
                     //ignore
                 }
@@ -146,18 +132,22 @@ final class JDKBugHacks {
                 // class loader.
                 try {
                     // Policy.getPolicy();
-                    Class<?> policyClass = Class
-                        .forName("javax.security.auth.Policy");
-                    Method method = policyClass.getMethod("getPolicy");
-                    method.invoke(null);
+                    if (!skipHack("org.apache.cxf.JDKBugHacks.policy")) {
+                        Class<?> policyClass = Class
+                            .forName("javax.security.auth.Policy");
+                        Method method = policyClass.getMethod("getPolicy");
+                        method.invoke(null);
+                    }
                 } catch (Throwable e) {
                     // ignore
                 }
                 try {
                     // Initializing javax.security.auth.login.Configuration retains a static
reference 
                     // to the context class loader.
-                    Class.forName("javax.security.auth.login.Configuration", true, 
-                                  ClassLoader.getSystemClassLoader());
+                    if (!skipHack("org.apache.cxf.JDKBugHacks.authConfiguration")) {
+                        Class.forName("javax.security.auth.login.Configuration", true, 
+                                      ClassLoader.getSystemClassLoader());
+                    }
                 } catch (Throwable e) {
                     // Ignore
                 }
@@ -165,7 +155,29 @@ final class JDKBugHacks {
                 // initializes the Java Cryptography Architecture. Under certain
                 // conditions this starts a Token poller thread with TCCL equal
                 // to the web application class loader.
-                java.security.Security.getProviders();
+                if (!skipHack("org.apache.cxf.JDKBugHacks.securityProviders")) {
+                    java.security.Security.getProviders();
+                }
+                
+                try {
+                    // Several components end up opening JarURLConnections without first
+                    // disabling caching. This effectively locks the file.
+                    // JAXB does this and thus affects us pretty badly.
+                    // Doesn't matter that this JAR doesn't exist - just as long as
+                    // the URL is well-formed
+                    if (!skipHack("org.apache.cxf.JDKBugHacks.defaultUsesCaches")) {
+                        URL url = new URL("jar:file://dummy.jar!/");
+                        URLConnection uConn = new URLConnection(url) {
+                            @Override
+                            public void connect() throws IOException {
+                                // NOOP
+                            }
+                        };
+                        uConn.setDefaultUseCaches(false);
+                    }
+                } catch (Throwable e) {
+                    //ignore
+                }                
             } finally {
                 Thread.currentThread().setContextClassLoader(orig);
             }



Mime
View raw message