[jboss-cvs] JBossAS SVN: r80456 - projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 4 00:40:59 EST 2008


Author: anil.saldhana at jboss.com
Date: 2008-11-04 00:40:58 -0500 (Tue, 04 Nov 2008)
New Revision: 80456

Modified:
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SAMLXACMLServlet.java
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SOAPSAMLXACMLServlet.java
Log:
close printwriter in finally

Modified: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SAMLXACMLServlet.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SAMLXACMLServlet.java	2008-11-04 05:40:34 UTC (rev 80455)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SAMLXACMLServlet.java	2008-11-04 05:40:58 UTC (rev 80456)
@@ -127,6 +127,7 @@
    {
       SAML2Util util = new SAML2Util();
       JBossSAMLRequest samlRequest = new JBossSAMLRequest();
+      PrintWriter pw = null;
       try
       {
          SAMLObject samlObject = samlRequest.getSAMLRequest(request.getInputStream());
@@ -174,7 +175,7 @@
          response.setContentType("text/xml;charset=utf-8");;
          OutputStream os = response.getOutputStream();
          OutputStreamWriter osw = new OutputStreamWriter(os , "UTF-8");
-         PrintWriter pw = new PrintWriter(osw);
+         pw = new PrintWriter(osw);
          
          String resp = XMLHelper.nodeToString(samlResponseMarshaller.marshall(samlResponse));
          log(resp);
@@ -185,6 +186,11 @@
       {
          throw new ServletException(e); 
       } 
+      finally
+      {
+         if(pw != null)
+            pw.close();
+      }
    }  
    
    private Element logXMLObject(XMLObject xmlObject)

Modified: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SOAPSAMLXACMLServlet.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SOAPSAMLXACMLServlet.java	2008-11-04 05:40:34 UTC (rev 80455)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/servlets/SOAPSAMLXACMLServlet.java	2008-11-04 05:40:58 UTC (rev 80456)
@@ -201,7 +201,6 @@
          response.setContentType("text/xml;charset=utf-8");;
          OutputStream os = response.getOutputStream();
          OutputStreamWriter osw = new OutputStreamWriter(os , "UTF-8");
-         PrintWriter pw = new PrintWriter(osw);
          
          String resp = null;
          try
@@ -213,8 +212,18 @@
             log("marshalling exception",e);
          }
          log(resp);
-         pw.print(resp);  
-         pw.flush(); 
+         PrintWriter pw = null;
+         try
+         {
+            pw = new PrintWriter(osw);
+            pw.print(resp);  
+            pw.flush();
+         } 
+         finally
+         {
+            if(pw != null)
+               pw.close();
+         }
       }
    } 
    




More information about the jboss-cvs-commits mailing list