[jbossws-commits] JBossWS SVN: r9268 - in stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss: ws/metadata/config and 3 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Feb 9 07:40:50 EST 2009


Author: darran.lofthouse at jboss.com
Date: 2009-02-09 07:40:50 -0500 (Mon, 09 Feb 2009)
New Revision: 9268

Modified:
   stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java
   stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
   stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java
   stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/tools/JavaToXSD.java
   stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
   stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/WSDLFilePublisher.java
Log:
Merge revision 8363

Modified: stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java	2009-02-09 12:33:57 UTC (rev 9267)
+++ stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/extensions/security/SecurityStore.java	2009-02-09 12:40:50 UTC (rev 9268)
@@ -25,6 +25,7 @@
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.reflect.Constructor;
@@ -136,11 +137,12 @@
       if (storeType == null)
          storeType = "jks";
 
-      KeyStore keyStore = null; 
+      KeyStore keyStore = null;
+      InputStream stream = null;
       try
       {
          log.debug("loadStore: " + storeURL);
-         InputStream stream = storeURL.openStream();
+         stream = storeURL.openStream();
          if (stream == null)
             throw new WSSecurityException("Cannot load store from: " + storeURL);
 
@@ -166,6 +168,20 @@
       {
          throw new WSSecurityException("Problems loading " + type + ": " + ex.getMessage(), ex);
       }
+      finally
+      {
+         if (stream != null)
+         {
+            try
+            {
+               stream.close();
+            }
+            catch (IOException ioe)
+            {
+               log.warn(ioe.getMessage(), ioe);
+            }
+         }
+      }
 
       return keyStore;
    }

Modified: stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java	2009-02-09 12:33:57 UTC (rev 9267)
+++ stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java	2009-02-09 12:40:50 UTC (rev 9268)
@@ -24,6 +24,7 @@
 //$Id$
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 
 import org.jboss.logging.Logger;
@@ -71,6 +72,7 @@
       if(log.isDebugEnabled()) log.debug("parse: " + configURL);
 
       Object wsConfig;
+      InputStream is = null;
       try
       {
          Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
@@ -78,13 +80,14 @@
          unmarshaller.setSchemaValidation(true);
 
          String nsURI = getNamespaceURI(configURL);
+         is = configURL.openStream();
          if (URN_JAXRPC_CONFIG.equals(nsURI))
          {
-            wsConfig = unmarshaller.unmarshal(configURL.openStream(), new OMFactoryJAXRPC(), null);
+            wsConfig = unmarshaller.unmarshal(is, new OMFactoryJAXRPC(), null);
          }
          else if (URN_JAXWS_CONFIG.equals(nsURI))
          {
-            wsConfig = unmarshaller.unmarshal(configURL.openStream(), new OMFactoryJAXWS(), null);
+            wsConfig = unmarshaller.unmarshal(is, new OMFactoryJAXWS(), null);
          }
          else
          {
@@ -100,6 +103,20 @@
       {
          throw new WSException("Failed to read config file: " + configURL, e);
       }
+      finally
+      {
+         if (is != null)
+         {
+            try
+            {
+               is.close();
+            }
+            catch (IOException ioe)
+            {
+               if(log.isDebugEnabled()) log.warn(ioe.getMessage(), ioe);
+            }
+         }
+      }
 
       return wsConfig;
    }

Modified: stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java	2009-02-09 12:33:57 UTC (rev 9267)
+++ stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java	2009-02-09 12:40:50 UTC (rev 9268)
@@ -21,8 +21,9 @@
  */
 package org.jboss.ws.metadata.wsdl.xmlschema;
 
-// $Id$
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -36,6 +37,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
 import org.jboss.ws.core.utils.ResourceURL;
+import org.jboss.wsf.common.IOUtils;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -157,15 +159,19 @@
 
    private XMLInputSource getXMLInputSource(URL url, XMLResourceIdentifier resId) throws IOException
    {
-      InputStream inputStream = new ResourceURL(url).openStream();
-      InputSource inputSource = new InputSource(inputStream);
+      InputStream urlStream = new ResourceURL(url).openStream();
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      IOUtils.copyStream(baos, urlStream); // [JBWS-2325]
+      InputSource inputSource = new InputSource(new ByteArrayInputStream(baos.toByteArray()));
       return getXMLInputSource(inputSource, resId);
    }
 
-   private XMLInputSource getXMLInputSource(InputSource inputSource, XMLResourceIdentifier resId)
+   private XMLInputSource getXMLInputSource(InputSource inputSource, XMLResourceIdentifier resId) throws IOException
    {
       String encoding = inputSource.getEncoding();
-      InputStream byteStream = inputSource.getByteStream();
-      return new XMLInputSource(resId.getPublicId(), resId.getExpandedSystemId(), resId.getBaseSystemId(), byteStream, encoding);
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      IOUtils.copyStream(baos, inputSource.getByteStream()); // [JBWS-2325]
+      InputStream is = new ByteArrayInputStream(baos.toByteArray());
+      return new XMLInputSource(resId.getPublicId(), resId.getExpandedSystemId(), resId.getBaseSystemId(), is, encoding);
    }
 }
\ No newline at end of file

Modified: stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/tools/JavaToXSD.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/tools/JavaToXSD.java	2009-02-09 12:33:57 UTC (rev 9267)
+++ stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/ws/tools/JavaToXSD.java	2009-02-09 12:40:50 UTC (rev 9268)
@@ -165,6 +165,7 @@
       Iterator<String> it = locs.keySet().iterator();
       while (it.hasNext())
       {
+         InputStream in = null;
          try
          {
             String nsURI = it.next();
@@ -176,7 +177,7 @@
             XMLInputSource inputSource = new XMLInputSource(null, url.toExternalForm(), null);
 
             InputSource tmpSrc = resolver.resolveEntity(null, url.toExternalForm());
-            InputStream in = tmpSrc.getByteStream() != null ? tmpSrc.getByteStream() : new ResourceURL(url).openStream();
+            in = tmpSrc.getByteStream() != null ? tmpSrc.getByteStream() : new ResourceURL(url).openStream();
             inputSource.setByteStream(in);
             
             SchemaGrammar grammar = (SchemaGrammar)loader.loadGrammar(inputSource);
@@ -193,6 +194,20 @@
          {
             throw new IllegalStateException("Cannot parse schema", ex);
          }
+         finally
+         {
+            if (in != null)
+            {
+               try
+               {
+                  in.close();
+               }
+               catch (IOException ioe)
+               {
+                  log.warn(ioe.getMessage(), ioe);
+               }
+            }
+         }
       }
       XSModel xsmodel = new XSModelImpl(gs);
 
@@ -242,46 +257,4 @@
       helper.setWsdlStyle(style);
    }
 
-   //******************************************************************
-   //             PRIVATE METHODS
-   //******************************************************************
-
-   /**
-    * FIXME: JBXB-33
-    */
-   private SchemaBindingResolver getSchemaBindingResolver(final Map<String, URL> map)
-   {
-      return new SchemaBindingResolver()
-      {
-         public String getBaseURI()
-         {
-            throw new UnsupportedOperationException("getBaseURI is not implemented.");
-         }
-
-         public void setBaseURI(String baseURI)
-         {
-            throw new UnsupportedOperationException("setBaseURI is not implemented.");
-         }
-
-         public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation)
-         {
-            throw new UnsupportedOperationException("resolve is not implemented.");
-         }
-
-         public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation)
-         {
-            URL url = map.get(nsUri);
-            if (url != null)
-               try
-               {
-                  return new LSInputAdaptor(url.openStream(), null);
-               }
-               catch (IOException e)
-               {
-                  log.error("URL is bad for schema parsing");
-               }
-            return null;
-         }
-      };
-   }
 }

Modified: stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java	2009-02-09 12:33:57 UTC (rev 9267)
+++ stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java	2009-02-09 12:40:50 UTC (rev 9268)
@@ -582,6 +582,17 @@
       {
          throw new WSException(ex);
       }
+      finally
+      {
+         try
+         {
+            outputStream.close();
+         }
+         catch (IOException ioe)
+         {
+            throw new WSException(ioe);
+         }
+      }
    }
 
    private void handleException(Exception ex) throws ServletException

Modified: stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/WSDLFilePublisher.java
===================================================================
--- stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/WSDLFilePublisher.java	2009-02-09 12:33:57 UTC (rev 9267)
+++ stack/native/branches/dlofthouse/JBPAPP-1687/src/main/java/org/jboss/wsf/stack/jbws/WSDLFilePublisher.java	2009-02-09 12:40:50 UTC (rev 9268)
@@ -261,14 +261,7 @@
                   }
                   finally
                   {
-                     try
-                     {
-                        if (fos != null) fos.close();
-                     }
-                     finally
-                     {
-                        is.close();
-                     }
+                     if (fos != null) fos.close();
                   }
 
                   if (log.isDebugEnabled())




More information about the jbossws-commits mailing list