cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1394425 - in /cxf/trunk: api/src/main/java/org/apache/cxf/common/jaxb/ api/src/main/java/org/apache/cxf/configuration/jsse/ rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs...
Date Fri, 05 Oct 2012 09:55:13 GMT
Author: coheigea
Date: Fri Oct  5 09:55:13 2012
New Revision: 1394425

URL: http://svn.apache.org/viewvc?rev=1394425&view=rev
Log:
Some more cleanup work

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
    cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java
    cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
    cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java?rev=1394425&r1=1394424&r2=1394425&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java Fri Oct 
5 09:55:13 2012
@@ -167,33 +167,32 @@ public final class JAXBContextCache {
                 }
             }
         }
-        if (context == null) {
-            try {
-                context = createContext(classes, map, typeRefs);
-            } catch (JAXBException ex) {
-                // load jaxb needed class and try to create jaxb context 
-                boolean added = addJaxbObjectFactory(ex, classes);
-                while (cachedContextAndSchemas == null && added) {
-                    try {
-                        context = AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>()
{
-                            public JAXBContext run() throws Exception {
-                                return JAXBContext.newInstance(classes
-                                                              .toArray(new Class[classes.size()]),
null);
-                            }
-                        });
-                    } catch (PrivilegedActionException e) {
-                        throw ex;
-                    }
-                }
-                if (context == null) {
+
+        try {
+            context = createContext(classes, map, typeRefs);
+        } catch (JAXBException ex) {
+            // load jaxb needed class and try to create jaxb context 
+            boolean added = addJaxbObjectFactory(ex, classes);
+            while (cachedContextAndSchemas == null && added) {
+                try {
+                    context = AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>()
{
+                        public JAXBContext run() throws Exception {
+                            return JAXBContext.newInstance(classes
+                                                          .toArray(new Class[classes.size()]),
null);
+                        }
+                    });
+                } catch (PrivilegedActionException e) {
                     throw ex;
                 }
             }
-            cachedContextAndSchemas = new CachedContextAndSchemas(context, classes);
-            synchronized (JAXBCONTEXT_CACHE) {
-                if (typeRefs == null || typeRefs.isEmpty()) {
-                    JAXBCONTEXT_CACHE.put(classes, cachedContextAndSchemas);
-                }
+            if (context == null) {
+                throw ex;
+            }
+        }
+        cachedContextAndSchemas = new CachedContextAndSchemas(context, classes);
+        synchronized (JAXBCONTEXT_CACHE) {
+            if (typeRefs == null || typeRefs.isEmpty()) {
+                JAXBCONTEXT_CACHE.put(classes, cachedContextAndSchemas);
             }
         }
 

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java?rev=1394425&r1=1394424&r2=1394425&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/SSLUtils.java Fri Oct  5
09:55:13 2012
@@ -192,7 +192,15 @@ public final class SSLUtils {
                              new Object[]{trustStoreLocation, e.getMessage()});
             } 
         } else {
-            trustedCertStore.load(new FileInputStream(trustStoreLocation), null);
+            FileInputStream trustStoreInputStream = null;
+            try {
+                trustStoreInputStream = new FileInputStream(trustStoreLocation);
+                trustedCertStore.load(trustStoreInputStream, null);
+            } finally {
+                if (trustStoreInputStream != null) {
+                    trustStoreInputStream.close();
+                }
+            }
         }
         
         TrustManagerFactory tmf  = 

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java?rev=1394425&r1=1394424&r2=1394425&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
(original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
Fri Oct  5 09:55:13 2012
@@ -122,7 +122,15 @@ public final class TLSParameterJaxBUtils
                     : KeyStore.getInstance(type, provider);
 
         if (kst.isSetFile()) {
-            keyStore.load(new FileInputStream(kst.getFile()), password);
+            FileInputStream kstInputStream = null;
+            try {
+                kstInputStream = new FileInputStream(kst.getFile());
+                keyStore.load(kstInputStream, password);
+            } finally {
+                if (kstInputStream != null) {
+                    kstInputStream.close();
+                }
+            }
         } else if (kst.isSetResource()) {
             final java.io.InputStream is = getResourceAsStream(kst.getResource());
             if (is == null) {
@@ -137,10 +145,16 @@ public final class TLSParameterJaxBUtils
         } else {
             String loc = SSLUtils.getKeystore(null, LOG);
             InputStream ins = null;
-            if (loc != null) {
-                ins = new FileInputStream(loc);
+            try {
+                if (loc != null) {
+                    ins = new FileInputStream(loc);
+                }
+                keyStore.load(ins, password);
+            } finally {
+                if (ins != null) {
+                    ins.close();
+                }
             }
-            keyStore.load(ins, password);
         }
         return keyStore;
     }

Modified: cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java?rev=1394425&r1=1394424&r2=1394425&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java
(original)
+++ cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java
Fri Oct  5 09:55:13 2012
@@ -195,7 +195,7 @@ public class DataWriterImpl implements D
                 } else {
                     StaxUtils.copy(reader, output, true);
                 }
-            } else if (obj == null && needToRender(obj, part)) {
+            } else if (needToRender(obj, part)) {
                 output.writeStartElement(part.getConcreteName().getNamespaceURI(),
                                          part.getConcreteName().getLocalPart());
                 output.writeEndElement();

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=1394425&r1=1394424&r2=1394425&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Fri Oct  5 09:55:13 2012
@@ -287,10 +287,7 @@ public class ClientProxyImpl extends Abs
                 }
             } 
                         
-            if (t == null) {
-                t = convertToWebApplicationException(r);
-            }
-
+            t = convertToWebApplicationException(r);
             
             if (inMessage.getExchange().get(Message.RESPONSE_CODE) == null) {
                 throw t;

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java?rev=1394425&r1=1394424&r2=1394425&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
Fri Oct  5 09:55:13 2012
@@ -230,7 +230,7 @@ public class EffectivePolicyImpl impleme
         QName qn = a.getName();
         
         List<Interceptor<? extends org.apache.cxf.message.Message>> i = null;
-        if (useIn & !fault) {
+        if (useIn && !fault) {
             i = reg.getInInterceptorsForAssertion(qn);
         } else if (!useIn && !fault) {
             i = reg.getOutInterceptorsForAssertion(qn);



Mime
View raw message